@angular/cli 13.0.0-rc.2 → 13.0.2

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.
@@ -109,9 +109,21 @@ function wrap(schematicFile, schematicDirectory, moduleCache, exportName) {
109
109
  return legacyModules[id];
110
110
  }
111
111
  else if (id.startsWith('@angular-devkit/') || id.startsWith('@schematics/')) {
112
+ // Files should not redirect `@angular/core` and instead use the direct
113
+ // dependency if available. This allows old major version migrations to continue to function
114
+ // even though the latest major version may have breaking changes in `@angular/core`.
115
+ if (id.startsWith('@angular-devkit/core')) {
116
+ try {
117
+ return schematicRequire(id);
118
+ }
119
+ catch (e) {
120
+ if (e.code !== 'MODULE_NOT_FOUND') {
121
+ throw e;
122
+ }
123
+ }
124
+ }
112
125
  // Resolve from inside the `@angular/cli` project
113
- const packagePath = require.resolve(id);
114
- return hostRequire(packagePath);
126
+ return hostRequire(id);
115
127
  }
116
128
  else if (id.startsWith('.') || id.startsWith('@angular/cdk')) {
117
129
  // Wrap relative files inside the schematic collection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "13.0.0-rc.2",
3
+ "version": "13.0.2",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1300.0-rc.2",
32
- "@angular-devkit/core": "13.0.0-rc.2",
33
- "@angular-devkit/schematics": "13.0.0-rc.2",
34
- "@schematics/angular": "13.0.0-rc.2",
31
+ "@angular-devkit/architect": "0.1300.2",
32
+ "@angular-devkit/core": "13.0.2",
33
+ "@angular-devkit/schematics": "13.0.2",
34
+ "@schematics/angular": "13.0.2",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.2",
@@ -51,12 +51,12 @@
51
51
  "ng-update": {
52
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
53
53
  "packageGroup": {
54
- "@angular/cli": "13.0.0-rc.2",
55
- "@angular-devkit/architect": "0.1300.0-rc.2",
56
- "@angular-devkit/build-angular": "13.0.0-rc.2",
57
- "@angular-devkit/build-webpack": "0.1300.0-rc.2",
58
- "@angular-devkit/core": "13.0.0-rc.2",
59
- "@angular-devkit/schematics": "13.0.0-rc.2"
54
+ "@angular/cli": "13.0.2",
55
+ "@angular-devkit/architect": "0.1300.2",
56
+ "@angular-devkit/build-angular": "13.0.2",
57
+ "@angular-devkit/build-webpack": "0.1300.2",
58
+ "@angular-devkit/core": "13.0.2",
59
+ "@angular-devkit/schematics": "13.0.2"
60
60
  }
61
61
  },
62
62
  "engines": {
@@ -320,13 +320,34 @@ function _usageMessage(options, infoMap, logger) {
320
320
  const packageGroups = new Map();
321
321
  const packagesToUpdate = [...infoMap.entries()]
322
322
  .map(([name, info]) => {
323
- const tag = options.next
323
+ var _a, _b;
324
+ let tag = options.next
324
325
  ? info.npmPackageJson['dist-tags']['next']
325
326
  ? 'next'
326
327
  : 'latest'
327
328
  : 'latest';
328
- const version = info.npmPackageJson['dist-tags'][tag];
329
- const target = info.npmPackageJson.versions[version];
329
+ let version = info.npmPackageJson['dist-tags'][tag];
330
+ let target = info.npmPackageJson.versions[version];
331
+ const versionDiff = semver.diff(info.installed.version, version);
332
+ if (versionDiff !== 'patch' &&
333
+ versionDiff !== 'minor' &&
334
+ /^@(?:angular|nguniversal)\//.test(name)) {
335
+ const installedMajorVersion = (_a = semver.parse(info.installed.version)) === null || _a === void 0 ? void 0 : _a.major;
336
+ const toInstallMajorVersion = (_b = semver.parse(version)) === null || _b === void 0 ? void 0 : _b.major;
337
+ if (installedMajorVersion !== undefined &&
338
+ toInstallMajorVersion !== undefined &&
339
+ installedMajorVersion < toInstallMajorVersion - 1) {
340
+ const nextMajorVersion = `${installedMajorVersion + 1}.`;
341
+ const nextMajorVersions = Object.keys(info.npmPackageJson.versions)
342
+ .filter((v) => v.startsWith(nextMajorVersion))
343
+ .sort((a, b) => (a > b ? -1 : 1));
344
+ if (nextMajorVersions.length) {
345
+ version = nextMajorVersions[0];
346
+ target = info.npmPackageJson.versions[version];
347
+ tag = '';
348
+ }
349
+ }
350
+ }
330
351
  return {
331
352
  name,
332
353
  info,
@@ -335,17 +356,13 @@ function _usageMessage(options, infoMap, logger) {
335
356
  target,
336
357
  };
337
358
  })
338
- .filter(({ info, version, target }) => {
339
- return target && semver.compare(info.installed.version, version) < 0;
340
- })
341
- .filter(({ target }) => {
342
- return target['ng-update'];
343
- })
359
+ .filter(({ info, version, target }) => (target === null || target === void 0 ? void 0 : target['ng-update']) && semver.compare(info.installed.version, version) < 0)
344
360
  .map(({ name, info, version, tag, target }) => {
361
+ var _a;
345
362
  // Look for packageGroup.
346
- if (target['ng-update'] && target['ng-update']['packageGroup']) {
347
- const packageGroup = target['ng-update']['packageGroup'];
348
- const packageGroupName = target['ng-update']['packageGroupName'] || target['ng-update']['packageGroup'][0];
363
+ const packageGroup = target['ng-update']['packageGroup'];
364
+ if (packageGroup) {
365
+ const packageGroupName = target['ng-update']['packageGroupName'] || packageGroup[0];
349
366
  if (packageGroupName) {
350
367
  if (packageGroups.has(name)) {
351
368
  return null;
@@ -356,7 +373,10 @@ function _usageMessage(options, infoMap, logger) {
356
373
  }
357
374
  }
358
375
  let command = `ng update ${name}`;
359
- if (tag == 'next') {
376
+ if (!tag) {
377
+ command += `@${((_a = semver.parse(version)) === null || _a === void 0 ? void 0 : _a.major) || version}`;
378
+ }
379
+ else if (tag == 'next') {
360
380
  command += ' --next';
361
381
  }
362
382
  return [name, `${info.installed.version} -> ${version} `, command];