workaround transient npm failures (#4989)

This commit is contained in:
Alex Lam S.L
2021-05-30 10:19:29 +01:00
committed by GitHub
parent 06e3dbc089
commit f4f0d2a2dd
11 changed files with 95 additions and 21 deletions

View File

@@ -58,22 +58,29 @@ if (typeof phantom == "undefined") {
}).listen(); }).listen();
server.on("listening", function() { server.on("listening", function() {
var port = server.address().port; var port = server.address().port;
if (debug) { if (debug) return console.log("http://localhost:" + port + "/");
console.log("http://localhost:" + port + "/"); var cmd = process.platform == "win32" ? "npm.cmd" : "npm";
} else (function install() {
child_process.spawn(process.platform == "win32" ? "npm.cmd" : "npm", [ function npm(args, done) {
child_process.spawn(cmd, args, { stdio: [ "ignore", 1, 2 ] }).on("exit", done);
}
(function install() {
npm([
"install", "install",
"phantomjs-prebuilt@2.1.14", "phantomjs-prebuilt@2.1.14",
"--no-audit", "--no-audit",
"--no-optional", "--no-optional",
"--no-save", "--no-save",
"--no-update-notifier", "--no-update-notifier",
], { ], function(code) {
stdio: [ "ignore", 1, 2 ]
}).on("exit", function(code) {
if (code) { if (code) {
console.log("npm install failed with code", code); console.log("npm install failed with code", code);
return install(); return npm([
"cache",
"clean",
"--force",
], install);
} }
var program = require("phantomjs-prebuilt").exec(process.argv[1], port); var program = require("phantomjs-prebuilt").exec(process.argv[1], port);
program.stdout.pipe(process.stdout); program.stdout.pipe(process.stdout);

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/acorn \ rm -rf tmp/acorn \
&& git clone https://github.com/acornjs/acorn.git tmp/acorn \ && git clone https://github.com/acornjs/acorn.git tmp/acorn \
&& cd tmp/acorn \ && cd tmp/acorn \
@@ -89,7 +96,7 @@ minify_in_situ "acorn/src" \
&& minify_in_situ "acorn-loose/src" \ && minify_in_situ "acorn-loose/src" \
&& minify_in_situ "acorn-walk/src" \ && minify_in_situ "acorn-walk/src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm install \ && npm_install \
&& rm -rf acorn/dist acorn-loose/dist acorn-walk/dist \ && rm -rf acorn/dist acorn-loose/dist acorn-walk/dist \
&& npm run build \ && npm run build \
&& minify_in_situ "acorn/dist" \ && minify_in_situ "acorn/dist" \

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/bootstrap \ rm -rf tmp/bootstrap \
&& git clone --depth 1 --branch v5.0.0-beta2 https://github.com/twbs/bootstrap.git tmp/bootstrap \ && git clone --depth 1 --branch v5.0.0-beta2 https://github.com/twbs/bootstrap.git tmp/bootstrap \
&& cd tmp/bootstrap \ && cd tmp/bootstrap \
@@ -171,7 +178,7 @@ rm -rf tmp/bootstrap \
EOF EOF
ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
rm -rf node_modules \ rm -rf node_modules \
&& npm ci \ && npm_install \
&& minify_in_situ "node_modules/@popperjs/core" \ && minify_in_situ "node_modules/@popperjs/core" \
&& rm -rf dist/js/* \ && rm -rf dist/js/* \
&& minify_in_situ "build" \ && minify_in_situ "build" \

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/buble \ rm -rf tmp/buble \
&& git clone https://github.com/bublejs/buble.git tmp/buble \ && git clone https://github.com/bublejs/buble.git tmp/buble \
&& cd tmp/buble \ && cd tmp/buble \
@@ -38,7 +45,7 @@ EOF
ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
minify_in_situ "src" \ minify_in_situ "src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm ci \ && npm_install \
&& rm -rf dist \ && rm -rf dist \
&& npm run build \ && npm run build \
&& minify_in_situ "dist" \ && minify_in_situ "dist" \

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/butternut \ rm -rf tmp/butternut \
&& git clone https://github.com/Rich-Harris/butternut.git tmp/butternut \ && git clone https://github.com/Rich-Harris/butternut.git tmp/butternut \
&& cd tmp/butternut \ && cd tmp/butternut \
@@ -38,7 +45,7 @@ EOF
ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
minify_in_situ "src" \ minify_in_situ "src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm install \ && npm_install \
&& rm -rf dist \ && rm -rf dist \
&& npm run build \ && npm run build \
&& minify_in_situ "dist" \ && minify_in_situ "dist" \

View File

@@ -36,7 +36,9 @@ EOF
} }
if [ $NATIVE ]; then unset -f timeout; fi if [ $NATIVE ]; then unset -f timeout; fi
git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs while !(git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs); do
rm -rf ~/.nvs
done
while ! timeout 60 bash -c ". ~/.nvs/nvs.sh add $NODE && nvs use $NODE"; do while ! timeout 60 bash -c ". ~/.nvs/nvs.sh add $NODE && nvs use $NODE"; do
cd ~/.nvs cd ~/.nvs
while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done
@@ -51,4 +53,6 @@ npm config set save false
npm config set strict-ssl false npm config set strict-ssl false
npm config set update-notifier false npm config set update-notifier false
npm --version npm --version
while !(npm install); do echo "'npm install' failed - retrying..."; done while !(npm install); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done

View File

@@ -18,6 +18,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/mathjs \ rm -rf tmp/mathjs \
&& git clone --depth 1 --branch v9.2.0 https://github.com/josdejong/mathjs.git tmp/mathjs \ && git clone --depth 1 --branch v9.2.0 https://github.com/josdejong/mathjs.git tmp/mathjs \
&& cd tmp/mathjs \ && cd tmp/mathjs \
@@ -191,7 +198,7 @@ minify_in_situ "bin" \
&& minify_in_situ "test" \ && minify_in_situ "test" \
&& minify_in_situ "tools" \ && minify_in_situ "tools" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm ci \ && npm_install \
&& rm -rf lib \ && rm -rf lib \
&& npm run build \ && npm run build \
&& minify_in_situ "lib" \ && minify_in_situ "lib" \

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/rollup \ rm -rf tmp/rollup \
&& git clone https://github.com/rollup/rollup.git tmp/rollup \ && git clone https://github.com/rollup/rollup.git tmp/rollup \
&& cd tmp/rollup \ && cd tmp/rollup \
@@ -77,7 +84,7 @@ minify_in_situ "bin" \
&& minify_in_situ "browser" \ && minify_in_situ "browser" \
&& minify_in_situ "src" \ && minify_in_situ "src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm ci \ && npm_install \
&& rm -rf dist \ && rm -rf dist \
&& npm run build \ && npm run build \
&& minify_in_situ "dist" \ && minify_in_situ "dist" \

View File

@@ -24,6 +24,13 @@ EOF
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/rollup \ rm -rf tmp/rollup \
&& git clone --depth 1 --branch v2.39.1 https://github.com/rollup/rollup.git tmp/rollup \ && git clone --depth 1 --branch v2.39.1 https://github.com/rollup/rollup.git tmp/rollup \
&& cd tmp/rollup \ && cd tmp/rollup \
@@ -44,11 +51,11 @@ rm -rf tmp/rollup \
+sander.rimrafSync(__dirname, 'samples', 'watch', 'watch-config-initial-error'); +sander.rimrafSync(__dirname, 'samples', 'watch', 'watch-config-initial-error');
EOF EOF
ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
npm install esbuild-wasm@0.8.56 \ npm_install esbuild-wasm@0.8.56 \
&& minify_in_situ "cli" \ && minify_in_situ "cli" \
&& minify_in_situ "src" \ && minify_in_situ "src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm ci \ && npm_install \
&& rm -rf dist \ && rm -rf dist \
&& npm run build \ && npm run build \
&& minify_in_situ "dist" \ && minify_in_situ "dist" \

View File

@@ -28,6 +28,13 @@ EOF
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/sucrase \ rm -rf tmp/sucrase \
&& git clone https://github.com/alangpierce/sucrase.git tmp/sucrase \ && git clone https://github.com/alangpierce/sucrase.git tmp/sucrase \
&& cd tmp/sucrase \ && cd tmp/sucrase \
@@ -83,10 +90,10 @@ rm -rf tmp/sucrase \
+export { getJSXPragmaInfo as HACK }; +export { getJSXPragmaInfo as HACK };
EOF EOF
ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
npm install esbuild-wasm@0.8.56 \ npm_install esbuild-wasm@0.8.56 \
&& minify_in_situ "src" \ && minify_in_situ "src" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm install \ && npm_install \
&& npm run clean \ && npm run clean \
&& npm run build \ && npm run build \
&& minify_in_situ "dist" \ && minify_in_situ "dist" \

View File

@@ -14,6 +14,13 @@ minify_in_situ() {
uglify-js $ARGS uglify-js $ARGS
} }
npm_install() {
PKG="$1"
while !(npm install $PKG); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done
}
rm -rf tmp/web-tooling-benchmark \ rm -rf tmp/web-tooling-benchmark \
&& git clone --depth 1 --branch v0.5.3 https://github.com/v8/web-tooling-benchmark.git tmp/web-tooling-benchmark \ && git clone --depth 1 --branch v0.5.3 https://github.com/v8/web-tooling-benchmark.git tmp/web-tooling-benchmark \
&& cd tmp/web-tooling-benchmark \ && cd tmp/web-tooling-benchmark \
@@ -47,7 +54,7 @@ ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
minify_in_situ "src" \ minify_in_situ "src" \
&& minify_in_situ "third_party" \ && minify_in_situ "third_party" \
&& rm -rf node_modules \ && rm -rf node_modules \
&& npm ci \ && npm_install \
&& rm -rf build/* \ && rm -rf build/* \
&& npm run build:terser-bundled \ && npm run build:terser-bundled \
&& npm run build:uglify-js-bundled \ && npm run build:uglify-js-bundled \