From 7458b24c0ba2d5c3530150afa052157d655c4e7d Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Sat, 9 Dec 2023 14:51:17 -0800 Subject: [PATCH] chore: bazel run //:format --- .aspect/workflows/terraform/workflows.tf | 2 +- .editorconfig | 3 + .github/workflows/release_prep.sh | 10 +- e2e/js_image_docker/test.sh | 4 +- e2e/js_image_oci/test.sh | 4 +- e2e/js_run_devserver/multirun_test.sh | 127 +++++++++---------- e2e/js_run_devserver/serve_test.sh | 80 ++++++------ e2e/js_run_devserver/test.sh | 2 +- e2e/npm_translate_lock/test.sh | 24 ++-- e2e/npm_translate_lock_auth/test.sh | 12 +- e2e/update_pnpm_lock/test.sh | 44 +++---- e2e/update_pnpm_lock_with_import/test.sh | 62 ++++----- e2e/verify_patches/test.sh | 66 +++++----- e2e/webpack_devserver/serve_test.sh | 26 ++-- e2e/webpack_devserver_esm/serve_test.sh | 26 ++-- js/private/bash.bzl | 12 +- js/private/js_binary.sh.tpl | 23 ++-- js/private/test/BUILD.bazel | 1 + js/private/test/image/structure/digests.sum | 2 +- js/private/test/shellcheck_launcher.sh | 37 +++--- npm/private/lifecycle/bundle.sh | 2 +- npm/private/noop.sh | 2 +- npm/private/test/npm_package_publish/test.sh | 10 +- npm/private/test/repositories_checked.bzl | 2 +- 24 files changed, 292 insertions(+), 291 deletions(-) create mode 100644 .editorconfig diff --git a/.aspect/workflows/terraform/workflows.tf b/.aspect/workflows/terraform/workflows.tf index 3c80733e5..fce4264ca 100644 --- a/.aspect/workflows/terraform/workflows.tf +++ b/.aspect/workflows/terraform/workflows.tf @@ -42,7 +42,7 @@ module "aspect_workflows" { # Warming set definitions warming_sets = { - default = {} + default = {} } # Resource types for use by runner groups diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..47ff00434 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.sh] +indent_style = space +indent_size = 4 diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index cbf81a69b..23cfe49e1 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -7,7 +7,7 @@ echo >.git/info/attributes "examples export-ignore" # But **do** include e2e/bzlmod since the BCR wants to run presubmit test # and it only sees our release artifact. # shellcheck disable=2010 -ls e2e | grep -v bzlmod | awk 'NF{print "e2e/" $0 " export-ignore"}' >> .git/info/attributes +ls e2e | grep -v bzlmod | awk 'NF{print "e2e/" $0 " export-ignore"}' >>.git/info/attributes # Set by GH actions, see # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables @@ -15,10 +15,10 @@ TAG=${GITHUB_REF_NAME} # The prefix is chosen to match what GitHub generates for source archives PREFIX="rules_js-${TAG:1}" ARCHIVE="rules_js-$TAG.tar.gz" -git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip > "$ARCHIVE" +git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip >"$ARCHIVE" SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}') -cat << EOF +cat </dev/null | grep "My first website"; then - echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to contain 'My first website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to contain 'My first website'" + exit 1 fi if ! curl http://localhost:$PORT2/index.html --fail 2>/dev/null | grep "My first website"; then - echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to contain 'My first website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to contain 'My first website'" + exit 1 fi if ! curl http://localhost:$PORT1/other.html --fail 2>/dev/null | grep "My other website"; then - echo "$$: ERROR: Expected http://localhost:$PORT1/other.html to contain 'My other website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT1/other.html to contain 'My other website'" + exit 1 fi if ! curl http://localhost:$PORT2/other.html --fail 2>/dev/null | grep "My other website"; then - echo "$$: ERROR: Expected http://localhost:$PORT2/other.html to contain 'My other website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT2/other.html to contain 'My other website'" + exit 1 fi if curl http://localhost:$PORT1/new.html --fail 2>/dev/null; then - echo "$$: ERROR: Expected http://localhost:$PORT1/new.html to fail with 404" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT1/new.html to fail with 404" + exit 1 fi if curl http://localhost:$PORT2/new.html --fail 2>/dev/null; then - echo "$$: ERROR: Expected http://localhost:$PORT2/new.html to fail with 404" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT2/new.html to fail with 404" + exit 1 fi if curl http://localhost:$PORT1/index.html --fail 2>/dev/null | grep "A second line"; then - echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to NOT contain 'A second line'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to NOT contain 'A second line'" + exit 1 fi if curl http://localhost:$PORT2/index.html --fail 2>/dev/null | grep "A second line"; then - echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to NOT contain 'A second line'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to NOT contain 'A second line'" + exit 1 fi -echo "
A second line
" >> src/index.html +echo "
A second line
" >>src/index.html # Wait for $PORT1 to show the updated file n=0 while ! curl http://localhost:$PORT1/index.html --fail 2>/dev/null | grep "A second line"; do - if [ $n -gt 30 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to contain 'A second line'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 30 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT1/index.html to contain 'A second line'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done # Wait for $PORT2 to show the updated file n=0 while ! curl http://localhost:$PORT2/index.html --fail 2>/dev/null | grep "A second line"; do - if [ $n -gt 30 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to contain 'A second line'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 30 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT2/index.html to contain 'A second line'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done -echo "
A new file
" > src/new.html +echo "
A new file
" >src/new.html _sedi 's#"other.html"#"other.html", "new.html"#' src/BUILD.bazel # Wait for $PORT1 to show the new file n=0 while ! curl http://localhost:$PORT1/new.html --fail 2>/dev/null | grep "A new file"; do - if [ $n -gt 30 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT1/new.html to contain 'A new file'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 30 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT1/new.html to contain 'A new file'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done # Wait for $PORT2 to show the new file n=0 while ! curl http://localhost:$PORT2/new.html --fail 2>/dev/null | grep "A new file"; do - if [ $n -gt 30 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT2/new.html to contain 'A new file'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 30 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT2/new.html to contain 'A new file'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done echo "$$: All tests passed" diff --git a/e2e/js_run_devserver/serve_test.sh b/e2e/js_run_devserver/serve_test.sh index 31cae8df7..eda7ac6ab 100755 --- a/e2e/js_run_devserver/serve_test.sh +++ b/e2e/js_run_devserver/serve_test.sh @@ -6,19 +6,19 @@ TARGET="$1" # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } # Find a random unused port to use -PORT=$((4080 + $RANDOM)) -while netstat -a | grep $PORT ; do - PORT=$((4080 + $RANDOM)) +PORT=$((4080 + RANDOM)) +while netstat -a | grep $PORT; do + PORT=$((4080 + RANDOM)) done export PORT @@ -28,11 +28,11 @@ echo "$$: TEST - $0: $TARGET @ $PORT" ibazel_pid="$!" function _exit { - echo "$$: Cleanup..." - kill "$ibazel_pid" - wait "$ibazel_pid" - git checkout src/index.html src/BUILD.bazel - rm -f src/new.html + echo "$$: Cleanup..." + kill "$ibazel_pid" + wait "$ibazel_pid" + git checkout src/index.html src/BUILD.bazel + rm -f src/new.html } trap _exit EXIT @@ -41,61 +41,61 @@ echo "$$: Waiting for $TARGET devserver to launch on $PORT..." # Wait for $PORT to start the http server n=0 while ! nc -z localhost $PORT; do - if [ $n -gt 100 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT to be available" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 100 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT to be available" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done echo "$$: Devserver ready" if ! curl http://localhost:$PORT/index.html --fail 2>/dev/null | grep "My first website"; then - echo "$$: ERROR: Expected http://localhost:$PORT/index.html to contain 'My first website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT/index.html to contain 'My first website'" + exit 1 fi if ! curl http://localhost:$PORT/other.html --fail 2>/dev/null | grep "My other website"; then - echo "$$: ERROR: Expected http://localhost:$PORT/other.html to contain 'My other website'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT/other.html to contain 'My other website'" + exit 1 fi if curl http://localhost:$PORT/new.html --fail 2>/dev/null; then - echo "$$: ERROR: Expected http://localhost:$PORT/new.html to fail with 404" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT/new.html to fail with 404" + exit 1 fi if curl http://localhost:$PORT/index.html --fail 2>/dev/null | grep "A second line"; then - echo "$$: ERROR: Expected http://localhost:$PORT/index.html to NOT contain 'A second line'" - exit 1 + echo "$$: ERROR: Expected http://localhost:$PORT/index.html to NOT contain 'A second line'" + exit 1 fi -echo "
A second line
" >> src/index.html +echo "
A second line
" >>src/index.html # Wait for $PORT to show the updated file n=0 while ! curl http://localhost:$PORT/index.html --fail 2>/dev/null | grep "A second line"; do - if [ $n -gt 30 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT/index.html to contain 'A second line'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 30 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT/index.html to contain 'A second line'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done -echo "
A new file
" > src/new.html +echo "
A new file
" >src/new.html _sedi 's#"other.html"#"other.html", "new.html"#' src/BUILD.bazel # Wait for $PORT to show the new file n=0 while ! curl http://localhost:$PORT/new.html --fail 2>/dev/null | grep "A new file"; do - if [ $n -gt 60 ]; then - echo "$$: ERROR: Expected http://localhost:$PORT/new.html to contain 'A new file'" - exit 1 - fi - sleep 1 # wait before check again - ((n=n+1)) + if [ $n -gt 60 ]; then + echo "$$: ERROR: Expected http://localhost:$PORT/new.html to contain 'A new file'" + exit 1 + fi + sleep 1 # wait before check again + ((n = n + 1)) done echo "$$: All tests passed" diff --git a/e2e/js_run_devserver/test.sh b/e2e/js_run_devserver/test.sh index cb20273e5..d3a6dffe4 100755 --- a/e2e/js_run_devserver/test.sh +++ b/e2e/js_run_devserver/test.sh @@ -15,4 +15,4 @@ bazel run $BZLMOD_FLAG -- @pnpm//:pnpm --dir "$PWD" install ./serve_test.sh //src:serve_naughty ./serve_test.sh //src:serve_naughty_bin ./multirun_test.sh //src:serve_multi -echo "test.sh: PASS" \ No newline at end of file +echo "test.sh: PASS" diff --git a/e2e/npm_translate_lock/test.sh b/e2e/npm_translate_lock/test.sh index 15e03c906..98a57ee88 100755 --- a/e2e/npm_translate_lock/test.sh +++ b/e2e/npm_translate_lock/test.sh @@ -2,23 +2,23 @@ set -o errexit -o nounset -o pipefail # @rollup npm package should use registry.npmjs.org as per @rollup:registry=https://registry.npmjs.org/ override -if ! grep registry.npmjs.org/@rollup > /dev/null < repositories_checked.bzl; then - echo "Expected to find registry.npmjs.org/@rollup in repositories_checked.bzl" - exit 1 +if ! grep registry.npmjs.org/@rollup >/dev/null /dev/null < repositories_checked.bzl; then - echo "Expected to not find registry.yarnpkg.com/@rollup in repositories_checked.bzl" - exit 1 +if ! grep -v registry.yarnpkg.com/@rollup >/dev/null /dev/null < repositories_checked.bzl; then - echo "Expected to find registry.yarnpkg.com/@types in repositories_checked.bzl" - exit 1 +if ! grep registry.yarnpkg.com/@types >/dev/null /dev/null < repositories_checked.bzl; then - echo "Expected to not find registry.npmjs.org/@types in repositories_checked.bzl" - exit 1 +if ! grep -v registry.npmjs.org/@types >/dev/null unset ASPECT_RULES_JS_FROZEN_PNPM_LOCK if [ "$BZLMOD_FLAG" ]; then - _sedi 's#npmrc = "//:.npmrc",#use_home_npmrc = True,#' MODULE.bazel + _sedi 's#npmrc = "//:.npmrc",#use_home_npmrc = True,#' MODULE.bazel else - _sedi 's#npmrc = "//:.npmrc",#use_home_npmrc = True,#' WORKSPACE + _sedi 's#npmrc = "//:.npmrc",#use_home_npmrc = True,#' WORKSPACE fi # shellcheck disable=SC2086 bazel run $BZLMOD_FLAG @npm//:sync diff --git a/e2e/update_pnpm_lock/test.sh b/e2e/update_pnpm_lock/test.sh index c3ae25bb7..f8a17f18e 100755 --- a/e2e/update_pnpm_lock/test.sh +++ b/e2e/update_pnpm_lock/test.sh @@ -3,26 +3,26 @@ set -o errexit -o nounset -o pipefail -o xtrace # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } # TODO: quote $BZLMOD_FLAG once https://github.com/aspect-build/silo/issues/1312 is fixed # shellcheck disable=SC2086 if ! bazel test ${BZLMOD_FLAG:-} //...; then - echo "ERROR: expected 'bazel test ${BZLMOD_FLAG:-} //...' to pass" - exit 1 + echo "ERROR: expected 'bazel test ${BZLMOD_FLAG:-} //...' to pass" + exit 1 fi diff="$(git diff .)" if [ "$diff" ]; then - echo "ERROR: expected 'git diff .' to be empty" - exit 1 + echo "ERROR: expected 'git diff .' to be empty" + exit 1 fi _sedi 's#"@types/node": "18.11.18"#"@types/node": "16"#' package.json @@ -32,8 +32,8 @@ export ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 # TODO: quote $BZLMOD_FLAG once https://github.com/aspect-build/silo/issues/1312 is fixed # shellcheck disable=SC2086 if bazel test ${BZLMOD_FLAG:-} //...; then - echo "ERROR: expected 'ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 bazel test ${BZLMOD_FLAG:-} //...' to fail" - exit 1 + echo "ERROR: expected 'ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 bazel test ${BZLMOD_FLAG:-} //...' to fail" + exit 1 fi export ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1 @@ -41,14 +41,14 @@ export ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1 # TODO: quote $BZLMOD_FLAG once https://github.com/aspect-build/silo/issues/1312 is fixed # shellcheck disable=SC2086 if ! bazel test ${BZLMOD_FLAG:-} //...; then - echo "ERROR: expected 'ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1 bazel test ${BZLMOD_FLAG:-} //...' to pass" - exit 1 + echo "ERROR: expected 'ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1 bazel test ${BZLMOD_FLAG:-} //...' to pass" + exit 1 fi diff="$(git diff pnpm-lock.yaml)" if [ "$diff" ]; then - echo "ERROR: expected 'git diff pnpm-lock.yaml' to be empty" - exit 1 + echo "ERROR: expected 'git diff pnpm-lock.yaml' to be empty" + exit 1 fi ASPECT_RULES_JS_FROZEN_PNPM_LOCK= @@ -61,28 +61,28 @@ _sedi 's#"@types/node": "16"#"@types/node": "14"#' package.json # TODO: quote $BZLMOD_FLAG once https://github.com/aspect-build/silo/issues/1312 is fixed # shellcheck disable=SC2086 if ! bazel run ${BZLMOD_FLAG:-} @npm//:sync; then - echo "ERROR: expected 'bazel run ${BZLMOD_FLAG:-} @npm//:sync' to pass" - exit 1 + echo "ERROR: expected 'bazel run ${BZLMOD_FLAG:-} @npm//:sync' to pass" + exit 1 fi diff="$(git diff pnpm-lock.yaml)" if [ -z "$diff" ]; then - echo "ERROR: expected 'git diff pnpm-lock.yaml' to not be empty" - exit 1 + echo "ERROR: expected 'git diff pnpm-lock.yaml' to not be empty" + exit 1 fi action_cache_file=".aspect/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU=" diff="$(git diff "$action_cache_file")" if [ -z "$diff" ]; then - echo "ERROR: expected 'git diff $action_cache_file' to not be empty" - exit 1 + echo "ERROR: expected 'git diff $action_cache_file' to not be empty" + exit 1 fi # TODO: quote $BZLMOD_FLAG once https://github.com/aspect-build/silo/issues/1312 is fixed # shellcheck disable=SC2086 if ! bazel test ${BZLMOD_FLAG:-} //...; then - echo "ERROR: expected 'bazel test ${BZLMOD_FLAG:-} //...' to pass" - exit 1 + echo "ERROR: expected 'bazel test ${BZLMOD_FLAG:-} //...' to pass" + exit 1 fi echo "All tests passed" diff --git a/e2e/update_pnpm_lock_with_import/test.sh b/e2e/update_pnpm_lock_with_import/test.sh index 4801b4190..1e935f539 100755 --- a/e2e/update_pnpm_lock_with_import/test.sh +++ b/e2e/update_pnpm_lock_with_import/test.sh @@ -3,20 +3,20 @@ set -o errexit -o nounset -o pipefail # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } print_step() { - printf "\n\n+----------------------------------------------------------------------+" - # shellcheck disable=SC2059,SC2145 - printf "\n $@" - printf "\n+----------------------------------------------------------------------+\n" + printf "\n\n+----------------------------------------------------------------------+" + # shellcheck disable=SC2059,SC2145 + printf "\n $@" + printf "\n+----------------------------------------------------------------------+\n" } BZLMOD_FLAG="${BZLMOD_FLAG:-}" @@ -24,16 +24,16 @@ BZLMOD_FLAG="${BZLMOD_FLAG:-}" print_step "It should initially pass" # shellcheck disable=SC2086 if ! bazel test $BZLMOD_FLAG //...; then - echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" - exit 1 + echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" + exit 1 fi print_step "It should fail a bazel test run after updating a dependency when ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1" diff="$(git diff .)" if [ "$diff" ]; then - echo "ERROR: expected 'git diff .' to be empty" - exit 1 + echo "ERROR: expected 'git diff .' to be empty" + exit 1 fi _sedi 's#"@types/node": "18.11.18"#"@types/node": "16"#' package.json @@ -42,8 +42,8 @@ export ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 # shellcheck disable=SC2086 if bazel test $BZLMOD_FLAG //...; then - echo "ERROR: expected 'ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 bazel test $BZLMOD_FLAG //...' to fail" - exit 1 + echo "ERROR: expected 'ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 bazel test $BZLMOD_FLAG //...' to fail" + exit 1 fi ASPECT_RULES_JS_FROZEN_PNPM_LOCK= @@ -51,29 +51,29 @@ ASPECT_RULES_JS_FROZEN_PNPM_LOCK= print_step "It should update the lockfile after a running the invalide target with ASPECT_RULES_JS_FROZEN_PNPM_LOCK unset" # shellcheck disable=SC2086 if ! bazel run $BZLMOD_FLAG @npm//:sync; then - echo "ERROR: expected 'bazel run $BZLMOD_FLAG @npm//:sync' to pass" - exit 1 + echo "ERROR: expected 'bazel run $BZLMOD_FLAG @npm//:sync' to pass" + exit 1 fi diff="$(git diff pnpm-lock.yaml)" if [ -z "$diff" ]; then - echo "ERROR: expected 'git diff pnpm-lock.yaml' to not be empty" - exit 1 + echo "ERROR: expected 'git diff pnpm-lock.yaml' to not be empty" + exit 1 fi action_cache_file=".aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU=" diff="$(git diff "$action_cache_file")" if [ -z "$diff" ]; then - echo "ERROR: expected 'git diff $action_cache_file' to not be empty" - exit 1 + echo "ERROR: expected 'git diff $action_cache_file' to not be empty" + exit 1 fi print_step "It should pass a bazel test run" # shellcheck disable=SC2086 if ! bazel test $BZLMOD_FLAG //...; then - echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" - exit 1 + echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" + exit 1 fi print_step "It should bootstrap the lockfile when pnpm_lock is missing" @@ -82,20 +82,20 @@ rm pnpm-lock.yaml # shellcheck disable=SC2086 if [ ! $BZLMOD_FLAG ]; then - _sedi 's#pnpm_lock = "//:pnpm-lock.yaml"#\# pnpm_lock = "//:pnpm-lock.yaml"#' WORKSPACE + _sedi 's#pnpm_lock = "//:pnpm-lock.yaml"#\# pnpm_lock = "//:pnpm-lock.yaml"#' WORKSPACE else - _sedi 's#pnpm_lock = "//:pnpm-lock.yaml"#\# pnpm_lock = "//:pnpm-lock.yaml"#' MODULE.bazel + _sedi 's#pnpm_lock = "//:pnpm-lock.yaml"#\# pnpm_lock = "//:pnpm-lock.yaml"#' MODULE.bazel fi # shellcheck disable=SC2086 if bazel test $BZLMOD_FLAG //...; then - echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to fail" - exit 1 + echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to fail" + exit 1 fi if [ ! -e pnpm-lock.yaml ]; then - echo "ERROR: expected the pnpm-lock.yaml file to have been boostraped by npm_translate_lock" - exit 1 + echo "ERROR: expected the pnpm-lock.yaml file to have been boostraped by npm_translate_lock" + exit 1 fi # Under WORKSPACE, the `pnpm_lock` attribute does not need to be restored at this point @@ -105,15 +105,15 @@ fi # doesn't exist. # shellcheck disable=SC2086 if [ $BZLMOD_FLAG ]; then - _sedi 's#\# pnpm_lock = "//:pnpm-lock.yaml"#pnpm_lock = "//:pnpm-lock.yaml"#' MODULE.bazel + _sedi 's#\# pnpm_lock = "//:pnpm-lock.yaml"#pnpm_lock = "//:pnpm-lock.yaml"#' MODULE.bazel fi print_step "It should pass a test after the lockfile has been bootstrapped" # shellcheck disable=SC2086 if ! bazel test $BZLMOD_FLAG //...; then - echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" - exit 1 + echo "ERROR: expected 'bazel test $BZLMOD_FLAG //...' to pass" + exit 1 fi echo "All tests passed" diff --git a/e2e/verify_patches/test.sh b/e2e/verify_patches/test.sh index cdb172ba7..724ec5a9a 100755 --- a/e2e/verify_patches/test.sh +++ b/e2e/verify_patches/test.sh @@ -2,41 +2,40 @@ set -o errexit -o nounset -o pipefail print_step() { - printf "\n\n+----------------------------------------------------------------------+" - # shellcheck disable=SC2059,SC2145 - printf "\n $@" - printf "\n+----------------------------------------------------------------------+\n" + printf "\n\n+----------------------------------------------------------------------+" + # shellcheck disable=SC2059,SC2145 + printf "\n $@" + printf "\n+----------------------------------------------------------------------+\n" } # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } - BZLMOD_FLAG="${BZLMOD_FLAG:-}" print_step "Should initially succeed" # shellcheck disable=SC2086 if ! bazel build $BZLMOD_FLAG //...; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to pass" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to pass" + exit 1 fi print_step "Should pass the generated patch list test when adding an excluded patch format" touch patches/foo.diff # shellcheck disable=SC2086 if ! bazel test $BZLMOD_FLAG //patches:patches_update_test; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to pass" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to pass" + exit 1 fi rm patches/foo.diff @@ -50,54 +49,53 @@ index bdc8c4e..4f9c0fb 100755 const testA = require('@gregmagolan/test-a'); console.log(\"Hello world!\") +console.log(\"foobar\")" -echo "$patch" > patches/foo.patch +echo "$patch" >patches/foo.patch # shellcheck disable=SC2086 if bazel test $BZLMOD_FLAG //patches:patches_update_test; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to fail" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to fail" + exit 1 fi print_step "Should succeed running the patches update target" # shellcheck disable=SC2086 if ! bazel run $BZLMOD_FLAG //patches:patches_update; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel run $BZLMOD_FLAG //patches:patches_update' to pass" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel run $BZLMOD_FLAG //patches:patches_update' to pass" + exit 1 fi print_step "Should fail the build because the new patch isn't in 'patches'" # shellcheck disable=SC2086 if bazel build $BZLMOD_FLAG //...; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to fail" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to fail" + exit 1 fi print_step "Should pass the build after adding the new patch to 'patches'" # shellcheck disable=SC2086 if [ $BZLMOD_FLAG ]; then - _sedi 's#"//:patches/test-b.patch"#"//:patches/test-b.patch", "//:patches/foo.patch"#' MODULE.bazel + _sedi 's#"//:patches/test-b.patch"#"//:patches/test-b.patch", "//:patches/foo.patch"#' MODULE.bazel else - _sedi 's#"//:patches/test-b.patch"#"//:patches/test-b.patch", "//:patches/foo.patch"#' WORKSPACE + _sedi 's#"//:patches/test-b.patch"#"//:patches/test-b.patch", "//:patches/foo.patch"#' WORKSPACE fi # shellcheck disable=SC2086 if ! bazel build $BZLMOD_FLAG //...; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to pass" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel build $BZLMOD_FLAG //...' to pass" + exit 1 fi print_step "Should succeed the generated patch list test" # shellcheck disable=SC2086 if ! bazel test $BZLMOD_FLAG //patches:patches_update_test; then - # shellcheck disable=SC2059 - printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to pass" - exit 1 + # shellcheck disable=SC2059 + printf "ERROR: expected 'bazel test $BZLMOD_FLAG //patches:patches_update_test' to pass" + exit 1 fi print_step "All tests passed" - diff --git a/e2e/webpack_devserver/serve_test.sh b/e2e/webpack_devserver/serve_test.sh index a45407fb0..8b032862a 100755 --- a/e2e/webpack_devserver/serve_test.sh +++ b/e2e/webpack_devserver/serve_test.sh @@ -5,13 +5,13 @@ BZLMOD_FLAG="${BZLMOD_FLAG:-}" # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } echo "TEST - $0: $1" @@ -20,17 +20,17 @@ echo "TEST - $0: $1" ibazel_pid="$!" function _exit { - echo "Cleanup..." - kill "$ibazel_pid" - git checkout src/index.html + echo "Cleanup..." + kill "$ibazel_pid" + git checkout src/index.html } trap _exit EXIT echo "Waiting for $1 devserver to launch on 8080..." while ! nc -z localhost 8080; do - echo "." - sleep 0.5 # wait before check again + echo "." + sleep 0.5 # wait before check again done echo "Waiting 5 seconds for devservers to settle..." @@ -39,8 +39,8 @@ sleep 5 echo "Devserver ready" if ! curl http://localhost:8080/index.html --fail 2>/dev/null | grep "Getting Started"; then - echo "ERROR: Expected http://localhost:8080/index.html to contain 'Getting Started'" - exit 1 + echo "ERROR: Expected http://localhost:8080/index.html to contain 'Getting Started'" + exit 1 fi _sedi 's#Getting Started#Goodbye#' src/index.html @@ -49,8 +49,8 @@ echo "Waiting 5 seconds for ibazel rebuild after change to src/index.html..." sleep 5 if ! curl http://localhost:8080/index.html --fail 2>/dev/null | grep "Goodbye"; then - echo "ERROR: Expected http://localhost:8080/index.html to contain 'Goodbye'" - exit 1 + echo "ERROR: Expected http://localhost:8080/index.html to contain 'Goodbye'" + exit 1 fi echo "All tests passed" diff --git a/e2e/webpack_devserver_esm/serve_test.sh b/e2e/webpack_devserver_esm/serve_test.sh index a45407fb0..8b032862a 100755 --- a/e2e/webpack_devserver_esm/serve_test.sh +++ b/e2e/webpack_devserver_esm/serve_test.sh @@ -5,13 +5,13 @@ BZLMOD_FLAG="${BZLMOD_FLAG:-}" # sedi makes `sed -i` work on both OSX & Linux # See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd -_sedi () { - case $(uname) in +_sedi() { + case $(uname) in Darwin*) sedi=('-i' '') ;; *) sedi=('-i') ;; - esac + esac - sed "${sedi[@]}" "$@" + sed "${sedi[@]}" "$@" } echo "TEST - $0: $1" @@ -20,17 +20,17 @@ echo "TEST - $0: $1" ibazel_pid="$!" function _exit { - echo "Cleanup..." - kill "$ibazel_pid" - git checkout src/index.html + echo "Cleanup..." + kill "$ibazel_pid" + git checkout src/index.html } trap _exit EXIT echo "Waiting for $1 devserver to launch on 8080..." while ! nc -z localhost 8080; do - echo "." - sleep 0.5 # wait before check again + echo "." + sleep 0.5 # wait before check again done echo "Waiting 5 seconds for devservers to settle..." @@ -39,8 +39,8 @@ sleep 5 echo "Devserver ready" if ! curl http://localhost:8080/index.html --fail 2>/dev/null | grep "Getting Started"; then - echo "ERROR: Expected http://localhost:8080/index.html to contain 'Getting Started'" - exit 1 + echo "ERROR: Expected http://localhost:8080/index.html to contain 'Getting Started'" + exit 1 fi _sedi 's#Getting Started#Goodbye#' src/index.html @@ -49,8 +49,8 @@ echo "Waiting 5 seconds for ibazel rebuild after change to src/index.html..." sleep 5 if ! curl http://localhost:8080/index.html --fail 2>/dev/null | grep "Goodbye"; then - echo "ERROR: Expected http://localhost:8080/index.html to contain 'Goodbye'" - exit 1 + echo "ERROR: Expected http://localhost:8080/index.html to contain 'Goodbye'" + exit 1 fi echo "All tests passed" diff --git a/js/private/bash.bzl b/js/private/bash.bzl index 3021c95d1..6095ec0ed 100644 --- a/js/private/bash.bzl +++ b/js/private/bash.bzl @@ -10,10 +10,10 @@ BASH_INITIALIZE_RUNFILES = r""" # It helps to determine if we are running on a Windows environment (excludes WSL as it acts like Unix) case "$(uname -s)" in - CYGWIN*) _IS_WINDOWS=1 ;; - MINGW*) _IS_WINDOWS=1 ;; - MSYS_NT*) _IS_WINDOWS=1 ;; - *) _IS_WINDOWS=0 ;; +CYGWIN*) _IS_WINDOWS=1 ;; +MINGW*) _IS_WINDOWS=1 ;; +MSYS_NT*) _IS_WINDOWS=1 ;; +*) _IS_WINDOWS=0 ;; esac # It helps to normalizes paths when running on Windows. @@ -25,7 +25,7 @@ function _normalize_path { # Apply the followings paths transformations to normalize paths on Windows # -process driver letter # -convert path separator - sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' <<< "$1" + sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' <<<"$1" else echo "$1" fi @@ -89,7 +89,7 @@ else fi if [ ! -L "$self" ]; then - break; + break fi readlink="$(readlink "$self")" diff --git a/js/private/js_binary.sh.tpl b/js/private/js_binary.sh.tpl index c2e81c4bf..ee4d0218f 100644 --- a/js/private/js_binary.sh.tpl +++ b/js/private/js_binary.sh.tpl @@ -32,10 +32,10 @@ function logf_stderr { local format_string="$1\n" shift if [ "${STDERR_CAPTURE:-}" ]; then - # shellcheck disable=SC2059 + # shellcheck disable=SC2059,SC2046 echo -e $(printf "$format_string" "$@") >>"$STDERR_CAPTURE" else - # shellcheck disable=SC2059 + # shellcheck disable=SC2059,SC2046 echo -e $(printf "$format_string" "$@") >&2 fi } @@ -129,7 +129,6 @@ trap _exit EXIT # Initialize RUNFILES environment variable # ============================================================================== {{initialize_runfiles}} - # TODO(2.0): export only JS_BINARY__RUNFILES export RUNFILES JS_BINARY__RUNFILES="$RUNFILES" @@ -164,7 +163,7 @@ if [[ "${bazel_out_segment:-}" ]]; then else # We in runfiles and we don't yet know the execroot rest="${PWD#*"$bazel_out_segment"}" - index=$(( ${#PWD} - ${#rest} - ${#bazel_out_segment} )) + index=$((${#PWD} - ${#rest} - ${#bazel_out_segment})) if [ ${index} -lt 0 ]; then printf "\nERROR: %s: No 'bazel-out' folder found in path '${PWD}'\n" "$JS_BINARY__LOG_PREFIX" >&2 exit 1 @@ -297,10 +296,10 @@ ARGS=() ALL_ARGS=({{fixed_args}} "$@") for ARG in ${ALL_ARGS[@]+"${ALL_ARGS[@]}"}; do case "$ARG" in - # Let users pass through arguments to node itself - --node_options=*) JS_BINARY__NODE_OPTIONS+=( "${ARG#--node_options=}" ) ;; - # Remaining argv is collected to pass to the program - *) ARGS+=( "$ARG" ) + # Let users pass through arguments to node itself + --node_options=*) JS_BINARY__NODE_OPTIONS+=("${ARG#--node_options=}") ;; + # Remaining argv is collected to pass to the program + *) ARGS+=("$ARG") ;; esac done @@ -314,8 +313,8 @@ export JS_BINARY__FS_PATCH_ROOTS # Enable coverage if requested if [ "${COVERAGE_DIR:-}" ]; then - logf_debug "enabling v8 coverage support ${COVERAGE_DIR}" - export NODE_V8_COVERAGE=${COVERAGE_DIR} + logf_debug "enabling v8 coverage support ${COVERAGE_DIR}" + export NODE_V8_COVERAGE=${COVERAGE_DIR} fi # Put the node wrapper directory on the path so that child processes find it first @@ -432,7 +431,7 @@ if [ "${JS_BINARY__EXPECTED_EXIT_CODE:-}" ]; then if [ $RESULT -eq 0 ]; then # This exit code is handled specially by Bazel: # https://github.com/bazelbuild/bazel/blob/486206012a664ecb20bdb196a681efc9a9825049/src/main/java/com/google/devtools/build/lib/util/ExitCode.java#L44 - readonly BAZEL_EXIT_TESTS_FAILED=3; + readonly BAZEL_EXIT_TESTS_FAILED=3 exit $BAZEL_EXIT_TESTS_FAILED fi exit $RESULT @@ -443,7 +442,7 @@ fi if [ "${JS_BINARY__EXIT_CODE_OUTPUT_FILE:-}" ]; then # Exit zero if the exit code was captured - echo -n "$RESULT" > "$JS_BINARY__EXIT_CODE_OUTPUT_FILE" + echo -n "$RESULT" >"$JS_BINARY__EXIT_CODE_OUTPUT_FILE" exit 0 else exit $RESULT diff --git a/js/private/test/BUILD.bazel b/js/private/test/BUILD.bazel index 58be75f23..3053d6659 100644 --- a/js/private/test/BUILD.bazel +++ b/js/private/test/BUILD.bazel @@ -15,6 +15,7 @@ write_file( js_binary( name = "shellcheck_launcher", entry_point = "shellcheck.js", + fixed_args = ["--my_arg"], ) # Make sed replacements for consistency on different platform diff --git a/js/private/test/image/structure/digests.sum b/js/private/test/image/structure/digests.sum index ef59f436a..b37a73046 100644 --- a/js/private/test/image/structure/digests.sum +++ b/js/private/test/image/structure/digests.sum @@ -1,2 +1,2 @@ -b44c02668701d4db8430edae7d6f6ecede824e704d5c46226e2b32cc20633407 +9546c440ffbbe36177f305a1aec4bf89fa08eea5926fe828c8e9edd8e08a16a7 f68066745a57eff40fc49b4600cdde860dfa86ab231ebe4ed65097c98cc2df4f diff --git a/js/private/test/shellcheck_launcher.sh b/js/private/test/shellcheck_launcher.sh index 4c963a0ce..28963d9f8 100644 --- a/js/private/test/shellcheck_launcher.sh +++ b/js/private/test/shellcheck_launcher.sh @@ -43,10 +43,10 @@ function logf_stderr { local format_string="$1\n" shift if [ "${STDERR_CAPTURE:-}" ]; then - # shellcheck disable=SC2059 + # shellcheck disable=SC2059,SC2046 echo -e $(printf "$format_string" "$@") >>"$STDERR_CAPTURE" else - # shellcheck disable=SC2059 + # shellcheck disable=SC2059,SC2046 echo -e $(printf "$format_string" "$@") >&2 fi } @@ -142,10 +142,10 @@ trap _exit EXIT # It helps to determine if we are running on a Windows environment (excludes WSL as it acts like Unix) case "$(uname -s)" in - CYGWIN*) _IS_WINDOWS=1 ;; - MINGW*) _IS_WINDOWS=1 ;; - MSYS_NT*) _IS_WINDOWS=1 ;; - *) _IS_WINDOWS=0 ;; +CYGWIN*) _IS_WINDOWS=1 ;; +MINGW*) _IS_WINDOWS=1 ;; +MSYS_NT*) _IS_WINDOWS=1 ;; +*) _IS_WINDOWS=0 ;; esac # It helps to normalizes paths when running on Windows. @@ -157,7 +157,7 @@ function _normalize_path { # Apply the followings paths transformations to normalize paths on Windows # -process driver letter # -convert path separator - sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' <<< "$1" + sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' <<<"$1" else echo "$1" fi @@ -221,7 +221,7 @@ else fi if [ ! -L "$self" ]; then - break; + break fi readlink="$(readlink "$self")" @@ -246,7 +246,6 @@ if [ "${RUNFILES:0:1}" != "/" ]; then RUNFILES="$PWD/$RUNFILES" fi - # TODO(2.0): export only JS_BINARY__RUNFILES export RUNFILES JS_BINARY__RUNFILES="$RUNFILES" @@ -281,7 +280,7 @@ if [[ "${bazel_out_segment:-}" ]]; then else # We in runfiles and we don't yet know the execroot rest="${PWD#*"$bazel_out_segment"}" - index=$(( ${#PWD} - ${#rest} - ${#bazel_out_segment} )) + index=$((${#PWD} - ${#rest} - ${#bazel_out_segment})) if [ ${index} -lt 0 ]; then printf "\nERROR: %s: No 'bazel-out' folder found in path '${PWD}'\n" "$JS_BINARY__LOG_PREFIX" >&2 exit 1 @@ -411,13 +410,13 @@ JS_BINARY__NODE_OPTIONS=() JS_BINARY__NODE_OPTIONS+=("--preserve-symlinks-main") ARGS=() -ALL_ARGS=( "$@") +ALL_ARGS=(--my_arg "$@") for ARG in ${ALL_ARGS[@]+"${ALL_ARGS[@]}"}; do case "$ARG" in - # Let users pass through arguments to node itself - --node_options=*) JS_BINARY__NODE_OPTIONS+=( "${ARG#--node_options=}" ) ;; - # Remaining argv is collected to pass to the program - *) ARGS+=( "$ARG" ) + # Let users pass through arguments to node itself + --node_options=*) JS_BINARY__NODE_OPTIONS+=("${ARG#--node_options=}") ;; + # Remaining argv is collected to pass to the program + *) ARGS+=("$ARG") ;; esac done @@ -431,8 +430,8 @@ export JS_BINARY__FS_PATCH_ROOTS # Enable coverage if requested if [ "${COVERAGE_DIR:-}" ]; then - logf_debug "enabling v8 coverage support ${COVERAGE_DIR}" - export NODE_V8_COVERAGE=${COVERAGE_DIR} + logf_debug "enabling v8 coverage support ${COVERAGE_DIR}" + export NODE_V8_COVERAGE=${COVERAGE_DIR} fi # Put the node wrapper directory on the path so that child processes find it first @@ -549,7 +548,7 @@ if [ "${JS_BINARY__EXPECTED_EXIT_CODE:-}" ]; then if [ $RESULT -eq 0 ]; then # This exit code is handled specially by Bazel: # https://github.com/bazelbuild/bazel/blob/486206012a664ecb20bdb196a681efc9a9825049/src/main/java/com/google/devtools/build/lib/util/ExitCode.java#L44 - readonly BAZEL_EXIT_TESTS_FAILED=3; + readonly BAZEL_EXIT_TESTS_FAILED=3 exit $BAZEL_EXIT_TESTS_FAILED fi exit $RESULT @@ -560,7 +559,7 @@ fi if [ "${JS_BINARY__EXIT_CODE_OUTPUT_FILE:-}" ]; then # Exit zero if the exit code was captured - echo -n "$RESULT" > "$JS_BINARY__EXIT_CODE_OUTPUT_FILE" + echo -n "$RESULT" >"$JS_BINARY__EXIT_CODE_OUTPUT_FILE" exit 0 else exit $RESULT diff --git a/npm/private/lifecycle/bundle.sh b/npm/private/lifecycle/bundle.sh index 08d4e1cd2..5e09c8036 100755 --- a/npm/private/lifecycle/bundle.sh +++ b/npm/private/lifecycle/bundle.sh @@ -16,5 +16,5 @@ npm install npx -y rollup -c # ascii_only avoids bad unicode conversions, fixing # https://github.com/aspect-build/rules_js/issues/45 -npx -y terser@5.12.1 min/index.js -b ascii_only=true > min/index.min.js +npx -y terser@5.12.1 min/index.js -b ascii_only=true >min/index.min.js rm min/index.js diff --git a/npm/private/noop.sh b/npm/private/noop.sh index 451814e2f..ec5b9e5f3 100755 --- a/npm/private/noop.sh +++ b/npm/private/noop.sh @@ -1,2 +1,2 @@ #!/usr/bin/env sh -exit 0 \ No newline at end of file +exit 0 diff --git a/npm/private/test/npm_package_publish/test.sh b/npm/private/test/npm_package_publish/test.sh index b37737e7f..6b6bb25e5 100755 --- a/npm/private/test/npm_package_publish/test.sh +++ b/npm/private/test/npm_package_publish/test.sh @@ -3,20 +3,22 @@ readonly PUBLISH_A="$1" readonly PUBLISH_B="$2" -# assert that it prints package name from package.json to stderr, +# assert that it prints package name from package.json to stderr, # to ensure package directory is properly passed and npm can read it. $PUBLISH_A 2>&1 | grep 'npm notice package: @mycorp/pkg-b@' +# shellcheck disable=SC2181 if [ $? != 0 ]; then echo "FAIL: expected 'npm notice package: @mycorp/pkg-b@' error" exit 1 fi -# asserting that npm_package has no package.json in it's srcs and we fail correctly. +# asserting that npm_package has no package.json in it's srcs and we fail correctly. # npm publish requires a package.json in the root of the package directory. $PUBLISH_B 2>&1 | grep 'npm ERR! enoent This is related to npm not being able to find a file.' +# shellcheck disable=SC2181 if [ $? != 0 ]; then - echo "FAIL: expected 'npm ERR! enoent This is related to npm not being able to find a file.' error" - exit 1 + echo "FAIL: expected 'npm ERR! enoent This is related to npm not being able to find a file.' error" + exit 1 fi diff --git a/npm/private/test/repositories_checked.bzl b/npm/private/test/repositories_checked.bzl index 9edd4942c..7c506e45a 100644 --- a/npm/private/test/repositories_checked.bzl +++ b/npm/private/test/repositories_checked.bzl @@ -26478,7 +26478,7 @@ def npm_repositories(): "@types/caseless": ["registry.npmjs.org/@types/caseless@0.12.2"], "@types/tough-cookie": ["registry.npmjs.org/@types/tough-cookie@4.0.2"], }, - lifecycle_hooks = ["prepare"], + lifecycle_hooks = ["build"], lifecycle_hooks_execution_requirements = [], )