Skip to content

Commit c7b9ae3

Browse files
authored
node_module: implement data file copy (#80)
1 parent fbefffb commit c7b9ae3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

node/internal/node_module.bzl

+7-3
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ def _node_module_impl(ctx):
159159
dst = ctx.new_file("%s/%s" % (name, _get_path_for_module_file(ctx, root_file, src, sourcemap)))
160160
outputs.append(_copy_file(ctx, src, dst))
161161

162+
for src in ctx.files.data:
163+
filename = src.short_path
164+
dst = ctx.actions.declare_file(filename, sibling = root_file)
165+
outputs.append(_copy_file(ctx, src, dst))
166+
162167
return struct(
163-
files = depset(outputs),
168+
files = depset(outputs + ctx.files.data),
164169
node_module = struct(
165170
identifier = name.replace(ctx.attr.separator, '_'),
166171
name = name,
@@ -230,10 +235,9 @@ node_module = rule(
230235
single_file = True,
231236
),
232237

233-
# Additional data files to be included in the module, but
234-
# excluded from the package.json 'files' attribute.
235238
"data": attr.label_list(
236239
allow_files = True,
240+
doc = "Additional data files to be included in the module, but excluded from the package.json 'files' attribute",
237241
),
238242

239243
# Module dependencies.

0 commit comments

Comments
 (0)