Skip to content

Commit

Permalink
Sandbox npm_repository install
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Terrington committed Oct 23, 2017
1 parent 92dfc1f commit 5fa06fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion node/internal/npm_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def _npm_repository_impl(ctx):
node = ctx.path(ctx.attr._node)
nodedir = node.dirname.dirname
npm = ctx.path(ctx.attr._npm)
install_path = ctx.path("._npmtemp")
cache_path = ctx.path("._npmcache")

modules = []
Expand All @@ -27,6 +28,8 @@ def _npm_repository_impl(ctx):
npm,
"install",
"--global",
"--prefix",
install_path,
"--cache",
cache_path,
]
Expand Down Expand Up @@ -59,7 +62,7 @@ def _npm_repository_impl(ctx):
deps_cmd = [
node,
"-p",
"deps=require('%s/lib/node_modules/%s/package.json').dependencies;if(deps){JSON.stringify(Object.keys(deps).map(d=>'//'+d))}else{'[]'}" % (nodedir, module)
"deps=require('%s/lib/node_modules/%s/package.json').dependencies;if(deps){JSON.stringify(Object.keys(deps).map(d=>'//'+d))}else{'[]'}" % (install_path, module)
]
deps = execute(ctx, deps_cmd).stdout
ctx.file("%s/BUILD" % module, BUILD_FILE.format(
Expand Down

0 comments on commit 5fa06fd

Please sign in to comment.