@angular/cli 10.1.0-rc.0 → 10.1.3

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.
@@ -9,22 +9,18 @@ exports.VersionCommand = void 0;
9
9
  * found in the LICENSE file at https://angular.io/license
10
10
  */
11
11
  const core_1 = require("@angular-devkit/core");
12
- const child_process = require("child_process");
13
12
  const fs = require("fs");
14
13
  const path = require("path");
15
14
  const command_1 = require("../models/command");
16
15
  const color_1 = require("../utilities/color");
17
- const find_up_1 = require("../utilities/find-up");
18
16
  class VersionCommand extends command_1.Command {
19
17
  async run() {
20
- const pkg = require(path.resolve(__dirname, '..', 'package.json'));
21
- let projPkg;
18
+ const cliPackage = require('../package.json');
19
+ let workspacePackage;
22
20
  try {
23
- projPkg = require(path.resolve(this.workspace.root, 'package.json'));
24
- }
25
- catch (_a) {
26
- projPkg = undefined;
21
+ workspacePackage = require(path.resolve(this.workspace.root, 'package.json'));
27
22
  }
23
+ catch (_a) { }
28
24
  const patterns = [
29
25
  /^@angular\/.*/,
30
26
  /^@angular-devkit\/.*/,
@@ -37,54 +33,25 @@ class VersionCommand extends command_1.Command {
37
33
  /^ng-packagr$/,
38
34
  /^webpack$/,
39
35
  ];
40
- const maybeNodeModules = find_up_1.findUp('node_modules', __dirname);
41
- const packageRoot = projPkg
42
- ? path.resolve(this.workspace.root, 'node_modules')
43
- : maybeNodeModules;
44
36
  const packageNames = [
45
- ...Object.keys((pkg && pkg['dependencies']) || {}),
46
- ...Object.keys((pkg && pkg['devDependencies']) || {}),
47
- ...Object.keys((projPkg && projPkg['dependencies']) || {}),
48
- ...Object.keys((projPkg && projPkg['devDependencies']) || {}),
37
+ ...Object.keys(cliPackage.dependencies || {}),
38
+ ...Object.keys(cliPackage.devDependencies || {}),
39
+ ...Object.keys((workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.dependencies) || {}),
40
+ ...Object.keys((workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.devDependencies) || {}),
49
41
  ];
50
- if (packageRoot != null) {
51
- // Add all node_modules and node_modules/@*/*
52
- const nodePackageNames = fs.readdirSync(packageRoot).reduce((acc, name) => {
53
- if (name.startsWith('@')) {
54
- return acc.concat(fs.readdirSync(path.resolve(packageRoot, name)).map(subName => name + '/' + subName));
55
- }
56
- else {
57
- return acc.concat(name);
58
- }
59
- }, []);
60
- packageNames.push(...nodePackageNames);
61
- }
62
42
  const versions = packageNames
63
43
  .filter(x => patterns.some(p => p.test(x)))
64
44
  .reduce((acc, name) => {
65
45
  if (name in acc) {
66
46
  return acc;
67
47
  }
68
- acc[name] = this.getVersion(name, packageRoot, maybeNodeModules);
48
+ acc[name] = this.getVersion(name);
69
49
  return acc;
70
50
  }, {});
71
- let ngCliVersion = pkg.version;
72
- if (!__dirname.match(/node_modules/)) {
73
- let gitBranch = '??';
74
- try {
75
- const gitRefName = child_process.execSync('git rev-parse --abbrev-ref HEAD', {
76
- cwd: __dirname,
77
- encoding: 'utf8',
78
- stdio: 'pipe',
79
- });
80
- gitBranch = gitRefName.replace('\n', '');
81
- }
82
- catch (_b) { }
83
- ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`;
84
- }
51
+ const ngCliVersion = cliPackage.version;
85
52
  let angularCoreVersion = '';
86
53
  const angularSameAsCore = [];
87
- if (projPkg) {
54
+ if (workspacePackage) {
88
55
  // Filter all angular versions that are the same as core.
89
56
  angularCoreVersion = versions['@angular/core'];
90
57
  if (angularCoreVersion) {
@@ -134,7 +101,7 @@ class VersionCommand extends command_1.Command {
134
101
  return acc;
135
102
  }, [])
136
103
  .join('\n... ')}
137
- Ivy Workspace: ${projPkg ? this.getIvyWorkspace() : ''}
104
+ Ivy Workspace: ${workspacePackage ? this.getIvyWorkspace() : ''}
138
105
 
139
106
  Package${namePad.slice(7)}Version
140
107
  -------${namePad.replace(/ /g, '-')}------------------
@@ -144,22 +111,31 @@ class VersionCommand extends command_1.Command {
144
111
  .join('\n')}
145
112
  `.replace(/^ {6}/gm, ''));
146
113
  }
147
- getVersion(moduleName, projectNodeModules, cliNodeModules) {
114
+ getVersion(moduleName) {
115
+ let packagePath;
116
+ let cliOnly = false;
117
+ // Try to find the package in the workspace
148
118
  try {
149
- if (projectNodeModules) {
150
- const modulePkg = require(path.resolve(projectNodeModules, moduleName, 'package.json'));
151
- return modulePkg.version;
152
- }
119
+ packagePath = require.resolve(`${moduleName}/package.json`, { paths: [this.workspace.root] });
153
120
  }
154
121
  catch (_a) { }
155
- try {
156
- if (cliNodeModules) {
157
- const modulePkg = require(path.resolve(cliNodeModules, moduleName, 'package.json'));
158
- return modulePkg.version + ' (cli-only)';
122
+ // If not found, try to find within the CLI
123
+ if (!packagePath) {
124
+ try {
125
+ packagePath = require.resolve(`${moduleName}/package.json`);
126
+ cliOnly = true;
127
+ }
128
+ catch (_b) { }
129
+ }
130
+ let version;
131
+ // If found, attempt to get the version
132
+ if (packagePath) {
133
+ try {
134
+ version = require(packagePath).version + (cliOnly ? ' (cli-only)' : '');
159
135
  }
136
+ catch (_c) { }
160
137
  }
161
- catch (_b) { }
162
- return '<error>';
138
+ return version || '<error>';
163
139
  }
164
140
  getIvyWorkspace() {
165
141
  try {
@@ -27,7 +27,7 @@
27
27
  "projects": {
28
28
  "type": "object",
29
29
  "patternProperties": {
30
- "^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$": {
30
+ "^(?:@[a-zA-Z0-9_-]+\/)?[a-zA-Z0-9_-]+$": {
31
31
  "$ref": "#/definitions/project"
32
32
  }
33
33
  },
@@ -725,7 +725,7 @@
725
725
  ]
726
726
  },
727
727
  "fileReplacements": {
728
- "description": "Replace files with other files in the build.",
728
+ "description": "Replace compilation source files with other compilation source files in the build.",
729
729
  "type": "array",
730
730
  "items": {
731
731
  "$ref": "#/definitions/targetOptions/definitions/browser/definitions/fileReplacement"
@@ -1202,7 +1202,7 @@
1202
1202
  },
1203
1203
  "allowedHosts": {
1204
1204
  "type": "array",
1205
- "description": "Whitelist of hosts that are allowed to access the dev server.",
1205
+ "description": "List of hosts that are allowed to access the dev server.",
1206
1206
  "default": [],
1207
1207
  "items": {
1208
1208
  "type": "string"
@@ -1511,7 +1511,7 @@
1511
1511
  "default": []
1512
1512
  },
1513
1513
  "fileReplacements": {
1514
- "description": "Replace files with other files in the build.",
1514
+ "description": "Replace compilation source files with other compilation source files in the build.",
1515
1515
  "type": "array",
1516
1516
  "items": {
1517
1517
  "oneOf": [
@@ -1752,7 +1752,7 @@
1752
1752
  ]
1753
1753
  },
1754
1754
  "fileReplacements": {
1755
- "description": "Replace files with other files in the build.",
1755
+ "description": "Replace compilation source files with other compilation source files in the build.",
1756
1756
  "type": "array",
1757
1757
  "items": {
1758
1758
  "$ref": "#/definitions/targetOptions/definitions/server/definitions/fileReplacement"
@@ -164,7 +164,10 @@ class SchematicCommand extends command_1.Command {
164
164
  registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
165
165
  resolvePaths: !!this.workspace.configFile
166
166
  // Workspace
167
- ? [process.cwd(), this.workspace.root, __dirname]
167
+ ? this.collectionName === this.defaultCollectionName
168
+ // Favor __dirname for @schematics/angular to use the build-in version
169
+ ? [__dirname, process.cwd(), this.workspace.root]
170
+ : [process.cwd(), this.workspace.root, __dirname]
168
171
  // Global
169
172
  : [__dirname, process.cwd()],
170
173
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "10.1.0-rc.0",
3
+ "version": "10.1.3",
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.1001.0-rc.0",
32
- "@angular-devkit/core": "10.1.0-rc.0",
33
- "@angular-devkit/schematics": "10.1.0-rc.0",
34
- "@schematics/angular": "10.1.0-rc.0",
35
- "@schematics/update": "0.1001.0-rc.0",
31
+ "@angular-devkit/architect": "0.1001.3",
32
+ "@angular-devkit/core": "10.1.3",
33
+ "@angular-devkit/schematics": "10.1.3",
34
+ "@schematics/angular": "10.1.3",
35
+ "@schematics/update": "0.1001.3",
36
36
  "@yarnpkg/lockfile": "1.1.0",
37
37
  "ansi-colors": "4.1.1",
38
38
  "debug": "4.1.1",
@@ -52,12 +52,12 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "10.1.0-rc.0",
56
- "@angular-devkit/build-angular": "0.1001.0-rc.0",
57
- "@angular-devkit/build-ng-packagr": "0.1001.0-rc.0",
58
- "@angular-devkit/build-webpack": "0.1001.0-rc.0",
59
- "@angular-devkit/core": "10.1.0-rc.0",
60
- "@angular-devkit/schematics": "10.1.0-rc.0"
55
+ "@angular/cli": "10.1.3",
56
+ "@angular-devkit/build-angular": "0.1001.3",
57
+ "@angular-devkit/build-ng-packagr": "0.1001.3",
58
+ "@angular-devkit/build-webpack": "0.1001.3",
59
+ "@angular-devkit/core": "10.1.3",
60
+ "@angular-devkit/schematics": "10.1.3"
61
61
  }
62
62
  },
63
63
  "engines": {