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:
Keen Yee Liau
2020-05-18 14:39:39 -07:00
committed by Matias Niemelä
parent 83ab99c746
commit 4a0d05515e
23 changed files with 0 additions and 852 deletions

View File

@ -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",
],
)

View File

@ -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."
}
}
}

View File

@ -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",
],
)

View File

@ -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;
});
};

View File

@ -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());

View File

@ -1,4 +0,0 @@
import {platformBrowser} from '@angular/platform-browser';
import {AppModule} from './app/app.module';
platformBrowser().bootstrapModule(AppModule);

View File

@ -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);

View File

@ -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(),
],
};

View File

@ -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});
});

View File

@ -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": [
]
}

View File

@ -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",
],
)

View File

@ -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"
]
}

View File

@ -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",
],
)