Skip to content

Commit

Permalink
fix(typescript): pass rootDir to ts_project tsc actions (bazel-contri…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored Mar 27, 2020
1 parent 1a83a7f commit 13caf8b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/typescript/src/internal/ts_project.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def _ts_project_impl(ctx):
ctx.file.tsconfig.short_path,
"--outDir",
"/".join([ctx.bin_dir.path, ctx.label.package]),
# Make sure TypeScript writes outputs to same directory structure as inputs
"--rootDir",
ctx.label.package if ctx.label.package else ".",
])
if len(ctx.outputs.typings_outs) > 0:
arguments.add_all([
Expand Down
4 changes: 4 additions & 0 deletions packages/typescript/test/ts_project/rootdir/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@npm_bazel_typescript//:index.bzl", "ts_project")

# Ensure that subdir/a.ts produces outDir/subdir/a.js
ts_project()
1 change: 1 addition & 0 deletions packages/typescript/test/ts_project/rootdir/subdir/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const a: string = 'hello';
1 change: 1 addition & 0 deletions packages/typescript/test/ts_project/rootdir/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 13caf8b

Please sign in to comment.