mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
Migrates the schematics-cli tests to `rules_js`. Notably a little extra logic was needed here as the tests were relying on the built npm package at runtime, resolvable via it's "package name". To address this, we manually link the package for the test at runtime. The spec file is moved into a separate folder for this reason, so that we don't accidentally expose the schematics CLI package for unexpected reasons.
90 lines
2.3 KiB
Python
90 lines
2.3 KiB
Python
load("@npm2//:defs.bzl", "npm_link_all_packages")
|
|
load("//tools:defaults2.bzl", "npm_package", "ts_project")
|
|
load("//tools:ts_json_schema.bzl", "ts_json_schema")
|
|
|
|
# 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
|
|
licenses(["notice"])
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
npm_link_all_packages()
|
|
|
|
RUNTIME_ASSETS = [
|
|
"blank/schema.json",
|
|
"collection.json",
|
|
"package.json",
|
|
"schematic/schema.json",
|
|
] + glob(
|
|
include = [
|
|
"blank/project-files/**/*",
|
|
"blank/schematic-files/**/*",
|
|
"schematic/files/**/*",
|
|
],
|
|
)
|
|
|
|
# @angular-devkit/schematics-cli
|
|
ts_project(
|
|
name = "schematics_cli",
|
|
srcs = glob(
|
|
include = ["**/*.ts"],
|
|
exclude = [
|
|
"**/*_spec.ts",
|
|
"schematic/files/**",
|
|
"blank/project-files/**",
|
|
"blank/schematic-files/**",
|
|
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
|
|
"node_modules/**",
|
|
],
|
|
) + [
|
|
# These files are generated from the JSON schema
|
|
"//packages/angular_devkit/schematics_cli:blank/schema.ts",
|
|
"//packages/angular_devkit/schematics_cli:schematic/schema.ts",
|
|
],
|
|
data = RUNTIME_ASSETS,
|
|
module_name = "@angular-devkit/schematics-cli",
|
|
deps = [
|
|
":node_modules/@angular-devkit/core",
|
|
":node_modules/@angular-devkit/schematics",
|
|
"//:node_modules/@inquirer/prompts",
|
|
"//:node_modules/@types/node",
|
|
"//:node_modules/@types/yargs-parser",
|
|
"//:node_modules/ansi-colors",
|
|
"//:node_modules/symbol-observable",
|
|
"//:node_modules/yargs-parser",
|
|
],
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "blank_schema",
|
|
src = "blank/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "schematic_schema",
|
|
src = "schematic/schema.json",
|
|
)
|
|
|
|
genrule(
|
|
name = "license",
|
|
srcs = ["//:LICENSE"],
|
|
outs = ["LICENSE"],
|
|
cmd = "cp $(execpath //:LICENSE) $@",
|
|
)
|
|
|
|
npm_package(
|
|
name = "pkg",
|
|
pkg_deps = [
|
|
"//packages/angular_devkit/schematics:package.json",
|
|
"//packages/angular_devkit/core:package.json",
|
|
],
|
|
tags = ["release-package"],
|
|
deps = RUNTIME_ASSETS + [
|
|
":README.md",
|
|
":license",
|
|
":schematics_cli_rjs",
|
|
],
|
|
)
|