Add script to check whether npm i needs to be run

and add it to the `build` command
This commit is contained in:
Michael B. Gale
2025-09-25 14:20:30 +01:00
parent 853decd26b
commit 455038c8a7
13 changed files with 19 additions and 12 deletions

View File

@@ -26443,7 +26443,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

2
lib/analyze-action.js generated
View File

@@ -32292,7 +32292,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -26443,7 +26443,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -32292,7 +32292,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

2
lib/init-action.js generated
View File

@@ -32292,7 +32292,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -26443,7 +26443,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -26443,7 +26443,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -44971,7 +44971,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

2
lib/upload-lib.js generated
View File

@@ -33589,7 +33589,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -26443,7 +26443,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -32292,7 +32292,7 @@ var require_package = __commonJS({
description: "CodeQL action",
scripts: {
_build_comment: "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
build: "npm run transpile && node build.mjs",
build: "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
lint: "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

View File

@@ -5,7 +5,7 @@
"description": "CodeQL action",
"scripts": {
"_build_comment": "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'",
"build": "npm run transpile && node build.mjs",
"build": "./scripts/check-node-modules.sh && npm run transpile && node build.mjs",
"lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif",
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",

7
scripts/check-node-modules.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Check if npm install is likely needed before proceeding
if [ ! -d node_modules ] || [ package-lock.json -nt node_modules/.package-lock.json ]; then
npm install
fi