Skip to content

Commit

Permalink
chore(deps): @npmcli/template-oss@4.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed May 4, 2024
1 parent f8cc313 commit e55cde8
Show file tree
Hide file tree
Showing 14 changed files with 361 additions and 411 deletions.
3 changes: 2 additions & 1 deletion .commitlintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
'header-max-length': [2, 'always', 80],
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
'subject-case': [0],
'body-max-line-length': [0],
},
}
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@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 }}"}
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
7 changes: 5 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ branches:
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
Expand All @@ -24,10 +25,11 @@ branches:
apps: []
users: []
teams: [ "cli-team" ]
- name: latest
- name: release/v5
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
Expand All @@ -37,10 +39,11 @@ branches:
apps: []
users: []
teams: [ "cli-team" ]
- name: release/v*
- name: release/v6
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
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@ jobs:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
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@v3
uses: actions/setup-node@v4
id: node
with:
node-version: 18.x
- name: Remove Template-OSS
if: matrix && matrix.node-version == '6.17.1'
run: |
# template-oss cannot be installed on older npms because there are transient deps
# that use "npm:" aliases which are not supported
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
mv package.json-update package.json
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
- name: Run Production Audit
Expand Down
140 changes: 30 additions & 110 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,68 +27,28 @@ jobs:
run:
shell: bash
steps:
- name: Get Workflow Job
uses: actions/github-script@v6
if: inputs.check-sha
id: check-output
env:
JOB_NAME: "Lint All"
MATRIX_NAME: ""
with:
script: |
const { owner, repo } = context.repo
const { data } = await github.rest.actions.listJobsForWorkflowRun({
owner,
repo,
run_id: context.runId,
per_page: 100
})
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
const job = data.jobs.find(j => j.name.endsWith(jobName))
const jobUrl = job?.html_url
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
let summary = `This check is assosciated with ${shaUrl}\n\n`
if (jobUrl) {
summary += `For run logs, click here: ${jobUrl}`
} else {
summary += `Run logs could not be found for a job with name: "${jobName}"`
}
return { summary }
- name: Create Check
uses: LouisBrunner/checks-action@v1.6.0
id: check
if: inputs.check-sha
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: in_progress
name: Lint All
sha: ${{ inputs.check-sha }}
output: ${{ steps.check-output.outputs.result }}
- name: Checkout
uses: actions/checkout@v3
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@v3
uses: actions/setup-node@v4
id: node
with:
node-version: 18.x
- name: Remove Template-OSS
if: matrix && matrix.node-version == '6.17.1'
run: |
# template-oss cannot be installed on older npms because there are transient deps
# that use "npm:" aliases which are not supported
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
mv package.json-update package.json
node-version: 22.x
check-latest: contains('22.x', '.x')
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Lint
Expand All @@ -97,11 +57,11 @@ jobs:
run: npm run postlint --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
if: steps.check.outputs.check_id && always()
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ steps.check.outputs.check_id }}
check_id: ${{ steps.create-check.outputs.check-id }}

test-all:
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand All @@ -115,74 +75,34 @@ jobs:
shell: bash
node-version:
- 6.17.1
- 18.x
- 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
steps:
- name: Get Workflow Job
uses: actions/github-script@v6
if: inputs.check-sha
id: check-output
env:
JOB_NAME: "Test All"
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
with:
script: |
const { owner, repo } = context.repo
const { data } = await github.rest.actions.listJobsForWorkflowRun({
owner,
repo,
run_id: context.runId,
per_page: 100
})
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
const job = data.jobs.find(j => j.name.endsWith(jobName))
const jobUrl = job?.html_url
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
let summary = `This check is assosciated with ${shaUrl}\n\n`
if (jobUrl) {
summary += `For run logs, click here: ${jobUrl}`
} else {
summary += `Run logs could not be found for a job with name: "${jobName}"`
}
return { summary }
- name: Create Check
uses: LouisBrunner/checks-action@v1.6.0
id: check
if: inputs.check-sha
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: in_progress
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
sha: ${{ inputs.check-sha }}
output: ${{ steps.check-output.outputs.result }}
- name: Checkout
uses: actions/checkout@v3
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@v3
uses: actions/setup-node@v4
id: node
with:
node-version: ${{ matrix.node-version }}
- name: Remove Template-OSS
if: matrix && matrix.node-version == '6.17.1'
run: |
# template-oss cannot be installed on older npms because there are transient deps
# that use "npm:" aliases which are not supported
jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
mv package.json-update package.json
check-latest: contains(matrix.node-version, '.x')
- name: Install Dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Add Problem Matcher
Expand All @@ -191,8 +111,8 @@ jobs:
run: npm test --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.6.0
if: steps.check.outputs.check_id && always()
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
check_id: ${{ steps.check.outputs.check_id }}
check_id: ${{ steps.create-check.outputs.check-id }}
Loading

0 comments on commit e55cde8

Please sign in to comment.