@schematics/angular 12.0.0-rc.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/app-shell/app-shell-long.md +2 -2
- package/app-shell/index.d.ts +7 -0
- package/app-shell/index.js +17 -19
- package/app-shell/schema.d.ts +4 -4
- package/app-shell/schema.json +2 -4
- package/application/index.d.ts +7 -0
- package/application/index.js +46 -47
- package/application/other-files/app.component.html.template +0 -11
- package/application/schema.json +15 -13
- package/class/index.d.ts +7 -0
- package/class/index.js +9 -9
- package/class/schema.json +1 -3
- package/collection.json +13 -13
- package/component/index.d.ts +7 -0
- package/component/index.js +23 -20
- package/component/schema.json +3 -10
- package/directive/index.d.ts +7 -0
- package/directive/index.js +13 -13
- package/directive/schema.json +1 -3
- package/e2e/e2e-long.md +1 -1
- package/e2e/index.d.ts +7 -0
- package/e2e/index.js +20 -8
- package/e2e/schema.json +1 -3
- package/enum/files/{__name@dasherize__.enum.ts.template → __name@dasherize____type__.ts.template} +0 -0
- package/enum/index.d.ts +7 -0
- package/enum/index.js +8 -7
- package/enum/schema.d.ts +4 -0
- package/enum/schema.json +5 -3
- package/guard/files/__name@dasherize__.guard.ts.template +1 -1
- package/guard/index.d.ts +7 -0
- package/guard/index.js +20 -12
- package/guard/schema.json +3 -12
- package/interceptor/index.d.ts +7 -0
- package/interceptor/index.js +4 -4
- package/interface/index.d.ts +7 -0
- package/interface/index.js +3 -3
- package/interface/schema.json +1 -3
- package/library/index.d.ts +7 -0
- package/library/index.js +4 -4
- package/library/library-long.md +1 -1
- package/migrations/update-10/add-deprecation-rule-tslint.d.ts +7 -0
- package/migrations/update-10/add-deprecation-rule-tslint.js +8 -1
- package/migrations/update-10/remove-es5-browser-support.d.ts +1 -1
- package/migrations/update-10/remove-es5-browser-support.js +5 -9
- package/migrations/update-10/remove-solution-style-tsconfig.d.ts +7 -0
- package/migrations/update-10/remove-solution-style-tsconfig.js +4 -3
- package/migrations/update-10/rename-browserslist-config.d.ts +7 -0
- package/migrations/update-10/rename-browserslist-config.js +3 -3
- package/migrations/update-10/update-angular-config.d.ts +1 -1
- package/migrations/update-10/update-angular-config.js +2 -2
- package/migrations/update-10/update-dependencies.d.ts +1 -1
- package/migrations/update-10/update-dependencies.js +7 -0
- package/migrations/update-10/update-libraries-tslib.d.ts +1 -1
- package/migrations/update-10/update-libraries-tslib.js +1 -1
- package/migrations/update-10/update-module-and-target-compiler-options.d.ts +7 -0
- package/migrations/update-10/update-module-and-target-compiler-options.js +11 -12
- package/migrations/update-10/update-tslint.d.ts +7 -0
- package/migrations/update-10/update-tslint.js +13 -8
- package/migrations/update-11/add-declaration-map-compiler-option.d.ts +1 -1
- package/migrations/update-11/add-declaration-map-compiler-option.js +1 -1
- package/migrations/update-11/replace-ng-packagr-builder.d.ts +1 -1
- package/migrations/update-11/replace-ng-packagr-builder.js +3 -3
- package/migrations/update-11/update-angular-config.d.ts +1 -1
- package/migrations/update-11/update-angular-config.js +3 -3
- package/migrations/update-11/update-dependencies.d.ts +1 -1
- package/migrations/update-11/update-dependencies.js +7 -0
- package/migrations/update-12/production-default-config.d.ts +1 -1
- package/migrations/update-12/production-default-config.js +4 -3
- package/migrations/update-12/remove-emit-decorator-metadata.d.ts +7 -0
- package/migrations/update-12/remove-emit-decorator-metadata.js +15 -3
- package/migrations/update-12/update-angular-config.d.ts +1 -1
- package/migrations/update-12/update-angular-config.js +6 -5
- package/migrations/update-12/update-lazy-module-paths.d.ts +1 -1
- package/migrations/update-12/update-lazy-module-paths.js +9 -4
- package/migrations/update-12/update-web-workers.d.ts +1 -1
- package/migrations/update-12/update-web-workers.js +7 -0
- package/migrations/update-12/update-zonejs.d.ts +7 -0
- package/migrations/update-12/update-zonejs.js +3 -4
- package/migrations/update-9/add-tslib.d.ts +1 -1
- package/migrations/update-9/add-tslib.js +8 -1
- package/migrations/update-9/index.d.ts +1 -1
- package/migrations/update-9/index.js +2 -2
- package/migrations/update-9/ivy-libraries.d.ts +1 -1
- package/migrations/update-9/ivy-libraries.js +2 -2
- package/migrations/update-9/ngsw-config.d.ts +1 -1
- package/migrations/update-9/ngsw-config.js +7 -0
- package/migrations/update-9/remove-tsickle.d.ts +1 -1
- package/migrations/update-9/remove-tsickle.js +7 -0
- package/migrations/update-9/schematic-options.d.ts +7 -0
- package/migrations/update-9/schematic-options.js +3 -3
- package/migrations/update-9/update-app-tsconfigs.d.ts +7 -0
- package/migrations/update-9/update-app-tsconfigs.js +3 -3
- package/migrations/update-9/update-dependencies.d.ts +1 -1
- package/migrations/update-9/update-dependencies.js +7 -0
- package/migrations/update-9/update-i18n.d.ts +7 -0
- package/migrations/update-9/update-i18n.js +9 -4
- package/migrations/update-9/update-server-main-file.d.ts +1 -1
- package/migrations/update-9/update-server-main-file.js +12 -5
- package/migrations/update-9/update-workspace-config.d.ts +7 -0
- package/migrations/update-9/update-workspace-config.js +7 -0
- package/migrations/update-9/utils.d.ts +7 -0
- package/migrations/update-9/utils.js +3 -3
- package/module/index.d.ts +7 -0
- package/module/index.js +14 -16
- package/module/schema.json +2 -4
- package/ng-new/index.d.ts +1 -1
- package/ng-new/index.js +3 -5
- package/package.json +4 -4
- package/pipe/index.d.ts +7 -0
- package/pipe/index.js +8 -8
- package/pipe/schema.json +1 -3
- package/resolver/index.d.ts +7 -0
- package/resolver/index.js +9 -11
- package/resolver/schema.json +1 -3
- package/service/index.d.ts +7 -0
- package/service/index.js +4 -4
- package/service-worker/index.d.ts +7 -0
- package/service-worker/index.js +2 -2
- package/service-worker/schema.d.ts +13 -13
- package/service-worker/schema.json +1 -3
- package/universal/index.d.ts +7 -0
- package/universal/index.js +15 -14
- package/universal/schema.d.ts +4 -4
- package/universal/schema.json +6 -5
- package/utility/ast-utils.d.ts +7 -0
- package/utility/ast-utils.js +40 -45
- package/utility/change.d.ts +1 -1
- package/utility/change.js +13 -4
- package/utility/dependencies.d.ts +1 -1
- package/utility/dependencies.js +7 -0
- package/utility/find-module.d.ts +1 -1
- package/utility/find-module.js +14 -14
- package/utility/json-file.d.ts +1 -1
- package/utility/json-file.js +2 -2
- package/utility/latest-versions.d.ts +1 -1
- package/utility/latest-versions.js +3 -3
- package/utility/lint-fix.d.ts +1 -1
- package/utility/lint-fix.js +4 -4
- package/utility/ng-ast-utils.d.ts +7 -0
- package/utility/ng-ast-utils.js +8 -7
- package/utility/parse-name.d.ts +1 -1
- package/utility/parse-name.js +3 -3
- package/utility/paths.d.ts +1 -1
- package/utility/paths.js +1 -1
- package/utility/project-targets.d.ts +1 -1
- package/utility/project-targets.js +1 -1
- package/utility/test/create-app-module.d.ts +1 -1
- package/utility/test/create-app-module.js +7 -0
- package/utility/test/get-file-content.d.ts +1 -1
- package/utility/test/get-file-content.js +7 -0
- package/utility/test/index.d.ts +1 -1
- package/utility/test/index.js +7 -7
- package/utility/validation.d.ts +7 -0
- package/utility/validation.js +5 -5
- package/utility/workspace-models.d.ts +3 -3
- package/utility/workspace-models.js +3 -3
- package/utility/workspace.d.ts +1 -1
- package/utility/workspace.js +3 -3
- package/web-worker/index.d.ts +7 -0
- package/web-worker/index.js +8 -6
- package/web-worker/schema.json +1 -4
- package/workspace/files/package.json.template +2 -5
- package/workspace/index.d.ts +7 -0
- package/workspace/index.js +3 -3
- package/workspace/schema.json +1 -4
package/README.md
CHANGED
|
@@ -5,26 +5,26 @@ for generating an Angular application.
|
|
|
5
5
|
|
|
6
6
|
## Schematics
|
|
7
7
|
|
|
8
|
-
Name
|
|
9
|
-
|
|
10
|
-
app-shell
|
|
11
|
-
application
|
|
12
|
-
class
|
|
13
|
-
component
|
|
14
|
-
directive
|
|
15
|
-
enum
|
|
16
|
-
guard
|
|
17
|
-
interceptor
|
|
18
|
-
interface
|
|
19
|
-
library
|
|
20
|
-
module
|
|
21
|
-
ng-new
|
|
22
|
-
pipe
|
|
23
|
-
resolver
|
|
24
|
-
service
|
|
25
|
-
service-worker | Pass this schematic to the "run" command to create a service worker
|
|
26
|
-
web-worker
|
|
27
|
-
workspace
|
|
8
|
+
| Name | Description |
|
|
9
|
+
| -------------- | ----------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| app-shell | Generates an app shell for running a server-side version of an app |
|
|
11
|
+
| application | Generates a new basic app definition in the "projects" subfolder of the workspace |
|
|
12
|
+
| class | Creates a new, generic class definition in the given or default project |
|
|
13
|
+
| component | Creates a new, generic component definition in the given or default project |
|
|
14
|
+
| directive | Creates a new, generic directive definition in the given or default project |
|
|
15
|
+
| enum | Generates a new, generic enum definition for the given or default project |
|
|
16
|
+
| guard | Generates a new, generic route guard definition in the given or default project |
|
|
17
|
+
| interceptor | Creates a new, generic interceptor definition in the given or default project |
|
|
18
|
+
| interface | Creates a new, generic interface definition in the given or default project |
|
|
19
|
+
| library | Creates a new, generic library project in the current workspace |
|
|
20
|
+
| module | Creates a new, generic NgModule definition in the given or default project |
|
|
21
|
+
| ng-new | Creates a new project by combining the workspace and application schematics |
|
|
22
|
+
| pipe | Creates a new, generic pipe definition in the given or default project |
|
|
23
|
+
| resolver | Creates a new, generic resolver definition in the given or default project |
|
|
24
|
+
| service | Creates a new, generic service definition in the given or default project |
|
|
25
|
+
| service-worker | Pass this schematic to the "run" command to create a service worker |
|
|
26
|
+
| web-worker | Creates a new, generic web worker definition in the given or default project |
|
|
27
|
+
| workspace | Initializes an empty workspace and adds the necessary dependencies required by an Angular application |
|
|
28
28
|
|
|
29
29
|
## Disclaimer
|
|
30
30
|
|
|
@@ -10,8 +10,8 @@ To create an app shell, use the following command.
|
|
|
10
10
|
ng generate app-shell my-app
|
|
11
11
|
</code-example>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
- `my-app` is the name of your client application
|
|
14
|
+
- `server-app` is the name of the Universal (server) application
|
|
15
15
|
|
|
16
16
|
The command adds two new architect build targets to your `angular.json` configuration file (along with a few other changes).
|
|
17
17
|
|
package/app-shell/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
9
|
import { Schema as AppShellOptions } from './schema';
|
|
3
10
|
export default function (options: AppShellOptions): Rule;
|
package/app-shell/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/**
|
|
4
3
|
* @license
|
|
5
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6
5
|
*
|
|
7
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8
7
|
* found in the LICENSE file at https://angular.io/license
|
|
9
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const core_1 = require("@angular-devkit/core");
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
12
|
const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
|
|
@@ -28,7 +28,7 @@ function getSourceFile(host, path) {
|
|
|
28
28
|
function getServerModulePath(host, sourceRoot, mainPath) {
|
|
29
29
|
const mainSource = getSourceFile(host, core_1.join(core_1.normalize(sourceRoot), mainPath));
|
|
30
30
|
const allNodes = ast_utils_1.getSourceNodes(mainSource);
|
|
31
|
-
const expNode = allNodes.find(node => ts.isExportDeclaration(node));
|
|
31
|
+
const expNode = allNodes.find((node) => ts.isExportDeclaration(node));
|
|
32
32
|
if (!expNode) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
@@ -65,15 +65,14 @@ function getBootstrapComponentPath(host, mainPath) {
|
|
|
65
65
|
const moduleSource = getSourceFile(host, modulePath);
|
|
66
66
|
const metadataNode = ast_utils_1.getDecoratorMetadata(moduleSource, 'NgModule', '@angular/core')[0];
|
|
67
67
|
const bootstrapProperty = getMetadataProperty(metadataNode, 'bootstrap');
|
|
68
|
-
const arrLiteral = bootstrapProperty
|
|
69
|
-
.initializer;
|
|
68
|
+
const arrLiteral = bootstrapProperty.initializer;
|
|
70
69
|
const componentSymbol = arrLiteral.elements[0].getText();
|
|
71
70
|
const relativePath = ast_utils_1.getSourceNodes(moduleSource)
|
|
72
71
|
.filter(ts.isImportDeclaration)
|
|
73
|
-
.filter(imp => {
|
|
72
|
+
.filter((imp) => {
|
|
74
73
|
return ast_utils_1.findNode(imp, ts.SyntaxKind.Identifier, componentSymbol);
|
|
75
74
|
})
|
|
76
|
-
.map(imp => {
|
|
75
|
+
.map((imp) => {
|
|
77
76
|
const pathStringLiteral = imp.moduleSpecifier;
|
|
78
77
|
return pathStringLiteral.text;
|
|
79
78
|
})[0];
|
|
@@ -109,9 +108,9 @@ function addAppShellConfigToWorkspace(options) {
|
|
|
109
108
|
if (!options.route) {
|
|
110
109
|
throw new schematics_1.SchematicsException(`Route is not defined`);
|
|
111
110
|
}
|
|
112
|
-
return workspace_1.updateWorkspace(workspace => {
|
|
111
|
+
return workspace_1.updateWorkspace((workspace) => {
|
|
113
112
|
var _a, _b, _c, _d;
|
|
114
|
-
const project = workspace.projects.get(options.
|
|
113
|
+
const project = workspace.projects.get(options.project);
|
|
115
114
|
if (!project) {
|
|
116
115
|
return;
|
|
117
116
|
}
|
|
@@ -134,8 +133,8 @@ function addAppShellConfigToWorkspace(options) {
|
|
|
134
133
|
continue;
|
|
135
134
|
}
|
|
136
135
|
configurations[key] = {
|
|
137
|
-
browserTarget: `${options.
|
|
138
|
-
serverTarget: `${options.
|
|
136
|
+
browserTarget: `${options.project}:build:${key}`,
|
|
137
|
+
serverTarget: `${options.project}:server:${key}`,
|
|
139
138
|
};
|
|
140
139
|
}
|
|
141
140
|
project.targets.add({
|
|
@@ -163,9 +162,7 @@ function addRouterModule(mainPath) {
|
|
|
163
162
|
}
|
|
164
163
|
function getMetadataProperty(metadata, propertyName) {
|
|
165
164
|
const properties = metadata.properties;
|
|
166
|
-
const property = properties
|
|
167
|
-
.filter(ts.isPropertyAssignment)
|
|
168
|
-
.filter((prop) => {
|
|
165
|
+
const property = properties.filter(ts.isPropertyAssignment).filter((prop) => {
|
|
169
166
|
const name = prop.name;
|
|
170
167
|
switch (name.kind) {
|
|
171
168
|
case ts.SyntaxKind.Identifier:
|
|
@@ -181,7 +178,7 @@ function addServerRoutes(options) {
|
|
|
181
178
|
return async (host) => {
|
|
182
179
|
// The workspace gets updated so this needs to be reloaded
|
|
183
180
|
const workspace = await workspace_1.getWorkspace(host);
|
|
184
|
-
const clientProject = workspace.projects.get(options.
|
|
181
|
+
const clientProject = workspace.projects.get(options.project);
|
|
185
182
|
if (!clientProject) {
|
|
186
183
|
throw new Error('Universal schematic removed client project.');
|
|
187
184
|
}
|
|
@@ -205,7 +202,7 @@ function addServerRoutes(options) {
|
|
|
205
202
|
change_1.applyToUpdateRecorder(recorder, [routesChange]);
|
|
206
203
|
}
|
|
207
204
|
const imports = ast_utils_1.getSourceNodes(moduleSource)
|
|
208
|
-
.filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)
|
|
205
|
+
.filter((node) => node.kind === ts.SyntaxKind.ImportDeclaration)
|
|
209
206
|
.sort((a, b) => a.getStart() - b.getStart());
|
|
210
207
|
const insertPosition = imports[imports.length - 1].getEnd();
|
|
211
208
|
const routeText = `\n\nconst routes: Routes = [ { path: '${options.route}', component: AppShellComponent }];`;
|
|
@@ -231,14 +228,14 @@ function addShellComponent(options) {
|
|
|
231
228
|
const componentOptions = {
|
|
232
229
|
name: 'app-shell',
|
|
233
230
|
module: options.rootModuleFileName,
|
|
234
|
-
project: options.
|
|
231
|
+
project: options.project,
|
|
235
232
|
};
|
|
236
233
|
return schematics_1.schematic('component', componentOptions);
|
|
237
234
|
}
|
|
238
235
|
function default_1(options) {
|
|
239
236
|
return async (tree) => {
|
|
240
237
|
const workspace = await workspace_1.getWorkspace(tree);
|
|
241
|
-
const clientProject = workspace.projects.get(options.
|
|
238
|
+
const clientProject = workspace.projects.get(options.project);
|
|
242
239
|
if (!clientProject || clientProject.extensions.projectType !== 'application') {
|
|
243
240
|
throw new schematics_1.SchematicsException(`A client project type of "application" is required.`);
|
|
244
241
|
}
|
|
@@ -246,7 +243,8 @@ function default_1(options) {
|
|
|
246
243
|
if (!clientBuildTarget) {
|
|
247
244
|
throw project_targets_1.targetBuildNotFoundError();
|
|
248
245
|
}
|
|
249
|
-
const clientBuildOptions = (clientBuildTarget.options ||
|
|
246
|
+
const clientBuildOptions = (clientBuildTarget.options ||
|
|
247
|
+
{});
|
|
250
248
|
return schematics_1.chain([
|
|
251
249
|
validateProject(clientBuildOptions.main),
|
|
252
250
|
clientProject.targets.has('server') ? schematics_1.noop() : addUniversalTarget(options),
|
package/app-shell/schema.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export interface Schema {
|
|
|
10
10
|
* The app ID to use in withServerTransition().
|
|
11
11
|
*/
|
|
12
12
|
appId?: string;
|
|
13
|
-
/**
|
|
14
|
-
* The name of the related client app.
|
|
15
|
-
*/
|
|
16
|
-
clientProject: string;
|
|
17
13
|
/**
|
|
18
14
|
* The name of the main entry-point file.
|
|
19
15
|
*/
|
|
20
16
|
main?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the related client app.
|
|
19
|
+
*/
|
|
20
|
+
project: string;
|
|
21
21
|
/**
|
|
22
22
|
* The name of the root module class.
|
|
23
23
|
*/
|
package/app-shell/schema.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"long-description": "./app-shell-long.md",
|
|
9
9
|
"properties": {
|
|
10
|
-
"
|
|
10
|
+
"project": {
|
|
11
11
|
"type": "string",
|
|
12
12
|
"description": "The name of the related client app.",
|
|
13
13
|
"$default": {
|
|
@@ -50,7 +50,5 @@
|
|
|
50
50
|
"default": "AppServerModule"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"required": [
|
|
54
|
-
"clientProject"
|
|
55
|
-
]
|
|
53
|
+
"required": ["project"]
|
|
56
54
|
}
|
package/application/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
9
|
import { Schema as ApplicationOptions } from './schema';
|
|
3
10
|
export default function (options: ApplicationOptions): Rule;
|
package/application/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/**
|
|
4
3
|
* @license
|
|
5
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6
5
|
*
|
|
7
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8
7
|
* found in the LICENSE file at https://angular.io/license
|
|
9
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const core_1 = require("@angular-devkit/core");
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
12
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
@@ -36,7 +36,7 @@ function addDependenciesToPackageJson(options) {
|
|
|
36
36
|
name: 'typescript',
|
|
37
37
|
version: latest_versions_1.latestVersions.TypeScript,
|
|
38
38
|
},
|
|
39
|
-
].forEach(dependency => dependencies_1.addPackageJsonDependency(host, dependency));
|
|
39
|
+
].forEach((dependency) => dependencies_1.addPackageJsonDependency(host, dependency));
|
|
40
40
|
if (!options.skipInstall) {
|
|
41
41
|
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
42
42
|
}
|
|
@@ -50,10 +50,10 @@ function addAppToWorkspaceFile(options, appDir) {
|
|
|
50
50
|
projectRoot += '/';
|
|
51
51
|
}
|
|
52
52
|
const schematics = {};
|
|
53
|
-
if (options.inlineTemplate
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (options.inlineTemplate ||
|
|
54
|
+
options.inlineStyle ||
|
|
55
|
+
options.minimal ||
|
|
56
|
+
options.style !== schema_1.Style.Css) {
|
|
57
57
|
const componentSchematicsOptions = {};
|
|
58
58
|
if ((_a = options.inlineTemplate) !== null && _a !== void 0 ? _a : options.minimal) {
|
|
59
59
|
componentSchematicsOptions.inlineTemplate = true;
|
|
@@ -67,7 +67,16 @@ function addAppToWorkspaceFile(options, appDir) {
|
|
|
67
67
|
schematics['@schematics/angular:component'] = componentSchematicsOptions;
|
|
68
68
|
}
|
|
69
69
|
if (options.skipTests || options.minimal) {
|
|
70
|
-
[
|
|
70
|
+
[
|
|
71
|
+
'class',
|
|
72
|
+
'component',
|
|
73
|
+
'directive',
|
|
74
|
+
'guard',
|
|
75
|
+
'interceptor',
|
|
76
|
+
'module',
|
|
77
|
+
'pipe',
|
|
78
|
+
'service',
|
|
79
|
+
].forEach((type) => {
|
|
71
80
|
if (!(`@schematics/angular:${type}` in schematics)) {
|
|
72
81
|
schematics[`@schematics/angular:${type}`] = {};
|
|
73
82
|
}
|
|
@@ -110,9 +119,7 @@ function addAppToWorkspaceFile(options, appDir) {
|
|
|
110
119
|
},
|
|
111
120
|
];
|
|
112
121
|
}
|
|
113
|
-
const inlineStyleLanguage = (options === null || options === void 0 ? void 0 : options.style) !== schema_1.Style.Css
|
|
114
|
-
? options.style
|
|
115
|
-
: undefined;
|
|
122
|
+
const inlineStyleLanguage = (options === null || options === void 0 ? void 0 : options.style) !== schema_1.Style.Css ? options.style : undefined;
|
|
116
123
|
const project = {
|
|
117
124
|
root: core_1.normalize(projectRoot),
|
|
118
125
|
sourceRoot,
|
|
@@ -130,22 +137,19 @@ function addAppToWorkspaceFile(options, appDir) {
|
|
|
130
137
|
polyfills: `${sourceRoot}/polyfills.ts`,
|
|
131
138
|
tsConfig: `${projectRoot}tsconfig.app.json`,
|
|
132
139
|
inlineStyleLanguage,
|
|
133
|
-
assets: [
|
|
134
|
-
|
|
135
|
-
`${sourceRoot}/assets`,
|
|
136
|
-
],
|
|
137
|
-
styles: [
|
|
138
|
-
`${sourceRoot}/styles.${options.style}`,
|
|
139
|
-
],
|
|
140
|
+
assets: [`${sourceRoot}/favicon.ico`, `${sourceRoot}/assets`],
|
|
141
|
+
styles: [`${sourceRoot}/styles.${options.style}`],
|
|
140
142
|
scripts: [],
|
|
141
143
|
},
|
|
142
144
|
configurations: {
|
|
143
145
|
production: {
|
|
144
146
|
budgets,
|
|
145
|
-
fileReplacements: [
|
|
147
|
+
fileReplacements: [
|
|
148
|
+
{
|
|
146
149
|
replace: `${sourceRoot}/environments/environment.ts`,
|
|
147
150
|
with: `${sourceRoot}/environments/environment.prod.ts`,
|
|
148
|
-
}
|
|
151
|
+
},
|
|
152
|
+
],
|
|
149
153
|
outputHashing: 'all',
|
|
150
154
|
},
|
|
151
155
|
development: {
|
|
@@ -177,27 +181,24 @@ function addAppToWorkspaceFile(options, appDir) {
|
|
|
177
181
|
browserTarget: `${options.name}:build`,
|
|
178
182
|
},
|
|
179
183
|
},
|
|
180
|
-
test: options.minimal
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
`${sourceRoot}/assets
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
],
|
|
195
|
-
scripts: [],
|
|
184
|
+
test: options.minimal
|
|
185
|
+
? undefined
|
|
186
|
+
: {
|
|
187
|
+
builder: workspace_models_1.Builders.Karma,
|
|
188
|
+
options: {
|
|
189
|
+
main: `${sourceRoot}/test.ts`,
|
|
190
|
+
polyfills: `${sourceRoot}/polyfills.ts`,
|
|
191
|
+
tsConfig: `${projectRoot}tsconfig.spec.json`,
|
|
192
|
+
karmaConfig: `${projectRoot}karma.conf.js`,
|
|
193
|
+
inlineStyleLanguage,
|
|
194
|
+
assets: [`${sourceRoot}/favicon.ico`, `${sourceRoot}/assets`],
|
|
195
|
+
styles: [`${sourceRoot}/styles.${options.style}`],
|
|
196
|
+
scripts: [],
|
|
197
|
+
},
|
|
196
198
|
},
|
|
197
|
-
},
|
|
198
199
|
},
|
|
199
200
|
};
|
|
200
|
-
return workspace_1.updateWorkspace(workspace => {
|
|
201
|
+
return workspace_1.updateWorkspace((workspace) => {
|
|
201
202
|
if (workspace.projects.size === 0) {
|
|
202
203
|
workspace.extensions.defaultProject = options.name;
|
|
203
204
|
}
|
|
@@ -219,15 +220,15 @@ function default_1(options) {
|
|
|
219
220
|
}
|
|
220
221
|
validation_1.validateProjectName(options.name);
|
|
221
222
|
const appRootSelector = `${options.prefix}-root`;
|
|
222
|
-
const componentOptions = !options.minimal
|
|
223
|
-
{
|
|
223
|
+
const componentOptions = !options.minimal
|
|
224
|
+
? {
|
|
224
225
|
inlineStyle: options.inlineStyle,
|
|
225
226
|
inlineTemplate: options.inlineTemplate,
|
|
226
227
|
skipTests: options.skipTests,
|
|
227
228
|
style: options.style,
|
|
228
229
|
viewEncapsulation: options.viewEncapsulation,
|
|
229
|
-
}
|
|
230
|
-
{
|
|
230
|
+
}
|
|
231
|
+
: {
|
|
231
232
|
inlineStyle: (_a = options.inlineStyle) !== null && _a !== void 0 ? _a : true,
|
|
232
233
|
inlineTemplate: (_b = options.inlineTemplate) !== null && _b !== void 0 ? _b : true,
|
|
233
234
|
skipTests: true,
|
|
@@ -273,14 +274,12 @@ function default_1(options) {
|
|
|
273
274
|
...componentOptions,
|
|
274
275
|
}),
|
|
275
276
|
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./other-files'), [
|
|
276
|
-
options.strict
|
|
277
|
-
? schematics_1.noop()
|
|
278
|
-
: schematics_1.filter(path => path !== '/package.json.template'),
|
|
277
|
+
options.strict ? schematics_1.noop() : schematics_1.filter((path) => path !== '/package.json.template'),
|
|
279
278
|
componentOptions.inlineTemplate
|
|
280
|
-
? schematics_1.filter(path => !path.endsWith('.html.template'))
|
|
279
|
+
? schematics_1.filter((path) => !path.endsWith('.html.template'))
|
|
281
280
|
: schematics_1.noop(),
|
|
282
281
|
componentOptions.skipTests
|
|
283
|
-
? schematics_1.filter(path => !path.endsWith('.spec.ts.template'))
|
|
282
|
+
? schematics_1.filter((path) => !path.endsWith('.spec.ts.template'))
|
|
284
283
|
: schematics_1.noop(),
|
|
285
284
|
schematics_1.applyTemplates({
|
|
286
285
|
utils: core_1.strings,
|
|
@@ -461,17 +461,6 @@
|
|
|
461
461
|
</svg>
|
|
462
462
|
</a>
|
|
463
463
|
|
|
464
|
-
<a class="circle-link" title="Protractor" href="https://www.protractortest.org/" target="_blank" rel="noopener">
|
|
465
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="21.81" height="23.447" viewBox="0 0 21.81 23.447">
|
|
466
|
-
<title>Angular Protractor Logo</title>
|
|
467
|
-
<g id="Group_26" data-name="Group 26" transform="translate(0)">
|
|
468
|
-
<path id="Path_28" data-name="Path 28" d="M4620.155,311.417h0l-10.881,3.9,1.637,14.4,9.244,5.152,9.244-5.152,1.685-14.4Z" transform="translate(-4609.274 -311.417)" fill="#e13439"/>
|
|
469
|
-
<path id="Path_29" data-name="Path 29" d="M4702.088,311.417v23.447l9.244-5.152,1.685-14.4Z" transform="translate(-4691.207 -311.417)" fill="#b52f32"/>
|
|
470
|
-
<path id="Path_30" data-name="Path 30" d="M4651.044,369.58v-.421h1.483a7.6,7.6,0,0,0-2.106-5.052l-1.123,1.123-.3-.3,1.122-1.121a7.588,7.588,0,0,0-4.946-2.055v1.482h-.421v-1.485a7.589,7.589,0,0,0-5.051,2.058l1.122,1.121-.3.3-1.123-1.123a7.591,7.591,0,0,0-2.106,5.052h1.482v.421h-1.489v1.734h15.241V369.58Zm-10.966-.263a4.835,4.835,0,0,1,9.67,0Z" transform="translate(-4634.008 -355.852)" fill="#fff"/>
|
|
471
|
-
</g>
|
|
472
|
-
</svg>
|
|
473
|
-
</a>
|
|
474
|
-
|
|
475
464
|
<a class="circle-link" title="Find a Local Meetup" href="https://www.meetup.com/find/?keywords=angular" target="_blank" rel="noopener">
|
|
476
465
|
<svg xmlns="http://www.w3.org/2000/svg" width="24.607" height="23.447" viewBox="0 0 24.607 23.447">
|
|
477
466
|
<title>Meetup Logo</title>
|
package/application/schema.json
CHANGED
|
@@ -56,20 +56,24 @@
|
|
|
56
56
|
"description": "The file extension or preprocessor to use for style files.",
|
|
57
57
|
"type": "string",
|
|
58
58
|
"default": "css",
|
|
59
|
-
"enum": [
|
|
60
|
-
"css",
|
|
61
|
-
"scss",
|
|
62
|
-
"sass",
|
|
63
|
-
"less"
|
|
64
|
-
],
|
|
59
|
+
"enum": ["css", "scss", "sass", "less"],
|
|
65
60
|
"x-prompt": {
|
|
66
61
|
"message": "Which stylesheet format would you like to use?",
|
|
67
62
|
"type": "list",
|
|
68
63
|
"items": [
|
|
69
|
-
{ "value": "css",
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
{ "value": "css", "label": "CSS" },
|
|
65
|
+
{
|
|
66
|
+
"value": "scss",
|
|
67
|
+
"label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"value": "sass",
|
|
71
|
+
"label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"value": "less",
|
|
75
|
+
"label": "Less [ http://lesscss.org ]"
|
|
76
|
+
}
|
|
73
77
|
]
|
|
74
78
|
},
|
|
75
79
|
"x-user-analytics": 5
|
|
@@ -116,7 +120,5 @@
|
|
|
116
120
|
"x-deprecated": "Legacy browsers support is deprecated since version 12. For more information, see https://angular.io/guide/browser-support"
|
|
117
121
|
}
|
|
118
122
|
},
|
|
119
|
-
"required": [
|
|
120
|
-
"name"
|
|
121
|
-
]
|
|
123
|
+
"required": ["name"]
|
|
122
124
|
}
|
package/class/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
9
|
import { Schema as ClassOptions } from './schema';
|
|
3
10
|
export default function (options: ClassOptions): Rule;
|
package/class/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright Google
|
|
6
|
-
*
|
|
7
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
-
* found in the LICENSE file at https://angular.io/license
|
|
9
|
-
*/
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const core_1 = require("@angular-devkit/core");
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
12
|
const lint_fix_1 = require("../utility/lint-fix");
|
|
@@ -17,12 +17,12 @@ function default_1(options) {
|
|
|
17
17
|
if (options.path === undefined) {
|
|
18
18
|
options.path = await workspace_1.createDefaultPath(host, options.project);
|
|
19
19
|
}
|
|
20
|
-
options.type =
|
|
20
|
+
options.type = options.type ? `.${options.type}` : '';
|
|
21
21
|
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
22
22
|
options.name = parsedPath.name;
|
|
23
23
|
options.path = parsedPath.path;
|
|
24
24
|
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
25
|
-
options.skipTests ? schematics_1.filter(path => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
25
|
+
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
26
26
|
schematics_1.applyTemplates({
|
|
27
27
|
...core_1.strings,
|
|
28
28
|
...options,
|
package/class/schema.json
CHANGED
package/collection.json
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"hidden": true
|
|
14
14
|
},
|
|
15
15
|
"service-worker": {
|
|
16
|
-
"aliases": [
|
|
16
|
+
"aliases": ["serviceWorker"],
|
|
17
17
|
"factory": "./service-worker",
|
|
18
18
|
"description": "Initializes a service worker setup.",
|
|
19
19
|
"schema": "./service-worker/schema.json"
|
|
20
20
|
},
|
|
21
21
|
"application": {
|
|
22
|
-
"aliases": [
|
|
22
|
+
"aliases": ["app"],
|
|
23
23
|
"factory": "./application",
|
|
24
24
|
"schema": "./application/schema.json",
|
|
25
25
|
"description": "Create an Angular application."
|
|
@@ -31,37 +31,37 @@
|
|
|
31
31
|
"hidden": true
|
|
32
32
|
},
|
|
33
33
|
"class": {
|
|
34
|
-
"aliases": [
|
|
34
|
+
"aliases": ["cl"],
|
|
35
35
|
"factory": "./class",
|
|
36
36
|
"description": "Create a class.",
|
|
37
37
|
"schema": "./class/schema.json"
|
|
38
38
|
},
|
|
39
39
|
"component": {
|
|
40
|
-
"aliases": [
|
|
40
|
+
"aliases": ["c"],
|
|
41
41
|
"factory": "./component",
|
|
42
42
|
"description": "Create an Angular component.",
|
|
43
43
|
"schema": "./component/schema.json"
|
|
44
44
|
},
|
|
45
45
|
"directive": {
|
|
46
|
-
"aliases": [
|
|
46
|
+
"aliases": ["d"],
|
|
47
47
|
"factory": "./directive",
|
|
48
48
|
"description": "Create an Angular directive.",
|
|
49
49
|
"schema": "./directive/schema.json"
|
|
50
50
|
},
|
|
51
51
|
"enum": {
|
|
52
|
-
"aliases": [
|
|
52
|
+
"aliases": ["e"],
|
|
53
53
|
"factory": "./enum",
|
|
54
54
|
"description": "Create an enumeration.",
|
|
55
55
|
"schema": "./enum/schema.json"
|
|
56
56
|
},
|
|
57
57
|
"guard": {
|
|
58
|
-
"aliases": [
|
|
58
|
+
"aliases": ["g"],
|
|
59
59
|
"factory": "./guard",
|
|
60
60
|
"description": "Create a guard.",
|
|
61
61
|
"schema": "./guard/schema.json"
|
|
62
62
|
},
|
|
63
63
|
"resolver": {
|
|
64
|
-
"aliases": [
|
|
64
|
+
"aliases": ["r"],
|
|
65
65
|
"factory": "./resolver",
|
|
66
66
|
"description": "Create a resolver.",
|
|
67
67
|
"schema": "./resolver/schema.json"
|
|
@@ -72,25 +72,25 @@
|
|
|
72
72
|
"schema": "./interceptor/schema.json"
|
|
73
73
|
},
|
|
74
74
|
"interface": {
|
|
75
|
-
"aliases": [
|
|
75
|
+
"aliases": ["i"],
|
|
76
76
|
"factory": "./interface",
|
|
77
77
|
"description": "Create an interface.",
|
|
78
78
|
"schema": "./interface/schema.json"
|
|
79
79
|
},
|
|
80
80
|
"module": {
|
|
81
|
-
"aliases": [
|
|
81
|
+
"aliases": ["m"],
|
|
82
82
|
"factory": "./module",
|
|
83
83
|
"description": "Create an Angular module.",
|
|
84
84
|
"schema": "./module/schema.json"
|
|
85
85
|
},
|
|
86
86
|
"pipe": {
|
|
87
|
-
"aliases": [
|
|
87
|
+
"aliases": ["p"],
|
|
88
88
|
"factory": "./pipe",
|
|
89
89
|
"description": "Create an Angular pipe.",
|
|
90
90
|
"schema": "./pipe/schema.json"
|
|
91
91
|
},
|
|
92
92
|
"service": {
|
|
93
|
-
"aliases": [
|
|
93
|
+
"aliases": ["s"],
|
|
94
94
|
"factory": "./service",
|
|
95
95
|
"description": "Create an Angular service.",
|
|
96
96
|
"schema": "./service/schema.json"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"hidden": true
|
|
103
103
|
},
|
|
104
104
|
"app-shell": {
|
|
105
|
-
"aliases": [
|
|
105
|
+
"aliases": ["appShell"],
|
|
106
106
|
"factory": "./app-shell",
|
|
107
107
|
"description": "Create an app shell.",
|
|
108
108
|
"schema": "./app-shell/schema.json"
|
package/component/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
9
|
import { Schema as ComponentOptions } from './schema';
|
|
3
10
|
export default function (options: ComponentOptions): Rule;
|