Alan Agius e7413d3ae1 refactor: reduce dependencies on @angular-devkit/core
By converting schemas from TypeScript `interfaces` to `types`, we can minimize the reliance on `json.JsonObject`. This approach avoids the error "Type 'Schema' does not satisfy the constraint 'JsonObject'" caused by the missing index signature for type 'string' in 'Schema'.
2025-01-21 16:36:23 +01:00

125 lines
3.2 KiB
Python

# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
npm_link_all_packages()
ts_json_schema(
name = "webpack_schema",
src = "src/builders/webpack/schema.json",
)
ts_json_schema(
name = "webpack_dev_server_schema",
src = "src/builders/webpack-dev-server/schema.json",
)
RUNTIME_ASSETS = [
"builders.json",
"package.json",
"src/builders/webpack-dev-server/schema.json",
"src/builders/webpack/schema.json",
]
ts_project(
name = "build_webpack",
srcs = glob(
include = ["src/**/*.ts"],
exclude = [
"src/test-utils.ts",
"**/*_spec.ts",
],
) + [
"index.ts",
"//packages/angular_devkit/build_webpack:src/builders/webpack-dev-server/schema.ts",
"//packages/angular_devkit/build_webpack:src/builders/webpack/schema.ts",
],
data = RUNTIME_ASSETS,
module_name = "@angular-devkit/build-webpack",
deps = [
":node_modules/@angular-devkit/architect",
"//:node_modules/@types/node",
"//:node_modules/rxjs",
"//:node_modules/webpack",
"//:node_modules/webpack-dev-server",
],
)
ts_project(
name = "build_webpack_test_lib",
testonly = True,
srcs = glob(
include = [
"src/**/*_spec.ts",
],
),
data = glob(
include = [
"test/**/*",
],
),
deps = [
":build_webpack_rjs",
":node_modules/@angular-devkit/architect",
":node_modules/@angular-devkit/core",
":node_modules/@ngtools/webpack",
"//:node_modules/@types/jasmine",
],
)
jasmine_test(
name = "build_webpack_test",
data = [
"build_webpack_test_lib_rjs",
"//:node_modules/@angular/common",
"//:node_modules/@angular/compiler",
"//:node_modules/@angular/compiler-cli",
"//:node_modules/@angular/core",
"//:node_modules/@angular/platform-browser",
"//:node_modules/@angular/platform-browser-dynamic",
"//:node_modules/tslib",
"//:node_modules/typescript",
"//:node_modules/zone.js",
],
)
genrule(
name = "license",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $(execpath //:LICENSE) $@",
)
npm_package(
name = "pkg",
pkg_deps = [
"//packages/angular_devkit/architect:package.json",
],
tags = ["release-package"],
deps = RUNTIME_ASSETS + [
":README.md",
":build_webpack_rjs",
":license",
],
)
api_golden_test_npm_package(
name = "build_webpack_api",
data = [
":npm_package",
"//goldens:public-api",
],
golden_dir = "angular_cli/goldens/public-api/angular_devkit/build_webpack",
npm_package = "angular_cli/packages/angular_devkit/build_webpack/npm_package",
)