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

TypeScript, ESM, tap18 support #371

Merged
merged 4 commits into from
Nov 15, 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
59 changes: 22 additions & 37 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -232,7 +217,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 @@ -242,34 +229,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-test-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,48 +38,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 @@ -133,7 +118,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 @@ -143,34 +130,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
Loading