Skip to content

Commit 883ef1b

Browse files
authored
Add Node v22 support
2 parents 4ab4b26 + 437d4d9 commit 883ef1b

File tree

6 files changed

+812
-727
lines changed

6 files changed

+812
-727
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,43 @@ on:
77
pull_request: {}
88

99
jobs:
10-
test:
10+
test-and-release:
1111
runs-on: ubuntu-latest
12-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
12+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
1313

1414
strategy:
1515
matrix:
16-
node-version: [18.x, 20.x]
16+
node-version: [20.x, 22.x, 24.x]
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.node-version }}
20+
cancel-in-progress: true
1721

1822
steps:
19-
- name: 🛑 Cancel Previous Runs
20-
uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # [email protected]
21-
- name: ⬇️ Checkout repo
22-
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2
23-
- name: ⎔ Setup node ${{ matrix.node-version }}
24-
uses: actions/setup-node@25316bbc1f10ac9d8798711f44914b1cf3c4e954 # pin@v2
23+
- name: 📥 Checkout repository
24+
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # pin@main
25+
26+
- name: 🟢 Setup Node.js
27+
uses: actions/setup-node@802632921f8532d2409ae6eac3313b6f81f11122 # pin@main
2528
with:
2629
node-version: ${{ matrix.node-version }}
2730
cache: "npm"
31+
2832
- name: 🗄 Cache node_modules
2933
id: cache-node_modules
30-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
34+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # pin@main
3135
with:
3236
path: "**/node_modules"
3337
key: node_modules-${{ runner.os }}-node-${{ matrix.node-version }}-${{
3438
hashFiles('**/package-lock.json') }}
35-
- name: 📥 Install dependencies
39+
40+
- name: 🔍 Install dependencies
3641
if: steps.cache-node_modules.outputs.cache-hit != 'true'
3742
run: |
38-
npm ci --ignore-scripts
39-
- name: 🧪 Test
43+
npm ci --ignore-scripts --prefer-offline --no-audit
44+
45+
- name: 🧪 Run tests
4046
run: |
4147
npm test
4248
env:
4349
CI: true
44-
- name: ⬆️ Upload coverage report
45-
uses: coverallsapp/github-action@9ba913c152ae4be1327bfb9085dc806cedb44057 # [email protected]
46-
with:
47-
github-token: ${{ secrets.GITHUB_TOKEN }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.3.1
1+
v22.16.0

lib/getImportGlobalsSrc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
* override globals without changing the global object itself.
44
*
55
* Returns something like
6-
* "var console = global.console; var process = global.process; ..."
6+
* "var console = globalThis.console; var process = globalThis.process; ..."
77
*
88
* @return {String}
99
*/
1010
function getImportGlobalsSrc(ignore) {
1111
var key,
1212
src = "",
13-
globalObj = typeof global === "undefined"? window: global;
13+
globalObj = typeof globalThis === "undefined"? window : globalThis;
1414

1515
ignore = ignore || [];
1616
ignore.push(
17-
// global itself can't be overridden because it's the only reference to our real global objects
18-
"global",
17+
// globalThis itself can't be overridden because it's the only reference to our real global objects
18+
"globalThis",
1919
// ignore 'module', 'exports' and 'require' on the global scope, because otherwise our code would
2020
// shadow the module-internal variables
2121
// @see https://github.com/jhnns/rewire-webpack/pull/6
@@ -40,7 +40,7 @@ function getImportGlobalsSrc(ignore) {
4040
// key may be an invalid variable name (e.g. 'a-b')
4141
try {
4242
eval("var " + key + ";");
43-
src += "var " + key + " = global." + key + "; ";
43+
src += "var " + key + " = globalThis." + key + "; ";
4444
} catch(e) {}
4545
}
4646

0 commit comments

Comments
 (0)