@angular/cli 12.1.0-next.4 → 12.1.1

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.
Files changed (36) hide show
  1. package/commands/analytics-impl.d.ts +1 -1
  2. package/commands/config-impl.d.ts +1 -1
  3. package/commands/doc-impl.js +25 -3
  4. package/commands/e2e-impl.d.ts +1 -1
  5. package/commands/e2e-impl.js +1 -0
  6. package/commands/new-impl.js +2 -2
  7. package/commands/update-impl.js +24 -4
  8. package/commands/version-impl.js +30 -2
  9. package/lib/config/schema.json +5 -3
  10. package/lib/config/workspace-schema.d.ts +18 -5
  11. package/lib/config/workspace-schema.js +20 -8
  12. package/lib/init.js +29 -33
  13. package/models/analytics-collector.js +27 -5
  14. package/models/analytics.js +27 -4
  15. package/models/architect-command.d.ts +1 -1
  16. package/models/command-runner.js +20 -1
  17. package/models/schematic-command.js +21 -2
  18. package/models/schematic-engine-host.js +10 -6
  19. package/package.json +16 -17
  20. package/src/commands/update/schematic/index.js +24 -5
  21. package/utilities/color.js +20 -1
  22. package/utilities/config.js +22 -3
  23. package/utilities/find-up.js +20 -1
  24. package/utilities/install-package.js +2 -5
  25. package/{src/commands/update/schematic → utilities}/package-json.d.ts +0 -0
  26. package/{src/commands/update/schematic → utilities}/package-json.js +0 -0
  27. package/utilities/package-metadata.d.ts +26 -9
  28. package/utilities/package-metadata.js +88 -30
  29. package/utilities/package-tree.js +21 -2
  30. package/utilities/project.js +22 -3
  31. package/utilities/prompt.js +20 -1
  32. package/utilities/spinner.js +5 -2
  33. package/src/commands/update/schematic/npm-package-json.d.ts +0 -24
  34. package/src/commands/update/schematic/npm-package-json.js +0 -9
  35. package/src/commands/update/schematic/npm.d.ts +0 -22
  36. package/src/commands/update/schematic/npm.js +0 -140
@@ -6,15 +6,18 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
10
13
  exports.Spinner = void 0;
11
- const ora = require("ora");
14
+ const ora_1 = __importDefault(require("ora"));
12
15
  const color_1 = require("./color");
