Skip to content

Commit 661dbe5

Browse files
committed
build: copy uFuzzy from node_modules at build instead of vendoring it
The python env select popup inlines uFuzzy as a <script> in its HTML string, so it needs the IIFE build as a file in the packaged app. That file was committed under src/assets and refreshed by hand through an update-ufuzzy script, which drifts: #988 bumped @leeoniya/ufuzzy to 1.0.19 but the vendored copy stayed on the old build. Copy it from node_modules at build time instead, like toolkit.min.js right above it in copyassets. The pinned dependency is the single source of truth, the vendored blob and the update-ufuzzy script both go away, and the drift cannot recur. shx was only used by that script, so it drops out of devDependencies here too. Note: AI-assisted (Claude Code). Manually verified by building: build/app-assets/uFuzzy.iife.min.js comes out byte-identical to the 1.0.19 dist, shx is gone from the lockfile with no remaining references, prettier clean, and the e2e suite passes so the popup loads it at runtime.
1 parent 661c576 commit 661dbe5

4 files changed

Lines changed: 18 additions & 177 deletions

File tree

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
"lint": "yarn && yarn prettier && yarn eslint",
5454
"lint:check": "yarn prettier:check && yarn eslint:check",
5555
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.mjs,.cjs,.css,.json,.md}\"",
56-
"prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.mjs,.cjs,.css,.json,.md}\"",
57-
"update-ufuzzy": "shx cp node_modules/@leeoniya/ufuzzy/dist/uFuzzy.iife.min.js src/assets/"
56+
"prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.mjs,.cjs,.css,.json,.md}\""
5857
},
5958
"build": {
6059
"appId": "org.jupyter.jupyterlab-desktop",
@@ -208,7 +207,6 @@
208207
"prettier": "~2.1.1",
209208
"read-package-tree": "^5.1.6",
210209
"rimraf": "^4.4.1",
211-
"shx": "^0.4.0",
212210
"typescript": "^6.0.0",
213211
"typescript-eslint": "^8.61.1",
214212
"vitest": "^4.1.9",

scripts/copyassets.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ function copyAssests() {
6767
path.join(dest, '../jupyter-ui-toolkit/toolkit.js')
6868
);
6969

70+
// Copy uFuzzy from node_modules at build time, like the toolkit above, so the
71+
// pinned dependency is the single source of truth and there is no vendored
72+
// copy in src/assets to keep in sync by hand.
73+
fs.copySync(
74+
path.join(
75+
srcDir,
76+
'../node_modules',
77+
'@leeoniya/ufuzzy',
78+
'dist',
79+
'uFuzzy.iife.min.js'
80+
),
81+
path.join(dest, '../app-assets', 'uFuzzy.iife.min.js')
82+
);
83+
7084
const envInfoPath = path.join('main', 'env_info.py');
7185
fs.copySync(path.join(srcDir, envInfoPath), path.join(dest, envInfoPath));
7286

src/assets/uFuzzy.iife.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)