Skip to content

Commit

Permalink
Feature/pr 1523 fast follow (#1524)
Browse files Browse the repository at this point in the history
* style: renames 'load-docker' npm script 'build-and-load-docker'

also adjusts README

* fix: adds --prefix to 'npm run' success, caution, and fail message

needed when directory is changed mid-npm script execution. eg with 'npm run ... && npm run ...'
  • Loading branch information
dgrebb authored Dec 22, 2023
1 parent 9ff1a53 commit 7dccc53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,13 @@ tl;dr
- `npm run init-docker-builder`
- customize `./docker/Dockerfile`
- `npm run build-docker`
- `npm run load-docker`
- `npm run build-and-load-docker`
<details>
<summary>Details</summary>
<p>The Docker image is created via `npm run build-docker`, which uses a custom docker builder, created via `npm run init-docker-builder`. This ensures the Docker image can run on multiple platform architectures (M1 vs. Inteal Macs for example). [Read more](https://docs.docker.com/build/building/multi-platform/ "Docker Documentation)) about this.</p>
<p>Because BackstopJS's Docker image is created with a custom `docker buildx` builder, one must "load" the image into their local registry. This is where `npm run load-docker` comes in handy.</p>
<p>Because BackstopJS's Docker image is created with a custom `docker buildx` builder, one must "load" the image into their local registry. This is where `npm run build-and-load-docker` comes in handy.</p>
</details>
#### Publishing to Container Registries
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@
"precommit": "lint-staged",
"build-compare": "cp ./node_modules/diverged/src/diverged.js ./compare/output/ && cp ./node_modules/diff/dist/diff.js ./compare/output/ && webpack --config ./compare/webpack.config.js && npm run -s lint",
"dev-compare": "webpack-dev-server --content-base ./compare/output --config ./compare/webpack.config.js",
"integration-test": "rm -rf newdir && mkdir newdir && cd newdir && node ../cli/index.js init && node ../cli/index.js reference && node ../cli/index.js test && node -e \"require('../')('test')\" && npm run -s success-message || npm run -s fail-message",
"smoke-test": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features && npm run -s success-message || npm run -s caution-message",
"smoke-test-playwright": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features_pw && npm run -s fail-message || npm run -s caution-message",
"smoke-test-docker": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features --docker && npm run -s fail-message || npm run -s caution-message",
"smoke-test-playwright-docker": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features_pw --docker && npm run -s fail-message || npm run -s caution-message",
"sanity-test": "cd test/configs/ && node ../../cli/index.js test && npm run -s success-message || npm run -s caution-message",
"sanity-test-playwright": "cd test/configs/ && node ../../cli/index.js test --config=playwright && npm run -s success-message || npm run -s caution-message",
"sanity-test-docker": "cd test/configs/ && node ../../cli/index.js test --docker && npm run -s success-message || npm run -s caution-message",
"sanity-test-playwright-docker": "cd test/configs/ && node ../../cli/index.js test --config=playwright --docker && npm run -s success-message || npm run -s caution-message",
"kill-zombies": "pkill -f \"(chrome)?(--headless)\"",
"integration-test": "rm -rf newdir && mkdir newdir && cd newdir && node ../cli/index.js init && node ../cli/index.js reference && node ../cli/index.js test && node -e \"require('../')('test')\" && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s fail-message",
"smoke-test": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s caution-message",
"smoke-test-playwright": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features_pw && npm --prefix ../../ run -s fail-message || npm --prefix ../../ run -s caution-message",
"smoke-test-docker": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features --docker && npm --prefix ../../ run -s fail-message || npm --prefix ../../ run -s caution-message",
"smoke-test-playwright-docker": "cd test/configs/ && node ../../cli/index.js test --config=backstop_features_pw --docker && npm --prefix ../../ run -s fail-message || npm --prefix ../../ run -s caution-message",
"sanity-test": "cd test/configs/ && node ../../cli/index.js test && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s caution-message",
"sanity-test-playwright": "cd test/configs/ && node ../../cli/index.js test --config=playwright && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s caution-message",
"sanity-test-docker": "cd test/configs/ && node ../../cli/index.js test --docker && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s caution-message",
"sanity-test-playwright-docker": "cd test/configs/ && node ../../cli/index.js test --config=playwright --docker && npm --prefix ../../ run -s success-message || npm --prefix ../../ run -s caution-message",
"copy-report-bundle": "mkdir -p test/configs/backstop_data/html_report && cp compare/output/index_bundle.js test/configs/backstop_data/html_report/",
"build-and-copy-report-bundle": "npm run build-compare && npm run copy-report-bundle",
"remote": "cd test/configs/ && node ../../cli/index.js remote",
"stop": "cd test/configs/ && node ../../cli/index.js stop",
"publish-npm": "npm publish",
"build-docker": "PV=$(node -p -e \"require('./package.json').version\"); echo $PV; docker buildx build --platform linux/amd64,linux/arm64 -t backstopjs/backstopjs:$PV --build-arg BACKSTOPJS_VERSION=$PV docker; docker buildx build --platform linux/amd64,linux/arm64 -t backstopjs/backstopjs:latest --build-arg BACKSTOPJS_VERSION=$PV docker",
"load-docker": "PV=$(node -p -e \"require('./package.json').version\"); echo $PV; docker buildx build --load -t backstopjs/backstopjs:$PV docker",
"build-and-load-docker": "PV=$(node -p -e \"require('./package.json').version\"); echo $PV; docker buildx build --load -t backstopjs/backstopjs:$PV docker",
"publish-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker buildx build --push --platform linux/amd64,linux/arm64 -t backstopjs/backstopjs:$PV --build-arg BACKSTOPJS_VERSION=$PV docker; docker buildx build --push --platform linux/amd64,linux/arm64 -t backstopjs/backstopjs:latest --build-arg BACKSTOPJS_VERSION=$PV docker",
"build-and-publish": "npm run publish-npm && npm run build-docker && npm run publish-docker",
"init-docker-builder": "docker buildx create --name backstopbuilder --use --bootstrap",
Expand Down

0 comments on commit 7dccc53

Please sign in to comment.