Skip to content

Commit

Permalink
refactor: always replace __files__ var in tsconfig template (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored Sep 20, 2024
1 parent 4f26edc commit a2d6cd6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ts/private/ts_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ def _write_tsconfig_rule(ctx):
content = content.replace("__extends__", extends_path)

filtered_files = _filter_input_files(ctx.files.files, ctx.attr.allow_js, ctx.attr.resolve_json_module)
if filtered_files:
# Update file paths to be relative to the tsconfig file, including a ./ prefix
# to ensure paths are all relative to the config file.
package_prefix = ctx.label.package + "/"
filtered_files = [
"./" + f.short_path.removeprefix(package_prefix)
for f in filtered_files
]

content = content.replace("\"__files__\"", str(filtered_files))

# Update file paths to be relative to the tsconfig file, including a ./ prefix
# to ensure paths are all relative to the config file.
package_prefix = ctx.label.package + "/"
filtered_files = [
"./" + f.short_path.removeprefix(package_prefix)
for f in filtered_files
]

content = content.replace("\"__files__\"", str(filtered_files))
ctx.actions.write(
output = ctx.outputs.out,
content = content,
Expand Down

0 comments on commit a2d6cd6

Please sign in to comment.