diff --git a/.buildkite/commands/install-node-dependencies.sh b/.buildkite/commands/install-node-dependencies.sh index 2c69e9133b..23a52e0755 100755 --- a/.buildkite/commands/install-node-dependencies.sh +++ b/.buildkite/commands/install-node-dependencies.sh @@ -3,15 +3,20 @@ PLATFORM=$(uname -s) ARCHITECTURE=$(uname -m) NODE_VERSION=$(node --version) + PACKAGE_HASH=$(hash_file package-lock.json) GUTENBERG_PACKAGE_HASH=$(hash_file gutenberg/package-lock.json) -JETPACK_PACKAGE_HASH=$(hash_file jetpack/pnpm-lock.yaml) CACHEKEY="$BUILDKITE_PIPELINE_SLUG-npm-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$PACKAGE_HASH-$GUTENBERG_PACKAGE_HASH" + +JETPACK_PACKAGE_HASH=$(hash_file jetpack/pnpm-lock.yaml) PNPM_CACHEKEY="$BUILDKITE_PIPELINE_SLUG-pnpm-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$JETPACK_PACKAGE_HASH" +I18N_CACHEKEY="$BUILDKITE_PIPELINE_SLUG-i18n-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$PACKAGE_HASH-$GUTENBERG_PACKAGE_HASH" + echo "--- :npm: Restore cache if present" restore_cache "$CACHEKEY" restore_cache "$PNPM_CACHEKEY" +restore_cache "$I18N_CACHEKEY" echo "--- :npm: Install Node dependencies" npm ci --unsafe-perm --prefer-offline --no-audit --no-progress "$@" @@ -21,6 +26,7 @@ echo "--- :npm: Save cache if necessary" # Those get regenerated by npm ci as per Node reccomendations. # What we are caching is the root npm folder, which stores pacakge downloads so they are available if the package.json resolution demands them. save_cache "$HOME/.npm" "$CACHEKEY" +save_cache src/i18n-cache "$I18N_CACHEKEY" # If we attempted to save the pnpm cache when npm run with '--prefix gutenberg', the command might fail. # That's because the Jetpack submodule alone uses pnpm.