@schematics/angular 18.0.0-next.5 → 18.0.0-rc.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.
@@ -232,9 +232,6 @@ function addAppToWorkspaceFile(options, appDir, folderName) {
232
232
  },
233
233
  'extract-i18n': {
234
234
  builder: workspace_models_1.Builders.ExtractI18n,
235
- options: {
236
- buildTarget: `${options.name}:build`,
237
- },
238
235
  },
239
236
  test: options.minimal
240
237
  ? undefined
@@ -174,14 +174,49 @@ function updateProjects(tree, context) {
174
174
  // Add direct @angular/build dependencies and remove @angular-devkit/build-angular
175
175
  rules.push((0, dependency_1.addDependency)('@angular/build', latest_versions_1.latestVersions.DevkitBuildAngular, {
176
176
  type: dependency_1.DependencyType.Dev,
177
+ // Always is set here since removePackageJsonDependency below does not automatically
178
+ // trigger the package manager execution.
177
179
  install: dependency_1.InstallBehavior.Always,
178
180
  existing: dependency_1.ExistingBehavior.Replace,
179
181
  }));
180
182
  (0, dependencies_1.removePackageJsonDependency)(tree, '@angular-devkit/build-angular');
183
+ // Add less dependency if any projects contain a Less stylesheet file.
184
+ // This check does not consider Node.js packages due to the performance
185
+ // cost of searching such a large directory structure. A build time error
186
+ // will provide instructions to install the package in this case.
187
+ if (hasLessStylesheets(tree)) {
188
+ rules.push((0, dependency_1.addDependency)('less', latest_versions_1.latestVersions['less'], {
189
+ type: dependency_1.DependencyType.Dev,
190
+ existing: dependency_1.ExistingBehavior.Skip,
191
+ }));
192
+ }
181
193
  }
182
194
  return (0, schematics_1.chain)(rules);
183
195
  });
184
196
  }
197
+ /**
198
+ * Searches the schematic tree for files that have a `.less` extension.
199
+ *
200
+ * @param tree A Schematics tree instance to search
201
+ * @returns true if Less stylesheet files are found; otherwise, false
202
+ */
203
+ function hasLessStylesheets(tree) {
204
+ const directories = [tree.getDir('/')];
205
+ let current;
206
+ while ((current = directories.pop())) {
207
+ for (const path of current.subfiles) {
208
+ if (path.endsWith('.less')) {
209
+ return true;
210
+ }
211
+ }
212
+ for (const path of current.subdirs) {
213
+ if (path === 'node_modules' || path.startsWith('.')) {
214
+ continue;
215
+ }
216
+ directories.push(current.dir(path));
217
+ }
218
+ }
219
+ }
185
220
  function* visit(directory) {
186
221
  for (const path of directory.subfiles) {
187
222
  const sass = path.endsWith('.scss');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "18.0.0-next.5",
3
+ "version": "18.0.0-rc.0",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "schematics": "./collection.json",
24
24
  "dependencies": {
25
- "@angular-devkit/core": "18.0.0-next.5",
26
- "@angular-devkit/schematics": "18.0.0-next.5",
25
+ "@angular-devkit/core": "18.0.0-rc.0",
26
+ "@angular-devkit/schematics": "18.0.0-rc.0",
27
27
  "jsonc-parser": "3.2.1"
28
28
  },
29
29
  "repository": {
@@ -16,6 +16,7 @@
16
16
  "karma-jasmine-html-reporter": "~2.1.0",
17
17
  "karma-jasmine": "~5.1.0",
18
18
  "karma": "~6.4.0",
19
+ "less": "^4.2.0",
19
20
  "ng-packagr": "^18.0.0-next.0",
20
21
  "protractor": "~7.0.0",
21
22
  "rxjs": "~7.8.0",
@@ -15,6 +15,6 @@ exports.latestVersions = {
15
15
  ...dependencies,
16
16
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
17
17
  Angular: dependencies['@angular/core'],
18
- DevkitBuildAngular: '^18.0.0-next.5',
19
- AngularSSR: '^18.0.0-next.5',
18
+ DevkitBuildAngular: '^18.0.0-rc.0',
19
+ AngularSSR: '^18.0.0-rc.0',
20
20
  };