forked from aspect-build/rules_ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow targets as ts_project(assets, srcs)
Fix aspect-build#579 Fix aspect-build#584
- Loading branch information
Showing
6 changed files
with
183 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"""Shows different ways to pass source files into ts_project""" | ||
|
||
load("@aspect_rules_ts//ts:defs.bzl", "ts_project") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
|
||
write_file( | ||
name = "gen-a-ts", | ||
out = "a.ts", | ||
content = [ | ||
"export const a = 42", | ||
], | ||
) | ||
|
||
write_file( | ||
name = "gen-b.ts", # Ensure this name has a ".ts" suffix! | ||
out = "b.ts", | ||
content = [ | ||
"export const a = 42", | ||
], | ||
) | ||
|
||
ts_project( | ||
name = "out-refs", | ||
srcs = [ | ||
"a.ts", | ||
"b.ts", | ||
], | ||
declaration = True, | ||
out_dir = "out-refs", | ||
source_map = True, | ||
) | ||
|
||
ts_project( | ||
name = "out-target-refs", | ||
srcs = [ | ||
":a.ts", | ||
":b.ts", | ||
], | ||
declaration = True, | ||
out_dir = "out-target-refs", | ||
source_map = True, | ||
) | ||
|
||
ts_project( | ||
name = "target-refs", | ||
srcs = [ | ||
":gen-a-ts", | ||
":gen-b.ts", | ||
], | ||
declaration = True, | ||
out_dir = "target-refs", | ||
source_map = True, | ||
) | ||
|
||
build_test( | ||
name = "test", | ||
targets = [ | ||
# pre-declared outputs | ||
"out-refs/a.js", | ||
"out-refs/a.js.map", | ||
"out-refs/a.d.ts", | ||
"out-refs/b.js", | ||
"out-refs/b.js.map", | ||
"out-refs/b.d.ts", | ||
|
||
# ts_project targets | ||
":out-refs", | ||
":out-target-refs", | ||
":target-refs", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"declaration": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters