2018-05-04 01:44:29 +03:00
|
|
|
template("npm_action") {
|
|
|
|
assert(defined(invoker.script),
|
|
|
|
"Need script name to run (must be defined in package.json)")
|
2018-10-04 02:03:26 +03:00
|
|
|
assert(defined(invoker.args), "Need script argumets")
|
2018-05-04 01:44:29 +03:00
|
|
|
|
2019-02-15 01:28:41 +03:00
|
|
|
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]),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-05-04 01:44:29 +03:00
|
|
|
action(target_name) {
|
2018-10-04 02:03:26 +03:00
|
|
|
forward_variables_from(invoker,
|
|
|
|
[
|
|
|
|
"deps",
|
|
|
|
"public_deps",
|
|
|
|
"sources",
|
|
|
|
"inputs",
|
|
|
|
"outputs",
|
|
|
|
])
|
2019-02-15 01:28:41 +03:00
|
|
|
if (!defined(deps)) {
|
|
|
|
deps = []
|
|
|
|
}
|
|
|
|
deps += [ ":npm_pre_flight_" + target_name ]
|
|
|
|
|
2018-05-04 01:44:29 +03:00
|
|
|
script = "//electron/build/npm-run.py"
|
|
|
|
args = [
|
2018-10-04 02:03:26 +03:00
|
|
|
"--silent",
|
|
|
|
invoker.script,
|
|
|
|
"--",
|
|
|
|
] + invoker.args
|
2018-05-04 01:44:29 +03:00
|
|
|
}
|
|
|
|
}
|