@schematics/angular 17.1.0-rc.0 → 17.1.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.
@@ -286,15 +286,15 @@
286
286
  rel="noopener"
287
287
  >
288
288
  <svg
289
- width="25"
290
- height="20"
291
- viewBox="0 0 25 20"
289
+ width="24"
290
+ height="24"
291
+ viewBox="0 0 24 24"
292
292
  fill="none"
293
293
  xmlns="http://www.w3.org/2000/svg"
294
294
  alt="Twitter"
295
295
  >
296
296
  <path
297
- d="M8.04524 20C17.3335 20 22.4138 12.3047 22.4138 5.63144C22.4138 5.41287 22.4138 5.19529 22.399 4.97869C23.3874 4.26381 24.2405 3.37867 24.9185 2.3647C23.9969 2.77329 23.0192 3.04112 22.018 3.15923C23.0723 2.52818 23.8613 1.53552 24.2382 0.366057C23.2469 0.954335 22.1624 1.36889 21.0315 1.59182C20.2701 0.782212 19.2631 0.246107 18.1663 0.0664704C17.0695 -0.113166 15.9441 0.0736804 14.9642 0.598096C13.9843 1.12251 13.2046 1.95526 12.7457 2.96748C12.2868 3.9797 12.1742 5.11495 12.4255 6.19756C10.4178 6.09685 8.45366 5.57507 6.66064 4.66609C4.86763 3.75712 3.28579 2.48127 2.01781 0.921344C1.37203 2.03306 1.17424 3.34911 1.46472 4.60154C1.75519 5.85397 2.51208 6.9486 3.58128 7.66257C2.77759 7.63903 1.9914 7.42221 1.28924 7.03049V7.09449C1.28956 8.26041 1.69316 9.39034 2.4316 10.2926C3.17003 11.1949 4.19783 11.8139 5.34067 12.0448C4.59721 12.2476 3.81715 12.2772 3.06045 12.1315C3.38327 13.1348 4.01156 14.0122 4.85746 14.641C5.70337 15.2698 6.72461 15.6185 7.77842 15.6384C6.73139 16.4614 5.53237 17.0699 4.24995 17.4291C2.96753 17.7882 1.62687 17.891 0.304688 17.7316C2.61411 19.2136 5.30121 19.9997 8.04524 19.9961"
297
+ d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
298
298
  />
299
299
  </svg>
300
300
  </a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "17.1.0-rc.0",
3
+ "version": "17.1.0",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "schematics": "./collection.json",
25
25
  "dependencies": {
26
- "@angular-devkit/core": "17.1.0-rc.0",
27
- "@angular-devkit/schematics": "17.1.0-rc.0",
26
+ "@angular-devkit/core": "17.1.0",
27
+ "@angular-devkit/schematics": "17.1.0",
28
28
  "jsonc-parser": "3.2.0"
29
29
  },
30
30
  "repository": {
package/server/index.js CHANGED
@@ -9,7 +9,6 @@
9
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
- const tasks_1 = require("@angular-devkit/schematics/tasks");
13
12
  const node_path_1 = require("node:path");
14
13
  const utility_1 = require("../utility");
15
14
  const dependencies_1 = require("../utility/dependencies");
@@ -103,22 +102,23 @@ function updateTsConfigFile(tsConfigPath) {
103
102
  json.modify(typePath, [...types]);
104
103
  };
105
104
  }
106
- function addDependencies() {
105
+ function addDependencies(skipInstall) {
107
106
  return (host) => {
108
107
  const coreDep = (0, dependencies_1.getPackageJsonDependency)(host, '@angular/core');
109
108
  if (coreDep === null) {
110
109
  throw new schematics_1.SchematicsException('Could not find version.');
111
110
  }
112
- const platformServerDep = {
113
- ...coreDep,
114
- name: '@angular/platform-server',
115
- };
116
- (0, dependencies_1.addPackageJsonDependency)(host, platformServerDep);
117
- (0, dependencies_1.addPackageJsonDependency)(host, {
118
- type: dependencies_1.NodeDependencyType.Dev,
119
- name: '@types/node',
120
- version: latest_versions_1.latestVersions['@types/node'],
121
- });
111
+ const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
112
+ return (0, schematics_1.chain)([
113
+ (0, utility_1.addDependency)('@angular/platform-server', coreDep.version, {
114
+ type: utility_1.DependencyType.Default,
115
+ install,
116
+ }),
117
+ (0, utility_1.addDependency)('@types/node', latest_versions_1.latestVersions['@types/node'], {
118
+ type: utility_1.DependencyType.Dev,
119
+ install,
120
+ }),
121
+ ]);
122
122
  };
123
123
  }
124
124
  function default_1(options) {
@@ -138,9 +138,6 @@ function default_1(options) {
138
138
  // Server has already been added.
139
139
  return;
140
140
  }
141
- if (!options.skipInstall) {
142
- context.addTask(new tasks_1.NodePackageInstallTask());
143
- }
144
141
  const clientBuildOptions = clientBuildTarget.options;
145
142
  const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
146
143
  const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
@@ -175,7 +172,7 @@ function default_1(options) {
175
172
  ])),
