Skip to content

Commit 785943d

Browse files
authored
Build: Make Migrate properly recognized as a CommonJS module in Node.js
PR gh-512 added the `"type": "module"` field to the top-level `package.json`, making Node-based workflows fail when trying to require Migrate as it's not exposed as ESM. To fix this, add a small `package.json` with just `"type": "commonjs"`. Also, add Node.js smoke tests as the simplest way to verify this change. Fixes gh-523 Closes gh-525 Ref gh-512
1 parent 3f35988 commit 785943d

File tree

6 files changed

+498
-5
lines changed

6 files changed

+498
-5
lines changed

.github/workflows/node.js.yml

+26
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@ env:
99
NODE_VERSION: 20.x
1010

1111
jobs:
12+
node-smoke-test:
13+
runs-on: ubuntu-latest
14+
name: Node smoke tests
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
18+
19+
- name: Use Node.js ${{ env.NODE_VERSION }}
20+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
21+
with:
22+
node-version: ${{ env.NODE_VERSION }}
23+
24+
- name: Cache
25+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
31+
32+
- name: Install dependencies
33+
run: npm install
34+
35+
- name: Run Node smoke tests
36+
run: npm run test:node_smoke_tests
37+
1238
test:
1339
runs-on: ubuntu-latest
1440
name: ${{ matrix.MIGRATE_VERSION }} - jQuery ${{ matrix.JQUERY_VERSION }} (Chrome/Firefox)

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ CDN
1010
.sizecache.json
1111
.eslintcache
1212

13-
/dist
13+
# Ignore built files in `dist` folder
14+
# Leave package.json
15+
/dist/*
16+
!/dist/package.json
17+
1418
/external
1519
/node_modules
1620

dist/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

0 commit comments

Comments
 (0)