This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The start of an example of how to use bazeltsc in your own project.
- Loading branch information
Showing
5 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bazel-* | ||
node_modules/ |
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,15 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary") | ||
load(":tsc.bzl", "tsc") | ||
|
||
nodejs_binary( | ||
name = "bazeltsc", | ||
entry_point = "bazeltsc/bin/bazeltsc", | ||
) | ||
|
||
# outputs are x.js, x.js.map, x.d.ts | ||
tsc( | ||
name = "x", | ||
srcs = ["x.ts"] | ||
) |
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,14 @@ | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
|
||
git_repository( | ||
name = "build_bazel_rules_nodejs", | ||
remote = "https://github.com/bazelbuild/rules_nodejs.git", | ||
tag = "0.1.0", # check for the latest tag when you install | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") | ||
|
||
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install | ||
# your npm dependencies. You must still run the package manager. | ||
node_repositories(package_json = ["//:package.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,16 @@ | ||
{ | ||
"name": "btsctest", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "Mike Morearty (https://github.com/mmorearty)", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"bazeltsc": "1.0.0", | ||
"typescript": "^2.6.1" | ||
} | ||
} |
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,5 @@ | ||
export class X { | ||
foo(n: number) { console.log(`This is X.foo ${n}`); } | ||
} | ||
|
||
new X().foo(7); |