angular/integration/npm_package_archives.bzl
Paul Gschwendtner 552ea77854 refactor(compiler-cli): drop tsickle code paths (#50602)
`tsickle` is not used in any code paths in 3P and we can remove
this complexity. The `tsickle` npm package has not been released
in a while and we are risking breakages with e.g. future TypeScript
versions.

Note that the `ng_module` rule was updated to not emit through
tsickle at all. The tsickle in 1P is done directly by `tsc_wrapped`
and our code path in `compiler-cli` is not needed at all.

PR Close #50602
2023-08-17 10:23:49 -07:00

46 lines
1.5 KiB
Python

# The @npm packages at the root node_modules are used by integration tests
# with `file:../../node_modules/foobar` references
NPM_PACKAGE_ARCHIVES = [
"@babel/core",
"@rollup/plugin-babel",
"@rollup/plugin-node-resolve",
"@rollup/plugin-commonjs",
"check-side-effects",
"jasmine",
"typescript",
"rxjs",
"systemjs",
"tslib",
"protractor",
"terser",
"rollup",
"rollup-plugin-sourcemaps",
"@angular/cli",
"@angular-devkit/build-angular",
"@bazel/bazelisk",
"@types/jasmine",
"@types/jasminewd2",
"@types/node",
]
def npm_package_archive_label(package_name):
return package_name.replace("/", "_").replace("@", "") + "_archive"
def npm_package_archives():
"""Function to generate pkg_tar definitions for WORKSPACE yarn_install manual_build_file_contents"""
npm_packages_to_archive = NPM_PACKAGE_ARCHIVES
result = """load("@rules_pkg//:pkg.bzl", "pkg_tar")
"""
for name in npm_packages_to_archive:
label_name = npm_package_archive_label(name)
last_segment_name = name.split("/")[-1]
result += """pkg_tar(
name = "{label_name}",
srcs = ["//{name}:{last_segment_name}__all_files"],
extension = "tar.gz",
strip_prefix = "/external/npm/node_modules/{name}",
# should not be built unless it is a dependency of another rule
tags = ["manual"],
)
""".format(name = name, label_name = label_name, last_segment_name = last_segment_name)
return result