From a2d6cd623b7072a493ea17b5ec5adeafa8b7a638 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Fri, 20 Sep 2024 16:53:30 -0700 Subject: [PATCH] refactor: always replace __files__ var in tsconfig template (#699) --- ts/private/ts_config.bzl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ts/private/ts_config.bzl b/ts/private/ts_config.bzl index 5637e360..29e92742 100644 --- a/ts/private/ts_config.bzl +++ b/ts/private/ts_config.bzl @@ -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,