mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-13 06:16:31 +00:00
chore(scripts): rebuild instead of removing node_modules
(#1215)
As removing the `node_modules` completely and then re-installing is quite time consuming and SSD-thrashing, resort to pruning and rebuilding native add-ons when switching targets. Change-Type: patch
This commit is contained in:
parent
f50feba78d
commit
cbc9dfecf6
12
Makefile
12
Makefile
@ -471,18 +471,7 @@ endif
|
|||||||
|
|
||||||
.PHONY: $(TARGETS)
|
.PHONY: $(TARGETS)
|
||||||
|
|
||||||
# Note that we need to remove `node_modules` every time.
|
|
||||||
# Since we use an `npm-shrinkwrap.json` file, if you pull changes
|
|
||||||
# that update a dependency and try to `npm install` directly, npm
|
|
||||||
# will complain that your `node_modules` tree is not equal to what
|
|
||||||
# is defined by the `npm-shrinkwrap.json` file, and will thus
|
|
||||||
# refuse to do anything but install from scratch.
|
|
||||||
# The `node_modules` directory also needs to be wiped out if you're
|
|
||||||
# changing between target architectures, since compiled add-ons
|
|
||||||
# will not work otherwise.
|
|
||||||
|
|
||||||
cli-develop:
|
cli-develop:
|
||||||
rm -rf node_modules
|
|
||||||
./scripts/build/dependencies-npm.sh \
|
./scripts/build/dependencies-npm.sh \
|
||||||
-r "$(TARGET_ARCH)" \
|
-r "$(TARGET_ARCH)" \
|
||||||
-v "$(ELECTRON_VERSION)" \
|
-v "$(ELECTRON_VERSION)" \
|
||||||
@ -490,7 +479,6 @@ cli-develop:
|
|||||||
-s "$(TARGET_PLATFORM)"
|
-s "$(TARGET_PLATFORM)"
|
||||||
|
|
||||||
electron-develop:
|
electron-develop:
|
||||||
rm -rf node_modules
|
|
||||||
./scripts/build/dependencies-npm.sh \
|
./scripts/build/dependencies-npm.sh \
|
||||||
-r "$(TARGET_ARCH)" \
|
-r "$(TARGET_ARCH)" \
|
||||||
-v "$(ELECTRON_VERSION)" \
|
-v "$(ELECTRON_VERSION)" \
|
||||||
|
@ -96,6 +96,18 @@ if [ "$ARGV_PRODUCTION" == "true" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function run_install() {
|
function run_install() {
|
||||||
|
|
||||||
|
# Since we use an `npm-shrinkwrap.json` file, if you pull changes
|
||||||
|
# that update a dependency and try to `npm install` directly, npm
|
||||||
|
# will complain that your `node_modules` tree is not equal to what
|
||||||
|
# is defined by the `npm-shrinkwrap.json` file, and will thus
|
||||||
|
# refuse to do anything but install from scratch.
|
||||||
|
npm prune
|
||||||
|
|
||||||
|
# When changing between target architectures, rebuild all dependencies,
|
||||||
|
# since compiled add-ons will not work otherwise.
|
||||||
|
npm rebuild
|
||||||
|
|
||||||
npm install $INSTALL_OPTS
|
npm install $INSTALL_OPTS
|
||||||
|
|
||||||
if [ "$ARGV_PRODUCTION" == "true" ]; then
|
if [ "$ARGV_PRODUCTION" == "true" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user