@schematics/angular 14.0.0-next.1 → 14.0.0-next.12

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.
Files changed (58) hide show
  1. package/app-shell/index.js +10 -10
  2. package/app-shell/schema.d.ts +3 -3
  3. package/app-shell/schema.json +3 -3
  4. package/application/index.js +4 -7
  5. package/application/schema.d.ts +1 -1
  6. package/application/schema.json +1 -1
  7. package/class/schema.json +1 -2
  8. package/collection.json +1 -4
  9. package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +1 -3
  10. package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +5 -4
  11. package/component/index.js +14 -15
  12. package/component/schema.d.ts +4 -0
  13. package/component/schema.json +6 -0
  14. package/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template +2 -1
  15. package/directive/index.js +14 -19
  16. package/directive/schema.d.ts +4 -0
  17. package/directive/schema.json +6 -0
  18. package/e2e/e2e-long.md +1 -1
  19. package/e2e/index.js +7 -1
  20. package/e2e/schema.d.ts +1 -1
  21. package/e2e/schema.json +1 -1
  22. package/interface/schema.json +0 -1
  23. package/library/index.js +3 -6
  24. package/migrations/migration-collection.json +10 -0
  25. package/migrations/update-14/remove-default-project-option.d.ts +10 -0
  26. package/migrations/update-14/remove-default-project-option.js +17 -0
  27. package/migrations/update-14/replace-default-collection-option.d.ts +10 -0
  28. package/migrations/update-14/replace-default-collection-option.js +32 -0
  29. package/module/index.js +13 -17
  30. package/ng-new/index.js +1 -1
  31. package/package.json +4 -4
  32. package/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template +2 -1
  33. package/pipe/index.js +13 -18
  34. package/pipe/schema.d.ts +4 -0
  35. package/pipe/schema.json +6 -0
  36. package/service-worker/index.js +8 -8
  37. package/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +7 -2
  38. package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +29 -16
  39. package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +4866 -3030
  40. package/universal/index.js +14 -9
  41. package/universal/schema.d.ts +1 -1
  42. package/universal/schema.json +1 -1
  43. package/utility/ast-utils.js +31 -27
  44. package/utility/find-module.d.ts +1 -0
  45. package/utility/find-module.js +5 -10
  46. package/utility/generate-from-files.js +2 -3
  47. package/utility/json-file.js +1 -7
  48. package/utility/latest-versions/package.json +7 -7
  49. package/utility/ng-ast-utils.js +7 -11
  50. package/utility/parse-name.js +0 -1
  51. package/utility/test/index.js +5 -1
  52. package/utility/validation.js +1 -3
  53. package/utility/workspace-models.d.ts +8 -6
  54. package/utility/workspace.js +1 -5
  55. package/web-worker/index.js +2 -2
  56. package/workspace/files/README.md.template +1 -1
  57. package/workspace/files/package.json.template +1 -2
  58. package/workspace/index.js +1 -2
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -36,11 +40,7 @@ const project_targets_1 = require("../utility/project-targets");
36
40
  const workspace_1 = require("../utility/workspace");
37
41
  const workspace_models_1 = require("../utility/workspace-models");
38
42
  function getSourceFile(host, path) {
39
- const buffer = host.read(path);
40
- if (!buffer) {
41
- throw new schematics_1.SchematicsException(`Could not find ${path}.`);
42
- }
43
- const content = buffer.toString();
43
+ const content = host.readText(path);
44
44
  const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);
45
45
  return source;
46
46
  }
@@ -72,10 +72,10 @@ function getComponentTemplate(host, compPath, tmplInfo) {
72
72
  const templateUrl = tmplInfo.templateUrlProp.initializer.text;
73
73
  const dir = (0, core_1.dirname)((0, core_1.normalize)(compPath));
74
74
  const templatePath = (0, core_1.join)(dir, templateUrl);
75
- const buffer = host.read(templatePath);
76
- if (buffer) {
77
- template = buffer.toString();
75
+ try {
76
+ template = host.readText(templatePath);
78
77
  }
78
+ catch { }
79
79
  }
80
80
  return template;
81
81
  }
