From 425fb98d708e7b6a0127e6cf7cdc203211ad8dfd Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Tue, 14 Jul 2020 23:29:47 +0100 Subject: [PATCH] Expand comment about `postinstall` --- scripts/postinstall.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index e14b318..0ca5207 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -1,5 +1,12 @@ -// There doesn't appear to be a way to skip `postinstall`, -// as doing `yarn --ignore-scripts` could prevent native packages from building: +// This allows `postinstall` to be skipped via `SKIP_YARN_POSTINSTALL=true`. +// This is useful when building a Docker image because it lets you +// take advantage of cached Docker layers and run Yarn +// only if `package.json` or `yarn.lock` changed, +// and not every time source code is updated: +// https://nodejs.org/en/docs/guides/nodejs-docker-webapp/ +// +// However, there doesn't appear to be a way to skip `postinstall`, +// and doing `yarn --ignore-scripts` could prevent native packages from building: // https://github.com/yarnpkg/yarn/issues/4100 const { execSync } = require("child_process");