@angular/cli 9.0.0-rc.6 → 9.0.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.
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- require('./ng-update-message');
5
- require('./analytics-prompt');
4
+ // These should not fail but if they do they should not block installation of the package
5
+ try {
6
+ require('./ng-update-message');
7
+ require('./analytics-prompt');
8
+ } catch (_) {}
@@ -3,7 +3,6 @@ import { SchematicCommand } from '../models/schematic-command';
3
3
  import { Schema as AddCommandSchema } from './add';
4
4
  export declare class AddCommand extends SchematicCommand<AddCommandSchema> {
5
5
  readonly allowPrivateSchematics = true;
6
- readonly allowAdditionalArgs = true;
7
6
  run(options: AddCommandSchema & Arguments): Promise<number | void>;
8
7
  reportAnalytics(paths: string[], options: AddCommandSchema & Arguments, dimensions?: (boolean | number | string)[], metrics?: (boolean | number | string)[]): Promise<void>;
9
8
  private isPackageInstalled;
@@ -23,7 +23,6 @@ class AddCommand extends schematic_command_1.SchematicCommand {
23
23
  constructor() {
24
24
  super(...arguments);
25
25
  this.allowPrivateSchematics = true;
26
- this.allowAdditionalArgs = true;
27
26
  }
28
27
  async run(options) {
29
28
  if (!options.collection) {
@@ -42,7 +42,7 @@ class DocCommand extends command_1.Command {
42
42
  }
43
43
  let searchUrl = `https://${domain}/api?query=${options.keyword}`;
44
44
  if (options.search) {
45
- searchUrl = `https://www.google.com/search?q=site%3A${domain}+${options.keyword}`;
45
+ searchUrl = `https://${domain}/?search=${options.keyword}`;
46
46
  }
47
47
  // We should wrap `open` in a new Promise because `open` is already resolved
48
48
  await new Promise(() => {
@@ -27,6 +27,14 @@ const pickManifest = require('npm-pick-manifest');
27
27
  const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
28
28
  const NG_VERSION_9_POST_MSG = color_1.colors.cyan('\nYour project has been updated to Angular version 9!\n' +
29
29
  'For more info, please see: https://v9.angular.io/guide/updating-to-version-9');
30
+ /**
31
+ * Disable CLI version mismatch checks and forces usage of the invoked CLI
32
+ * instead of invoking the local installed version.
33
+ */
34
+ const disableVersionCheckEnv = process.env['NG_DISABLE_VERSION_CHECK'];
35
+ const disableVersionCheck = disableVersionCheckEnv !== undefined &&
36
+ disableVersionCheckEnv !== '0' &&
37
+ disableVersionCheckEnv.toLowerCase() !== 'false';
30
38
  class UpdateCommand extends command_1.Command {
31
39
  constructor() {
32
40
  super(...arguments);
@@ -174,8 +182,26 @@ class UpdateCommand extends command_1.Command {
174
182
  }
175
183
  // tslint:disable-next-line:no-big-function
176
184
  async run(options) {
185
+ // Check if the @angular-devkit/schematics package can be resolved from the workspace root
186
+ // This works around issues with packages containing migrations that cannot directly depend on the package
187
+ // This check can be removed once the schematic runtime handles this situation
188
+ try {
189
+ require.resolve('@angular-devkit/schematics', { paths: [this.workspace.root] });
190
+ }
191
+ catch (e) {
192
+ if (e.code === 'MODULE_NOT_FOUND') {
193
+ this.logger.fatal('The "@angular-devkit/schematics" package cannot be resolved from the workspace root directory. ' +
194
+ 'This may be due to an unsupported node modules structure.\n' +
195
+ 'Please remove both the "node_modules" directory and the package lock file; and then reinstall.\n' +
196
+ 'If this does not correct the problem, ' +
197
+ 'please temporarily install the "@angular-devkit/schematics" package within the workspace. ' +
198
+ 'It can be removed once the update is complete.');
199
+ return 1;
200
+ }
201
+ throw e;
202
+ }
177
203
  // Check if the current installed CLI version is older than the latest version.
178
- if (await this.checkCLILatestVersion(options.verbose, options.next)) {
204
+ if (!disableVersionCheck && await this.checkCLILatestVersion(options.verbose, options.next)) {
179
205
  this.logger.warn(`The installed Angular CLI version is older than the latest ${options.next ? 'pre-release' : 'stable'} version.\n` +
180
206
  'Installing a temporary version to perform the update.');
181
207
  return install_package_1.runTempPackageBin(`@angular/cli@${options.next ? 'next' : 'latest'}`, this.logger, this.packageManager, process.argv.slice(2));
package/lib/init.js CHANGED
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  */
10
10
  require("symbol-observable");
11
11
  // symbol polyfill must go first
12
- // tslint:disable: no-console
13
12
  // tslint:disable-next-line:ordered-imports import-groups
14
13
  const core_1 = require("@angular-devkit/core");
15
14
  const fs = require("fs");
@@ -61,6 +60,13 @@ if (process.env['NG_CLI_PROFILING']) {
61
60
  process.on('uncaughtException', () => exitHandler({ exit: true }));
62
61
  }
63
62
  (async () => {
63
+ /**
64
+ * Disable Browserslist old data warning as otherwise with every release we'd need to update this dependency
65
+ * which is cumbersome considering we pin versions and the warning is not user actionable.
66
+ * `Browserslist: caniuse-lite is outdated. Please run next command `npm update`
67
+ * See: https://github.com/browserslist/browserslist/blob/819c4337456996d19db6ba953014579329e9c6e1/node.js#L324
68
+ */
69
+ process.env.BROWSERSLIST_IGNORE_OLD_DATA = '1';
64
70
  const disableVersionCheckEnv = process.env['NG_DISABLE_VERSION_CHECK'];
65
71
  /**
66
72
  * Disable CLI version mismatch checks and forces usage of the invoked CLI
@@ -84,7 +90,7 @@ if (process.env['NG_CLI_PROFILING']) {
84
90
  shouldWarn = localVersion != null && globalVersion.compare(localVersion) > 0;
85
91
  }
86
92
  catch (e) {
87
- // eslint-disable-next-line no-console
93
+ // tslint:disable-next-line no-console
88
94
  console.error(e);
89
95
  shouldWarn = true;
90
96
  }
@@ -97,11 +103,11 @@ if (process.env['NG_CLI_PROFILING']) {
97
103
  `);
98
104
  // Don't show warning colorised on `ng completion`
99
105
  if (process.argv[2] !== 'completion') {
100
- // eslint-disable-next-line no-console
106
+ // tslint:disable-next-line no-console
101
107
  console.error(warning);
102
108
  }
103
109
  else {
104
- // eslint-disable-next-line no-console
110
+ // tslint:disable-next-line no-console
105
111
  console.error(warning);
106
112
  process.exit(1);
107
113
  }
@@ -141,6 +147,7 @@ if (process.env['NG_CLI_PROFILING']) {
141
147
  process.exit(exitCode);
142
148
  })
143
149
  .catch((err) => {
150
+ // tslint:disable-next-line no-console
144
151
  console.error('Unknown error: ' + err.toString());
145
152
  process.exit(127);
146
153
  });
@@ -31,7 +31,6 @@ export declare class UnknownCollectionError extends Error {
31
31
  }
32
32
  export declare abstract class SchematicCommand<T extends BaseSchematicSchema & BaseCommandOptions> extends Command<T> {
33
33
  readonly allowPrivateSchematics: boolean;
34
- readonly allowAdditionalArgs: boolean;
35
34
  private _host;
36
35
  private _workspace;
37
36
  protected _workflow: NodeWorkflow;
@@ -31,7 +31,6 @@ class SchematicCommand extends command_1.Command {
31
31
  constructor(context, description, logger) {
32
32
  super(context, description, logger);
33
33
  this.allowPrivateSchematics = false;
34
- this.allowAdditionalArgs = false;
35
34
  this._host = new node_1.NodeJsSyncHost();
36
35
  this.defaultCollectionName = '@schematics/angular';
37
36
  this.collectionName = this.defaultCollectionName;
@@ -163,7 +162,7 @@ class SchematicCommand extends command_1.Command {
163
162
  registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
164
163
  resolvePaths: !!this.workspace.configFile
165
164
  // Workspace
166
- ? [process.cwd(), this.workspace.root]
165
+ ? [process.cwd(), this.workspace.root, __dirname]
167
166
  // Global
168
167
  : [__dirname, process.cwd()],
169
168
  });
@@ -341,8 +340,8 @@ class SchematicCommand extends command_1.Command {
341
340
  o = await json_schema_1.parseJsonSchemaToOptions(workflow.registry, schematic.description.schemaJson);
342
341
  args = await this.parseArguments(schematicOptions || [], o);
343
342
  }
344
- // ng-add is special because we don't know all possible options at this point
345
- if (args['--'] && !this.allowAdditionalArgs) {
343
+ const allowAdditionalProperties = typeof schematic.description.schemaJson === 'object' && schematic.description.schemaJson.additionalProperties;
344
+ if (args['--'] && !allowAdditionalProperties) {
346
345
  args['--'].forEach(additional => {
347
346
  this.logger.fatal(`Unknown option: '${additional.split(/=/)[0]}'`);
348
347
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "9.0.0-rc.6",
3
+ "version": "9.0.0",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.900.0-rc.6",
32
- "@angular-devkit/core": "9.0.0-rc.6",
33
- "@angular-devkit/schematics": "9.0.0-rc.6",
34
- "@schematics/angular": "9.0.0-rc.6",
35
- "@schematics/update": "0.900.0-rc.6",
31
+ "@angular-devkit/architect": "0.900.0",
32
+ "@angular-devkit/core": "9.0.0",
33
+ "@angular-devkit/schematics": "9.0.0",
34
+ "@schematics/angular": "9.0.0",
35
+ "@schematics/update": "0.900.0",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
37
  "ansi-colors": "4.1.1",
38
38
  "debug": "^4.1.1",
@@ -52,16 +52,17 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "9.0.0-rc.6",
56
- "@angular-devkit/build-angular": "0.900.0-rc.6",
57
- "@angular-devkit/build-ng-packagr": "0.900.0-rc.6",
58
- "@angular-devkit/build-webpack": "0.900.0-rc.6"
55
+ "@angular/cli": "9.0.0",
56
+ "@angular-devkit/build-angular": "0.900.0",
57
+ "@angular-devkit/build-ng-packagr": "0.900.0",
58
+ "@angular-devkit/build-webpack": "0.900.0",
59
+ "@angular-devkit/core": "9.0.0",
60
+ "@angular-devkit/schematics": "9.0.0"
59
61
  }
60
62
  },
61
63
  "engines": {
62
64
  "node": ">= 10.13.0",
63
65
  "npm": ">= 6.11.0",
64
- "pnpm": ">= 3.2.0",
65
66
  "yarn": ">= 1.13.0"
66
67
  },
67
68
  "husky": {