build: add a pre-flight check to all NPM steps in GN to ensure that we have the right NPM deps installed (#16974)

This commit is contained in:
Samuel Attard 2019-02-14 14:28:41 -08:00 committed by GitHub
parent 28638b0a6b
commit 4ccd6d5900
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 39 deletions

View file

@ -3,6 +3,26 @@ template("npm_action") {
"Need script name to run (must be defined in package.json)")
assert(defined(invoker.args), "Need script argumets")
action("npm_pre_flight_" + target_name) {
inputs = [
"package.json",
"package-lock.json",
]
script = "//electron/build/npm-run.py"
outputs = [
"$target_gen_dir/npm_pre_stamps/" + target_name + ".stamp",
]
args = [
"--silent",
"pre-flight",
"--",
"--stamp",
rebase_path(outputs[0]),
]
}
action(target_name) {
forward_variables_from(invoker,
[
@ -12,6 +32,11 @@ template("npm_action") {
"inputs",
"outputs",
])
if (!defined(deps)) {
deps = []
}
deps += [ ":npm_pre_flight_" + target_name ]
script = "//electron/build/npm-run.py"
args = [
"--silent",