Skip to content

Commit

Permalink
chore: postinstall for dependabot template-oss PR
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Nov 16, 2023
1 parent e147f5b commit d7887a4
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 309 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -10,6 +10,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand Down
59 changes: 22 additions & 37 deletions .github/workflows/audit.yml
Expand Up @@ -30,48 +30,33 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')

# 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
- name: Install Latest npm
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
- 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"
echo "node@$NODE_VERSION"
- 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"
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
- 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
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
Expand Down
108 changes: 47 additions & 61 deletions .github/workflows/ci-release.yml
Expand Up @@ -85,48 +85,33 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')

# 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
- name: Install Latest npm
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
- 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"
echo "node@$NODE_VERSION"
- 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"
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)"
- 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
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
run: npm -v
Expand Down Expand Up @@ -235,7 +220,9 @@ jobs:
- 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.')
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
Expand All @@ -245,34 +232,33 @@ jobs:
cd ..
rmdir /s /q package
# Start on Node 10 because we dont test on anything lower
- name: Install npm@7 on Node 10
- name: Install Latest npm
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
- 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"
echo "node@$NODE_VERSION"
- 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"
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
- 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
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
Expand Down
108 changes: 47 additions & 61 deletions .github/workflows/ci.yml
Expand Up @@ -34,48 +34,33 @@ jobs:
node-version: 20.x
check-latest: contains('20.x', '.x')

# 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
- name: Install Latest npm
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
- 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"
echo "node@$NODE_VERSION"
- 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"
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
- 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
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
Expand Down Expand Up @@ -132,7 +117,9 @@ jobs:
- 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.')
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
Expand All @@ -142,34 +129,33 @@ jobs:
cd ..
rmdir /s /q package
# Start on Node 10 because we dont test on anything lower
- name: Install npm@7 on Node 10
- name: Install Latest npm
shell: bash
if: startsWith(steps.node.outputs.node-version, 'v10.')
id: npm-7
env:
NODE_VERSION: ${{ steps.node.outputs.node-version }}
run: |
npm i --prefer-online --no-fund --no-audit -g npm@7
echo "updated=true" >> "$GITHUB_OUTPUT"
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
- 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"
echo "node@$NODE_VERSION"
- 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"
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
- 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
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
- name: npm Version
run: npm -v
Expand Down

0 comments on commit d7887a4

Please sign in to comment.