diff --git a/.eslintignore b/.eslintignore index f5fc2f625..373bf7a87 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,7 +2,6 @@ *_uncompressed*.js gulpfile.js /msg/* -/built/* /dist/* /core/utils/global.js /tests/blocks/* diff --git a/.gitignore b/.gitignore index ea2fce879..02387abda 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,5 @@ local_build/*compiler*.jar local_build/local_*_compressed.js chromedriver typings/tmp/* -built/ +build/ dist/ diff --git a/scripts/gulpfiles/config.js b/scripts/gulpfiles/config.js index 30434f8c0..8f8424c6c 100644 --- a/scripts/gulpfiles/config.js +++ b/scripts/gulpfiles/config.js @@ -12,6 +12,12 @@ var path = require('path'); // Paths are all relative to the repository root. Do not include // trailing slash. +// +// TODO(#5007): If you modify these values, you must also modify the +// corresponding values in the following files: +// +// - tests/scripts/compile_typings.sh +// - tests/scripts/check_metadata.sh module.exports = { // Directory to write compiled output to. BUILD_DIR: 'build', diff --git a/tests/scripts/check_metadata.sh b/tests/scripts/check_metadata.sh index 4b02649b7..a35257c8e 100755 --- a/tests/scripts/check_metadata.sh +++ b/tests/scripts/check_metadata.sh @@ -7,7 +7,10 @@ # Run this script to get the new values. # Location of the pre-built compressed files. -readonly BUILD_DIR='built' +# +# (TODO(#5007): Should fetch this from scripts/gulpfiles/config.js +# instead of hardcoding it here. +readonly BUILD_DIR='build' # These values should be updated with each release. (Note that the # historic values are tab-delimited.) @@ -65,6 +68,14 @@ readonly BOLD_GREEN='\033[1;32m' readonly BOLD_RED='\033[1;31m' readonly ANSI_RESET='\033[0m' +# Terminate immediately with non-zero status if any command exits +# with non-zero status, printing a nice message. +set -e +function fail { + echo -e "${BOLD_RED}Error while checking metadata.${ANSI_RESET}" >&2 +} +trap fail ERR + # GZip them for additional size comparisons (keep originals, force # overwite previously-gzipped copies). echo "Zipping the compressed files" diff --git a/tests/scripts/compile_typings.sh b/tests/scripts/compile_typings.sh index 893407732..35e9d56dc 100755 --- a/tests/scripts/compile_typings.sh +++ b/tests/scripts/compile_typings.sh @@ -1,13 +1,24 @@ #!/bin/bash # Location that npm run typings will write .d.ts files to. -readonly BUILD_DIR='built' +# +# (TODO(#5007): Should fetch this from scripts/gulpfiles/config.js +# instead of hardcoding it here. +readonly BUILD_DIR='build' # ANSI colors BOLD_GREEN='\033[1;32m' BOLD_RED='\033[1;31m' ANSI_RESET='\033[0m' +# Terminate immediately with non-zero status if any command exits +# with non-zero status, printing a nice message. +set -e +function fail { + echo -e "${BOLD_RED}Failed to compile TypeScript typings.${ANSI_RESET}" >&2 +} +trap fail ERR + # Generate Blockly typings. echo "Generating Blockly typings" npm run typings @@ -18,12 +29,4 @@ echo "Compiling typings" cd "${BUILD_DIR}" ../node_modules/.bin/tsc blockly.d.ts - -if [ $? -eq 0 ] -then - echo -e "${BOLD_GREEN}TypeScript typings compiled successfully.${ANSI_RESET}" - exit 0 -else - echo -e "${BOLD_RED}Failed to compile TypeScript typings.${ANSI_RESET}" >&2 - exit 1 -fi +echo -e "${BOLD_GREEN}TypeScript typings compiled successfully.${ANSI_RESET}"