pax_global_header 0000666 0000000 0000000 00000000064 15040460430 0014506 g ustar 00root root 0000000 0000000 52 comment=46967fd9b06db3cc23f6f813c89a9f6232299563
normalize-package-data-8.0.0/ 0000775 0000000 0000000 00000000000 15040460430 0016013 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.commitlintrc.js 0000664 0000000 0000000 00000000566 15040460430 0021142 0 ustar 00root root 0000000 0000000 /* This file is automatically added by @npmcli/template-oss. Do not edit. */
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
'header-max-length': [2, 'always', 80],
'subject-case': [0],
'body-max-line-length': [0],
'footer-max-line-length': [0],
},
}
normalize-package-data-8.0.0/.eslintrc.js 0000664 0000000 0000000 00000000623 15040460430 0020253 0 ustar 00root root 0000000 0000000 /* This file is automatically added by @npmcli/template-oss. Do not edit. */
'use strict'
const { readdirSync: readdir } = require('fs')
const localConfigs = readdir(__dirname)
.filter((file) => file.startsWith('.eslintrc.local.'))
.map((file) => `./${file}`)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
],
}
normalize-package-data-8.0.0/.github/ 0000775 0000000 0000000 00000000000 15040460430 0017353 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/CODEOWNERS 0000664 0000000 0000000 00000000132 15040460430 0020742 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
* @npm/cli-team
normalize-package-data-8.0.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15040460430 0021536 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/ISSUE_TEMPLATE/bug.yml 0000664 0000000 0000000 00000002655 15040460430 0023046 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Bug
description: File a bug/issue
title: "[BUG]
"
labels: [ Bug, Needs Triage ]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please [search here](./issues) to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A clear & concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A clear & concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
value: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **npm**: 7.6.3
- **Node**: 13.14.0
- **OS**: Ubuntu 20.04
- **platform**: Macbook Pro
value: |
- npm:
- Node:
- OS:
- platform:
validations:
required: false
normalize-package-data-8.0.0/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000000145 15040460430 0023526 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
blank_issues_enabled: true
normalize-package-data-8.0.0/.github/actions/ 0000775 0000000 0000000 00000000000 15040460430 0021013 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/actions/create-check/ 0000775 0000000 0000000 00000000000 15040460430 0023331 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/actions/create-check/action.yml 0000664 0000000 0000000 00000002720 15040460430 0025332 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: 'Create Check'
inputs:
name:
required: true
token:
required: true
sha:
required: true
check-name:
default: ''
outputs:
check-id:
value: ${{ steps.create-check.outputs.check_id }}
runs:
using: "composite"
steps:
- name: Get Workflow Job
uses: actions/github-script@v7
id: workflow
env:
JOB_NAME: "${{ inputs.name }}"
SHA: "${{ inputs.sha }}"
with:
result-encoding: string
script: |
const { repo: { owner, repo}, runId, serverUrl } = context
const { JOB_NAME, SHA } = process.env
const job = await github.rest.actions.listJobsForWorkflowRun({
owner,
repo,
run_id: runId,
per_page: 100
}).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME)))
return [
`This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`,
'Run logs:',
job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`,
].join(' ')
- name: Create Check
uses: LouisBrunner/checks-action@v1.6.0
id: create-check
with:
token: ${{ inputs.token }}
sha: ${{ inputs.sha }}
status: in_progress
name: ${{ inputs.check-name || inputs.name }}
output: |
{"summary":"${{ steps.workflow.outputs.result }}"}
normalize-package-data-8.0.0/.github/actions/install-latest-npm/ 0000775 0000000 0000000 00000000000 15040460430 0024543 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/actions/install-latest-npm/action.yml 0000664 0000000 0000000 00000003406 15040460430 0026546 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: 'Install Latest npm'
description: 'Install the latest version of npm compatible with the Node version'
inputs:
node:
description: 'Current Node version'
required: true
runs:
using: "composite"
steps:
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- name: Update Windows npm
if: |
runner.os == 'Windows' && (
startsWith(inputs.node, 'v10.') ||
startsWith(inputs.node, 'v12.') ||
startsWith(inputs.node, 'v14.')
)
shell: cmd
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Install Latest npm
shell: bash
env:
NODE_VERSION: ${{ inputs.node }}
working-directory: ${{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
echo "node@$NODE_VERSION"
for SPEC in ${SPECS[@]}; do
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
MATCH=$SPEC
echo "Found compatible version: npm@$MATCH"
break
fi
done
if [ -z $MATCH ]; then
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
exit 1
fi
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
shell: bash
run: npm -v
normalize-package-data-8.0.0/.github/dependabot.yml 0000664 0000000 0000000 00000000656 15040460430 0022212 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: daily
target-branch: "main"
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "Dependencies"
open-pull-requests-limit: 10
normalize-package-data-8.0.0/.github/matchers/ 0000775 0000000 0000000 00000000000 15040460430 0021161 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/matchers/tap.json 0000664 0000000 0000000 00000001204 15040460430 0022635 0 ustar 00root root 0000000 0000000 {
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
"problemMatcher": [
{
"owner": "tap",
"pattern": [
{
"regexp": "^\\s*not ok \\d+ - (.*)",
"message": 1
},
{
"regexp": "^\\s*---"
},
{
"regexp": "^\\s*at:"
},
{
"regexp": "^\\s*line:\\s*(\\d+)",
"line": 1
},
{
"regexp": "^\\s*column:\\s*(\\d+)",
"column": 1
},
{
"regexp": "^\\s*file:\\s*(.*)",
"file": 1
}
]
}
]
}
normalize-package-data-8.0.0/.github/settings.yml 0000664 0000000 0000000 00000001377 15040460430 0021746 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
repository:
allow_merge_commit: false
allow_rebase_merge: true
allow_squash_merge: true
squash_merge_commit_title: PR_TITLE
squash_merge_commit_message: PR_BODY
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true
branches:
- name: main
protection:
required_status_checks: null
enforce_admins: true
block_creations: true
required_pull_request_reviews:
required_approving_review_count: 1
require_code_owner_reviews: true
require_last_push_approval: true
dismiss_stale_reviews: true
restrictions:
apps: []
users: []
teams: [ "cli-team" ]
normalize-package-data-8.0.0/.github/workflows/ 0000775 0000000 0000000 00000000000 15040460430 0021410 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/.github/workflows/audit.yml 0000664 0000000 0000000 00000002275 15040460430 0023247 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Audit
on:
workflow_dispatch:
schedule:
# "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1
- cron: "0 8 * * 1"
permissions:
contents: read
jobs:
audit:
name: Audit Dependencies
if: github.repository_owner == 'npm'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
- name: Run Production Audit
run: npm audit --omit=dev
- name: Run Full Audit
run: npm audit --audit-level=none
normalize-package-data-8.0.0/.github/workflows/ci-release.yml 0000664 0000000 0000000 00000010707 15040460430 0024151 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: CI - Release
on:
workflow_dispatch:
inputs:
ref:
required: true
type: string
default: main
workflow_call:
inputs:
ref:
required: true
type: string
check-sha:
required: true
type: string
permissions:
contents: read
checks: write
jobs:
lint-all:
name: Lint All
if: github.repository_owner == 'npm'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Create Check
id: create-check
if: ${{ inputs.check-sha }}
uses: ./.github/actions/create-check
with:
name: "Lint All"
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ inputs.check-sha }}
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Lint
run: npm run lint --ignore-scripts
- name: Post Lint
run: npm run postlint --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
if: steps.create-check.outputs.check-id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ steps.create-check.outputs.check-id }}
test-all:
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
if: github.repository_owner == 'npm'
strategy:
fail-fast: false
matrix:
platform:
- name: Linux
os: ubuntu-latest
shell: bash
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 20.17.0
- 20.x
- 22.9.0
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.9.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Create Check
id: create-check
if: ${{ inputs.check-sha }}
uses: ./.github/actions/create-check
with:
name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ inputs.check-sha }}
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: npm test --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
if: steps.create-check.outputs.check-id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ steps.create-check.outputs.check-id }}
normalize-package-data-8.0.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000006141 15040460430 0022530 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
- cron: "0 9 * * 1"
permissions:
contents: read
jobs:
lint:
name: Lint
if: github.repository_owner == 'npm'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Lint
run: npm run lint --ignore-scripts
- name: Post Lint
run: npm run postlint --ignore-scripts
test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
if: github.repository_owner == 'npm'
strategy:
fail-fast: false
matrix:
platform:
- name: Linux
os: ubuntu-latest
shell: bash
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 20.17.0
- 20.x
- 22.9.0
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.9.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: npm test --ignore-scripts
normalize-package-data-8.0.0/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000001606 15040460430 0025226 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: CodeQL
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# "At 10:00 UTC (03:00 PT) on Monday" https://crontab.guru/#0_10_*_*_1
- cron: "0 10 * * 1"
permissions:
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
normalize-package-data-8.0.0/.github/workflows/post-dependabot.yml 0000664 0000000 0000000 00000012004 15040460430 0025220 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Post Dependabot
on: pull_request
permissions:
contents: write
jobs:
template-oss:
name: template-oss
if: github.repository_owner == 'npm' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Fetch Dependabot Metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Dependabot can update multiple directories so we output which directory
# it is acting on so we can run the command for the correct root or workspace
- name: Get Dependabot Directory
if: contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')
id: flags
run: |
dependabot_dir="${{ steps.metadata.outputs.directory }}"
if [[ "$dependabot_dir" == "/" || "$dependabot_dir" == "/main" ]]; then
echo "workspace=-iwr" >> $GITHUB_OUTPUT
else
# strip leading slash from directory so it works as a
# a path to the workspace flag
echo "workspace=--workspace ${dependabot_dir#/}" >> $GITHUB_OUTPUT
fi
- name: Apply Changes
if: steps.flags.outputs.workspace
id: apply
run: |
npm run template-oss-apply ${{ steps.flags.outputs.workspace }}
if [[ `git status --porcelain` ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
fi
# This only sets the conventional commit prefix. This workflow can't reliably determine
# what the breaking change is though. If a BREAKING CHANGE message is required then
# this PR check will fail and the commit will be amended with stafftools
if [[ "${{ steps.metadata.outputs.update-type }}" == "version-update:semver-major" ]]; then
prefix='feat!'
else
prefix='chore'
fi
echo "message=$prefix: postinstall for dependabot template-oss PR" >> $GITHUB_OUTPUT
# This step will fail if template-oss has made any workflow updates. It is impossible
# for a workflow to update other workflows. In the case it does fail, we continue
# and then try to apply only a portion of the changes in the next step
- name: Push All Changes
if: steps.apply.outputs.changes
id: push
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git commit -am "${{ steps.apply.outputs.message }}"
git push
# If the previous step failed, then reset the commit and remove any workflow changes
# and attempt to commit and push again. This is helpful because we will have a commit
# with the correct prefix that we can then --amend with @npmcli/stafftools later.
- name: Push All Changes Except Workflows
if: steps.apply.outputs.changes && steps.push.outcome == 'failure'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git reset HEAD~
git checkout HEAD -- .github/workflows/
git clean -fd .github/workflows/
git commit -am "${{ steps.apply.outputs.message }}"
git push
# Check if all the necessary template-oss changes were applied. Since we continued
# on errors in one of the previous steps, this check will fail if our follow up
# only applied a portion of the changes and we need to followup manually.
#
# Note that this used to run `lint` and `postlint` but that will fail this action
# if we've also shipped any linting changes separate from template-oss. We do
# linting in another action, so we want to fail this one only if there are
# template-oss changes that could not be applied.
- name: Check Changes
if: steps.apply.outputs.changes
run: |
npm exec --offline ${{ steps.flags.outputs.workspace }} -- template-oss-check
- name: Fail on Breaking Change
if: steps.apply.outputs.changes && startsWith(steps.apply.outputs.message, 'feat!')
run: |
echo "This PR has a breaking change. Run 'npx -p @npmcli/stafftools gh template-oss-fix'"
echo "for more information on how to fix this with a BREAKING CHANGE footer."
exit 1
normalize-package-data-8.0.0/.github/workflows/pull-request.yml 0000664 0000000 0000000 00000002737 15040460430 0024606 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Pull Request
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
permissions:
contents: read
jobs:
commitlint:
name: Lint Commits
if: github.repository_owner == 'npm'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Run Commitlint on Commits
id: commit
continue-on-error: true
run: npx --offline commitlint -V --from 'origin/${{ github.base_ref }}' --to ${{ github.event.pull_request.head.sha }}
- name: Run Commitlint on PR Title
if: steps.commit.outcome == 'failure'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: echo "$PR_TITLE" | npx --offline commitlint -V
normalize-package-data-8.0.0/.github/workflows/release-integration.yml 0000664 0000000 0000000 00000004163 15040460430 0026100 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Release Integration
on:
workflow_dispatch:
inputs:
releases:
required: true
type: string
description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
workflow_call:
inputs:
releases:
required: true
type: string
description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version'
secrets:
PUBLISH_TOKEN:
required: true
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ fromJSON(inputs.releases)[0].tagName }}
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Set npm authToken
run: npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN}
- name: Publish
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
RELEASES: ${{ inputs.releases }}
run: |
EXIT_CODE=0
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
npm publish --provenance --tag="$PUBLISH_TAG"
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
fi
done
exit $EXIT_CODE
normalize-package-data-8.0.0/.github/workflows/release.yml 0000664 0000000 0000000 00000026106 15040460430 0023560 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
checks: write
jobs:
release:
outputs:
pr: ${{ steps.release.outputs.pr }}
pr-branch: ${{ steps.release.outputs.pr-branch }}
pr-number: ${{ steps.release.outputs.pr-number }}
pr-sha: ${{ steps.release.outputs.pr-sha }}
releases: ${{ steps.release.outputs.releases }}
comment-id: ${{ steps.create-comment.outputs.comment-id || steps.update-comment.outputs.comment-id }}
check-id: ${{ steps.create-check.outputs.check-id }}
name: Release
if: github.repository_owner == 'npm'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Release Please
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --offline template-oss-release-please --branch="${{ github.ref_name }}" --backport="" --defaultTag="latest"
- name: Create Release Manager Comment Text
if: steps.release.outputs.pr-number
uses: actions/github-script@v7
id: comment-text
with:
result-encoding: string
script: |
const { runId, repo: { owner, repo } } = context
const { data: workflow } = await github.rest.actions.getWorkflowRun({ owner, repo, run_id: runId })
return['## Release Manager', `Release workflow run: ${workflow.html_url}`].join('\n\n')
- name: Find Release Manager Comment
uses: peter-evans/find-comment@v2
if: steps.release.outputs.pr-number
id: found-comment
with:
issue-number: ${{ steps.release.outputs.pr-number }}
comment-author: 'github-actions[bot]'
body-includes: '## Release Manager'
- name: Create Release Manager Comment
id: create-comment
if: steps.release.outputs.pr-number && !steps.found-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ steps.release.outputs.pr-number }}
body: ${{ steps.comment-text.outputs.result }}
- name: Update Release Manager Comment
id: update-comment
if: steps.release.outputs.pr-number && steps.found-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.found-comment.outputs.comment-id }}
body: ${{ steps.comment-text.outputs.result }}
edit-mode: 'replace'
- name: Create Check
id: create-check
uses: ./.github/actions/create-check
if: steps.release.outputs.pr-sha
with:
name: "Release"
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ steps.release.outputs.pr-sha }}
update:
needs: release
outputs:
sha: ${{ steps.commit.outputs.sha }}
check-id: ${{ steps.create-check.outputs.check-id }}
name: Update - Release
if: github.repository_owner == 'npm' && needs.release.outputs.pr
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.pr-branch }}
- name: Setup Git User
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- name: Setup Node
uses: actions/setup-node@v4
id: node
with:
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Create Release Manager Checklist Text
id: comment-text
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm exec --offline -- template-oss-release-manager --pr="${{ needs.release.outputs.pr-number }}" --backport="" --defaultTag="latest" --publish
- name: Append Release Manager Comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ needs.release.outputs.comment-id }}
body: ${{ steps.comment-text.outputs.result }}
edit-mode: 'append'
- name: Run Post Pull Request Actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run rp-pull-request --ignore-scripts --if-present -- --pr="${{ needs.release.outputs.pr-number }}" --commentId="${{ needs.release.outputs.comment-id }}"
- name: Commit
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git commit --all --amend --no-edit || true
git push --force-with-lease
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Create Check
id: create-check
uses: ./.github/actions/create-check
with:
name: "Update - Release"
check-name: "Release"
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ steps.commit.outputs.sha }}
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ needs.release.outputs.check-id }}
ci:
name: CI - Release
needs: [ release, update ]
if: needs.release.outputs.pr
uses: ./.github/workflows/ci-release.yml
with:
ref: ${{ needs.release.outputs.pr-branch }}
check-sha: ${{ needs.update.outputs.sha }}
post-ci:
needs: [ release, update, ci ]
name: Post CI - Release
if: github.repository_owner == 'npm' && needs.release.outputs.pr && always()
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Get CI Conclusion
id: conclusion
run: |
result=""
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
result="failure"
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
result="cancelled"
else
result="success"
fi
echo "result=$result" >> $GITHUB_OUTPUT
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ steps.conclusion.outputs.result }}
check_id: ${{ needs.update.outputs.check-id }}
post-release:
needs: release
outputs:
comment-id: ${{ steps.create-comment.outputs.comment-id }}
name: Post Release - Release
if: github.repository_owner == 'npm' && needs.release.outputs.releases
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Create Release PR Comment Text
id: comment-text
uses: actions/github-script@v7
env:
RELEASES: ${{ needs.release.outputs.releases }}
with:
result-encoding: string
script: |
const releases = JSON.parse(process.env.RELEASES)
const { runId, repo: { owner, repo } } = context
const issue_number = releases[0].prNumber
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`
return [
'## Release Workflow\n',
...releases.map(r => `- \`${r.pkgName}@${r.version}\` ${r.url}`),
`- Workflow run: :arrows_counterclockwise: ${runUrl}`,
].join('\n')
- name: Create Release PR Comment
id: create-comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ fromJSON(needs.release.outputs.releases)[0].prNumber }}
body: ${{ steps.comment-text.outputs.result }}
release-integration:
needs: release
name: Release Integration
if: needs.release.outputs.releases
uses: ./.github/workflows/release-integration.yml
permissions:
contents: read
id-token: write
secrets:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
with:
releases: ${{ needs.release.outputs.releases }}
post-release-integration:
needs: [ release, release-integration, post-release ]
name: Post Release Integration - Release
if: github.repository_owner == 'npm' && needs.release.outputs.releases && always()
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Get Post Release Conclusion
id: conclusion
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
result="x"
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
result="heavy_multiplication_x"
else
result="white_check_mark"
fi
echo "result=$result" >> $GITHUB_OUTPUT
- name: Find Release PR Comment
uses: peter-evans/find-comment@v2
id: found-comment
with:
issue-number: ${{ fromJSON(needs.release.outputs.releases)[0].prNumber }}
comment-author: 'github-actions[bot]'
body-includes: '## Release Workflow'
- name: Create Release PR Comment Text
id: comment-text
if: steps.found-comment.outputs.comment-id
uses: actions/github-script@v7
env:
RESULT: ${{ steps.conclusion.outputs.result }}
BODY: ${{ steps.found-comment.outputs.comment-body }}
with:
result-encoding: string
script: |
const { RESULT, BODY } = process.env
const body = [BODY.replace(/(Workflow run: :)[a-z_]+(:)/, `$1${RESULT}$2`)]
if (RESULT !== 'white_check_mark') {
body.push(':rotating_light::rotating_light::rotating_light:')
body.push([
'@npm/cli-team: The post-release workflow failed for this release.',
'Manual steps may need to be taken after examining the workflow output.'
].join(' '))
body.push(':rotating_light::rotating_light::rotating_light:')
}
return body.join('\n\n').trim()
- name: Update Release PR Comment
if: steps.comment-text.outputs.result
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.found-comment.outputs.comment-id }}
body: ${{ steps.comment-text.outputs.result }}
edit-mode: 'replace'
normalize-package-data-8.0.0/.gitignore 0000664 0000000 0000000 00000001050 15040460430 0017777 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
# ignore everything in the root
/*
!**/.gitignore
!/.commitlintrc.js
!/.eslint.config.js
!/.eslintrc.js
!/.eslintrc.local.*
!/.git-blame-ignore-revs
!/.github/
!/.gitignore
!/.npmrc
!/.prettierignore
!/.prettierrc.js
!/.release-please-manifest.json
!/bin/
!/CHANGELOG*
!/CODE_OF_CONDUCT.md
!/CONTRIBUTING.md
!/docs/
!/lib/
!/LICENSE*
!/map.js
!/package.json
!/README*
!/release-please-config.json
!/scripts/
!/SECURITY.md
!/tap-snapshots/
!/test/
!/tsconfig.json
tap-testdir*/
normalize-package-data-8.0.0/.npmrc 0000664 0000000 0000000 00000000135 15040460430 0017132 0 ustar 00root root 0000000 0000000 ; This file is automatically added by @npmcli/template-oss. Do not edit.
package-lock=false
normalize-package-data-8.0.0/.release-please-manifest.json 0000664 0000000 0000000 00000000023 15040460430 0023452 0 ustar 00root root 0000000 0000000 {
".": "8.0.0"
}
normalize-package-data-8.0.0/CHANGELOG.md 0000664 0000000 0000000 00000020117 15040460430 0017625 0 ustar 00root root 0000000 0000000 # Changelog
## [8.0.0](https://github.com/npm/normalize-package-data/compare/v7.0.1...v8.0.0) (2025-07-24)
### ⚠️ BREAKING CHANGES
* `normalize-package-data` now supports node `^20.17.0 || >=22.9.0`
### Bug Fixes
* [`4b978e0`](https://github.com/npm/normalize-package-data/commit/4b978e07b4c257407a60aef4fa325bea6a773164) [#248](https://github.com/npm/normalize-package-data/pull/248) align to npm 11 node engine range (@owlstronaut)
### Dependencies
* [`7b28c1a`](https://github.com/npm/normalize-package-data/commit/7b28c1a84de9efa04b1f5d6a790e6fb082ef0244) [#248](https://github.com/npm/normalize-package-data/pull/248) `hosted-git-info@9.0.0`
## [7.0.1](https://github.com/npm/normalize-package-data/compare/v7.0.0...v7.0.1) (2025-07-22)
### Bug Fixes
* [`97fb20a`](https://github.com/npm/normalize-package-data/commit/97fb20adabf7a6f22c67733252b2e30da520ed96) [#247](https://github.com/npm/normalize-package-data/pull/247) use `URL.canParse` instead of runtime deprecated `url.parse` api (#247) (@SuperchupuDev)
* [`cc37f25`](https://github.com/npm/normalize-package-data/commit/cc37f25f02b8110ceded0cdfae5e4bb33dd2de0d) [#244](https://github.com/npm/normalize-package-data/pull/244) use `isBuiltin` instead of `builtinModules` (#244) (@SuperchupuDev)
### Chores
* [`acafa71`](https://github.com/npm/normalize-package-data/commit/acafa7127ca8af7cbb60813e63d197d418dd759f) [#245](https://github.com/npm/normalize-package-data/pull/245) bump @npmcli/template-oss from 4.24.4 to 4.25.0 (#245) (@dependabot[bot], @owlstronaut)
## [7.0.0](https://github.com/npm/normalize-package-data/compare/v6.0.2...v7.0.0) (2024-09-24)
### ⚠️ BREAKING CHANGES
* `normalize-package-data` now supports node `^18.17.0 || >=20.5.0`
### Bug Fixes
* [`c3e0c45`](https://github.com/npm/normalize-package-data/commit/c3e0c452c9a7b75bee471c8cac29b40361ea6387) [#238](https://github.com/npm/normalize-package-data/pull/238) align to npm 10 node engine range (@hashtagchris)
### Dependencies
* [`a313806`](https://github.com/npm/normalize-package-data/commit/a313806d61272799b577b5dbe56639047d933480) [#238](https://github.com/npm/normalize-package-data/pull/238) `hosted-git-info@8.0.0`
### Chores
* [`cbf987b`](https://github.com/npm/normalize-package-data/commit/cbf987bc26b974adcc45ded1d3a0d5ad73bc67a7) [#238](https://github.com/npm/normalize-package-data/pull/238) run template-oss-apply (@hashtagchris)
* [`846ae80`](https://github.com/npm/normalize-package-data/commit/846ae80d05f26b22ac2bec3e8bb300ce2e67aa19) [#235](https://github.com/npm/normalize-package-data/pull/235) bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
* [`2077b44`](https://github.com/npm/normalize-package-data/commit/2077b44f59009fd98ea4d0efd5a353c413cf122b) [#236](https://github.com/npm/normalize-package-data/pull/236) postinstall for dependabot template-oss PR (@hashtagchris)
* [`f314b3d`](https://github.com/npm/normalize-package-data/commit/f314b3d6c28febedb819ecfad8ff5fa730a1c666) [#236](https://github.com/npm/normalize-package-data/pull/236) bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])
## [6.0.2](https://github.com/npm/normalize-package-data/compare/v6.0.1...v6.0.2) (2024-06-25)
### Dependencies
* [`43bab20`](https://github.com/npm/normalize-package-data/commit/43bab2087123dd105235bee9e4d99a84fa179bd3) [#224](https://github.com/npm/normalize-package-data/pull/224) replace `is-core-module` with node builtin (#224) (@SuperchupuDev, @wraithgar)
## [6.0.1](https://github.com/npm/normalize-package-data/compare/v6.0.0...v6.0.1) (2024-05-04)
### Bug Fixes
* [`27688b4`](https://github.com/npm/normalize-package-data/commit/27688b4e35adbff465eb333374854fe19ac1795d) [#217](https://github.com/npm/normalize-package-data/pull/217) linting: no-unused-vars (@lukekarrys)
### Documentation
* [`c5b90cd`](https://github.com/npm/normalize-package-data/commit/c5b90cdaaee99adefb805a1e84289ff66e23cc38) [#214](https://github.com/npm/normalize-package-data/pull/214) readme: fix broken badge URL (#214) (@10xLaCroixDrinker)
### Chores
* [`3c74f51`](https://github.com/npm/normalize-package-data/commit/3c74f51a1a754e34023bfb8db25418c75d3642e7) [#217](https://github.com/npm/normalize-package-data/pull/217) bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
* [`02de832`](https://github.com/npm/normalize-package-data/commit/02de832d320573c142659fece85fc7fb8a022ac5) [#217](https://github.com/npm/normalize-package-data/pull/217) postinstall for dependabot template-oss PR (@lukekarrys)
* [`f6b1f8c`](https://github.com/npm/normalize-package-data/commit/f6b1f8cff7a0eb346b82c76c9191bab2ae7d197e) [#216](https://github.com/npm/normalize-package-data/pull/216) bump @npmcli/template-oss from 4.21.3 to 4.21.4 (@dependabot[bot])
## [6.0.0](https://github.com/npm/normalize-package-data/compare/v5.0.0...v6.0.0) (2023-08-15)
### ⚠️ BREAKING CHANGES
* support for node 14 has been removed
### Bug Fixes
* [`2338ad0`](https://github.com/npm/normalize-package-data/commit/2338ad01a93ad731f100aaa385da81f5adfe1903) [#186](https://github.com/npm/normalize-package-data/pull/186) drop node14 support (@lukekarrys)
### Dependencies
* [`7b0f828`](https://github.com/npm/normalize-package-data/commit/7b0f82848d2a09c213d9749ffac70975fb5e61ca) [#185](https://github.com/npm/normalize-package-data/pull/185) bump hosted-git-info from 6.1.1 to 7.0.0
## [5.0.0](https://github.com/npm/normalize-package-data/compare/v4.0.1...v5.0.0) (2022-10-12)
### ⚠️ BREAKING CHANGES
* `normalize-package-data` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0`
### Features
* [`c299178`](https://github.com/npm/normalize-package-data/commit/c299178b90a1be97a93bebd17204664c2f8d640e) [#156](https://github.com/npm/normalize-package-data/pull/156) postinstall for dependabot template-oss PR (@lukekarrys)
### Dependencies
* [`8a9c5ee`](https://github.com/npm/normalize-package-data/commit/8a9c5ee4f0e57e239069b44c9d89e8987efaaf40) [#164](https://github.com/npm/normalize-package-data/pull/164) `hosted-git-info@6.0.0` (#164)
## [4.0.1](https://github.com/npm/normalize-package-data/compare/v4.0.0...v4.0.1) (2022-08-15)
### Bug Fixes
* linting ([#146](https://github.com/npm/normalize-package-data/issues/146)) ([850038e](https://github.com/npm/normalize-package-data/commit/850038e68baa8155f55f9169977cb631fecbe1d4))
## [4.0.0](https://www.github.com/npm/normalize-package-data/compare/v3.0.3...v4.0.0) (2022-03-14)
### ⚠ BREAKING CHANGES
* this drops support for node 10 and non-LTS versions of node 12 and node 14
### Bug Fixes
* do not overwrite bundled dependency ranges with * ([#128](https://www.github.com/npm/normalize-package-data/issues/128)) ([b8e4604](https://www.github.com/npm/normalize-package-data/commit/b8e460412c45a334c71f874d8fe118522ae73c95))
* safer regex ([abcdb36](https://www.github.com/npm/normalize-package-data/commit/abcdb36f5bbeeb4d1e0a0aafac6aaf8b3e8488b3))
### Documentation
* Missprint in readme ([#127](https://www.github.com/npm/normalize-package-data/issues/127)) ([ac078ea](https://www.github.com/npm/normalize-package-data/commit/ac078eaa9bc3f41c971bdf5539e46b2738820156))
* @npmcli/template-oss@2.9.2 ([80daf4a](https://www.github.com/npm/normalize-package-data/commit/80daf4a771c0cae08695466f0b766f6989b31525))
### Dependencies
* bump hosted-git-info from 4.1.0 to 5.0.0 ([#135](https://www.github.com/npm/normalize-package-data/issues/135)) ([289674d](https://www.github.com/npm/normalize-package-data/commit/289674dc86fca6e2685d505b9e735bdc6ef84ea6))
* update is-core-module requirement from ^2.5.0 to ^2.8.1 ([#132](https://www.github.com/npm/normalize-package-data/issues/132)) ([b3ec77e](https://www.github.com/npm/normalize-package-data/commit/b3ec77e1413c17713ccd984ad2702679cc02f6eb))
* update semver requirement from ^7.3.4 to ^7.3.5 ([#133](https://www.github.com/npm/normalize-package-data/issues/133)) ([e0a56dc](https://www.github.com/npm/normalize-package-data/commit/e0a56dc76afa0da4e147afe8892c5b0306f1a77a))
* update validate-npm-package-license requirement ([#131](https://www.github.com/npm/normalize-package-data/issues/131)) ([fe7dc60](https://www.github.com/npm/normalize-package-data/commit/fe7dc60d74e8cdaaf8b0015e67a57b4aa5366f63))
normalize-package-data-8.0.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000000507 15040460430 0020614 0 ustar 00root root 0000000 0000000
All interactions in this repo are covered by the [npm Code of
Conduct](https://docs.npmjs.com/policies/conduct)
The npm cli team may, at its own discretion, moderate, remove, or edit
any interactions such as pull requests, issues, and comments.
normalize-package-data-8.0.0/CONTRIBUTING.md 0000664 0000000 0000000 00000005133 15040460430 0020246 0 ustar 00root root 0000000 0000000
# Contributing
## Code of Conduct
All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://docs.npmjs.com/policies/conduct).
## Reporting Bugs
Before submitting a new bug report please search for an existing or similar report.
Use one of our existing issue templates if you believe you've come across a unique problem.
Duplicate issues, or issues that don't use one of our templates may get closed without a response.
## Pull Request Conventions
### Commits
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
When opening a pull request please be sure that either the pull request title, or each commit in the pull request, has one of the following prefixes:
- `feat`: For when introducing a new feature. The result will be a new semver minor version of the package when it is next published.
- `fix`: For bug fixes. The result will be a new semver patch version of the package when it is next published.
- `docs`: For documentation updates. The result will be a new semver patch version of the package when it is next published.
- `chore`: For changes that do not affect the published module. Often these are changes to tests. The result will be *no* change to the version of the package when it is next published (as the commit does not affect the published version).
### Test Coverage
Pull requests made against this repo will run `npm test` automatically. Please make sure tests pass locally before submitting a PR.
Every new feature or bug fix should come with a corresponding test or tests that validate the solutions. Testing also reports on code coverage and will fail if code coverage drops.
### Linting
Linting is also done automatically once tests pass. `npm run lintfix` will fix most linting errors automatically.
Please make sure linting passes before submitting a PR.
## What _not_ to contribute?
### Dependencies
It should be noted that our team does not accept third-party dependency updates/PRs. If you submit a PR trying to update our dependencies we will close it with or without a reference to these contribution guidelines.
### Tools/Automation
Our core team is responsible for the maintenance of the tooling/automation in this project and we ask contributors to not make changes to these when contributing (e.g. `.github/*`, `.eslintrc.json`, `.licensee.json`). Most of those files also have a header at the top to remind folks they are automatically generated. Pull requests that alter these will not be accepted.
normalize-package-data-8.0.0/LICENSE 0000664 0000000 0000000 00000002573 15040460430 0017027 0 ustar 00root root 0000000 0000000 This package contains code originally written by Isaac Z. Schlueter.
Used with permission.
Copyright (c) Meryn Stol ("Author")
All rights reserved.
The BSD License
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
normalize-package-data-8.0.0/README.md 0000664 0000000 0000000 00000016147 15040460430 0017303 0 ustar 00root root 0000000 0000000 # normalize-package-data
[](https://github.com/npm/normalize-package-data)
normalize-package-data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.
normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.
## Installation
```
npm install normalize-package-data
```
## Usage
Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.
```javascript
normalizeData = require('normalize-package-data')
packageData = require("./package.json")
normalizeData(packageData)
// packageData is now normalized
```
#### Strict mode
You may activate strict validation by passing true as the second argument.
```javascript
normalizeData = require('normalize-package-data')
packageData = require("./package.json")
normalizeData(packageData, true)
// packageData is now normalized
```
If strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace.
#### Warnings
Optionally, you may pass a "warning" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data.
```javascript
normalizeData = require('normalize-package-data')
packageData = require("./package.json")
warnFn = function(msg) { console.error(msg) }
normalizeData(packageData, warnFn)
// packageData is now normalized. Any number of warnings may have been logged.
```
You may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third.
When `private` field is set to `true`, warnings will be suppressed.
### Potential exceptions
If the supplied data has an invalid name or version field, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.
## What normalization (currently) entails
* The value of `name` field gets trimmed (unless in strict mode).
* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).
* If `name` and/or `version` fields are missing, they are set to empty strings.
* If `files` field is not an array, it will be removed.
* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.
* If `man` field is a string, it will become an array with the original string as its sole member.
* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`.
* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.
* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.
* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.
* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.
* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved.
* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shortcut was previously expanded to a URL.
* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`.
* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git+https://github.com/[owner-name]/[repo-name].git
* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.
* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.
* If `homepage` field is not a string, it will be removed.
* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`.
* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]#readme . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
### Rules for name field
If `name` field is given, the value of the name field must be a string. The string may not:
* start with a period.
* contain the following characters: `/@\s+%`
* contain any characters that would need to be encoded for use in urls.
* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).
### Rules for version field
If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).
### Rules for license field
The `license`/`licence` field should be a valid *SPDX license expression* or one of the special values allowed by [validate-npm-package-license](https://npmjs.com/package/validate-npm-package-license). See [documentation for the license field in package.json](https://docs.npmjs.com/files/package.json#license).
## Credits
This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permission.
## License
normalize-package-data is released under the [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).
Copyright (c) 2013 Meryn Stol
normalize-package-data-8.0.0/SECURITY.md 0000664 0000000 0000000 00000002320 15040460430 0017601 0 ustar 00root root 0000000 0000000
GitHub takes the security of our software products and services seriously, including the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub).
If you believe you have found a security vulnerability in this GitHub-owned open source repository, you can report it to us in one of two ways.
If the vulnerability you have found is *not* [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) or if you do not wish to be considered for a bounty reward, please report the issue to us directly through [opensource-security@github.com](mailto:opensource-security@github.com).
If the vulnerability you have found is [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) and you would like for your finding to be considered for a bounty reward, please submit the vulnerability to us through [HackerOne](https://hackerone.com/github) in order to be eligible to receive a bounty award.
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
Thanks for helping make GitHub safe for everyone.
normalize-package-data-8.0.0/docs/ 0000775 0000000 0000000 00000000000 15040460430 0016743 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/docs/AUTHORS 0000664 0000000 0000000 00000000230 15040460430 0020006 0 ustar 00root root 0000000 0000000 # Names sorted by how much code was originally theirs.
Isaac Z. Schlueter
Meryn Stol
Robert Kowalski
normalize-package-data-8.0.0/lib/ 0000775 0000000 0000000 00000000000 15040460430 0016561 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/lib/extract_description.js 0000664 0000000 0000000 00000001045 15040460430 0023174 0 ustar 00root root 0000000 0000000 module.exports = extractDescription
// Extracts description from contents of a readme file in markdown format
function extractDescription (d) {
if (!d) {
return
}
if (d === 'ERROR: No README data found!') {
return
}
// the first block of text before the first heading
// that isn't the first line heading
d = d.trim().split('\n')
let s = 0
while (d[s] && d[s].trim().match(/^(#|$)/)) {
s++
}
const l = d.length
let e = s + 1
while (e < l && d[e].trim()) {
e++
}
return d.slice(s, e).join(' ').trim()
}
normalize-package-data-8.0.0/lib/fixer.js 0000664 0000000 0000000 00000030243 15040460430 0020236 0 ustar 00root root 0000000 0000000 var { URL } = require('node:url')
var isValidSemver = require('semver/functions/valid')
var cleanSemver = require('semver/functions/clean')
var validateLicense = require('validate-npm-package-license')
var hostedGitInfo = require('hosted-git-info')
var { isBuiltin } = require('node:module')
var depTypes = ['dependencies', 'devDependencies', 'optionalDependencies']
var extractDescription = require('./extract_description')
var typos = require('./typos.json')
var isEmail = str => str.includes('@') && (str.indexOf('@') < str.lastIndexOf('.'))
module.exports = {
// default warning function
warn: function () {},
fixRepositoryField: function (data) {
if (data.repositories) {
this.warn('repositories')
data.repository = data.repositories[0]
}
if (!data.repository) {
return this.warn('missingRepository')
}
if (typeof data.repository === 'string') {
data.repository = {
type: 'git',
url: data.repository,
}
}
var r = data.repository.url || ''
if (r) {
var hosted = hostedGitInfo.fromUrl(r)
if (hosted) {
r = data.repository.url
= hosted.getDefaultRepresentation() === 'shortcut' ? hosted.https() : hosted.toString()
}
}
if (r.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)) {
this.warn('brokenGitUrl', r)
}
},
fixTypos: function (data) {
Object.keys(typos.topLevel).forEach(function (d) {
if (Object.prototype.hasOwnProperty.call(data, d)) {
this.warn('typo', d, typos.topLevel[d])
}
}, this)
},
fixScriptsField: function (data) {
if (!data.scripts) {
return
}
if (typeof data.scripts !== 'object') {
this.warn('nonObjectScripts')
delete data.scripts
return
}
Object.keys(data.scripts).forEach(function (k) {
if (typeof data.scripts[k] !== 'string') {
this.warn('nonStringScript')
delete data.scripts[k]
} else if (typos.script[k] && !data.scripts[typos.script[k]]) {
this.warn('typo', k, typos.script[k], 'scripts')
}
}, this)
},
fixFilesField: function (data) {
var files = data.files
if (files && !Array.isArray(files)) {
this.warn('nonArrayFiles')
delete data.files
} else if (data.files) {
data.files = data.files.filter(function (file) {
if (!file || typeof file !== 'string') {
this.warn('invalidFilename', file)
return false
} else {
return true
}
}, this)
}
},
fixBinField: function (data) {
if (!data.bin) {
return
}
if (typeof data.bin === 'string') {
var b = {}
var match
if (match = data.name.match(/^@[^/]+[/](.*)$/)) {
b[match[1]] = data.bin
} else {
b[data.name] = data.bin
}
data.bin = b
}
},
fixManField: function (data) {
if (!data.man) {
return
}
if (typeof data.man === 'string') {
data.man = [data.man]
}
},
fixBundleDependenciesField: function (data) {
var bdd = 'bundledDependencies'
var bd = 'bundleDependencies'
if (data[bdd] && !data[bd]) {
data[bd] = data[bdd]
delete data[bdd]
}
if (data[bd] && !Array.isArray(data[bd])) {
this.warn('nonArrayBundleDependencies')
delete data[bd]
} else if (data[bd]) {
data[bd] = data[bd].filter(function (filtered) {
if (!filtered || typeof filtered !== 'string') {
this.warn('nonStringBundleDependency', filtered)
return false
} else {
if (!data.dependencies) {
data.dependencies = {}
}
if (!Object.prototype.hasOwnProperty.call(data.dependencies, filtered)) {
this.warn('nonDependencyBundleDependency', filtered)
data.dependencies[filtered] = '*'
}
return true
}
}, this)
}
},
fixDependencies: function (data) {
objectifyDeps(data, this.warn)
addOptionalDepsToDeps(data, this.warn)
this.fixBundleDependenciesField(data)
;['dependencies', 'devDependencies'].forEach(function (deps) {
if (!(deps in data)) {
return
}
if (!data[deps] || typeof data[deps] !== 'object') {
this.warn('nonObjectDependencies', deps)
delete data[deps]
return
}
Object.keys(data[deps]).forEach(function (d) {
var r = data[deps][d]
if (typeof r !== 'string') {
this.warn('nonStringDependency', d, JSON.stringify(r))
delete data[deps][d]
}
var hosted = hostedGitInfo.fromUrl(data[deps][d])
if (hosted) {
data[deps][d] = hosted.toString()
}
}, this)
}, this)
},
fixModulesField: function (data) {
if (data.modules) {
this.warn('deprecatedModules')
delete data.modules
}
},
fixKeywordsField: function (data) {
if (typeof data.keywords === 'string') {
data.keywords = data.keywords.split(/,\s+/)
}
if (data.keywords && !Array.isArray(data.keywords)) {
delete data.keywords
this.warn('nonArrayKeywords')
} else if (data.keywords) {
data.keywords = data.keywords.filter(function (kw) {
if (typeof kw !== 'string' || !kw) {
this.warn('nonStringKeyword')
return false
} else {
return true
}
}, this)
}
},
fixVersionField: function (data, strict) {
// allow "loose" semver 1.0 versions in non-strict mode
// enforce strict semver 2.0 compliance in strict mode
var loose = !strict
if (!data.version) {
data.version = ''
return true
}
if (!isValidSemver(data.version, loose)) {
throw new Error('Invalid version: "' + data.version + '"')
}
data.version = cleanSemver(data.version, loose)
return true
},
fixPeople: function (data) {
modifyPeople(data, unParsePerson)
modifyPeople(data, parsePerson)
},
fixNameField: function (data, options) {
if (typeof options === 'boolean') {
options = { strict: options }
} else if (typeof options === 'undefined') {
options = {}
}
var strict = options.strict
if (!data.name && !strict) {
data.name = ''
return
}
if (typeof data.name !== 'string') {
throw new Error('name field must be a string.')
}
if (!strict) {
data.name = data.name.trim()
}
ensureValidName(data.name, strict, options.allowLegacyCase)
if (isBuiltin(data.name)) {
this.warn('conflictingName', data.name)
}
},
fixDescriptionField: function (data) {
if (data.description && typeof data.description !== 'string') {
this.warn('nonStringDescription')
delete data.description
}
if (data.readme && !data.description) {
data.description = extractDescription(data.readme)
}
if (data.description === undefined) {
delete data.description
}
if (!data.description) {
this.warn('missingDescription')
}
},
fixReadmeField: function (data) {
if (!data.readme) {
this.warn('missingReadme')
data.readme = 'ERROR: No README data found!'
}
},
fixBugsField: function (data) {
if (!data.bugs && data.repository && data.repository.url) {
var hosted = hostedGitInfo.fromUrl(data.repository.url)
if (hosted && hosted.bugs()) {
data.bugs = { url: hosted.bugs() }
}
} else if (data.bugs) {
if (typeof data.bugs === 'string') {
if (isEmail(data.bugs)) {
data.bugs = { email: data.bugs }
} else if (URL.canParse(data.bugs)) {
data.bugs = { url: data.bugs }
} else {
this.warn('nonEmailUrlBugsString')
}
} else {
bugsTypos(data.bugs, this.warn)
var oldBugs = data.bugs
data.bugs = {}
if (oldBugs.url) {
if (URL.canParse(oldBugs.url)) {
data.bugs.url = oldBugs.url
} else {
this.warn('nonUrlBugsUrlField')
}
}
if (oldBugs.email) {
if (typeof (oldBugs.email) === 'string' && isEmail(oldBugs.email)) {
data.bugs.email = oldBugs.email
} else {
this.warn('nonEmailBugsEmailField')
}
}
}
if (!data.bugs.email && !data.bugs.url) {
delete data.bugs
this.warn('emptyNormalizedBugs')
}
}
},
fixHomepageField: function (data) {
if (!data.homepage && data.repository && data.repository.url) {
var hosted = hostedGitInfo.fromUrl(data.repository.url)
if (hosted && hosted.docs()) {
data.homepage = hosted.docs()
}
}
if (!data.homepage) {
return
}
if (typeof data.homepage !== 'string') {
this.warn('nonUrlHomepage')
return delete data.homepage
}
if (!URL.canParse(data.homepage)) {
data.homepage = 'http://' + data.homepage
}
},
fixLicenseField: function (data) {
const license = data.license || data.licence
if (!license) {
return this.warn('missingLicense')
}
if (
typeof (license) !== 'string' ||
license.length < 1 ||
license.trim() === ''
) {
return this.warn('invalidLicense')
}
if (!validateLicense(license).validForNewPackages) {
return this.warn('invalidLicense')
}
},
}
function isValidScopedPackageName (spec) {
if (spec.charAt(0) !== '@') {
return false
}
var rest = spec.slice(1).split('/')
if (rest.length !== 2) {
return false
}
return rest[0] && rest[1] &&
rest[0] === encodeURIComponent(rest[0]) &&
rest[1] === encodeURIComponent(rest[1])
}
function isCorrectlyEncodedName (spec) {
return !spec.match(/[/@\s+%:]/) &&
spec === encodeURIComponent(spec)
}
function ensureValidName (name, strict, allowLegacyCase) {
if (name.charAt(0) === '.' ||
!(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
(strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
name.toLowerCase() === 'node_modules' ||
name.toLowerCase() === 'favicon.ico') {
throw new Error('Invalid name: ' + JSON.stringify(name))
}
}
function modifyPeople (data, fn) {
if (data.author) {
data.author = fn(data.author)
}['maintainers', 'contributors'].forEach(function (set) {
if (!Array.isArray(data[set])) {
return
}
data[set] = data[set].map(fn)
})
return data
}
function unParsePerson (person) {
if (typeof person === 'string') {
return person
}
var name = person.name || ''
var u = person.url || person.web
var wrappedUrl = u ? (' (' + u + ')') : ''
var e = person.email || person.mail
var wrappedEmail = e ? (' <' + e + '>') : ''
return name + wrappedEmail + wrappedUrl
}
function parsePerson (person) {
if (typeof person !== 'string') {
return person
}
var matchedName = person.match(/^([^(<]+)/)
var matchedUrl = person.match(/\(([^()]+)\)/)
var matchedEmail = person.match(/<([^<>]+)>/)
var obj = {}
if (matchedName && matchedName[0].trim()) {
obj.name = matchedName[0].trim()
}
if (matchedEmail) {
obj.email = matchedEmail[1]
}
if (matchedUrl) {
obj.url = matchedUrl[1]
}
return obj
}
function addOptionalDepsToDeps (data) {
var o = data.optionalDependencies
if (!o) {
return
}
var d = data.dependencies || {}
Object.keys(o).forEach(function (k) {
d[k] = o[k]
})
data.dependencies = d
}
function depObjectify (deps, type, warn) {
if (!deps) {
return {}
}
if (typeof deps === 'string') {
deps = deps.trim().split(/[\n\r\s\t ,]+/)
}
if (!Array.isArray(deps)) {
return deps
}
warn('deprecatedArrayDependencies', type)
var o = {}
deps.filter(function (d) {
return typeof d === 'string'
}).forEach(function (d) {
d = d.trim().split(/(:?[@\s><=])/)
var dn = d.shift()
var dv = d.join('')
dv = dv.trim()
dv = dv.replace(/^@/, '')
o[dn] = dv
})
return o
}
function objectifyDeps (data, warn) {
depTypes.forEach(function (type) {
if (!data[type]) {
return
}
data[type] = depObjectify(data[type], type, warn)
})
}
function bugsTypos (bugs, warn) {
if (!bugs) {
return
}
Object.keys(bugs).forEach(function (k) {
if (typos.bugs[k]) {
warn('typo', k, typos.bugs[k], 'bugs')
bugs[typos.bugs[k]] = bugs[k]
delete bugs[k]
}
})
}
normalize-package-data-8.0.0/lib/make_warning.js 0000664 0000000 0000000 00000001307 15040460430 0021562 0 ustar 00root root 0000000 0000000 var util = require('util')
var messages = require('./warning_messages.json')
module.exports = function () {
var args = Array.prototype.slice.call(arguments, 0)
var warningName = args.shift()
if (warningName === 'typo') {
return makeTypoWarning.apply(null, args)
} else {
var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
args.unshift(msgTemplate)
return util.format.apply(null, args)
}
}
function makeTypoWarning (providedName, probableName, field) {
if (field) {
providedName = field + "['" + providedName + "']"
probableName = field + "['" + probableName + "']"
}
return util.format(messages.typo, providedName, probableName)
}
normalize-package-data-8.0.0/lib/normalize.js 0000664 0000000 0000000 00000002544 15040460430 0021124 0 ustar 00root root 0000000 0000000 module.exports = normalize
var fixer = require('./fixer')
normalize.fixer = fixer
var makeWarning = require('./make_warning')
var fieldsToFix = ['name', 'version', 'description', 'repository', 'modules', 'scripts',
'files', 'bin', 'man', 'bugs', 'keywords', 'readme', 'homepage', 'license']
var otherThingsToFix = ['dependencies', 'people', 'typos']
var thingsToFix = fieldsToFix.map(function (fieldName) {
return ucFirst(fieldName) + 'Field'
})
// two ways to do this in CoffeeScript on only one line, sub-70 chars:
// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
thingsToFix = thingsToFix.concat(otherThingsToFix)
function normalize (data, warn, strict) {
if (warn === true) {
warn = null
strict = true
}
if (!strict) {
strict = false
}
if (!warn || data.private) {
warn = function () { /* noop */ }
}
if (data.scripts &&
data.scripts.install === 'node-gyp rebuild' &&
!data.scripts.preinstall) {
data.gypfile = true
}
fixer.warn = function () {
warn(makeWarning.apply(null, arguments))
}
thingsToFix.forEach(function (thingName) {
fixer['fix' + ucFirst(thingName)](data, strict)
})
data._id = data.name + '@' + data.version
}
function ucFirst (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}
normalize-package-data-8.0.0/lib/safe_format.js 0000664 0000000 0000000 00000000406 15040460430 0021405 0 ustar 00root root 0000000 0000000 var util = require('util')
module.exports = function () {
var args = Array.prototype.slice.call(arguments, 0)
args.forEach(function (arg) {
if (!arg) {
throw new TypeError('Bad arguments.')
}
})
return util.format.apply(null, arguments)
}
normalize-package-data-8.0.0/lib/typos.json 0000664 0000000 0000000 00000001353 15040460430 0020634 0 ustar 00root root 0000000 0000000 {
"topLevel": {
"dependancies": "dependencies"
,"dependecies": "dependencies"
,"depdenencies": "dependencies"
,"devEependencies": "devDependencies"
,"depends": "dependencies"
,"dev-dependencies": "devDependencies"
,"devDependences": "devDependencies"
,"devDepenencies": "devDependencies"
,"devdependencies": "devDependencies"
,"repostitory": "repository"
,"repo": "repository"
,"prefereGlobal": "preferGlobal"
,"hompage": "homepage"
,"hampage": "homepage"
,"autohr": "author"
,"autor": "author"
,"contributers": "contributors"
,"publicationConfig": "publishConfig"
,"script": "scripts"
},
"bugs": { "web": "url", "name": "url" },
"script": { "server": "start", "tests": "test" }
}
normalize-package-data-8.0.0/lib/warning_messages.json 0000664 0000000 0000000 00000003406 15040460430 0023013 0 ustar 00root root 0000000 0000000 {
"repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
,"missingRepository": "No repository field."
,"brokenGitUrl": "Probably broken git url: %s"
,"nonObjectScripts": "scripts must be an object"
,"nonStringScript": "script values must be string commands"
,"nonArrayFiles": "Invalid 'files' member"
,"invalidFilename": "Invalid filename in 'files' list: %s"
,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s"
,"nonObjectDependencies": "%s field must be an object"
,"nonStringDependency": "Invalid dependency: %s %s"
,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
,"deprecatedModules": "modules field is deprecated"
,"nonArrayKeywords": "keywords should be an array of strings"
,"nonStringKeyword": "keywords should be an array of strings"
,"conflictingName": "%s is also the name of a node core module."
,"nonStringDescription": "'description' field should be a string"
,"missingDescription": "No description"
,"missingReadme": "No README data"
,"missingLicense": "No license field."
,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
,"nonUrlHomepage": "homepage field must be a string url. Deleted."
,"invalidLicense": "license should be a valid SPDX license expression"
,"typo": "%s should probably be %s."
}
normalize-package-data-8.0.0/package.json 0000664 0000000 0000000 00000002606 15040460430 0020305 0 ustar 00root root 0000000 0000000 {
"name": "normalize-package-data",
"version": "8.0.0",
"author": "GitHub Inc.",
"description": "Normalizes data that can be found in package.json files.",
"license": "BSD-2-Clause",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/normalize-package-data.git"
},
"main": "lib/normalize.js",
"scripts": {
"test": "tap",
"npmclilint": "npmcli-lint",
"lint": "npm run eslint",
"lintfix": "npm run eslint -- --fix",
"posttest": "npm run lint",
"postsnap": "npm run lintfix --",
"postlint": "template-oss-check",
"snap": "tap",
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"dependencies": {
"hosted-git-info": "^9.0.0",
"semver": "^7.3.5",
"validate-npm-package-license": "^3.0.4"
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.25.0",
"tap": "^16.0.1"
},
"files": [
"bin/",
"lib/"
],
"engines": {
"node": "^20.17.0 || >=22.9.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.25.0",
"publish": "true"
},
"tap": {
"branches": 86,
"functions": 92,
"lines": 86,
"statements": 86,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}
normalize-package-data-8.0.0/release-please-config.json 0000664 0000000 0000000 00000001277 15040460430 0023047 0 ustar 00root root 0000000 0000000 {
"group-pull-request-title-pattern": "chore: release ${version}",
"pull-request-title-pattern": "chore: release${component} ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
},
{
"type": "chore",
"section": "Chores",
"hidden": true
}
],
"packages": {
".": {
"package-name": ""
}
},
"prerelease-type": "pre.0"
}
normalize-package-data-8.0.0/test/ 0000775 0000000 0000000 00000000000 15040460430 0016772 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/test/basic.js 0000664 0000000 0000000 00000002770 15040460430 0020417 0 ustar 00root root 0000000 0000000 var tap = require('tap')
var normalize = require('../lib/normalize')
var path = require('path')
var fs = require('fs')
tap.test('basic test', function (t) {
var p = path.resolve(__dirname, './fixtures/read-package-json.json')
fs.readFile(p, function (err, contents) {
if (err) {
throw err
}
var originalData = JSON.parse(contents.toString())
var data = JSON.parse(contents.toString())
normalize(data)
t.ok(data)
verifyFields(t, data, originalData)
t.end()
})
})
function verifyFields (t, normalized, original) {
t.equal(normalized.version, original.version, 'Version field stays same')
t.equal(normalized._id, normalized.name + '@' + normalized.version, 'It gets good id.')
t.equal(normalized.name, original.name, 'Name stays the same.')
t.type(normalized.author, 'object', 'author field becomes object')
t.same(normalized.scripts, original.scripts, 'scripts field (object) stays same')
t.equal(normalized.main, original.main)
// optional deps are folded in.
t.same(normalized.optionalDependencies,
original.optionalDependencies)
t.has(
normalized.dependencies,
original.optionalDependencies, 'opt depedencies are copied into dependencies'
)
t.has(normalized.dependencies, original.dependencies, 'regular depedencies stay in place')
t.same(normalized.devDependencies, original.devDependencies)
t.type(normalized.bugs, 'object', 'bugs should become object')
t.equal(normalized.bugs.url, 'https://github.com/isaacs/read-package-json/issues')
}
normalize-package-data-8.0.0/test/consistency.js 0000664 0000000 0000000 00000001510 15040460430 0021666 0 ustar 00root root 0000000 0000000 const t = require('tap')
const normalize = require('../lib/normalize')
const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const readFile = promisify(fs.readFile)
const readdir = promisify(fs.readdir)
t.test('consistent normalization', async t => {
const entries = await readdir(path.join(__dirname, 'fixtures'))
const verifyConsistency = async (entryName) => {
const warn = () => null
const filename = path.join(__dirname, 'fixtures', entryName)
const contents = await readFile(filename)
const data = JSON.parse(contents.toString())
normalize(data, warn)
const clonedData = { ...data }
normalize(data, warn)
t.same(clonedData, data,
'Normalization of ' + entryName + ' is consistent.')
}
return Promise.all(entries.map(i => verifyConsistency(i)))
})
normalize-package-data-8.0.0/test/dependencies.js 0000664 0000000 0000000 00000003333 15040460430 0021760 0 ustar 00root root 0000000 0000000 var tap = require('tap')
var normalize = require('../lib/normalize')
var warningMessages = require('../lib/warning_messages.json')
var safeFormat = require('../lib/safe_format')
tap.test('warn if dependency contains anything else but a string', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
dependencies: { a: 123 },
devDependencies: { b: 456 },
optionalDependencies: { c: 789 },
}, warn)
var wanted1 = safeFormat(warningMessages.nonStringDependency, 'a', 123)
var wanted2 = safeFormat(warningMessages.nonStringDependency, 'b', 456)
var wanted3 = safeFormat(warningMessages.nonStringDependency, 'c', 789)
t.ok(~warnings.indexOf(wanted1), wanted1)
t.ok(~warnings.indexOf(wanted2), wanted2)
t.ok(~warnings.indexOf(wanted3), wanted3)
t.end()
})
tap.test('warn if bundleDependencies array contains anything else but strings', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
bundleDependencies: ['abc', 123, { foo: 'bar' }],
}, warn)
var pkg = {
dependencies: {
def: '^1.0.0',
},
bundleDependencies: ['abc', 'def', 123, { foo: 'bar' }],
}
normalize(pkg, warn)
var wanted1 = safeFormat(warningMessages.nonStringBundleDependency, 123)
var wanted2 = safeFormat(warningMessages.nonStringBundleDependency, { foo: 'bar' })
var wanted3 = safeFormat(warningMessages.nonDependencyBundleDependency, 'abc')
t.ok(~warnings.indexOf(wanted1), wanted1)
t.ok(~warnings.indexOf(wanted2), wanted2)
t.ok(~warnings.indexOf(wanted3), wanted3)
t.equal(pkg.dependencies.abc, '*', 'added bundled dep to dependencies with *')
t.equal(pkg.dependencies.def, '^1.0.0', 'left def dependency alone')
t.end()
})
normalize-package-data-8.0.0/test/fixtures/ 0000775 0000000 0000000 00000000000 15040460430 0020643 5 ustar 00root root 0000000 0000000 normalize-package-data-8.0.0/test/fixtures/async.json 0000664 0000000 0000000 00000001550 15040460430 0022654 0 ustar 00root root 0000000 0000000 {
"name": "async",
"description": "Higher-order functions and common patterns for asynchronous code",
"main": "./lib/async",
"author": "Caolan McMahon",
"version": "0.2.6",
"repository" : {
"type" : "git",
"url" : "http://github.com/caolan/async.git"
},
"bugs" : {
"url" : "http://github.com/caolan/async/issues"
},
"licenses" : [
{
"type" : "MIT",
"url" : "http://github.com/caolan/async/raw/master/LICENSE"
}
],
"devDependencies": {
"nodeunit": ">0.0.0",
"uglify-js": "1.2.x",
"nodelint": ">0.0.0"
},
"jam": {
"main": "lib/async.js",
"include": [
"lib/async.js",
"README.md",
"LICENSE"
]
},
"scripts": {
"test": "nodeunit test/test-async.js"
}
}
normalize-package-data-8.0.0/test/fixtures/badscripts.json 0000664 0000000 0000000 00000000116 15040460430 0023672 0 ustar 00root root 0000000 0000000 {
"name": "bad-scripts-package",
"version": "0.0.1",
"scripts": "foo"
}
normalize-package-data-8.0.0/test/fixtures/bcrypt.json 0000664 0000000 0000000 00000003436 15040460430 0023047 0 ustar 00root root 0000000 0000000 {
"name": "bcrypt",
"description": "A bcrypt library for NodeJS.",
"keywords": [
"bcrypt",
"password",
"auth",
"authentication",
"encryption",
"crypt",
"crypto"
],
"main": "./bcrypt",
"version": "0.7.5",
"author": "Nick Campbell (http://github.com/ncb000gt)",
"engines": {
"node": ">= 0.6.0"
},
"repository": {
"type": "git",
"url": "http://github.com/ncb000gt/node.bcrypt.js.git"
},
"licenses": [
{
"type": "MIT"
}
],
"bugs": {
"url": "http://github.com/ncb000gt/node.bcrypt.js/issues"
},
"scripts": {
"test": "node-gyp configure build && nodeunit test"
},
"dependencies": {
"bindings": "1.0.0"
},
"devDependencies": {
"nodeunit": ">=0.6.4"
},
"contributors": [
"Antonio Salazar Cardozo (https://github.com/Shadowfiend)",
"Van Nguyen (https://github.com/thegoleffect)",
"David Trejo (https://github.com/dtrejo)",
"Ben Glow (https://github.com/pixelglow)",
"NewITFarmer.com <> (https://github.com/newitfarmer)",
"Alfred Westerveld (https://github.com/alfredwesterveld)",
"Vincent Côté-Roy (https://github.com/vincentcr)",
"Lloyd Hilaiel (https://github.com/lloyd)",
"Roman Shtylman (https://github.com/shtylman)",
"Vadim Graboys (https://github.com/vadimg)",
"Ben Noorduis <> (https://github.com/bnoordhuis)",
"Nate Rajlich (https://github.com/tootallnate)",
"Sean McArthur (https://github.com/seanmonstar)",
"Fanie Oosthuysen (https://github.com/weareu)"
]
}
normalize-package-data-8.0.0/test/fixtures/coffee-script.json 0000664 0000000 0000000 00000001673 15040460430 0024276 0 ustar 00root root 0000000 0000000 {
"name": "coffee-script",
"description": "Unfancy JavaScript",
"keywords": ["javascript", "language", "coffeescript", "compiler"],
"author": "Jeremy Ashkenas",
"version": "1.6.2",
"licenses": [{
"type": "MIT",
"url": "https://raw.github.com/jashkenas/coffee-script/master/LICENSE"
}],
"engines": {
"node": ">=0.8.0"
},
"directories" : {
"lib" : "./lib/coffee-script"
},
"main" : "./lib/coffee-script/coffee-script",
"bin": {
"coffee": "./bin/coffee",
"cake": "./bin/cake"
},
"scripts": {
"test": "node ./bin/cake test"
},
"homepage": "http://coffeescript.org",
"bugs": "https://github.com/jashkenas/coffee-script/issues",
"repository": {
"type": "git",
"url": "git://github.com/jashkenas/coffee-script.git"
},
"devDependencies": {
"uglify-js": "~2.2",
"jison": ">=0.2.0"
}
}
normalize-package-data-8.0.0/test/fixtures/http-server.json 0000664 0000000 0000000 00000002303 15040460430 0024017 0 ustar 00root root 0000000 0000000 {
"name": "http-server",
"preferGlobal": true,
"version": "0.3.0",
"author": "Nodejitsu ",
"description": "a simple zero-configuration command-line http server",
"contributors": [
{
"name": "Marak Squires",
"email": "marak@nodejitsu.com"
}
],
"bin": {
"http-server": "./bin/http-server"
},
"scripts": {
"start": "node ./bin/http-server",
"test": "vows --spec --isolate",
"predeploy": "echo This will be run before deploying the app",
"postdeploy": "echo This will be run after deploying the app"
},
"main": "./lib/http-server",
"repository": {
"type": "git",
"url": "https://github.com/nodejitsu/http-server.git"
},
"keywords": [
"cli",
"http",
"server"
],
"dependencies" : {
"colors" : "*",
"flatiron" : "0.1.x",
"optimist" : "0.2.x",
"union" : "0.1.x",
"ecstatic" : "0.1.x",
"plates" : "https://github.com/flatiron/plates/tarball/master"
},
"analyze": false,
"devDependencies": {
"vows" : "0.5.x",
"request" : "2.1.x"
},
"bundledDependencies": [
"union",
"ecstatic"
],
"license": "MIT",
"engines": {
"node": ">=0.6"
}
}
normalize-package-data-8.0.0/test/fixtures/movefile.json 0000664 0000000 0000000 00000001071 15040460430 0023343 0 ustar 00root root 0000000 0000000 {
"name": "movefile",
"description": "rename implementation working over devices",
"version": "0.2.0",
"author": "yazgazan ",
"main": "./build/Release/movefile",
"keywords": ["move", "file", "rename"],
"repository": "git://github.com/yazgazan/movefile.git",
"directories": {
"lib": "./build/Release/"
},
"scripts": {
"install": "./node_modules/node-gyp/bin/node-gyp.js configure && ./node_modules/node-gyp/bin/node-gyp.js build"
},
"engines": {
"node": "*"
},
"dependencies": {
"node-gyp": "~0.9.1"
}
}
normalize-package-data-8.0.0/test/fixtures/no-description.json 0000664 0000000 0000000 00000000066 15040460430 0024475 0 ustar 00root root 0000000 0000000 {
"name": "foo-bar-package",
"version": "0.0.1"
}
normalize-package-data-8.0.0/test/fixtures/node-module_exist.json 0000664 0000000 0000000 00000001117 15040460430 0025162 0 ustar 00root root 0000000 0000000 {
"name": "node-module_exist",
"description": "Find if a NodeJS module is available to require or not",
"version": "0.0.1",
"main": "module_exist.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gist.github.com:3135914.git"
},
"homepage": "https://github.com/FGRibreau",
"author": {
"name": "Francois-Guillaume Ribreau",
"url": "http://fgribreau.com.com/"
},
"devDependencies": {
"nodeunit": "~0.7.4"
},
"keywords": [
"core",
"modules"
],
"license": "MIT"
}
normalize-package-data-8.0.0/test/fixtures/npm.json 0000664 0000000 0000000 00000005413 15040460430 0022333 0 ustar 00root root 0000000 0000000 {
"version": "1.2.17",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
},
"description": "A package manager for node",
"keywords": [
"package manager",
"modules",
"install",
"package.json"
],
"preferGlobal": true,
"config": {
"publishtest": false
},
"homepage": "https://npmjs.org/doc/",
"author": "Isaac Z. Schlueter (http://blog.izs.me)",
"repository": {
"type": "git",
"url": "https://github.com/isaacs/npm"
},
"bugs": {
"email": "npm-@googlegroups.com",
"url": "http://github.com/isaacs/npm/issues"
},
"directories": {
"doc": "./doc",
"man": "./man",
"lib": "./lib",
"bin": "./bin"
},
"main": "./lib/npm.js",
"bin": "./bin/npm-cli.js",
"dependencies": {
"semver": "~1.1.2",
"ini": "~1.1.0",
"slide": "1",
"abbrev": "~1.0.4",
"graceful-fs": "~1.2.0",
"minimatch": "~0.2.11",
"nopt": "~2.1.1",
"rimraf": "2",
"request": "~2.9",
"which": "1",
"tar": "~0.1.17",
"fstream": "~0.1.22",
"block-stream": "*",
"inherits": "1",
"mkdirp": "~0.3.3",
"read": "~1.0.4",
"lru-cache": "~2.3.0",
"node-gyp": "~0.9.3",
"fstream-npm": "~0.1.3",
"uid-number": "0",
"archy": "0",
"chownr": "0",
"npmlog": "0",
"ansi": "~0.1.2",
"npm-registry-client": "~0.2.18",
"read-package-json": "~0.3.0",
"read-installed": "0",
"glob": "~3.1.21",
"init-package-json": "0.0.6",
"osenv": "0",
"lockfile": "~0.3.0",
"retry": "~0.6.0",
"once": "~1.1.1",
"npmconf": "0",
"opener": "~1.3.0",
"chmodr": "~0.1.0",
"cmd-shim": "~1.1.0"
},
"bundleDependencies": [
"semver",
"ini",
"slide",
"abbrev",
"graceful-fs",
"minimatch",
"nopt",
"rimraf",
"request",
"which",
"tar",
"fstream",
"block-stream",
"inherits",
"mkdirp",
"read",
"lru-cache",
"node-gyp",
"fstream-npm",
"uid-number",
"archy",
"chownr",
"npmlog",
"ansi",
"npm-registry-client",
"read-package-json",
"read-installed",
"glob",
"init-package-json",
"osenv",
"lockfile",
"retry",
"once",
"npmconf",
"opener",
"chmodr",
"cmd-shim"
],
"devDependencies": {
"ronn": "~0.3.6",
"tap": "~0.4.0"
},
"engines": {
"node": ">=0.6",
"npm": "1"
},
"scripts": {
"test": "node ./test/run.js && tap test/tap/*.js",
"tap": "tap test/tap/*.js",
"prepublish": "node bin/npm-cli.js prune ; rm -rf test/*/*/node_modules ; make -j4 doc",
"dumpconf": "env | grep npm | sort | uniq",
"echo": "node bin/npm-cli.js"
},
"licenses": [
{
"type": "MIT +no-false-attribs",
"url": "https://github.com/isaacs/npm/raw/master/LICENSE"
}
]
}
normalize-package-data-8.0.0/test/fixtures/read-package-json.json 0000664 0000000 0000000 00000001244 15040460430 0025012 0 ustar 00root root 0000000 0000000 {
"name": "read-package-json",
"version": "0.1.1",
"author": "Isaac Z. Schlueter (http://blog.izs.me/)",
"description": "The thing npm uses to read package.json files with semantics and defaults and validation",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/read-package-json.git"
},
"license": "MIT",
"main": "read-json.js",
"scripts": {
"test": "tap test/*.js"
},
"dependencies": {
"glob": "~3.1.9",
"lru-cache": "~1.1.0",
"semver": "~1.0.14",
"slide": "~1.1.3"
},
"devDependencies": {
"tap": "~0.2.5"
},
"optionalDependencies": {
"npmlog": "0",
"graceful-fs": "~1.1.8"
}
}
normalize-package-data-8.0.0/test/fixtures/request.json 0000664 0000000 0000000 00000001466 15040460430 0023235 0 ustar 00root root 0000000 0000000 {
"name": "request",
"description": "Simplified HTTP request client.",
"tags": [
"http",
"simple",
"util",
"utility"
],
"version": "2.16.7",
"author": "Mikeal Rogers ",
"repository": {
"type": "git",
"url": "http://github.com/mikeal/request.git"
},
"bugs": {
"url": "http://github.com/mikeal/request/issues"
},
"engines": [
"node >= 0.8.0"
],
"main": "index.js",
"dependencies": {
"form-data": "~0.0.3",
"mime": "~1.2.7",
"hawk": "~0.10.2",
"node-uuid": "~1.4.0",
"cookie-jar": "~0.2.0",
"aws-sign": "~0.2.0",
"oauth-sign": "~0.2.0",
"forever-agent": "~0.2.0",
"tunnel-agent": "~0.2.0",
"json-stringify-safe": "~3.0.0",
"qs": "~0.5.4"
},
"scripts": {
"test": "node tests/run.js"
}
}
normalize-package-data-8.0.0/test/fixtures/underscore.json 0000664 0000000 0000000 00000001176 15040460430 0023714 0 ustar 00root root 0000000 0000000 {
"name" : "underscore",
"description" : "JavaScript's functional programming helper library.",
"homepage" : "http://underscorejs.org",
"keywords" : ["util", "functional", "server", "client", "browser"],
"author" : "Jeremy Ashkenas ",
"repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"},
"main" : "underscore.js",
"version" : "1.4.4",
"devDependencies": {
"phantomjs": "1.9.0-1"
},
"scripts": {
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true"
},
"license" : "MIT"
}
normalize-package-data-8.0.0/test/github-urls.js 0000664 0000000 0000000 00000002262 15040460430 0021577 0 ustar 00root root 0000000 0000000 const t = require('tap')
const normalize = require('../lib/normalize')
const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const readFile = promisify(fs.readFile)
t.test('consistent normalization', async t => {
const entries = [
'read-package-json.json',
'http-server.json',
'movefile.json',
'node-module_exist.json',
]
const verifyConsistency = async (entryName) => {
const warn = () => null
const filename = path.join(__dirname, 'fixtures', entryName)
const contents = await readFile(filename)
const data = JSON.parse(contents.toString())
normalize(data, warn)
if (data.name === 'node-module_exist') {
t.same(data.bugs.url, 'https://gist.github.com/3135914')
}
if (data.name === 'read-package-json') {
t.same(data.bugs.url, 'https://github.com/isaacs/read-package-json/issues')
}
if (data.name === 'http-server') {
t.same(data.bugs.url, 'https://github.com/nodejitsu/http-server/issues')
}
if (data.name === 'movefile') {
t.same(data.bugs.url, 'https://github.com/yazgazan/movefile/issues')
}
}
return Promise.all(entries.map(i => verifyConsistency(i)))
})
normalize-package-data-8.0.0/test/mixedcase-names.js 0000664 0000000 0000000 00000001420 15040460430 0022370 0 ustar 00root root 0000000 0000000 var test = require('tap').test
var normalize = require('../')
var fixer = normalize.fixer
test('mixedcase', function (t) {
t.doesNotThrow(function () {
fixer.fixNameField({ name: 'foo' }, true)
})
t.doesNotThrow(function () {
fixer.fixNameField({ name: 'foo' }, false)
})
t.doesNotThrow(function () {
fixer.fixNameField({ name: 'foo' })
})
t.throws(function () {
fixer.fixNameField({ name: 'Foo' }, true)
}, new Error('Invalid name: "Foo"'), 'should throw an error')
t.throws(function () {
fixer.fixNameField({ name: 'Foo' }, { strict: true })
}, new Error('Invalid name: "Foo"'), 'should throw an error')
t.doesNotThrow(function () {
fixer.fixNameField({ name: 'Foo' }, { strict: true, allowLegacyCase: true })
})
t.end()
})
normalize-package-data-8.0.0/test/normalize.js 0000664 0000000 0000000 00000016727 15040460430 0021345 0 ustar 00root root 0000000 0000000 var tap = require('tap')
var fs = require('fs')
var path = require('path')
var normalize = require('../lib/normalize')
var warningMessages = require('../lib/warning_messages.json')
var safeFormat = require('../lib/safe_format')
var rpjPath = path.resolve(__dirname, './fixtures/read-package-json.json')
tap.test('normalize some package data', function (t) {
var packageData = require(rpjPath)
var warnings = []
normalize(packageData, function (warning) {
warnings.push(warning)
})
// there's no readme data in this particular object
t.equal(warnings.length, 1, "There's exactly one warning.")
fs.readFile(rpjPath, function (err, data) {
if (err) {
throw err
}
// Various changes have been made
t.not(packageData, JSON.parse(data), 'Output is different from input.')
t.end()
})
})
tap.test('runs without passing warning function', function (t) {
fs.readFile(rpjPath, function (err, data) {
if (err) {
throw err
}
normalize(JSON.parse(data))
t.ok(true, "If you read this, this means I'm still alive.")
t.end()
})
})
tap.test('empty object', function (t) {
var packageData = {}
var expect =
{ name: '',
version: '',
readme: 'ERROR: No README data found!',
_id: '@' }
var warnings = []
function warn (m) {
warnings.push(m)
}
normalize(packageData, warn)
t.same(packageData, expect)
t.same(warnings, [
warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.missingLicense,
])
t.end()
})
tap.test('core module name', function (t) {
var warnings = []
function warn (m) {
warnings.push(m)
}
var coreModules = ['http', '_stream_writable']
var expect = []
for (var i = 0; i < coreModules.length; ++i) {
normalize({
name: coreModules[i],
readme: 'read yourself how about',
homepage: 123,
bugs: "what is this i don't even",
repository: 'Hello.',
}, warn)
expect = expect.concat([
safeFormat(warningMessages.conflictingName, coreModules[i]),
warningMessages.nonEmailUrlBugsString,
warningMessages.emptyNormalizedBugs,
warningMessages.nonUrlHomepage,
warningMessages.missingLicense,
])
}
t.same(warnings, expect)
t.end()
})
tap.test('urls required', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
bugs: {
url: '/1',
email: 'not an email address',
},
}, warn)
normalize({
readme: 'read yourself how about',
homepage: 123,
bugs: "what is this i don't even",
repository: 'Hello.',
}, warn)
var expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.nonUrlBugsUrlField,
warningMessages.nonEmailBugsEmailField,
warningMessages.emptyNormalizedBugs,
warningMessages.missingReadme,
warningMessages.missingLicense,
warningMessages.nonEmailUrlBugsString,
warningMessages.emptyNormalizedBugs,
warningMessages.nonUrlHomepage,
warningMessages.missingLicense]
t.same(warnings, expect)
t.end()
})
tap.test('homepage field must start with a protocol.', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
var a
normalize(a = {
homepage: 'example.org',
}, warn)
var expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.missingLicense]
t.same(warnings, expect)
t.same(a.homepage, 'http://example.org')
t.end()
})
tap.test('license field should be a valid SPDX expression', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
license: 'Apache 2',
}, warn)
var expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.invalidLicense]
t.same(warnings, expect)
t.end()
})
tap.test("don't fail when license is just a space", function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
license: ' ',
}, warn)
var expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.invalidLicense]
t.same(warnings, expect)
t.end()
})
tap.test("don't fail when license is licence", function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
description: 'description',
readme: 'readme',
repository: 'https://npmjs.org',
licence: 'MIT',
}, warn)
t.same(warnings, [])
t.end()
})
tap.test('gist bugs url', function (t) {
var d = {
repository: 'git@gist.github.com:1234567.git',
}
normalize(d)
t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/1234567.git' })
t.same(d.bugs, { url: 'https://gist.github.com/1234567' })
t.end()
})
tap.test('singularize repositories', function (t) {
var d = { repositories: ['git@gist.github.com:1234567.git'] }
normalize(d)
t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/1234567.git' })
t.end()
})
tap.test('treat visionmedia/express as github repo', function (t) {
var d = { repository: { type: 'git', url: 'visionmedia/express' } }
normalize(d)
t.same(d.repository, { type: 'git', url: 'git+https://github.com/visionmedia/express.git' })
t.end()
})
tap.test('treat isaacs/node-graceful-fs as github repo', function (t) {
var d = { repository: { type: 'git', url: 'isaacs/node-graceful-fs' } }
normalize(d)
t.same(d.repository, { type: 'git', url: 'git+https://github.com/isaacs/node-graceful-fs.git' })
t.end()
})
tap.test('homepage field will set to github url if repository is a github repo', function (t) {
var a
normalize(a = {
repository: { type: 'git', url: 'https://github.com/isaacs/node-graceful-fs' },
})
t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs#readme')
t.end()
})
tap.test('homepage field will set to github gist url if repository is a gist', function (t) {
var a
normalize(a = {
repository: { type: 'git', url: 'git@gist.github.com:1234567.git' },
})
t.same(a.homepage, 'https://gist.github.com/1234567')
t.end()
})
/* eslint-disable-next-line max-len */
tap.test('homepage field will set to github gist url if repository is a shorthand reference', function (t) {
var a
normalize(a = {
repository: { type: 'git', url: 'sindresorhus/chalk' },
})
t.same(a.homepage, 'https://github.com/sindresorhus/chalk#readme')
t.end()
})
tap.test("don't mangle github shortcuts in dependencies", function (t) {
var d = { dependencies: { 'node-graceful-fs': 'isaacs/node-graceful-fs' } }
normalize(d)
t.same(d.dependencies, { 'node-graceful-fs': 'github:isaacs/node-graceful-fs' })
t.end()
})
tap.test('deprecation warning for array in dependencies fields', function (t) {
var warnings = []
function warn (w) {
warnings.push(w)
}
normalize({
dependencies: [],
devDependencies: [],
optionalDependencies: [],
}, warn)
t.ok(
~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'dependencies')),
'deprecation warning'
)
t.ok(
~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'devDependencies')),
'deprecation warning'
)
t.ok(
~warnings.indexOf(
safeFormat(warningMessages.deprecatedArrayDependencies, 'optionalDependencies')
),
'deprecation warning'
)
t.end()
})
normalize-package-data-8.0.0/test/scoped.js 0000664 0000000 0000000 00000002633 15040460430 0020611 0 ustar 00root root 0000000 0000000 var test = require('tap').test
var fixNameField = require('../lib/fixer.js').fixNameField
var fixBinField = require('../lib/fixer.js').fixBinField
test('a simple scoped module has a valid name', function (t) {
var data = { name: '@org/package' }
fixNameField(data, false)
t.equal(data.name, '@org/package', 'name was unchanged')
t.end()
})
test("'org@package' is not a valid name", function (t) {
t.throws(function () {
fixNameField({ name: 'org@package' }, false)
}, 'blows up as expected')
t.end()
})
test("'org=package' is not a valid name", function (t) {
t.throws(function () {
fixNameField({ name: 'org=package' }, false)
}, 'blows up as expected')
t.end()
})
test("'@org=sub/package' is not a valid name", function (t) {
t.throws(function () {
fixNameField({ name: '@org=sub/package' }, false)
}, 'blows up as expected')
t.end()
})
test("'@org/' is not a valid name", function (t) {
t.throws(function () {
fixNameField({ name: '@org/' }, false)
}, 'blows up as expected')
t.end()
})
test("'@/package' is not a valid name", function (t) {
t.throws(function () {
fixNameField({ name: '@/package' }, false)
}, 'blows up as expected')
t.end()
})
test("name='@org/package', bin='bin.js' is bin={package:'bin.js'}", function (t) {
var obj = { name: '@org/package', bin: 'bin.js' }
fixBinField(obj)
t.strictSame(obj.bin, { package: 'bin.js' })
t.end()
})
normalize-package-data-8.0.0/test/scripts.js 0000664 0000000 0000000 00000001415 15040460430 0021020 0 ustar 00root root 0000000 0000000 var tap = require('tap')
var normalize = require('../lib/normalize')
var path = require('path')
var fs = require('fs')
tap.test('bad scripts', function (t) {
var p = path.resolve(__dirname, './fixtures/badscripts.json')
fs.readFile(p, function (err, contents) {
if (err) {
throw err
}
var originalData = JSON.parse(contents.toString())
var data = JSON.parse(contents.toString())
normalize(data)
t.ok(data)
verifyFields(t, data, originalData)
t.end()
})
})
function verifyFields (t, normalized, original) {
t.equal(normalized.version, original.version, 'Version field stays same')
t.equal(normalized.name, original.name, 'Name stays the same.')
// scripts is not an object, so it should be deleted
t.notOk(normalized.scripts)
}
normalize-package-data-8.0.0/test/strict.js 0000664 0000000 0000000 00000002244 15040460430 0020642 0 ustar 00root root 0000000 0000000 var test = require('tap').test
var normalize = require('../')
test('strict', function (t) {
var threw
try {
threw = false
normalize({ name: 'X' }, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid name: "X"')
} finally {
t.equal(threw, true)
}
try {
threw = false
normalize({ name: ' x ' }, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid name: " x "')
} finally {
t.equal(threw, true)
}
try {
threw = false
normalize({ name: 'x', version: '01.02.03' }, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid version: "01.02.03"')
} finally {
t.equal(threw, true)
}
// these should not throw
var slob = { name: ' X ',
version: '01.02.03',
dependencies: {
y: '>01.02.03',
z: '! 99 $$ASFJ(Aawenf90awenf as;naw.3j3qnraw || an elephant',
} }
normalize(slob, false)
t.same(slob,
{ name: 'X',
version: '1.2.3',
dependencies:
{ y: '>01.02.03',
z: '! 99 $$ASFJ(Aawenf90awenf as;naw.3j3qnraw || an elephant' },
readme: 'ERROR: No README data found!',
_id: 'X@1.2.3' })
t.end()
})
normalize-package-data-8.0.0/test/typo.js 0000664 0000000 0000000 00000007511 15040460430 0020327 0 ustar 00root root 0000000 0000000 var test = require('tap').test
var normalize = require('../')
var warningMessages = require('../lib/warning_messages.json')
var safeFormat = require('../lib/safe_format')
test('typos', function (t) {
var warnings = []
function warn (m) {
warnings.push(m)
}
var typoMessage = safeFormat.bind(undefined, warningMessages.typo)
var expect =
[warningMessages.missingRepository,
warningMessages.missingLicense,
typoMessage('dependancies', 'dependencies'),
typoMessage('dependecies', 'dependencies'),
typoMessage('depdenencies', 'dependencies'),
typoMessage('devEependencies', 'devDependencies'),
typoMessage('depends', 'dependencies'),
typoMessage('dev-dependencies', 'devDependencies'),
typoMessage('devDependences', 'devDependencies'),
typoMessage('devDepenencies', 'devDependencies'),
typoMessage('devdependencies', 'devDependencies'),
typoMessage('repostitory', 'repository'),
typoMessage('repo', 'repository'),
typoMessage('prefereGlobal', 'preferGlobal'),
typoMessage('hompage', 'homepage'),
typoMessage('hampage', 'homepage'),
typoMessage('autohr', 'author'),
typoMessage('autor', 'author'),
typoMessage('contributers', 'contributors'),
typoMessage('publicationConfig', 'publishConfig')]
normalize({ dependancies: 'dependencies',
dependecies: 'dependencies',
depdenencies: 'dependencies',
devEependencies: 'devDependencies',
depends: 'dependencies',
'dev-dependencies': 'devDependencies',
devDependences: 'devDependencies',
devDepenencies: 'devDependencies',
devdependencies: 'devDependencies',
repostitory: 'repository',
repo: 'repository',
prefereGlobal: 'preferGlobal',
hompage: 'homepage',
hampage: 'homepage',
autohr: 'author',
autor: 'author',
contributers: 'contributors',
publicationConfig: 'publishConfig',
readme: 'asdf',
name: 'name',
version: '1.2.5' }, warn)
t.same(warnings, expect)
warnings.length = 0
expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
typoMessage("bugs['web']", "bugs['url']"),
typoMessage("bugs['name']", "bugs['url']"),
warningMessages.nonUrlBugsUrlField,
warningMessages.emptyNormalizedBugs,
warningMessages.missingReadme,
warningMessages.missingLicense]
normalize({ name: 'name',
version: '1.2.5',
bugs: { web: 'url', name: 'url' } }, warn)
t.same(warnings, expect)
warnings.length = 0
expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.missingLicense,
typoMessage('script', 'scripts')]
normalize({ name: 'name',
version: '1.2.5',
script: { server: 'start', tests: 'test' } }, warn)
t.same(warnings, expect)
warnings.length = 0
expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
typoMessage("scripts['server']", "scripts['start']"),
typoMessage("scripts['tests']", "scripts['test']"),
warningMessages.missingReadme,
warningMessages.missingLicense]
normalize({ name: 'name',
version: '1.2.5',
scripts: { server: 'start', tests: 'test' } }, warn)
t.same(warnings, expect)
warnings.length = 0
expect =
[warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.missingLicense]
normalize({ name: 'name',
version: '1.2.5',
scripts: { server: 'start',
tests: 'test',
start: 'start',
test: 'test' } }, warn)
t.same(warnings, expect)
warnings.length = 0
expect = []
normalize({ private: true,
name: 'name',
version: '1.2.5',
scripts: { server: 'start', tests: 'test' } }, warn)
t.same(warnings, expect)
t.end()
})