mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-26 09:11:01 +03:00
allow customizing extra args
This commit is contained in:
parent
bd08b25e85
commit
2cc0bff87e
1
BUCK
1
BUCK
@ -21,6 +21,7 @@ node_modules(
|
||||
extra_files = {
|
||||
"lib": "//lib:src"
|
||||
},
|
||||
extra_args = ["--include=dev"],
|
||||
)
|
||||
|
||||
npm_bin(
|
||||
|
@ -21,6 +21,10 @@ def _node_modules_impl(ctx: "context") -> [DefaultInfo.type]:
|
||||
for (name, value) in (ctx.attrs.extra_files or {}).items():
|
||||
cmd.add(cmd_args(value, format = "--extra-file=" + name + "={}"))
|
||||
|
||||
if ctx.attrs.extra_args:
|
||||
cmd.add("--")
|
||||
cmd.add(ctx.attrs.extra_args)
|
||||
|
||||
ctx.actions.run(cmd, category = "npm")
|
||||
|
||||
return [DefaultInfo(default_output = out)]
|
||||
@ -37,6 +41,10 @@ node_modules = rule(
|
||||
),
|
||||
default = None,
|
||||
),
|
||||
"extra_args": attrs.option(
|
||||
attrs.list(attrs.arg()),
|
||||
default = None,
|
||||
),
|
||||
"_node_toolchain": attrs.toolchain_dep(
|
||||
default = "toolchains//:node",
|
||||
providers = [NodeToolchainInfo],
|
||||
|
@ -11,7 +11,6 @@ import tempfile
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("out", help="Where you want node_modules to end up")
|
||||
parser.add_argument(
|
||||
"--package",
|
||||
help="The package.json to install dependencies from",
|
||||
@ -32,8 +31,14 @@ if __name__ == "__main__":
|
||||
metavar="FILE=SRC",
|
||||
help="Add a file that the package needs, sourced from the given path. This may be used, for example, to add files needed by a prepublish script.",
|
||||
)
|
||||
parser.add_argument("out", help="Where you want node_modules to end up")
|
||||
parser.add_argument(
|
||||
"npm_args",
|
||||
nargs="*",
|
||||
help="Specify extra args for the call to `npm clean-install`",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_intermixed_args()
|
||||
|
||||
if args.bin_dir:
|
||||
os.environ["PATH"] = "{}:{}".format(
|
||||
@ -56,7 +61,8 @@ if __name__ == "__main__":
|
||||
|
||||
os.symlink(os.path.abspath(src), os.path.join(tempdir, target))
|
||||
|
||||
cmd = ["npm", "clean-install", "--foreground-scripts"]
|
||||
cmd = ["npm", "clean-install"] + args.npm_args
|
||||
print(cmd)
|
||||
|
||||
proc = subprocess.Popen(cmd, cwd=tempdir)
|
||||
proc.communicate()
|
||||
|
Loading…
Reference in New Issue
Block a user