dhbaird / bazel-custom-rules

Custom Bazel build rules to compile TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bazel custom build rules for TypeScript

Custom Bazel build rules to compile TypeScript.

Syntax

ts_library(
  name = "externs",
  srcs = ["externs.d.ts"],
)

ts_library(
  name = "common",
  srcs = ["common.ts"],
  deps = [":externs"],
)

ts_binary(
  name = "main"
  srcs = ["main.ts"],
  deps = [":common"],
  flags = [
      "--removeComments",
      "--noEmitOnError",
  ],
)

Build example

  1. Install Bazel
  2. Add load("/build-rules/typescript", "ts_library", "ts_binary") to %bazel/tools/build_rules/prelude_bazel
  3. Run git clone https://github.com/zmxv/bazel-custom-rules && cd bazel-custom-rules
  4. Run bazel build //examples/typescript:main
  5. Examine the output in bazel-bin/examples/typescript/main.js

About

Custom Bazel build rules to compile TypeScript


Languages

Language:Python 100.0%