mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-04 07:02:12 +03:00
make it possible to run installation scripts in our repo
This commit is contained in:
parent
ecfce394df
commit
595dc838a1
3
BUCK
3
BUCK
@ -18,6 +18,9 @@ node_modules(
|
|||||||
name = "node_modules",
|
name = "node_modules",
|
||||||
package = "package.json",
|
package = "package.json",
|
||||||
package_lock = "package-lock.json",
|
package_lock = "package-lock.json",
|
||||||
|
extra_files = {
|
||||||
|
"lib": "//lib:src"
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
npm_bin(
|
npm_bin(
|
||||||
|
6
lib/BUCK
6
lib/BUCK
@ -5,3 +5,9 @@ genrule(
|
|||||||
cmd = "$(exe //:browserify) index.js --outfile $OUT",
|
cmd = "$(exe //:browserify) index.js --outfile $OUT",
|
||||||
visibility = ["//component-catalog:public"],
|
visibility = ["//component-catalog:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "src",
|
||||||
|
srcs = glob(["**/*.js"]),
|
||||||
|
visibility = ["//:node_modules"],
|
||||||
|
)
|
||||||
|
@ -6,21 +6,23 @@ def _node_modules_impl(ctx: "context") -> [DefaultInfo.type]:
|
|||||||
|
|
||||||
node_toolchain = ctx.attrs._node_toolchain[NodeToolchainInfo]
|
node_toolchain = ctx.attrs._node_toolchain[NodeToolchainInfo]
|
||||||
|
|
||||||
ctx.actions.run(
|
cmd = cmd_args(
|
||||||
[
|
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
||||||
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
node_toolchain.build_node_modules[DefaultInfo].default_outputs,
|
||||||
node_toolchain.build_node_modules[DefaultInfo].default_outputs,
|
out.as_output(),
|
||||||
out.as_output(),
|
"--package",
|
||||||
"--package",
|
ctx.attrs.package,
|
||||||
ctx.attrs.package,
|
"--package-lock",
|
||||||
"--package-lock",
|
ctx.attrs.package_lock,
|
||||||
ctx.attrs.package_lock,
|
"--bin-dir",
|
||||||
"--bin-dir",
|
node_toolchain.bin_dir[DefaultInfo].default_outputs,
|
||||||
node_toolchain.bin_dir[DefaultInfo].default_outputs,
|
|
||||||
],
|
|
||||||
category = "npm",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for (name, value) in (ctx.attrs.extra_files or {}).items():
|
||||||
|
cmd.add(cmd_args(value, format = "--extra-file=" + name + "={}"))
|
||||||
|
|
||||||
|
ctx.actions.run(cmd, category = "npm")
|
||||||
|
|
||||||
return [DefaultInfo(default_output = out)]
|
return [DefaultInfo(default_output = out)]
|
||||||
|
|
||||||
node_modules = rule(
|
node_modules = rule(
|
||||||
@ -28,6 +30,13 @@ node_modules = rule(
|
|||||||
attrs = {
|
attrs = {
|
||||||
"package": attrs.source(),
|
"package": attrs.source(),
|
||||||
"package_lock": attrs.source(),
|
"package_lock": attrs.source(),
|
||||||
|
"extra_files": attrs.option(
|
||||||
|
attrs.dict(
|
||||||
|
attrs.string(),
|
||||||
|
attrs.source(allow_directory = True),
|
||||||
|
),
|
||||||
|
default = None,
|
||||||
|
),
|
||||||
"_node_toolchain": attrs.toolchain_dep(
|
"_node_toolchain": attrs.toolchain_dep(
|
||||||
default = "toolchains//:node",
|
default = "toolchains//:node",
|
||||||
providers = [NodeToolchainInfo],
|
providers = [NodeToolchainInfo],
|
||||||
|
Loading…
Reference in New Issue
Block a user