diff --git a/packages/bazel/package.json b/packages/bazel/package.json index 6caa8554faf..3023ae53fcf 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -11,8 +11,7 @@ "api-extractor": "./src/api-extractor/index.js", "ngc-wrapped": "./src/ngc-wrapped/index.js", "packager": "./src/ng_package/packager.js", - "xi18n": "./src/ngc-wrapped/extract_i18n.js", - "modify_tsconfig": "./src/modify_tsconfig.js" + "xi18n": "./src/ngc-wrapped/extract_i18n.js" }, "typings": "./src/ngc-wrapped/index.d.ts", "bazelBin": { diff --git a/packages/bazel/src/BUILD.bazel b/packages/bazel/src/BUILD.bazel index 5a5ec0b0093..e1498ab4dc9 100644 --- a/packages/bazel/src/BUILD.bazel +++ b/packages/bazel/src/BUILD.bazel @@ -1,4 +1,3 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") # BEGIN-DEV-ONLY package(default_visibility = ["//packages/bazel:__subpackages__"]) @@ -7,13 +6,4 @@ filegroup( name = "package_assets", srcs = glob(["*"]), ) - -nodejs_binary( - name = "modify_tsconfig", - data = [ - "modify_tsconfig.js", - ], - entry_point = ":modify_tsconfig.js", - visibility = ["//visibility:public"], -) # END-DEV-ONLY diff --git a/packages/bazel/src/modify_tsconfig.js b/packages/bazel/src/modify_tsconfig.js deleted file mode 100755 index 55d3c6a7ccc..00000000000 --- a/packages/bazel/src/modify_tsconfig.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @fileoverview Read a tsconfig.json file intended to produce production mode - * JS output, modify it to produce esm5 output instead, and write the result - * to disk. - */ -const fs = require('fs'); -const path = require('path'); - -function main(args) { - if (args.length < 3) { - console.error('Usage: $0 input.tsconfig.json output.tsconfig.json newRoot binDir'); - } - - const [input, output, newRoot, binDir] = args; - const data = JSON.parse(fs.readFileSync(input, {encoding: 'utf-8'})); - const {compilerOptions, bazelOptions} = data; - - // Relative path to the execroot that refers to the directory for the ES5 output files. - const newOutputBase = path.posix.join(binDir, newRoot); - - // Update the compiler options to produce ES5 output. Also ensure that the new ES5 output - // directory is used. - compilerOptions['target'] = 'es5'; - compilerOptions['outDir'] = path.posix.join(compilerOptions['outDir'], newRoot); - - bazelOptions['es5Mode'] = true; - bazelOptions['tsickleExternsPath'] = - bazelOptions['tsickleExternsPath'].replace(binDir, newOutputBase); - - if (data['angularCompilerOptions']) { - const {angularCompilerOptions} = data; - // Don't enable tsickle's closure conversions - angularCompilerOptions['annotateForClosureCompiler'] = false; - // Note: It's important that the "expectedOut" is only modified in a way that still - // keeps posix normalized paths. Otherwise this could cause unexpected behavior because - // ngc-wrapped is expecting POSIX paths and the TypeScript Bazel rules by default only pass - // POSIX paths as well. - angularCompilerOptions['expectedOut'] = angularCompilerOptions['expectedOut'].map( - f => f.replace(/\.mjs$/, '.js').replace(binDir, newOutputBase)); - } - fs.writeFileSync(output, JSON.stringify(data)); -} - -if (require.main === module) { - process.exitCode = main(process.argv.slice(2)); -}