Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: @npmcli/template-oss@4.21.2 #7051

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
'docs/**',
'smoke-tests/**',
'mock-globals/**',
Expand Down
52 changes: 52 additions & 0 deletions .github/actions/create-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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@v6
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 }}"}
58 changes: 58 additions & 0 deletions .github/actions/install-latest-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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
1 change: 0 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')
cache: npm

- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/ci-libnpmaccess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmaccess
run: npm run lint --ignore-scripts -w libnpmaccess
- name: Post Lint
run: node . run postlint --ignore-scripts -w libnpmaccess
run: npm run postlint --ignore-scripts -w libnpmaccess

test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand Down Expand Up @@ -89,14 +92,17 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmaccess
run: npm test --ignore-scripts -w libnpmaccess
- name: Check Git Status
run: node scripts/git-dirty.js
16 changes: 11 additions & 5 deletions .github/workflows/ci-libnpmdiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmdiff
run: npm run lint --ignore-scripts -w libnpmdiff
- name: Post Lint
run: node . run postlint --ignore-scripts -w libnpmdiff
run: npm run postlint --ignore-scripts -w libnpmdiff

test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand Down Expand Up @@ -89,14 +92,17 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmdiff
run: npm test --ignore-scripts -w libnpmdiff
- name: Check Git Status
run: node scripts/git-dirty.js
16 changes: 11 additions & 5 deletions .github/workflows/ci-libnpmexec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmexec
run: npm run lint --ignore-scripts -w libnpmexec
- name: Post Lint
run: node . run postlint --ignore-scripts -w libnpmexec
run: npm run postlint --ignore-scripts -w libnpmexec

test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand Down Expand Up @@ -89,14 +92,17 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
cache: npm

- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmexec
run: npm test --ignore-scripts -w libnpmexec
- name: Check Git Status
run: node scripts/git-dirty.js
100 changes: 8 additions & 92 deletions .github/workflows/ci-libnpmfund.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,10 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')
cache: npm

# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- name: Update Windows npm
if: |
matrix.platform.os == 'windows-latest' && (
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
)
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

# Start on Node 10 because we dont test on anything lower
- name: Install npm@7 on Node 10
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@8 on Node 12
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v12.')
id: npm-8
run: |
npm i --prefer-online --no-fund --no-audit -g npm@8
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@9 on Node 14/16/18.0
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
id: npm-9
run: |
npm i --prefer-online --no-fund --no-audit -g npm@9
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@latest on Node
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest

- name: npm Version
run: npm -v
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
Expand Down Expand Up @@ -134,52 +92,10 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: contains(matrix.node-version, '.x')
cache: npm

# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
- name: Update Windows npm
if: |
matrix.platform.os == 'windows-latest' && (
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
)
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

# Start on Node 10 because we dont test on anything lower
- name: Install npm@7 on Node 10
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@8 on Node 12
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v12.')
id: npm-8
run: |
npm i --prefer-online --no-fund --no-audit -g npm@8
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@9 on Node 14/16/18.0
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
id: npm-9
run: |
npm i --prefer-online --no-fund --no-audit -g npm@9
echo "updated=true" >> "$GITHUB_OUTPUT"

- name: Install npm@latest on Node
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest

- name: npm Version
run: npm -v
- name: Install Latest npm
uses: ./.github/actions/install-latest-npm
with:
node: ${{ steps.node.outputs.node-version }}
- name: Check Git Status
run: node scripts/git-dirty.js
- name: Reset Deps
Expand Down
Loading