From 6dd88aadac73648e497a8c8b6ee79c901d80b259 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 1 Jul 2021 21:41:53 +0200 Subject: [PATCH] fix(dev-infra): api-golden tool does not specify a tsconfig and breaks for consumers (#42737) Tools that are shipped as a Bazel rule with the shared dev-infra tool require a specific `tsconfig` as otherwise `ts_library` will accidentally look for a tsconfig in `@npm//:tsconfig` and the build will fail. We bring in our dev-infra tsconfig and reference it explicitly. PR Close #42737 --- dev-infra/BUILD.bazel | 5 +++++ dev-infra/bazel/api-golden/BUILD.bazel | 3 +++ 2 files changed, 8 insertions(+) diff --git a/dev-infra/BUILD.bazel b/dev-infra/BUILD.bazel index 5cd5d2c63f..8e9670d775 100644 --- a/dev-infra/BUILD.bazel +++ b/dev-infra/BUILD.bazel @@ -2,6 +2,8 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") load("@npm//@bazel/typescript:index.bzl", "ts_library") load("//dev-infra:index.bzl", "ng_dev_rolled_up_generated_file") +exports_files(["tsconfig.json"]) + ts_library( name = "cli", srcs = [ @@ -43,6 +45,9 @@ pkg_npm( name = "npm_package", srcs = [ "index.bzl", + # Some tools within `dev-infra` which are shipped as Bazel rules might + # rely on a tsconfig file. We bring the config into the NPM package. + "tsconfig.json", "//dev-infra/bazel:files", "//dev-infra/benchmark:files", ], diff --git a/dev-infra/bazel/api-golden/BUILD.bazel b/dev-infra/bazel/api-golden/BUILD.bazel index 0ab29df547..1c417b7d2c 100644 --- a/dev-infra/bazel/api-golden/BUILD.bazel +++ b/dev-infra/bazel/api-golden/BUILD.bazel @@ -15,6 +15,9 @@ ts_library( "index_npm_packages.ts", "test_api_report.ts", ], + # A tsconfig needs to be specified as otherwise `ts_library` will look for the config + # in `//:package.json` and this breaks when the BUILD file is copied to `@npm//`. + tsconfig = "//dev-infra:tsconfig.json", deps = [ "@npm//@bazel/runfiles", "@npm//@microsoft/api-extractor",