-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): add json to ts_project DefaultInfo, fix #1988
- Loading branch information
Showing
10 changed files
with
92 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test") | ||
load("//packages/typescript:index.bzl", "ts_project") | ||
|
||
SRCS = glob(["**/*.ts*"]) + [ | ||
"subdir/foo.json", | ||
"bar.json", | ||
] | ||
|
||
ts_project( | ||
name = "tsconfig", | ||
srcs = SRCS, | ||
outdir = "foobar", | ||
) | ||
|
||
ts_project( | ||
name = "tsconfig-no-outdir", | ||
srcs = SRCS, | ||
tsconfig = "tsconfig.json", | ||
) | ||
|
||
generated_file_test( | ||
name = "test-subdir", | ||
src = "foo.golden.json", | ||
# Refers to the output from tsconfig ts_project above | ||
generated = ":foobar/subdir/foo.json", | ||
) | ||
|
||
generated_file_test( | ||
name = "test", | ||
src = "bar.golden.json", | ||
# Refers to the output from tsconfig ts_project above | ||
generated = ":foobar/bar.json", | ||
) | ||
|
||
# We cannot reuse foo.golden.json bc tsc inserts a newline when | ||
# it copies to outdir | ||
generated_file_test( | ||
name = "test-subdir-no-outdir", | ||
src = "foo-no-outdir.golden.json", | ||
# Refers to the output from tsconfig-no-outdir ts_project above | ||
generated = ":subdir/foo.json", | ||
) | ||
|
||
# We cannot reuse bar.golden.json bc tsc inserts a newline when | ||
# it copies to outdir | ||
generated_file_test( | ||
name = "test-no-outdir", | ||
src = "bar-no-outdir.golden.json", | ||
# Refers to the output from tsconfig-no-outdir ts_project above | ||
generated = ":bar.json", | ||
) |
3 changes: 3 additions & 0 deletions
3
packages/typescript/test/ts_project/json/bar-no-outdir.golden.json
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 @@ | ||
{ | ||
"name": "bar" | ||
} |
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 @@ | ||
{ | ||
"name": "bar" | ||
} |
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 @@ | ||
{ | ||
"name": "bar" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/typescript/test/ts_project/json/foo-no-outdir.golden.json
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 @@ | ||
{ | ||
"name": "json" | ||
} |
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 @@ | ||
{ | ||
"name": "json" | ||
} |
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,4 @@ | ||
export const a: string = 'hello'; | ||
import {name} from './foo.json' | ||
export {name} from '../bar.json' | ||
export const jsonName = name |
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 @@ | ||
{ | ||
"name": "json" | ||
} |
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": { | ||
"types": [], | ||
"resolveJsonModule": true | ||
} | ||
} |