Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bazel): ng-new schematics with Bazel (#27277)
This commit creates a schematics for ng new command that builds the project with Bazel. PR Close #27277
- Loading branch information
Showing
16 changed files
with
633 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/bazel/src/schematics/bazel-workspace/files/src/initialize_testbed.ts.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @fileoverview Provides a script to initialize TestBed before tests are run. | ||
* This file should be included in the "runtime_deps" of a "ts_web_test_suite" | ||
* rule. | ||
*/ | ||
import {TestBed} from '@angular/core/testing'; | ||
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing'; | ||
|
||
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("//tools:defaults.bzl", "ts_library") | ||
|
||
ts_library( | ||
name = "ng-new", | ||
srcs = [ | ||
"index.ts", | ||
"schema.d.ts", | ||
], | ||
data = glob(["files/**/*"]) + [ | ||
"schema.json", | ||
], | ||
deps = [ | ||
"//packages/bazel/src/schematics/bazel-workspace", | ||
"@ngdeps//@angular-devkit/core", | ||
"@ngdeps//@angular-devkit/schematics", | ||
"@ngdeps//@schematics/angular", | ||
"@ngdeps//typescript", | ||
], | ||
) | ||
|
||
ts_library( | ||
name = "test", | ||
testonly = True, | ||
srcs = [ | ||
"index_spec.ts", | ||
], | ||
data = [ | ||
"//packages/bazel/src/schematics:package_assets", | ||
], | ||
deps = [ | ||
":ng-new", | ||
"@ngdeps//@angular-devkit/schematics", | ||
], | ||
) |
16 changes: 16 additions & 0 deletions
16
packages/bazel/src/schematics/ng-new/files/index.html.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title><%= utils.classify(name) %></title> | ||
<base href="/"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | ||
</head> | ||
<body> | ||
<app-root></app-root> | ||
<script src="/zone.min.js"></script> | ||
<script src="/bundle.min.js"></script> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
packages/bazel/src/schematics/ng-new/files/main.dev.ts.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import {platformBrowser} from '@angular/platform-browser'; | ||
import {AppModuleNgFactory} from './app/app.module.ngfactory'; | ||
|
||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); |
6 changes: 6 additions & 0 deletions
6
packages/bazel/src/schematics/ng-new/files/main.prod.ts.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {enableProdMode} from '@angular/core'; | ||
import {platformBrowser} from '@angular/platform-browser'; | ||
import {AppModuleNgFactory} from './app/app.module.ngfactory'; | ||
|
||
enableProdMode(); | ||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); |
Oops, something went wrong.