@schematics/angular 14.0.0-next.6 → 14.0.0-next.7

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.
@@ -198,9 +198,6 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
198
198
  },
199
199
  };
200
200
  return (0, workspace_1.updateWorkspace)((workspace) => {
201
- if (workspace.projects.size === 0) {
202
- workspace.extensions.defaultProject = options.name;
203
- }
204
201
  workspace.projects.add({
205
202
  name: options.name,
206
203
  ...project,
@@ -234,7 +231,7 @@ function default_1(options) {
234
231
  const newProjectRoot = workspace.extensions.newProjectRoot || '';
235
232
  const isRootApp = options.projectRoot !== undefined;
236
233
  // If scoped project (i.e. "@foo/bar"), convert dir to "foo/bar".
237
- let folderName = options.name.startsWith('@') ? options.name.substr(1) : options.name;
234
+ let folderName = options.name.startsWith('@') ? options.name.slice(1) : options.name;
238
235
  if (/[A-Z]/.test(folderName)) {
239
236
  folderName = core_1.strings.dasherize(folderName);
240
237
  }
@@ -11,9 +11,7 @@ describe('<%= classify(name) %><%= classify(type) %>', () => {
11
11
  declarations: [ <%= classify(name) %><%= classify(type) %> ]
12
12
  })
13
13
  .compileComponents();
14
- });
15
14
 
16
- beforeEach(() => {
17
15
  fixture = TestBed.createComponent(<%= classify(name) %><%= classify(type) %>);
18
16
  component = fixture.componentInstance;
19
17
  fixture.detectChanges();
@@ -6,15 +6,15 @@ import { Component, OnInit<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }
6
6
  <p>
7
7
  <%= dasherize(name) %> works!
8
8
  </p>
9
- `,<% } else { %>
10
- templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html',<% } if(inlineStyle) { %>
9
+ `<% } else { %>
10
+ templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html'<% } if(inlineStyle) { %>,
11
11
  styles: [<% if(displayBlock){ %>
12
12
  `
13
13
  :host {
14
14
  display: block;
15
15
  }
16
16
  `<% } %>
17
- ]<% } else if (style !== 'none') { %>
17
+ ]<% } else if (style !== 'none') { %>,
18
18
  styleUrls: ['./<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>']<% } %><% if(!!viewEncapsulation) { %>,
19
19
  encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
20
20
  changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
package/library/index.js CHANGED
@@ -61,9 +61,6 @@ function addDependenciesToPackageJson() {
61
61
  }
62
62
  function addLibToWorkspaceFile(options, projectRoot, projectName) {
63
63
  return (0, workspace_1.updateWorkspace)((workspace) => {
64
- if (workspace.projects.size === 0) {
65
- workspace.extensions.defaultProject = projectName;
66
- }
67
64
  workspace.projects.add({
68
65
  name: projectName,
69
66
  root: projectRoot,
@@ -109,7 +106,7 @@ function default_1(options) {
109
106
  }
110
107
  const workspace = await (0, workspace_1.getWorkspace)(host);
111
108
  const newProjectRoot = workspace.extensions.newProjectRoot || '';
112
- let folderName = packageName.startsWith('@') ? packageName.substr(1) : packageName;
109
+ let folderName = packageName.startsWith('@') ? packageName.slice(1) : packageName;
113
110
  if (/[A-Z]/.test(folderName)) {
114
111
  folderName = core_1.strings.dasherize(folderName);
115
112
  }
@@ -14,6 +14,16 @@
14
14
  "version": "14.0.0",
15
15
  "factory": "./update-14/remove-show-circular-dependencies-option",
16
16
  "description": "Remove 'showCircularDependencies' option from browser and server builders."
17
+ },
18
+ "remove-default-project-option": {
19
+ "version": "14.0.0",
20
+ "factory": "./update-14/remove-default-project-option",
21
+ "description": "Remove 'defaultProject' option from workspace configuration. The project to use will be determined from the current working directory."
22
+ },
23
+ "replace-default-collection-option": {
24
+ "version": "14.0.0",
25
+ "factory": "./update-14/replace-default-collection-option",
26
+ "description": "Replace 'defaultCollection' option in workspace configuration with 'schematicCollections'."
17
27
  }
18
28
  }
19
29
  }
@@ -0,0 +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
+ */
8
+ import { Rule } from '@angular-devkit/schematics';
9
+ /** Migration to remove 'defaultProject' option from angular.json. */
10
+ export default function (): Rule;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
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
+ const workspace_1 = require("../../utility/workspace");
11
+ /** Migration to remove 'defaultProject' option from angular.json. */
12
+ function default_1() {
13
+ return (0, workspace_1.updateWorkspace)((workspace) => {
14
+ delete workspace.extensions['defaultProject'];
15
+ });
16
+ }
17
+ exports.default = default_1;
@@ -0,0 +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
+ */
8
+ import { Rule } from '@angular-devkit/schematics';
9
+ /** Migration to replace 'defaultCollection' option in angular.json. */
10
+ export default function (): Rule;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
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
+ const core_1 = require("@angular-devkit/core");
11
+ const workspace_1 = require("../../utility/workspace");
12
+ /** Migration to replace 'defaultCollection' option in angular.json. */
13
+ function default_1() {
14
+ return (0, workspace_1.updateWorkspace)((workspace) => {
15
+ // workspace level
16
+ replaceDefaultCollection(workspace.extensions['cli']);
17
+ // Project level
18
+ for (const project of workspace.projects.values()) {
19
+ replaceDefaultCollection(project.extensions['cli']);
20
+ }
21
+ });
22
+ }
23
+ exports.default = default_1;
24
+ function replaceDefaultCollection(cliExtension) {
25
+ if (cliExtension && (0, core_1.isJsonObject)(cliExtension) && cliExtension['defaultCollection']) {
26
+ // If `schematicsCollection` defined `defaultCollection` is ignored hence no need to warn.
27
+ if (!cliExtension['schematicCollections']) {
28
+ cliExtension['schematicCollections'] = [cliExtension['defaultCollection']];
29
+ }
30
+ delete cliExtension['defaultCollection'];
31
+ }
32
+ }
package/ng-new/index.js CHANGED
@@ -12,7 +12,7 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
12
12
  function default_1(options) {
13
13
  if (!options.directory) {
14
14
  // If scoped project (i.e. "@foo/bar"), convert directory to "foo/bar".
15
- options.directory = options.name.startsWith('@') ? options.name.substr(1) : options.name;
15
+ options.directory = options.name.startsWith('@') ? options.name.slice(1) : options.name;
16
16
  }
17
17
  const workspaceOptions = {
18
18
  name: options.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "14.0.0-next.6",
3
+ "version": "14.0.0-next.7",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -15,8 +15,8 @@
15
15
  ],
16
16
  "schematics": "./collection.json",
17
17
  "dependencies": {
18
- "@angular-devkit/core": "14.0.0-next.6",
19
- "@angular-devkit/schematics": "14.0.0-next.6",
18
+ "@angular-devkit/core": "14.0.0-next.7",
19
+ "@angular-devkit/schematics": "14.0.0-next.7",
20
20
  "jsonc-parser": "3.0.0"
21
21
  },
22
22
  "repository": {
@@ -3,7 +3,7 @@
3
3
  "comment": "This file is needed so that depedencies are synced by Renovate.",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@types/jasmine": "~3.10.0",
6
+ "@types/jasmine": "~4.0.0",
7
7
  "@types/node": "^14.15.0",
8
8
  "jasmine-core": "~4.0.0",
9
9
  "karma-chrome-launcher": "~3.1.0",
@@ -110,12 +110,15 @@ export declare type TestBuilderTarget = BuilderTarget<Builders.Karma, TestBuilde
110
110
  export declare type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderOptions>;
111
111
  export declare type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>;
112
112
  export declare type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>;
113
+ interface WorkspaceCLISchema {
114
+ warnings?: Record<string, boolean>;
115
+ schematicCollections?: string[];
116
+ defaultCollection?: string;
117
+ }
113
118
  export interface WorkspaceSchema {
114
119
  version: 1;
115
120
  defaultProject?: string;
116
- cli?: {
117
- warnings?: Record<string, boolean>;
118
- };
121
+ cli?: WorkspaceCLISchema;
119
122
  projects: {
120
123
  [key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>;
121
124
  };
@@ -128,9 +131,7 @@ export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType
128
131
  root: string;
129
132
  sourceRoot: string;
130
133
  prefix: string;
131
- cli?: {
132
- warnings?: Record<string, boolean>;
133
- };
134
+ cli?: WorkspaceCLISchema;
134
135
  /**
135
136
  * Tool options.
136
137
  */
@@ -150,3 +151,4 @@ export interface WorkspaceTargets<TProjectType extends ProjectType = ProjectType
150
151
  'extract-i18n'?: ExtractI18nBuilderTarget;
151
152
  [key: string]: any;
152
153
  }
154
+ export {};