refactor(bazel): Remove Schematics for Bazel Builder (#37190)
This commit removes `ng-add` and `ng-new` schematics for the Bazel Builder, and update the corresponding BUILD files. PR Close #37190
This commit is contained in:
parent
9791c9ecaf
commit
a36667d984
|
@ -8,10 +8,8 @@ pkg_npm(
|
|||
) + [
|
||||
"//packages/bazel/src:package_assets",
|
||||
"//packages/bazel/src/api-extractor:package_assets",
|
||||
"//packages/bazel/src/builders:package_assets",
|
||||
"//packages/bazel/src/ng_package:package_assets",
|
||||
"//packages/bazel/src/ngc-wrapped:package_assets",
|
||||
"//packages/bazel/src/schematics:package_assets",
|
||||
"//packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf:package_assets",
|
||||
],
|
||||
nested_packages = [
|
||||
|
@ -29,10 +27,7 @@ pkg_npm(
|
|||
visibility = ["//integration:__pkg__"],
|
||||
deps = [
|
||||
"//packages/bazel/src/api-extractor:lib",
|
||||
"//packages/bazel/src/builders",
|
||||
"//packages/bazel/src/ng_package:lib",
|
||||
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
||||
"//packages/bazel/src/schematics/ng-add",
|
||||
"//packages/bazel/src/schematics/ng-new",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = [
|
||||
"builders.json",
|
||||
],
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "builders",
|
||||
srcs = [
|
||||
"bazel.ts",
|
||||
"index.ts",
|
||||
"schema.d.ts",
|
||||
],
|
||||
data = [
|
||||
"schema.json",
|
||||
] + glob(["files/**/*"]),
|
||||
module_name = "@angular/bazel/src/builders",
|
||||
deps = [
|
||||
"@npm//@angular-devkit/architect",
|
||||
"@npm//@angular-devkit/core",
|
||||
"@npm//@types/node",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"builders": {
|
||||
"build": {
|
||||
"implementation": "./index",
|
||||
"schema": "./schema.json",
|
||||
"description": "Executes Bazel on a target."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# This export allows targets in other packages to reference files that live
|
||||
# in this package.
|
||||
exports_files([
|
||||
"tsconfig.json",
|
||||
])
|
|
@ -1,92 +0,0 @@
|
|||
# WARNING: This file is generated and it's not meant to be edited.
|
||||
# Before making any changes, please read Bazel documentation.
|
||||
# https://docs.bazel.build/versions/master/be/workspace.html
|
||||
# The WORKSPACE file tells Bazel that this directory is a "workspace", which is like a project root.
|
||||
# The content of this file specifies all the external dependencies Bazel needs to perform a build.
|
||||
|
||||
####################################
|
||||
# ESModule imports (and TypeScript imports) can be absolute starting with the workspace name.
|
||||
# The name of the workspace should match the npm package where we publish, so that these
|
||||
# imports also make sense when referencing the published package.
|
||||
workspace(
|
||||
name = "project",
|
||||
managed_directories = {"@npm": ["node_modules"]},
|
||||
)
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
RULES_NODEJS_VERSION = "1.6.0"
|
||||
RULES_NODEJS_SHA256 = "f9e7b9f42ae202cc2d2ce6d698ccb49a9f7f7ea572a78fd451696d03ef2ee116"
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
sha256 = RULES_NODEJS_SHA256,
|
||||
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/%s/rules_nodejs-%s.tar.gz" % (RULES_NODEJS_VERSION, RULES_NODEJS_VERSION),
|
||||
)
|
||||
|
||||
# Rules for compiling sass
|
||||
RULES_SASS_VERSION = "1.24.0"
|
||||
RULES_SASS_SHA256 = "77e241148f26d5dbb98f96fe0029d8f221c6cb75edbb83e781e08ac7f5322c5f"
|
||||
http_archive(
|
||||
name = "io_bazel_rules_sass",
|
||||
sha256 = RULES_SASS_SHA256,
|
||||
strip_prefix = "rules_sass-%s" % RULES_SASS_VERSION,
|
||||
urls = [
|
||||
"https://github.com/bazelbuild/rules_sass/archive/%s.zip" % RULES_SASS_VERSION,
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/%s.zip" % RULES_SASS_VERSION,
|
||||
],
|
||||
)
|
||||
|
||||
####################################
|
||||
# Load and install our dependencies downloaded above.
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "node_repositories",
|
||||
"yarn_install")
|
||||
check_bazel_version(
|
||||
message = """
|
||||
You no longer need to install Bazel on your machine.
|
||||
Your project should have a dependency on the @bazel/bazel package which supplies it.
|
||||
Try running `yarn bazel` instead.
|
||||
(If you did run that, check that you've got a fresh `yarn install`)
|
||||
|
||||
""",
|
||||
minimum_bazel_version = "0.27.0",
|
||||
)
|
||||
|
||||
# Setup the Node repositories. We need a NodeJS version that is more recent than v10.15.0
|
||||
# because "selenium-webdriver" which is required for "ng e2e" cannot be installed.
|
||||
# TODO: remove the custom repositories once "rules_nodejs" supports v12.14.1 by default.
|
||||
node_repositories(
|
||||
node_repositories = {
|
||||
"12.14.1-darwin_amd64": ("node-v12.14.1-darwin-x64.tar.gz", "node-v12.14.1-darwin-x64", "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f"),
|
||||
"12.14.1-linux_amd64": ("node-v12.14.1-linux-x64.tar.xz", "node-v12.14.1-linux-x64", "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b"),
|
||||
"12.14.1-windows_amd64": ("node-v12.14.1-win-x64.zip", "node-v12.14.1-win-x64", "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3"),
|
||||
},
|
||||
node_version = "12.14.1",
|
||||
)
|
||||
|
||||
yarn_install(
|
||||
name = "npm",
|
||||
package_json = "//:package.json",
|
||||
yarn_lock = "//:yarn.lock",
|
||||
)
|
||||
|
||||
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
|
||||
install_bazel_dependencies()
|
||||
|
||||
load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies")
|
||||
npm_bazel_protractor_dependencies()
|
||||
|
||||
load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies")
|
||||
npm_bazel_karma_dependencies()
|
||||
|
||||
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
||||
web_test_repositories()
|
||||
|
||||
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories")
|
||||
browser_repositories(chromium = True, firefox = True)
|
||||
|
||||
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
|
||||
ts_setup_workspace()
|
||||
|
||||
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
|
||||
sass_repositories()
|
|
@ -1,2 +0,0 @@
|
|||
dist
|
||||
node_modules
|
|
@ -1,40 +0,0 @@
|
|||
# Make TypeScript and Angular compilation fast, by keeping a few copies of the
|
||||
# compiler running as daemons, and cache SourceFile AST's to reduce parse time.
|
||||
build --strategy=TypeScriptCompile=worker
|
||||
build --strategy=AngularTemplateCompile=worker
|
||||
|
||||
# Don't create bazel-* symlinks in the WORKSPACE directory, except `bazel-out`,
|
||||
# which is mandatory.
|
||||
# These require .gitignore and may scare users.
|
||||
# Also, it's a workaround for https://github.com/bazelbuild/rules_typescript/issues/12
|
||||
# which affects the common case of having `tsconfig.json` in the WORKSPACE directory.
|
||||
#
|
||||
# Instead, the output will appear in `dist/bin`. You'll need to ignore the
|
||||
# `bazel-out` directory that is created in the workspace root.
|
||||
build --symlink_prefix=dist/
|
||||
|
||||
# Turn on --incompatible_strict_action_env which was on by default
|
||||
# in Bazel 0.21.0 but turned off again in 0.22.0. Follow
|
||||
# https://github.com/bazelbuild/bazel/issues/7026 for more details.
|
||||
# This flag is needed to so that the bazel cache is not invalidated
|
||||
# when running bazel via `yarn bazel`.
|
||||
# See https://github.com/angular/angular/issues/27514.
|
||||
build --incompatible_strict_action_env
|
||||
run --incompatible_strict_action_env
|
||||
test --incompatible_strict_action_env
|
||||
|
||||
build --incompatible_bzl_disallow_load_after_statement=false
|
||||
|
||||
test --test_output=errors
|
||||
|
||||
# Use the Angular Ivy compiler
|
||||
# See https://github.com/angular/angular/blob/master/docs/BAZEL.md#various-flags-used-for-tests
|
||||
build --define=angular_ivy_enabled=True
|
||||
|
||||
# Temporary define while angular depends on the legacy rollup_bundle rule.
|
||||
# TODO: remove this setting after https://github.com/angular/angular/pull/33201 lands.
|
||||
build --define=enable_legacy_rollup_rule=1
|
||||
|
||||
# Turn on managed directories feature in Bazel
|
||||
# This allows us to avoid installing a second copy of node_modules
|
||||
common --experimental_allow_incremental_repository_updates
|
|
@ -1,42 +0,0 @@
|
|||
load("@npm_bazel_protractor//:index.bzl", "protractor_web_test_suite")
|
||||
load("@npm_bazel_typescript//:index.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "e2e_lib",
|
||||
testonly = 1,
|
||||
srcs = glob(["src/**/*.ts"]),
|
||||
tsconfig = ":tsconfig.e2e.json" if len(glob(["tsconfig.e2e.json"])) else ":tsconfig.json",
|
||||
deps = [
|
||||
"@npm//@types/jasmine",
|
||||
"@npm//@types/jasminewd2",
|
||||
"@npm//@types/node",
|
||||
"@npm//jasmine",
|
||||
"@npm//protractor",
|
||||
"@npm//tslib",
|
||||
],
|
||||
data = [
|
||||
"//:tsconfig.json",
|
||||
],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
name = "prodserver_test",
|
||||
on_prepare = ":protractor.on-prepare.js",
|
||||
server = "//src:prodserver",
|
||||
deps = [":e2e_lib"],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
name = "devserver_test",
|
||||
on_prepare = ":protractor.on-prepare.js",
|
||||
server = "//src:devserver",
|
||||
deps = [":e2e_lib"],
|
||||
)
|
||||
|
||||
# Default target in this package is to run the e2e tests on the devserver.
|
||||
# This is a faster round-trip but doesn't exercise production optimizations like
|
||||
# code-splitting and lazy loading.
|
||||
alias(
|
||||
name = "e2e",
|
||||
actual = "devserver_test",
|
||||
)
|
|
@ -1,188 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
|
||||
load("@npm//history-server:index.bzl", "history_server")
|
||||
load("@npm//html-insert-assets:index.bzl", "html_insert_assets")
|
||||
load("@npm_angular_bazel//:index.bzl", "ng_module")
|
||||
load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
|
||||
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
|
||||
load("@npm_bazel_terser//:index.bzl", "terser_minified")
|
||||
load("@npm_bazel_typescript//:index.bzl", "ts_devserver", "ts_library")
|
||||
load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary", "sass_binary")
|
||||
|
||||
sass_binary(
|
||||
name = "global_stylesheet",
|
||||
src = glob(["styles.css", "styles.scss"])[0],
|
||||
output_name = "global_stylesheet.css",
|
||||
)
|
||||
|
||||
multi_sass_binary(
|
||||
name = "styles",
|
||||
srcs = glob(
|
||||
include = ["**/*.scss"],
|
||||
exclude = ["styles.scss"],
|
||||
),
|
||||
)
|
||||
|
||||
ng_module(
|
||||
name = "src",
|
||||
srcs = glob(
|
||||
include = ["**/*.ts"],
|
||||
exclude = [
|
||||
"**/*.spec.ts",
|
||||
"main.ts",
|
||||
"test.ts",
|
||||
"initialize_testbed.ts",
|
||||
],
|
||||
),
|
||||
assets = glob([
|
||||
"**/*.css",
|
||||
"**/*.html",
|
||||
]) + ([":styles"] if len(glob(["**/*.scss"])) else []),
|
||||
generate_ve_shims = True,
|
||||
deps = [
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/platform-browser",
|
||||
"@npm//@angular/router",
|
||||
"@npm//@types",
|
||||
"@npm//tslib",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "bundle",
|
||||
config_file = "rollup.config.js",
|
||||
entry_point = ":main.prod.ts",
|
||||
deps = [
|
||||
"//src",
|
||||
"@npm//rollup-plugin-commonjs",
|
||||
"@npm//rollup-plugin-node-resolve",
|
||||
],
|
||||
)
|
||||
|
||||
terser_minified(
|
||||
name = "bundle.min",
|
||||
src = ":bundle",
|
||||
)
|
||||
|
||||
html_insert_assets(
|
||||
name = "asset_injected_index_html",
|
||||
outs = ["_/index.html"],
|
||||
args = [
|
||||
"--html",
|
||||
"$(execpath :index.html)",
|
||||
"--out",
|
||||
"$@",
|
||||
"--roots",
|
||||
"$(RULEDIR)",
|
||||
"--assets",
|
||||
"$(execpath :global_stylesheet.css)",
|
||||
"$(execpath @npm//:node_modules/zone.js/dist/zone.min.js)",
|
||||
"bundle.min.js",
|
||||
],
|
||||
data = [
|
||||
":index.html",
|
||||
":global_stylesheet.css",
|
||||
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_web(
|
||||
name = "prodapp",
|
||||
additional_root_paths = ["src/_"],
|
||||
srcs = [
|
||||
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
||||
":bundle.min",
|
||||
":global_stylesheet",
|
||||
":asset_injected_index_html",
|
||||
"favicon.ico",
|
||||
],
|
||||
)
|
||||
|
||||
history_server(
|
||||
name = "prodserver",
|
||||
data = [":prodapp"],
|
||||
args = [
|
||||
"--port",
|
||||
"4200",
|
||||
],
|
||||
templated_args = ["$(rlocation project/src/prodapp)"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "rxjs_umd_modules",
|
||||
srcs = [
|
||||
# do not sort
|
||||
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
|
||||
":rxjs_shims.js",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
additional_root_paths = ["project/src/_"],
|
||||
port = 4200,
|
||||
entry_module = "project/src/main.dev",
|
||||
serving_path = "/bundle.min.js",
|
||||
scripts = [
|
||||
"@npm//:node_modules/tslib/tslib.js",
|
||||
":rxjs_umd_modules",
|
||||
],
|
||||
static_files = [
|
||||
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
||||
":global_stylesheet",
|
||||
":asset_injected_index_html",
|
||||
"favicon.ico",
|
||||
],
|
||||
deps = [":src"],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "test_lib",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.spec.ts"]),
|
||||
deps = [
|
||||
":src",
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/router",
|
||||
"@npm//@types",
|
||||
"@npm//tslib",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "initialize_testbed",
|
||||
testonly = 1,
|
||||
srcs = [
|
||||
"initialize_testbed.ts",
|
||||
],
|
||||
deps = [
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/platform-browser-dynamic",
|
||||
"@npm//@types",
|
||||
],
|
||||
)
|
||||
|
||||
karma_web_test_suite(
|
||||
name = "test",
|
||||
srcs = [
|
||||
"@npm//:node_modules/tslib/tslib.js",
|
||||
],
|
||||
runtime_deps = [
|
||||
":initialize_testbed",
|
||||
],
|
||||
# do not sort
|
||||
bootstrap = [
|
||||
"@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
|
||||
"@npm//:node_modules/reflect-metadata/Reflect.js",
|
||||
],
|
||||
browsers = [
|
||||
"@io_bazel_rules_webtesting//browsers:chromium-local",
|
||||
],
|
||||
tags = ["native"],
|
||||
deps = [
|
||||
":rxjs_umd_modules",
|
||||
":test_lib",
|
||||
],
|
||||
)
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"title": "Bazel builder schema",
|
||||
"description": "Options for Bazel Builder",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"targetLabel": {
|
||||
"type": "string",
|
||||
"description": "Target to be executed under Bazel."
|
||||
},
|
||||
"bazelCommand": {
|
||||
"type": "string",
|
||||
"description": "Common commands supported by Bazel.",
|
||||
"enum": [
|
||||
"run",
|
||||
"build",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
"watch": {
|
||||
"type": "boolean",
|
||||
"description": "If true, watch the filesystem using ibazel.",
|
||||
"default": false
|
||||
},
|
||||
"leaveBazelFilesOnDisk": {
|
||||
"type": "boolean",
|
||||
"description": "If true, leave Bazel files on disk after running command.",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"targetLabel",
|
||||
"bazelCommand"
|
||||
]
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = [
|
||||
"collection.json",
|
||||
],
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
bootstrap = ["//tools/testing:node_es5"],
|
||||
deps = [
|
||||
"//packages/bazel/src/schematics/ng-add:test",
|
||||
"//packages/bazel/src/schematics/ng-new:test",
|
||||
"//packages/bazel/src/schematics/utility:test",
|
||||
],
|
||||
)
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "@angular/bazel",
|
||||
"version": "0.1",
|
||||
"schematics": {
|
||||
"ng-add": {
|
||||
"factory": "./ng-add",
|
||||
"schema": "ng-add/schema.json",
|
||||
"description": "Add Bazel build files and configurations to a project"
|
||||
},
|
||||
"ng-new": {
|
||||
"factory": "./ng-new",
|
||||
"schema": "./ng-new/schema.json",
|
||||
"description": "Create an Angular project that builds with Bazel."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ng-add",
|
||||
srcs = [
|
||||
"index.ts",
|
||||
"schema.d.ts",
|
||||
],
|
||||
data = glob(["files/**/*"]) + [
|
||||
"schema.json",
|
||||
],
|
||||
deps = [
|
||||
"//packages/bazel/src/schematics/utility",
|
||||
"@npm//@angular-devkit/core",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
"@npm//@schematics/angular",
|
||||
"@npm//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "test",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"index_spec.ts",
|
||||
],
|
||||
data = [
|
||||
"//packages/bazel/src/schematics:package_assets",
|
||||
],
|
||||
deps = [
|
||||
":ng-add",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
],
|
||||
)
|
|
@ -1,24 +0,0 @@
|
|||
// The function exported from this file is used by the protractor_web_test_suite.
|
||||
// It is passed to the `onPrepare` configuration setting in protractor and executed
|
||||
// before running tests.
|
||||
//
|
||||
// If the function returns a promise, as it does here, protractor will wait
|
||||
// for the promise to resolve before running tests.
|
||||
|
||||
const protractorUtils = require('@bazel/protractor/protractor-utils');
|
||||
const protractor = require('protractor');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function(config) {
|
||||
// In this example, `@bazel/protractor/protractor-utils` is used to run
|
||||
// the server. protractorUtils.runServer() runs the server on a randomly
|
||||
// selected port (given a port flag to pass to the server as an argument).
|
||||
// The port used is returned in serverSpec and the protractor serverUrl
|
||||
// is the configured.
|
||||
const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver';
|
||||
return protractorUtils.runServer(config.workspace, config.server, isProdserver ? '-p' : '-port', [])
|
||||
.then(serverSpec => {
|
||||
const serverUrl = `http://localhost:${serverSpec.port}`;
|
||||
protractor.browser.baseUrl = serverUrl;
|
||||
});
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
/**
|
||||
* @fileoverview Provides a script to initialize TestBed before tests are run.
|
||||
* This file should be included in the "runtime_deps" of a "karma_web_test_suite"
|
||||
* rule.
|
||||
*/
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
|
@ -1,4 +0,0 @@
|
|||
import {platformBrowser} from '@angular/platform-browser';
|
||||
import {AppModule} from './app/app.module';
|
||||
|
||||
platformBrowser().bootstrapModule(AppModule);
|
|
@ -1,6 +0,0 @@
|
|||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
import {AppModule} from './app/app.module';
|
||||
|
||||
enableProdMode();
|
||||
platformBrowser().bootstrapModule(AppModule);
|
|
@ -1,11 +0,0 @@
|
|||
const node = require('rollup-plugin-node-resolve');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
node({
|
||||
mainFields: ['browser', 'es2015', 'module', 'jsnext:main', 'main'],
|
||||
}),
|
||||
commonjs(),
|
||||
],
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* @fileoverview Provides named UMD shims for `rxjs/operators` and `rxjs/testing`.
|
||||
* This file should be included in the "scripts" of a "ts_devserver"
|
||||
* rule and the "deps" of a "karma_web_test_suite" rule.
|
||||
*/
|
||||
// rxjs/operators
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/operators', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.operators).forEach(function(key) { exports[key] = rxjs.operators[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
||||
|
||||
// rxjs/testing
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/testing', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.testing).forEach(function(key) { exports[key] = rxjs.testing[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsAngularBazelNgAdd",
|
||||
"title": "Angular Bazel Ng Add Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "The name of the project.",
|
||||
"type": "string",
|
||||
"format": "html-selector",
|
||||
"$default": {
|
||||
"$source": "argv",
|
||||
"index": 0
|
||||
}
|
||||
},
|
||||
"skipInstall": {
|
||||
"description": "When true, does not install dependency packages.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
]
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "ng-new",
|
||||
srcs = [
|
||||
"index.ts",
|
||||
"schema.d.ts",
|
||||
],
|
||||
data = glob(["files/**/*"]) + [
|
||||
"schema.json",
|
||||
],
|
||||
deps = [
|
||||
"//packages/bazel/src/schematics/ng-add",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
"@npm//@schematics/angular",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "test",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"index_spec.ts",
|
||||
],
|
||||
data = [
|
||||
"//packages/bazel/src/schematics:package_assets",
|
||||
],
|
||||
deps = [
|
||||
":ng-new",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
],
|
||||
)
|
|
@ -1,152 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsAngularNgNew",
|
||||
"title": "Angular Ng New Options Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"directory": {
|
||||
"type": "string",
|
||||
"description": "The directory name to create the workspace in."
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the new workspace and initial project.",
|
||||
"type": "string",
|
||||
"format": "html-selector",
|
||||
"$default": {
|
||||
"$source": "argv",
|
||||
"index": 0
|
||||
},
|
||||
"x-prompt": "What name would you like to use for the new workspace and initial project?"
|
||||
},
|
||||
"enableIvy": {
|
||||
"description": "When true, creates a new app that uses the Ivy rendering engine.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"skipInstall": {
|
||||
"description": "When true, does not install dependency packages.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"linkCli": {
|
||||
"description": "When true, links the CLI to the global version (internal development only).",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"visible": false
|
||||
},
|
||||
"skipGit": {
|
||||
"description": "When true, does not initialize a git repository.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "g"
|
||||
},
|
||||
"commit": {
|
||||
"description": "Initial git repository commit information.",
|
||||
"oneOf": [
|
||||
{ "type": "boolean" },
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"email"
|
||||
]
|
||||
}
|
||||
],
|
||||
"default": true
|
||||
},
|
||||
"newProjectRoot": {
|
||||
"description": "The path where new projects will be created, relative to the new workspace root.",
|
||||
"type": "string",
|
||||
"default": "projects"
|
||||
},
|
||||
"inlineStyle": {
|
||||
"description": "When true, includes styles inline in the component TS file. By default, an external styles file is created and referenced in the component TS file.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "s"
|
||||
},
|
||||
"inlineTemplate": {
|
||||
"description": "When true, includes template inline in the component TS file. By default, an external template file is created and referenced in the component TS file.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "t"
|
||||
},
|
||||
"viewEncapsulation": {
|
||||
"description": "The view encapsulation strategy to use in the initial project.",
|
||||
"enum": ["Emulated", "Native", "None", "ShadowDom"],
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "The version of the Angular CLI to use.",
|
||||
"visible": false,
|
||||
"$default": {
|
||||
"$source": "ng-cli-version"
|
||||
}
|
||||
},
|
||||
"routing": {
|
||||
"type": "boolean",
|
||||
"description": "When true, generates a routing module for the initial project.",
|
||||
"default": false,
|
||||
"x-prompt": "Would you like to add Angular routing?"
|
||||
},
|
||||
"prefix": {
|
||||
"type": "string",
|
||||
"format": "html-selector",
|
||||
"description": "The prefix to apply to generated selectors for the initial project.",
|
||||
"minLength": 1,
|
||||
"default": "app",
|
||||
"alias": "p"
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension or preprocessor to use for style files.",
|
||||
"type": "string",
|
||||
"default": "css",
|
||||
"enum": [
|
||||
"css",
|
||||
"scss",
|
||||
"sass"
|
||||
],
|
||||
"x-prompt": {
|
||||
"message": "Which stylesheet format would you like to use?",
|
||||
"type": "list",
|
||||
"items": [
|
||||
{ "value": "css", "label": "CSS" },
|
||||
{ "value": "scss", "label": "SCSS [ http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ]" },
|
||||
{ "value": "sass", "label": "Sass [ http://sass-lang.com/documentation/file.INDENTED_SYNTAX.html ]" }
|
||||
]
|
||||
}
|
||||
},
|
||||
"skipTests": {
|
||||
"description": "When true, does not generate \"spec.ts\" test files for the new project. ",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"createApplication": {
|
||||
"description": "When true (the default), creates a new initial app project in the src folder of the new workspace. When false, creates an empty workspace with no initial app. You can then use the generate application command so that all apps are created in the projects folder.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"minimal": {
|
||||
"description": "When true, creates a project without any testing frameworks. (Use for learning purposes only.)",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"version"
|
||||
]
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "utility",
|
||||
srcs = [
|
||||
"json-utils.ts",
|
||||
"workspace-utils.ts",
|
||||
],
|
||||
module_name = "@angular/bazel/src/schematics/utility",
|
||||
deps = [
|
||||
"@npm//@angular-devkit/core",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
"@npm//@schematics/angular",
|
||||
"@npm//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "test",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"json-utils_spec.ts",
|
||||
"workspace-utils_spec.ts",
|
||||
],
|
||||
deps = [
|
||||
":utility",
|
||||
"@npm//@angular-devkit/core",
|
||||
"@npm//@angular-devkit/schematics",
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue