Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

try a simple approach for default tsconfig #45

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package(default_visibility = ["//visibility:public"])

load("@angular//:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module")

ng_module(
name = "src",
srcs = glob(["*.ts"]),
tsconfig = ":tsconfig.json",
deps = ["//src/hello-world"],
)

Expand Down
5 changes: 2 additions & 3 deletions src/hello-world/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package(default_visibility = ["//visibility:public"])

load("@angular//:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module", "ts_library")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")

sass_binary(
name = "hello-world-styles",
Expand All @@ -20,7 +20,6 @@ ng_module(
"hello-world.module.ts",
],
assets = [":hello-world-styles"],
tsconfig = "//src:tsconfig.json",
deps = [
"//src/lib",
"@rxjs",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("//tools:defaults.bzl", "ts_library")

ts_library(
name = "lib",
Expand Down
1 change: 1 addition & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": true,
"lib": [
"dom",
"es5",
Expand Down
1 change: 1 addition & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker that this is a Bazel package
14 changes: 14 additions & 0 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
load("@angular//:index.bzl", _ng_module = "ng_module")

DEFAULT_TSCONFIG = "//src:tsconfig.json"

def ts_library(tsconfig = None, **kwargs):
if not tsconfig:
tsconfig = DEFAULT_TSCONFIG
_ts_library(tsconfig = tsconfig, **kwargs)

def ng_module(tsconfig = None, **kwargs):
if not tsconfig:
tsconfig = DEFAULT_TSCONFIG
_ng_module(tsconfig = tsconfig, **kwargs)