rules_multi_tsc
unknown
published unknown ago
13 stars
1 forks
1 watchers
Apache License 2.0
public

Please read this post.

Provides a single key rule, tsc, which allows a typescript project to be split into small libraries, and for those libraries to be independently compiled.

In contrast to rules_typescript, it depends on a few core bazel rules and has no other dependencies. You plug in your own nodejs executable, tsc implementation, and tsconfig.json.

Comes with bonus rules for creating and minifying js bundles, from the results of tsc compilation. All sourcemaps contain original typescript source code.

Installation

TODO

Example usage

load("@rules_multi_tsc//:def.bzl", "tsc")

tsc(
    name="tsc",
    ts_path="polygon",
    srcs=glob(["*.ts"]),
    deps=["//02_dependent/basics:tsc"],

    node_executable="@node//:bin/node",
    tsc_script="@node_modules_archive//:node_modules/typescript/lib/tsc.js",
    tsconfig_json="//:tsconfig.json",
)

This example compiles .ts files in the current directory, and makes associated typescript definitions available at the polygon path, e.g.:

import {Hexagon} from "polygon/hexagon"

Please see the scenarios directory for more examples.