Skip to content

Commit dc3997f

Browse files
authored
Fix emit duplicate sh_binary rules by parse_yarn_lock.js (#32)
Previously iteration over the entries map was done rather than the de-duplicated cache map. This PR also fixes a bug where filenames with '$' were not being copied correctly.
1 parent 9337ee0 commit dc3997f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

node/internal/node_binary.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _copy_module(ctx, output_dir, module):
2828
dst_filename = _get_filename_relative_to_module(module, src)
2929
dst = ctx.new_file('%s/node_modules/%s' % (output_dir, dst_filename))
3030
outputs.append(dst)
31-
script_lines.append('cp %s %s' % (src.path, dst.path))
31+
script_lines.append("cp '%s' '%s'" % (src.path, dst.path))
3232

3333
ctx.file_action(
3434
output = script_file,

node/internal/node_module.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _copy_file(ctx, src, dst):
108108
mnemonic = "CopyFileToNodeModule",
109109
inputs = [src],
110110
outputs = [dst],
111-
command = "cp %s %s" % (src.path, dst.path),
111+
command = "cp '%s' '%s'" % (src.path, dst.path),
112112
)
113113
return dst
114114

node/internal/parse_yarn_lock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ entries.forEach(entry => printNodeModule(entry));
2121

2222
printNodeModules(cache);
2323

24-
entries.forEach(entry => parsePackageJson(entry));
24+
cache.forEach(entry => parsePackageJson(entry));
2525

2626
print("");
2727
print("# EOF");

0 commit comments

Comments
 (0)