Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(6.0): remove internal typescript tools #3649

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ generate_codeowners(
# do not sort
owners = [
"//:OWNERS",
"//examples:OWNERS.examples_jest",
"//examples:OWNERS.examples_nestjs",
"//examples:OWNERS.examples_angular",
"//examples:OWNERS.examples_angular_bazel_architect",
],
)

Expand Down
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
# To update, run:
# yarn update-codeowners

* @mattem @gregmagolan @alexeagle
/examples/jest/** @mrmeku @alexeagle @gregmagolan @mattem
/examples/nestjs/** @zachgrayio @zMotivat0r @rayman1104 @siberex @alexeagle @gregmagolan @mattem
/examples/angular/** @alan-agius4 @jbedard @alexeagle @gregmagolan @mattem
/examples/angular_bazel_architect/** @alan-agius4 @jbedard @alexeagle @gregmagolan @mattem
* @mattem @gregmagolan @alexeagle @jbedard
9 changes: 1 addition & 8 deletions docs/Built-ins.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/Providers.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
"checked_in_ts_project rule"
"checked_in_tsc rule"

load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
load("//packages/typescript:index.bzl", "ts_project")
load("//internal:tsc.bzl", "tsc")

def checked_in_ts_project(name, src, checked_in_js = None, tsconfig = None, **kwargs):
"""
In rules_nodejs "builtin" package, we are creating the toolchain for building
tsc-wrapped and executing ts_project, so we cannot depend on them.
However, we still want to be able to write our tooling in TypeScript.
This macro lets us check in the resulting .js files, and still ensure that they are
compiled from the .ts by using a golden file test.
"""
def checked_in_tsc(name, src, checked_in_js = None, tsconfig = None, **kwargs):
"""A tsc rule that also asserts that the generated JS is up-to-date."""
if not checked_in_js:
checked_in_js = src[:-3] + ".js"

if tsconfig == None:
tsconfig = "//:tsconfig.json"

ts_project(
tsc(
name = name,
srcs = [src],
tsconfig = tsconfig,
Expand Down
4 changes: 2 additions & 2 deletions internal/coverage/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# BEGIN-INTERNAL
load("//packages/typescript:checked_in_ts_project.bzl", "checked_in_ts_project")
load("//internal:checked_in_tsc.bzl", "checked_in_tsc")

checked_in_ts_project(
checked_in_tsc(
name = "lcov_merger_js_lib",
src = "lcov_merger.ts",
checked_in_js = "lcov_merger-js.js",
Expand Down
4 changes: 2 additions & 2 deletions internal/linker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

# BEGIN-INTERNAL
load("//:index.bzl", "js_library")
load("//packages/typescript:checked_in_ts_project.bzl", "checked_in_ts_project")
load("//internal:checked_in_tsc.bzl", "checked_in_tsc")

# We can't bootstrap the ts_library rule using the linker itself,
# because the implementation of ts_library depends on the linker so that would be a cycle.
# So we compile it to JS and check in the result as index.js.
# To update index.js run:
# bazel run //internal/linker:linker_lib_check_compiled.update
checked_in_ts_project(
checked_in_tsc(
name = "linker_lib",
src = "link_node_modules.ts",
checked_in_js = "index.js",
Expand Down
4 changes: 2 additions & 2 deletions internal/linker/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("//packages/typescript:index.bzl", "ts_project")
load("//internal:tsc.bzl", "tsc")

ts_project(
tsc(
name = "test_lib",
srcs = glob(["*.ts"]),
deps = [
Expand Down
4 changes: 2 additions & 2 deletions internal/linker/test/multi_linker/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("//packages/typescript:checked_in_ts_project.bzl", "checked_in_ts_project")
load("//internal:checked_in_tsc.bzl", "checked_in_tsc")

checked_in_ts_project(
checked_in_tsc(
name = "checked_in_test",
src = "test.ts",
checked_in_js = "checked_in_test.js",
Expand Down
4 changes: 2 additions & 2 deletions internal/npm_install/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# BEGIN-INTERNAL
# avoid leaking a ts dependency
load("//packages/typescript:checked_in_ts_project.bzl", "checked_in_ts_project")
load("//internal:checked_in_tsc.bzl", "checked_in_tsc")

# Using checked in ts library like the linker
# To update index.js run:
# bazel run //internal/npm_install:compile_generate_build_file_check_compiled.update
checked_in_ts_project(
checked_in_tsc(
name = "compile_generate_build_file",
src = "generate_build_file.ts",
checked_in_js = "index.js",
Expand Down
12 changes: 1 addition & 11 deletions internal/npm_install/npm_install.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ The above links will create the targets,
@npm//target
```

that can be referenced as `data` or `deps` by other rules such as `nodejs_binary` and `ts_project`
that can be referenced as `data` or `deps` by other rules such as `nodejs_binary`
and can be required as `@scope/target` and `target` with standard node_modules resolution at runtime,

```
Expand All @@ -168,16 +168,6 @@ nodejs_binary(
"@npm//other/dep"
],
)

ts_project(
name = "test",
srcs = [...],
deps = [
"@npm//@scope/target",
"@npm//target"
"@npm//other/dep"
],
)
```
""",
),
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_npm/pkg_npm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ my_rule(
# Used in angular/angular /packages/bazel/src/ng_package/ng_package.bzl
PKG_NPM_ATTRS = {
"deps": attr.label_list(
doc = """Other targets which produce files that should be included in the package`""",
doc = """Other targets which produce files that should be included in the package""",
allow_files = True,
),
"nested_packages": attr.label_list(
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_npm/test/pkg_npm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('pkg_npm', () => {
it('copies files from other packages', () => {
expect(readFromPkg('dependent_file')).toEqual('dependent_file content');
});
it('copies js files from ts_project', () => {
it('copies js files from tsc', () => {
expect(readFromPkg('foo.js')).toContain('exports.a = \'\';');
});
it('copies data dependencies', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/typescript/index.bzl → internal/tsc.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@npm//typescript:index.bzl", "tsc")
load("@npm//typescript:index.bzl", _tsc = "tsc")

# Basic wrapper around tsc to replace ts_project()
def ts_project(name, srcs, deps = [], data = [], tsconfig = "//:tsconfig.json", **kwargs):
# Basic wrapper around tsc to replace tsc()
def tsc(name, srcs, deps = [], data = [], tsconfig = "//:tsconfig.json", **kwargs):
outs = [s.replace(".ts", ".js") for s in srcs] + [s.replace(".ts", ".d.ts") for s in srcs]

tsc(
_tsc(
name = name,
args = [
"-p",
Expand Down
2 changes: 0 additions & 2 deletions nodejs/private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files(["ts_project_options_validator.js"])

filegroup(
name = "package_contents",
srcs = glob(["*"]) + [
Expand Down
152 changes: 0 additions & 152 deletions nodejs/private/ts_config.bzl

This file was deleted.

Loading