@@ -105,7 +105,7 @@ function validateProject(mainPath) {
105
105
  const tmpl = getComponentTemplateInfo(host, componentPath);
106
106
  const template = getComponentTemplate(host, componentPath, tmpl);
107
107
  if (!routerOutletCheckRegex.test(template)) {
108
- const errorMsg = `Prerequisite for app shell is to define a router-outlet in your root component.`;
108
+ const errorMsg = `Prerequisite for application shell is to define a router-outlet in your root component.`;
109
109
  context.logger.error(errorMsg);
110
110
  throw new schematics_1.SchematicsException(errorMsg);
111
111
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generates an app shell for running a server-side version of an app.
2
+ * Generates an application shell for running a server-side version of an app.
3
3
  */
4
4
  export interface Schema {
5
5
  /**
@@ -7,7 +7,7 @@ export interface Schema {
7
7
  */
8
8
  appDir?: string;
9
9
  /**
10
- * The app ID to use in withServerTransition().
10
+ * The application ID to use in withServerTransition().
11
11
  */
12
12
  appId?: string;
13
13
  /**
@@ -27,7 +27,7 @@ export interface Schema {
27
27
  */
28
28
  rootModuleFileName?: string;
29
29
  /**
30
- * Route path used to produce the app shell.
30
+ * Route path used to produce the application shell.
31
31
  */
32
32
  route?: string;
33
33
  }
@@ -3,7 +3,7 @@
3
3
  "$id": "SchematicsAngularAppShell",
4
4
  "title": "Angular AppShell Options Schema",
5
5
  "type": "object",
6
- "description": "Generates an app shell for running a server-side version of an app.",
6
+ "description": "Generates an application shell for running a server-side version of an app.",
7
7
  "additionalProperties": false,
8
8
  "long-description": "./app-shell-long.md",
9
9
  "properties": {
@@ -16,13 +16,13 @@
16
16
  },
17
17
  "route": {
18
18
  "type": "string",
19
- "description": "Route path used to produce the app shell.",
19
+ "description": "Route path used to produce the application shell.",
20
20
  "default": "shell"
21
21
  },
22
22
  "appId": {
23
23
  "type": "string",
24
24
  "format": "html-selector",
25
- "description": "The app ID to use in withServerTransition().",
25
+ "description": "The application ID to use in withServerTransition().",
26
26
  "default": "serverApp"
27
27
  },
28
28
  "main": {
@@ -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,9 +231,9 @@ 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
- folderName = core_1.strings.dasherize(folderName);
236
+ folderName = schematics_1.strings.dasherize(folderName);
240
237
  }
241
238
  const appDir = isRootApp
242
239
  ? (0, core_1.normalize)(options.projectRoot || '')
@@ -247,7 +244,7 @@ function default_1(options) {
247
244
  (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
248
245
  options.minimal ? (0, schematics_1.filter)(minimalPathFilter) : (0, schematics_1.noop)(),
249
246
  (0, schematics_1.applyTemplates)({
250
- utils: core_1.strings,
247
+ utils: schematics_1.strings,
251
248
  ...options,
252
249
  relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(appDir),
253
250
  appName: options.name,
@@ -283,7 +280,7 @@ function default_1(options) {
283
280
  ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template'))
284
281
  : (0, schematics_1.noop)(),
285
282
  (0, schematics_1.applyTemplates)({
286
- utils: core_1.strings,
283
+ utils: schematics_1.strings,
287
284
  ...options,
288
285
  selector: appRootSelector,
289
286
  ...componentOptions,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generates a new basic app definition in the "projects" subfolder of the workspace.
2
+ * Generates a new basic application definition in the "projects" subfolder of the workspace.
3
3
  */
4
4
  export interface Schema {
5
5
  /**
@@ -3,7 +3,7 @@
3
3
  "$id": "SchematicsAngularApp",
4
4
  "title": "Angular Application Options Schema",
5
5
  "type": "object",
6
- "description": "Generates a new basic app definition in the \"projects\" subfolder of the workspace.",
6
+ "description": "Generates a new basic application definition in the \"projects\" subfolder of the workspace.",
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
9
  "projectRoot": {
package/class/schema.json CHANGED
@@ -36,8 +36,7 @@
36
36
  },
37
37
  "type": {
38
38
  "type": "string",
39
- "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".",
40
- "default": ""
39
+ "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
41
40
  }
42
41
  },
43
42
  "required": ["name"]
package/collection.json CHANGED
@@ -13,7 +13,6 @@
13
13
  "hidden": true
14
14
  },
15
15
  "service-worker": {
16
- "aliases": ["serviceWorker"],
17
16
  "factory": "./service-worker",
18
17
  "description": "Initializes a service worker setup.",
19
18
  "schema": "./service-worker/schema.json"
@@ -102,9 +101,8 @@
102
101
  "hidden": true
103
102
  },
104
103
  "app-shell": {
105
- "aliases": ["appShell"],
106
104
  "factory": "./app-shell",
107
- "description": "Create an app shell.",
105
+ "description": "Create an application shell.",
108
106
  "schema": "./app-shell/schema.json"
109
107
  },
110
108
  "library": {
@@ -114,7 +112,6 @@
114
112
  "description": "Generate a library project for Angular."
115
113
  },
116
114
  "web-worker": {
117
- "aliases": ["webWorker"],
118
115
  "factory": "./web-worker",
119
116
  "schema": "./web-worker/schema.json",
120
117
  "description": "Create a Web Worker."
@@ -8,12 +8,10 @@ describe('<%= classify(name) %><%= classify(type) %>', () => {
8
8
 
9
9
  beforeEach(async () => {
10
10
  await TestBed.configureTestingModule({
11
- declarations: [ <%= classify(name) %><%= classify(type) %> ]
11
+ <%= standalone ? 'imports' : '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();
@@ -1,20 +1,21 @@
1
1
  import { Component, OnInit<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
2
2
 
3
3
  @Component({<% if(!skipSelector) {%>
4
- selector: '<%= selector %>',<%}%><% if(inlineTemplate) { %>
4
+ selector: '<%= selector %>',<%}%><% if(standalone) {%>
5
+ standalone: true,<%}%><% if(inlineTemplate) { %>
5
6
  template: `
6
7
  <p>
7
8
  <%= dasherize(name) %> works!
8
9
  </p>
9
- `,<% } else { %>
10
- templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html',<% } if(inlineStyle) { %>
10
+ `<% } else { %>
11
+ templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html'<% } if(inlineStyle) { %>,
11
12
  styles: [<% if(displayBlock){ %>
12
13
  `
13
14
  :host {
14
15
  display: block;
15
16
  }
16
17
  `<% } %>
17
- ]<% } else if (style !== 'none') { %>
18
+ ]<% } else if (style !== 'none') { %>,
18
19
  styleUrls: ['./<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>']<% } %><% if(!!viewEncapsulation) { %>,
19
20
  encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
20
21
  changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -26,7 +30,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
30
  return result;
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const core_1 = require("@angular-devkit/core");
30
33
  const schematics_1 = require("@angular-devkit/schematics");
31
34
  const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
32
35
  const ast_utils_1 = require("../utility/ast-utils");
@@ -37,28 +40,24 @@ const validation_1 = require("../utility/validation");
37
40
  const workspace_1 = require("../utility/workspace");
38
41
  const schema_1 = require("./schema");
39
42
  function readIntoSourceFile(host, modulePath) {
40
- const text = host.read(modulePath);
41
- if (text === null) {
42
- throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`);
43
- }
44
- const sourceText = text.toString('utf-8');
43
+ const sourceText = host.readText(modulePath);
45
44
  return ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
46
45
  }
47
46
  function addDeclarationToNgModule(options) {
48
47
  return (host) => {
49
- if (options.skipImport || !options.module) {
48
+ if (options.skipImport || options.standalone || !options.module) {
50
49
  return host;
51
50
  }
52
51
  options.type = options.type != null ? options.type : 'Component';
53
52
  const modulePath = options.module;
54
53
  const source = readIntoSourceFile(host, modulePath);
55
54
  const componentPath = `/${options.path}/` +
56
- (options.flat ? '' : core_1.strings.dasherize(options.name) + '/') +
57
- core_1.strings.dasherize(options.name) +
55
+ (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
56
+ schematics_1.strings.dasherize(options.name) +
58
57
  (options.type ? '.' : '') +
59
- core_1.strings.dasherize(options.type);
58
+ schematics_1.strings.dasherize(options.type);
60
59
  const relativePath = (0, find_module_1.buildRelativePath)(modulePath, componentPath);
61
- const classifiedName = core_1.strings.classify(options.name) + core_1.strings.classify(options.type);
60
+ const classifiedName = schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type);
62
61
  const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath);
63
62
  const declarationRecorder = host.beginUpdate(modulePath);
64
63
  for (const change of declarationChanges) {
@@ -71,7 +70,7 @@ function addDeclarationToNgModule(options) {
71
70
  // Need to refresh the AST because we overwrote the file in the host.
72
71
  const source = readIntoSourceFile(host, modulePath);
73
72
  const exportRecorder = host.beginUpdate(modulePath);
74
- const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, core_1.strings.classify(options.name) + core_1.strings.classify(options.type), relativePath);
73
+ const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type), relativePath);
75
74
  for (const change of exportChanges) {
76
75
  if (change instanceof change_1.InsertChange) {
77
76
  exportRecorder.insertLeft(change.pos, change.toAdd);
@@ -83,7 +82,7 @@ function addDeclarationToNgModule(options) {
83
82
  };
84
83
  }
85
84
  function buildSelector(options, projectPrefix) {
86
- let selector = core_1.strings.dasherize(options.name);
85
+ let selector = schematics_1.strings.dasherize(options.name);
87
86
  if (options.prefix) {
88
87
  selector = `${options.prefix}-${selector}`;
89
88
  }
@@ -115,7 +114,7 @@ function default_1(options) {
115
114
  skipStyleFile ? (0, schematics_1.filter)((path) => !path.endsWith('.__style__.template')) : (0, schematics_1.noop)(),
116
115
  options.inlineTemplate ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) : (0, schematics_1.noop)(),
117
116
  (0, schematics_1.applyTemplates)({
118
- ...core_1.strings,
117
+ ...schematics_1.strings,
119
118
  'if-flat': (s) => (options.flat ? '' : s),
120
119
  ...options,
121
120
  }),
@@ -65,6 +65,10 @@ export interface Schema {
65
65
  * Do not create "spec.ts" test files for the new component.
66
66
  */
67
67
  skipTests?: boolean;
68
+ /**
69
+ * Whether the generated component is standalone.
70
+ */
71
+ standalone?: boolean;
68
72
  /**
69
73
  * The file extension or preprocessor to use for style files, or 'none' to skip generating
70
74
  * the style file.
@@ -48,6 +48,12 @@
48
48
  "alias": "t",
49
49
  "x-user-analytics": 10
50
50
  },
51
+ "standalone": {
52
+ "description": "Whether the generated component is standalone.",
53
+ "type": "boolean",
54
+ "default": false,
55
+ "x-user-analytics": 15
56
+ },
51
57
  "viewEncapsulation": {
52
58
  "description": "The view encapsulation strategy to use in the new component.",
53
59
  "enum": ["Emulated", "None", "ShadowDom"],
@@ -1,7 +1,8 @@
1
1
  import { Directive } from '@angular/core';
2
2
 
3
3
  @Directive({
4
- selector: '[<%= selector %>]'
4
+ selector: '[<%= selector %>]'<% if(standalone) {%>,
5
+ standalone: true<%}%>
5
6
  })
6
7
  export class <%= classify(name) %>Directive {
7
8
 
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -26,7 +30,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
30
  return result;
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const core_1 = require("@angular-devkit/core");
30
33
  const schematics_1 = require("@angular-devkit/schematics");
31
34
  const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
32
35
  const ast_utils_1 = require("../utility/ast-utils");
@@ -37,22 +40,18 @@ const validation_1 = require("../utility/validation");
37
40
  const workspace_1 = require("../utility/workspace");
38
41
  function addDeclarationToNgModule(options) {
39
42
  return (host) => {
40
- if (options.skipImport || !options.module) {
43
+ if (options.skipImport || options.standalone || !options.module) {
41
44
  return host;
42
45
  }
43
46
  const modulePath = options.module;
44
- const text = host.read(modulePath);
45
- if (text === null) {
46
- throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`);
47
- }
48
- const sourceText = text.toString('utf-8');
47
+ const sourceText = host.readText(modulePath);
49
48
  const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
50
49
  const directivePath = `/${options.path}/` +
51
- (options.flat ? '' : core_1.strings.dasherize(options.name) + '/') +
52
- core_1.strings.dasherize(options.name) +
50
+ (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
51
+ schematics_1.strings.dasherize(options.name) +
53
52
  '.directive';
54
53
  const relativePath = (0, find_module_1.buildRelativePath)(modulePath, directivePath);
55
- const classifiedName = core_1.strings.classify(`${options.name}Directive`);
54
+ const classifiedName = schematics_1.strings.classify(`${options.name}Directive`);
56
55
  const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath);
57
56
  const declarationRecorder = host.beginUpdate(modulePath);
58
57
  for (const change of declarationChanges) {
@@ -63,14 +62,10 @@ function addDeclarationToNgModule(options) {
63
62
  host.commitUpdate(declarationRecorder);
64
63
  if (options.export) {
65
64
  // Need to refresh the AST because we overwrote the file in the host.
66
- const text = host.read(modulePath);
67
- if (text === null) {
68
- throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`);
69
- }
70
- const sourceText = text.toString('utf-8');
65
+ const sourceText = host.readText(modulePath);
71
66
  const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
72
67
  const exportRecorder = host.beginUpdate(modulePath);
73
- const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, core_1.strings.classify(`${options.name}Directive`), relativePath);
68
+ const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, schematics_1.strings.classify(`${options.name}Directive`), relativePath);
74
69
  for (const change of exportChanges) {
75
70
  if (change instanceof change_1.InsertChange) {
76
71
  exportRecorder.insertLeft(change.pos, change.toAdd);
@@ -89,7 +84,7 @@ function buildSelector(options, projectPrefix) {
89
84
  else if (options.prefix === undefined && projectPrefix) {
90
85
  selector = `${projectPrefix}-${selector}`;
91
86
  }
92
- return core_1.strings.camelize(selector);
87
+ return schematics_1.strings.camelize(selector);
93
88
  }
94
89
  function default_1(options) {
95
90
  return async (host) => {
@@ -110,7 +105,7 @@ function default_1(options) {
110
105
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
111
106
  options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
112
107
  (0, schematics_1.applyTemplates)({
113
- ...core_1.strings,
108
+ ...schematics_1.strings,
114
109
  'if-flat': (s) => (options.flat ? '' : s),
115
110
  ...options,
116
111
  }),
@@ -43,4 +43,8 @@ export interface Schema {
43
43
  * Do not create "spec.ts" test files for the new class.
44
44
  */
45
45
  skipTests?: boolean;
46
+ /**
47
+ * Whether the generated directive is standalone.
48
+ */
49
+ standalone?: boolean;
46
50
  }
@@ -59,6 +59,12 @@
59
59
  "format": "html-selector",
60
60
  "description": "The HTML selector to use for this directive."
61
61
  },
62
+ "standalone": {
63
+ "description": "Whether the generated directive is standalone.",
64
+ "type": "boolean",
65
+ "default": false,
66
+ "x-user-analytics": 15
67
+ },
62
68
  "flat": {
63
69
  "type": "boolean",
64
70
  "description": "When true (the default), creates the new files at the top level of the current project.",
package/e2e/e2e-long.md CHANGED
@@ -1,2 +1,2 @@
1
- The e2e tests are created in a separate app in the `projects` folder of the workspace,
1
+ The e2e tests are created in a separate application in the `projects` folder of the workspace,
2
2
  next to the project being tested.
package/e2e/index.js CHANGED
@@ -11,6 +11,7 @@ const core_1 = require("@angular-devkit/core");
11
11
  const schematics_1 = require("@angular-devkit/schematics");
12
12
  const dependencies_1 = require("../utility/dependencies");
13
13
  const json_file_1 = require("../utility/json-file");
14
+ const latest_versions_1 = require("../utility/latest-versions");
14
15
  const paths_1 = require("../utility/paths");
15
16
  const workspace_1 = require("../utility/workspace");
16
17
  const workspace_models_1 = require("../utility/workspace-models");
@@ -52,7 +53,7 @@ function default_1(options) {
52
53
  (0, workspace_1.updateWorkspace)(workspace),
53
54
  (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
54
55
  (0, schematics_1.applyTemplates)({
55
- utils: core_1.strings,
56
+ utils: schematics_1.strings,
56
57
  ...options,
57
58
  relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(root),
58
59
  }),
@@ -74,6 +75,11 @@ function default_1(options) {
74
75
  name: 'ts-node',
75
76
  version: '~9.1.1',
76
77
  },
78
+ {
79
+ type: dependencies_1.NodeDependencyType.Dev,
80
+ name: '@types/node',
81
+ version: latest_versions_1.latestVersions['@types/node'],
82
+ },
77
83
  ].forEach((dep) => (0, dependencies_1.addPackageJsonDependency)(host, dep)),
78
84
  addScriptsToPackageJson(),
79
85
  ]);
package/e2e/schema.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export interface Schema {
5
5
  /**
6
- * The name of the app being tested.
6
+ * The name of the application being tested.
7
7
  */
8
8
  relatedAppName: string;
9
9
  /**
package/e2e/schema.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "default": "app-root"
14
14
  },
15
15
  "relatedAppName": {
16
- "description": "The name of the app being tested.",
16
+ "description": "The name of the application being tested.",
17
17
  "type": "string"
18
18
  }
19
19
  },
@@ -30,7 +30,6 @@
30
30
  },
31
31
  "prefix": {
32
32
  "type": "string",
33
- "default": "",
34
33
  "description": "A prefix to apply to generated selectors."
35
34
  },
36
35
  "type": {
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,9 +106,9 @@ 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
- folderName = core_1.strings.dasherize(folderName);
111
+ folderName = schematics_1.strings.dasherize(folderName);
115
112
  }
116
113
  const projectRoot = (0, core_1.join)((0, core_1.normalize)(newProjectRoot), folderName);
117
114
  const distRoot = `dist/${folderName}`;
@@ -119,7 +116,7 @@ function default_1(options) {
119
116
  const sourceDir = `${projectRoot}/src/lib`;
120
117
  const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
121
118
  (0, schematics_1.applyTemplates)({
122
- ...core_1.strings,
119
+ ...schematics_1.strings,
123
120
  ...options,
124
121
  packageName,
125
122
  projectRoot,
@@ -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;