1 Commits
Author SHA1 Message Date
sneak 50a332f5a0 chore: script/bootstrap fails when node cannot find a module the tests load (closes #263)
check / check (push) Successful in 8m27s
e2e / e2e-chrome (push) Successful in 9m2s
e2e / e2e-firefox (push) Successful in 4m31s
yarn install exits 0 without touching node_modules whenever
node_modules/.yarn-integrity matches yarn.lock, so a package deleted from
node_modules stayed deleted while bootstrap printed "bootstrap complete".
After the install, bootstrap now asks node to resolve jest,
playwright-core and ethers, and on the first it cannot find it names the
module and the fix: rm -rf node_modules && make bootstrap.

Model: opus-5-5
2026-10-06 22:05:26 +00:00
3 changed files with 18 additions and 29 deletions
+1 -2
View File
@@ -219,8 +219,7 @@ provide:
- `script/bootstrap` — install all dependencies (pinned node via nvm if needed,
yarn via corepack, `yarn install --frozen-lockfile`), then fail, naming the
package, if node cannot find a package listed in `dependencies` or
`devDependencies` of `package.json`
module, if node cannot find `jest`, `playwright-core` or `ethers`
- `script/setup` — make a fresh clone ready for development: bootstrap plus the
git pre-commit hook
- `script/projectname` — print the project name (used for the Docker image tag)
+3 -3
View File
@@ -46,10 +46,10 @@ but the review is broader than any of them.
# Completed Steps
- 2026-10-06: `script/bootstrap` no longer reports success while node cannot
find a package listed in `dependencies` or `devDependencies` of `package.json`
find a module the tests load
([#263](https://git.eeqj.de/sneak/AutistMask/issues/263)). After the install
it asks node for each one's `package.json`, and fails naming the missing
package and the fix. yarn skips the install whenever
it asks node for `jest`, `playwright-core` and `ethers`, and fails naming the
missing one and the fix. yarn skips the install whenever
`node_modules/.yarn-integrity` matches `yarn.lock`, so a package deleted from
`node_modules` stayed deleted while bootstrap said it was complete. The
fresh-clone failure the issue reports did not reproduce.
+14 -24
View File
@@ -127,38 +127,28 @@ install_js_deps() {
fi
}
# run_node: run node from the repo root, through nvm when node is not on PATH;
# the script comes on stdin
run_node() {
# resolvable <module>: true when node, run from the repo root, finds it
resolvable() {
if missing node && [ -s "$HOME/.nvm/nvm.sh" ]; then
nvm_sh "nvm use $NODE_VERSION >/dev/null && cd \"$ROOT\" && node"
nvm_sh "nvm use $NODE_VERSION >/dev/null && cd \"$ROOT\" && \
node -e \"require.resolve('$1')\"" 2>/dev/null
else
node
node -e "require.resolve('$1')" 2>/dev/null
fi
}
# yarn install exits 0 without touching node_modules once
# node_modules/.yarn-integrity matches yarn.lock, so a package deleted from
# node_modules stays deleted. Fail unless node finds every package listed in
# dependencies and devDependencies of package.json, by its package.json. When a
# package's exports does not list that file, node throws
# ERR_PACKAGE_PATH_NOT_EXPORTED, which it can only do once it has found the
# package, so that error counts as found.
# node_modules stays deleted. Fail unless node finds the modules the tests
# load: jest for make test, playwright-core and ethers for tests/e2e/.
check_js_deps() {
run_node <<'EOF'
const { dependencies, devDependencies } = require("./package.json");
for (const name of Object.keys({ ...dependencies, ...devDependencies })) {
try {
require.resolve(name + "/package.json");
} catch (e) {
if (e.code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") {
console.error(`bootstrap: node cannot find ${name} after yarn install`);
console.error(" fix: rm -rf node_modules && make bootstrap");
process.exit(1);
}
}
}
EOF
for module in jest playwright-core ethers; do
if ! resolvable "$module"; then
echo "bootstrap: node cannot find $module after yarn install" >&2
echo " fix: rm -rf node_modules && make bootstrap" >&2
exit 1
fi
done
}
main() {