forked from bazel-contrib/rules_nodejs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): generate tsconfig.json for ts_project
This is an experimental, opt-in feature where ts_project will generate a tsconfig.json file in place of the user specifying one in the source directory. I expect a long tail of compatibility bugs since any path appearing in this generated file needs to point from bazel-out back to the source directory. Fixes bazel-contrib#2058
- Loading branch information
Alex Eagle
committed
Aug 20, 2020
1 parent
660b456
commit 3a506e9
Showing
7 changed files
with
105 additions
and
38 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
32 changes: 32 additions & 0 deletions
32
packages/typescript/test/ts_project/generated_tsconfig/BUILD.bazel
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,32 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test") | ||
load("//packages/typescript:index.bzl", "ts_project") | ||
|
||
ts_project( | ||
name = "compile1", | ||
srcs = glob(["*.ts*"]), | ||
config = {}, | ||
out_dir = "1", | ||
) | ||
|
||
generated_file_test( | ||
name = "test1", | ||
src = "empty_config.js_", | ||
generated = ":1/a.js", | ||
) | ||
|
||
ts_project( | ||
name = "compile2", | ||
srcs = glob(["*.ts*"]), | ||
config = { | ||
"compilerOptions": { | ||
"module": "esnext", | ||
}, | ||
}, | ||
out_dir = "2", | ||
) | ||
|
||
generated_file_test( | ||
name = "test2", | ||
src = "esnext.js_", | ||
generated = ":2/a.js", | ||
) |
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 @@ | ||
export const a: string = 'hello world'; |
3 changes: 3 additions & 0 deletions
3
packages/typescript/test/ts_project/generated_tsconfig/empty_config.js_
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,3 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.a = 'hello world'; |
1 change: 1 addition & 0 deletions
1
packages/typescript/test/ts_project/generated_tsconfig/esnext.js_
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 @@ | ||
export var a = 'hello world'; |