Skip to content

Commit bb592e9

Browse files
authored
build: DH-21044: Disable pre/post install scripts (#2586) (#2596)
- Pre/post install scripts was something Sha1-hulud used to propagate - Just disable them - Updated scripts to ensure `npm install` then `npm start`/`npm run build`/`npm run test` all work correctly
1 parent 3ad471d commit bb592e9

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
engine-strict=true
2-
provenance=true
2+
provenance=true
3+
ignore-scripts=true

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
"npm": ">=11"
1111
},
1212
"scripts": {
13-
"postinstall": "node ./skip.js || run-s build:necessary",
1413
"clean:build": "rimraf packages/*/dist packages/*/build",
15-
"postclean:build": "npm run clean:types",
1614
"clean:cache": "run-s clean:cache:*",
1715
"clean:cache:eslint": "rimraf .eslintcache",
1816
"clean:cache:jest": "jest --clearCache",
@@ -33,15 +31,14 @@
3331
"analyze": "lerna run analyze",
3432
"preview": "lerna run --scope=@deephaven/{code-studio,embed-widget} preview --stream",
3533
"preview:app": "lerna run --scope=@deephaven/code-studio preview --stream",
36-
"prestart": "npm run build:necessary",
37-
"start": "run-p watch:types start:*",
34+
"preview:embed-widget": "lerna run --scope=@deephaven/embed-widget preview --stream",
35+
"dev": "run-p watch:types start:*",
36+
"start": "run-s build:necessary dev",
3837
"start:app": "lerna run start --scope=@deephaven/code-studio --stream",
3938
"start:embed-widget": "lerna run start --scope=@deephaven/embed-widget --stream",
40-
"pretest": "npm run build:necessary",
4139
"test": "jest --watch --changedSince origin/main",
4240
"test:debug": "node --inspect-brk node_modules/.bin/jest --config jest.config.unit.cjs --runInBand --watch",
43-
"pretest:unit": "npm run pretest",
44-
"test:unit": "jest --config jest.config.unit.cjs",
41+
"test:unit": "npm run build:necessary && jest --config jest.config.unit.cjs",
4542
"test:lint": "jest --config jest.config.lint.cjs",
4643
"test:golden-layout": "lerna run test:ci --scope=@deephaven/golden-layout --stream",
4744
"version-bump": "lerna version --conventional-commits --create-release github",

packages/golden-layout/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"build": "cross-env NODE_ENV=production run-p build:*",
2323
"build:sass": "sass --embed-sources --load-path=../../node_modules --style=compressed ./src:./dist ./scss:./css",
2424
"build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.js,.tsx,.jsx\" --source-maps --root-mode upward",
25-
"pretest": "npm run build",
26-
"test": "karma start karma.conf.cjs",
27-
"pretest:ci": "npm run pretest",
28-
"test:ci": "karma start karma.conf.cjs --single-run"
25+
"test": "run-s build test-start",
26+
"test-start": "karma start karma.conf.cjs",
27+
"test:ci": "run-s build test:ci-start",
28+
"test:ci-start": "karma start karma.conf.cjs --single-run"
2929
},
3030
"repository": {
3131
"type": "git",

skip.js

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

tests/docker-scripts/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FROM alpine AS copy-packages
55
WORKDIR /work/
66
COPY . /tmp/web-client-ui
7-
COPY package.json package-lock.json skip.js ./
7+
COPY package.json package-lock.json ./
88
# cd first so the cp doesn't include /tmp/web-client-ui in the paths
99
RUN cd /tmp/web-client-ui && cp --parents ./packages/*/package.json /work/
1010

@@ -50,9 +50,8 @@ COPY --from=copy-packages /work/ .
5050
# Confirm node version is correct for debugging
5151
RUN node --version
5252

53-
# Disable the postinstall script, or npm ci will try and build and the files won't be there
54-
# We don't need the postinstall since we're going to rebuild right after
55-
RUN SKIP_POSTINSTALL=1 npm ci
53+
# Install npm packages
54+
RUN npm ci
5655

5756
# Copy the web-client-ui src folder to the docker image
5857
# We do this last because the source files are the most likely to change

0 commit comments

Comments
 (0)