Declare runtime dependencies

These are needed for local dev, and users must install them as well. See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies

Rules

http_archive_version

Re-implementation of http_archive that can read the version from package.json

Example usage (generated)

load("@rules_ts//ts:repositories.bzl", "http_archive_version")

http_archive_version(
    # A unique name for this repository.
    name = "",
    # A dictionary from local repository name to global repository name
    repo_mapping = {},
)

name

A unique name for this repository.

build_file

The BUILD file to symlink into the created repository.

integrity

Needed only if the ts version isn't mirrored in versions.bzl.

repo_mapping

A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

urls

URLs to fetch from. Each must have one {}-style placeholder.

version

Explicit version for urls placeholder. If provided, the package.json is not read.

version_from

Location of package.json which may have a version for the package.


Macros and Functions

rules_ts_dependencies

Dependencies needed by users of rules_ts.

To skip fetching the typescript package, define repository called 'npm_typescript' before calling this.

Example usage (generated)

load("@rules_ts//ts:repositories.bzl", "rules_ts_dependencies")

rules_ts_dependencies(
)

ts_version_from

label of a json file (typically package.json) which declares an exact typescript version in a dependencies or devDependencies property. Exactly one of ts_version or ts_version_from must be set.

ts_version

version of the TypeScript compiler. Exactly one of ts_version or ts_version_from must be set.

ts_integrity

integrity hash for the npm package. By default, uses values mirrored into rules_ts. For example, to get the integrity of version 4.6.3 you could run curl --silent https://registry.npmjs.org/typescript/4.6.3 | jq -r '.dist.integrity'