176
173
  updateConfigFileBrowserBuilder(options, tsConfigDirectory),
177
174
  ]),
178
- addDependencies(),
175
+ addDependencies(options.skipInstall),
179
176
  (0, utility_1.addRootProvider)(options.project, ({ code, external }) => code `${external('provideClientHydration', '@angular/platform-browser')}()`),
180
177
  ]);
181
178
  };
@@ -34,6 +34,7 @@ exports.hasTopLevelIdentifier = exports.addRouteDeclarationToModule = exports.ge
34
34
  const core_1 = require("@angular-devkit/core");
35
35
  const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
36
36
  const change_1 = require("./change");
37
+ const eol_1 = require("./eol");
37
38
  /**
38
39
  * Add Import `import { symbolName } from fileName` if the import doesn't exit
39
40
  * already. Assumes fileToEdit can be resolved and accessed.
@@ -81,11 +82,12 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
81
82
  }
82
83
  const open = isDefault ? '' : '{ ';
83
84
  const close = isDefault ? '' : ' }';
85
+ const eol = (0, eol_1.getEOL)(rootNode.getText());
84
86
  // if there are no imports or 'use strict' statement, insert import at beginning of file
85
87
  const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;
86
- const separator = insertAtBeginning ? '' : ';\n';
88
+ const separator = insertAtBeginning ? '' : `;${eol}`;
87
89
  const toInsert = `${separator}import ${open}${importExpression}${close}` +
88
- ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
90
+ ` from '${fileName}'${insertAtBeginning ? `;${eol}` : ''}`;
89
91
  return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
90
92
  }
91
93
  exports.insertImport = insertImport;
@@ -0,0 +1,8 @@
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
+ export declare function getEOL(content: string): string;
package/utility/eol.js ADDED
@@ -0,0 +1,23 @@
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
+ exports.getEOL = void 0;
11
+ const node_os_1 = require("node:os");
12
+ const CRLF = '\r\n';
13
+ const LF = '\n';
14
+ function getEOL(content) {
15
+ const newlines = content.match(/(?:\r?\n)/g);
16
+ if (newlines?.length) {
17
+ const crlf = newlines.filter((l) => l === CRLF).length;
18
+ const lf = newlines.length - crlf;
19
+ return crlf > lf ? CRLF : LF;
20
+ }
21
+ return node_os_1.EOL;
22
+ }
23
+ exports.getEOL = getEOL;
@@ -14,6 +14,7 @@ export declare class JSONFile {
14
14
  private readonly host;
15
15
  private readonly path;
16
16
  content: string;
17
+ private eol;
17
18
  constructor(host: Tree, path: string);
18
19
  private _jsonAst;
19
20
  private get JsonAst();
@@ -9,15 +9,18 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.JSONFile = void 0;
11
11
  const jsonc_parser_1 = require("jsonc-parser");
12
+ const eol_1 = require("./eol");
12
13
  /** @private */
13
14
  class JSONFile {
14
15
  host;
15
16
  path;
16
17
  content;
18
+ eol;
17
19
  constructor(host, path) {
18
20
  this.host = host;
19
21
  this.path = path;
20
22
  this.content = this.host.readText(this.path);
23
+ this.eol = (0, eol_1.getEOL)(this.content);
21
24
  }
22
25
  _jsonAst;
23
26
  get JsonAst() {
@@ -55,6 +58,7 @@ class JSONFile {
55
58
  const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
56
59
  getInsertionIndex,
57
60
  formattingOptions: {
61
+ eol: this.eol,
58
62
  insertSpaces: true,
59
63
  tabSize: 2,
60
64
  },
@@ -15,12 +15,12 @@
15
15
  "karma-jasmine-html-reporter": "~2.1.0",
16
16
  "karma-jasmine": "~5.1.0",
17
17
  "karma": "~6.4.0",
18
- "ng-packagr": "^17.1.0-next.0",
18
+ "ng-packagr": "^17.1.0",
19
19
  "protractor": "~7.0.0",
20
20
  "rxjs": "~7.8.0",
21
21
  "tslib": "^2.3.0",
22
22
  "ts-node": "~10.9.0",
23
23
  "typescript": "~5.3.2",
24
- "zone.js": "~0.14.2"
24
+ "zone.js": "~0.14.3"
25
25
  }
26
26
  }
@@ -13,7 +13,7 @@ exports.latestVersions = {
13
13
  // but ts_library doesn't support JSON inputs.
14
14
  ...require('./latest-versions/package.json')['dependencies'],
15
15
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
16
- Angular: '^17.1.0-next.0',
17
- DevkitBuildAngular: '^17.1.0-rc.0',
18
- AngularSSR: '^17.1.0-rc.0',
16
+ Angular: '^17.1.0',
17
+ DevkitBuildAngular: '^17.1.0',
18
+ AngularSSR: '^17.1.0',
19
19
  };