Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b64b31

Browse files
committed
Add script to check whether npm i needs to be run
and add it to the `build` command
1 parent 5235174 commit 7b64b31

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "CodeQL action",
66
"scripts": {
77
"_build_comment": "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
8-
"build": "npm run transpile && node build.mjs",
8+
"build": "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
99
"lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
1010
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
1111
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

scripts/check-node-modules.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Check if npm install is likely needed before proceeding
4+
if [ ! -d node_modules ] || [ package-lock.json -nt node_modules/.package-lock.json ]; then
5+
npm install
6+
fi

0 commit comments

Comments
 (0)