13
16
  class Spinner {
14
17
  constructor(text) {
15
18
  /** When false, only fail messages will be displayed. */
16
19
  this.enabled = true;
17
- this.spinner = ora({
20
+ this.spinner = ora_1.default({
18
21
  text,
19
22
  // The below 2 options are needed because otherwise CTRL+C will be delayed
20
23
  // when the underlying process is sync.
@@ -1,24 +0,0 @@
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
- import { JsonSchemaForNpmPackageJsonFiles } from './package-json';
9
- export interface NpmRepositoryPackageJson {
10
- name: string;
11
- requestedName: string;
12
- description: string;
13
- 'dist-tags': {
14
- [name: string]: string;
15
- };
16
- versions: {
17
- [version: string]: JsonSchemaForNpmPackageJsonFiles;
18
- };
19
- time: {
20
- modified: string;
21
- created: string;
22
- [version: string]: string;
23
- };
24
- }
@@ -1,9 +0,0 @@
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 });
@@ -1,22 +0,0 @@
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
- import { logging } from '@angular-devkit/core';
9
- import { NpmRepositoryPackageJson } from './npm-package-json';
10
- /**
11
- * Get the NPM repository's package.json for a package. This is p
12
- * @param {string} packageName The package name to fetch.
13
- * @param {string} registryUrl The NPM Registry URL to use.
14
- * @param {LoggerApi} logger A logger instance to log debug information.
15
- * @returns An observable that will put the pacakge.json content.
16
- * @private
17
- */
18
- export declare function getNpmPackageJson(packageName: string, logger: logging.LoggerApi, options?: {
19
- registryUrl?: string;
20
- usingYarn?: boolean;
21
- verbose?: boolean;
22
- }): Promise<Partial<NpmRepositoryPackageJson>>;
@@ -1,140 +0,0 @@
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.getNpmPackageJson = void 0;
11
- const fs_1 = require("fs");
12
- const os_1 = require("os");
13
- const path = require("path");
14
- const lockfile = require('@yarnpkg/lockfile');
15
- const ini = require('ini');
16
- const pacote = require('pacote');
17
- const npmPackageJsonCache = new Map();
18
- let npmrc;
19
- function readOptions(logger, yarn = false, showPotentials = false) {
20
- const cwd = process.cwd();
21
- const baseFilename = yarn ? 'yarnrc' : 'npmrc';
22
- const dotFilename = '.' + baseFilename;
23
- let globalPrefix;
24
- if (process.env.PREFIX) {
25
- globalPrefix = process.env.PREFIX;
26
- }
27
- else {
28
- globalPrefix = path.dirname(process.execPath);
29
- if (process.platform !== 'win32') {
30
- globalPrefix = path.dirname(globalPrefix);
31
- }
32
- }
33
- const defaultConfigLocations = [
34
- path.join(globalPrefix, 'etc', baseFilename),
35
- path.join(os_1.homedir(), dotFilename),
36
- ];
37
- const projectConfigLocations = [path.join(cwd, dotFilename)];
38
- const root = path.parse(cwd).root;
39
- for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
40
- projectConfigLocations.unshift(path.join(curDir, dotFilename));
41
- }
42
- if (showPotentials) {
43
- logger.info(`Locating potential ${baseFilename} files:`);
44
- }
45
- const options = {};
46
- for (const location of [...defaultConfigLocations, ...projectConfigLocations]) {
47
- if (fs_1.existsSync(location)) {
48
- if (showPotentials) {
49
- logger.info(`Trying '${location}'...found.`);
50
- }
51
- const data = fs_1.readFileSync(location, 'utf8');
52
- // Normalize RC options that are needed by 'npm-registry-fetch'.
53
- // See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f7af2e02c8a22bcaf9e850/index.js#L99-L126
54
- const rcConfig = yarn ? lockfile.parse(data) : ini.parse(data);
55
- for (const [key, value] of Object.entries(rcConfig)) {
56
- switch (key) {
57
- case 'noproxy':
58
- case 'no-proxy':
59
- options['noProxy'] = value;
60
- break;
61
- case 'maxsockets':
62
- options['maxSockets'] = value;
63
- break;
64
- case 'https-proxy':
65
- case 'proxy':
66
- options['proxy'] = value;
67
- break;
68
- case 'strict-ssl':
69
- options['strictSSL'] = value;
70
- break;
71
- case 'local-address':
72
- options['localAddress'] = value;
73
- break;
74
- case 'cafile':
75
- if (typeof value === 'string') {
76
- const cafile = path.resolve(path.dirname(location), value);
77
- try {
78
- options['ca'] = fs_1.readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n');
79
- }
80
- catch { }
81
- }
82
- break;
83
- default:
84
- options[key] = value;
85
- break;
86
- }
87
- }
88
- }
89
- else if (showPotentials) {
90
- logger.info(`Trying '${location}'...not found.`);
91
- }
92
- }
93
- // Substitute any environment variable references
94
- for (const key in options) {
95
- const value = options[key];
96
- if (typeof value === 'string') {
97
- options[key] = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');
98
- }
99
- }
100
- return options;
101
- }
102
- /**
103
- * Get the NPM repository's package.json for a package. This is p
104
- * @param {string} packageName The package name to fetch.
105
- * @param {string} registryUrl The NPM Registry URL to use.
106
- * @param {LoggerApi} logger A logger instance to log debug information.
107
- * @returns An observable that will put the pacakge.json content.
108
- * @private
109
- */
110
- function getNpmPackageJson(packageName, logger, options) {
111
- const cachedResponse = npmPackageJsonCache.get(packageName);
112
- if (cachedResponse) {
113
- return cachedResponse;
114
- }
115
- if (!npmrc) {
116
- try {
117
- npmrc = readOptions(logger, false, options && options.verbose);
118
- }
119
- catch { }
120
- if (options && options.usingYarn) {
121
- try {
122
- npmrc = { ...npmrc, ...readOptions(logger, true, options && options.verbose) };
123
- }
124
- catch { }
125
- }
126
- }
127
- const resultPromise = pacote.packument(packageName, {
128
- fullMetadata: true,
129
- ...npmrc,
130
- ...(options && options.registryUrl ? { registry: options.registryUrl } : {}),
131
- });
132
- // TODO: find some way to test this
133
- const response = resultPromise.catch((err) => {
134
- logger.warn(err.message || err);
135
- return { requestedName: packageName };
136
- });
137
- npmPackageJsonCache.set(packageName, response);
138
- return response;
139
- }
140
- exports.getNpmPackageJson = getNpmPackageJson;