Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafc9e4fe3 |
@@ -219,7 +219,8 @@ provide:
|
|||||||
|
|
||||||
- `script/bootstrap` — install all dependencies (pinned node via nvm if needed,
|
- `script/bootstrap` — install all dependencies (pinned node via nvm if needed,
|
||||||
yarn via corepack, `yarn install --frozen-lockfile`), then fail, naming the
|
yarn via corepack, `yarn install --frozen-lockfile`), then fail, naming the
|
||||||
module, if node cannot find `jest`, `playwright-core` or `ethers`
|
package, if node cannot find a package listed in `dependencies` or
|
||||||
|
`devDependencies` of `package.json`
|
||||||
- `script/setup` — make a fresh clone ready for development: bootstrap plus the
|
- `script/setup` — make a fresh clone ready for development: bootstrap plus the
|
||||||
git pre-commit hook
|
git pre-commit hook
|
||||||
- `script/projectname` — print the project name (used for the Docker image tag)
|
- `script/projectname` — print the project name (used for the Docker image tag)
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ but the review is broader than any of them.
|
|||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
- 2026-10-06: `script/bootstrap` no longer reports success while node cannot
|
- 2026-10-06: `script/bootstrap` no longer reports success while node cannot
|
||||||
find a module the tests load
|
find a package listed in `dependencies` or `devDependencies` of `package.json`
|
||||||
([#263](https://git.eeqj.de/sneak/AutistMask/issues/263)). After the install
|
([#263](https://git.eeqj.de/sneak/AutistMask/issues/263)). After the install
|
||||||
it asks node for `jest`, `playwright-core` and `ethers`, and fails naming the
|
it asks node for each one's `package.json`, and fails naming the missing
|
||||||
missing one and the fix. yarn skips the install whenever
|
package and the fix. yarn skips the install whenever
|
||||||
`node_modules/.yarn-integrity` matches `yarn.lock`, so a package deleted from
|
`node_modules/.yarn-integrity` matches `yarn.lock`, so a package deleted from
|
||||||
`node_modules` stayed deleted while bootstrap said it was complete. The
|
`node_modules` stayed deleted while bootstrap said it was complete. The
|
||||||
fresh-clone failure the issue reports did not reproduce.
|
fresh-clone failure the issue reports did not reproduce.
|
||||||
|
|||||||
+24
-14
@@ -127,28 +127,38 @@ install_js_deps() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# resolvable <module>: true when node, run from the repo root, finds it
|
# run_node: run node from the repo root, through nvm when node is not on PATH;
|
||||||
resolvable() {
|
# the script comes on stdin
|
||||||
|
run_node() {
|
||||||
if missing node && [ -s "$HOME/.nvm/nvm.sh" ]; then
|
if missing node && [ -s "$HOME/.nvm/nvm.sh" ]; then
|
||||||
nvm_sh "nvm use $NODE_VERSION >/dev/null && cd \"$ROOT\" && \
|
nvm_sh "nvm use $NODE_VERSION >/dev/null && cd \"$ROOT\" && node"
|
||||||
node -e \"require.resolve('$1')\"" 2>/dev/null
|
|
||||||
else
|
else
|
||||||
node -e "require.resolve('$1')" 2>/dev/null
|
node
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# yarn install exits 0 without touching node_modules once
|
# yarn install exits 0 without touching node_modules once
|
||||||
# node_modules/.yarn-integrity matches yarn.lock, so a package deleted from
|
# node_modules/.yarn-integrity matches yarn.lock, so a package deleted from
|
||||||
# node_modules stays deleted. Fail unless node finds the modules the tests
|
# node_modules stays deleted. Fail unless node finds every package listed in
|
||||||
# load: jest for make test, playwright-core and ethers for tests/e2e/.
|
# 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.
|
||||||
check_js_deps() {
|
check_js_deps() {
|
||||||
for module in jest playwright-core ethers; do
|
run_node <<'EOF'
|
||||||
if ! resolvable "$module"; then
|
const { dependencies, devDependencies } = require("./package.json");
|
||||||
echo "bootstrap: node cannot find $module after yarn install" >&2
|
for (const name of Object.keys({ ...dependencies, ...devDependencies })) {
|
||||||
echo " fix: rm -rf node_modules && make bootstrap" >&2
|
try {
|
||||||
exit 1
|
require.resolve(name + "/package.json");
|
||||||
fi
|
} catch (e) {
|
||||||
done
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user