Skip to content

Commit a770ef8

Browse files
committed
Assistant checkpoint: Fix CI workflow npm install and external deps
Assistant generated file changes: - .github/workflows/ci.yml: Fix npm install by using --ignore-scripts flag Fix npm install by using --ignore-scripts flag Fix npm install in publish job - rollup.config.js: Simplify CLI externals to only include actual dependencies --- User prompt: here is the analysis of the error now fix it: Replit-Commit-Author: Assistant Replit-Commit-Session-Id: e5c8aa2d-05f7-401c-b338-9e102c33d9ab
1 parent f6c5578 commit a770ef8

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Build and Publish to NPM
32

43
on:
@@ -20,20 +19,20 @@ jobs:
2019
runs-on: ubuntu-latest
2120
steps:
2221
- uses: actions/checkout@v4
23-
22+
2423
- name: Setup Node.js
2524
uses: actions/setup-node@v4
2625
with:
2726
node-version: '18'
2827
registry-url: 'https://registry.npmjs.org'
2928
cache: 'npm'
30-
29+
3130
- name: Install dependencies
32-
run: npm install
33-
31+
run: npm ci --ignore-scripts
32+
3433
- name: Build package
3534
run: npm run build
36-
35+
3736
- name: Verify build artifacts
3837
run: |
3938
echo "Checking build artifacts..."
@@ -47,7 +46,7 @@ jobs:
4746
exit 1
4847
fi
4948
echo "✅ Build artifacts present"
50-
49+
5150
- name: Upload build artifacts
5251
uses: actions/upload-artifact@v4
5352
with:
@@ -66,24 +65,24 @@ jobs:
6665
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
6766
steps:
6867
- uses: actions/checkout@v4
69-
68+
7069
- name: Setup Node.js
7170
uses: actions/setup-node@v4
7271
with:
7372
node-version: '18'
7473
registry-url: 'https://registry.npmjs.org'
75-
74+
7675
- name: Install dependencies
77-
run: npm install
78-
76+
run: npm ci --ignore-scripts
77+
7978
- name: Build package
8079
run: npm run build
8180

8281
- name: Update version (if manual trigger)
8382
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
8483
run: |
8584
npm version ${{ github.event.inputs.version }} --no-git-tag-version
86-
85+
8786
- name: Publish to NPM
8887
run: npm publish --access public
8988
env:
@@ -112,7 +111,7 @@ jobs:
112111
cache: 'npm'
113112

114113
- name: Install dependencies
115-
run: npm install
114+
run: npm ci --ignore-scripts
116115

117116
- name: Build package
118117
run: npm run build
@@ -163,4 +162,4 @@ jobs:
163162
path: '_site'
164163

165164
- name: Deploy to GitHub Pages
166-
uses: actions/deploy-pages@v4
165+
uses: actions/deploy-pages@v4

rollup.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ export default [
4646
format: 'cjs',
4747
banner: '#!/usr/bin/env node'
4848
},
49-
external: ['commander', 'jsdom', 'fs', 'path', 'd3', '@tensorflow/tfjs', 'util', 'os', 'crypto', 'stream', 'events', 'url', 'https', 'http', 'zlib'],
49+
external: (id) => {
50+
// Mark Node.js built-ins as external
51+
if (id.startsWith('node:') || ['fs', 'path', 'util', 'os', 'crypto', 'stream', 'events', 'url', 'https', 'http', 'zlib'].includes(id)) {
52+
return true;
53+
}
54+
// Mark npm packages as external
55+
return ['commander', 'jsdom', 'd3', '@tensorflow/tfjs'].includes(id);
56+
},
5057
plugins: [
5158
nodeResolve({
5259
preferBuiltins: true,

0 commit comments

Comments
 (0)