/rules_typescript_deprecated

Bazel (http://bazel.io) build rules for typescript

Primary LanguagePythonMIT LicenseMIT

Bazel build rules for building TypeScript projects

These build rules allow TypeScript to be compiled by Bazel.

To load Typescript into your repo:

#### rules_node is a dependency so it must be included.

git_repository(
    name = "org_pubref_rules_node",
    commit = "99f4b5711612df28e4d874dda05c2c83ae0ff3b6",
    remote = "https://github.com/achew22/rules_node.git",
)

load("@org_pubref_rules_node//node:rules.bzl", "node_repositories")

node_repositories()
git_repository(
    name = "com_github_achew22_rules_typescript",
    commit = "16e11f74499234403ef20e75eca4d32b69221970",
    remote = "https://github.com/achew22/rules_typescript",
)

load("@com_github_achew22_rules_typescript//typescript:def.bzl", "typescript_repositories")
typescript_repositories()

Now you can import the build rules and use them like in this repo:

# BUILD
load("@com_github_achew22_bazel_typescript//typescript:def.bzl", "ts_library", "ts_binary")

ts_library(
    name = "lib",
    srcs = ["main.ts"],
)

ts_binary(
    name = "visionics",
    flags = [
        "--pretty",
    ],
    deps = [
        ":lib",
    ],
)

And:

# main.ts
alert("Hello world")

To try it out in this repo with the examples:

  1. Install Bazel
  2. Clone this repo
  3. Run bazel build //examples/walkthrough/...
  4. View the output in bazel-out/examples/walkthrough/*