@angular/cli 14.0.0-next.0 → 14.0.0-next.11
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.
- package/bin/ng.js +3 -5
- package/lib/cli/index.d.ts +1 -2
- package/lib/cli/index.js +16 -45
- package/lib/config/schema.json +30 -15
- package/lib/config/workspace-schema.d.ts +6 -1
- package/lib/init.js +10 -9
- package/package.json +21 -23
- package/{models → src/analytics}/analytics-collector.d.ts +0 -0
- package/{models → src/analytics}/analytics-collector.js +8 -2
- package/src/analytics/analytics.d.ts +47 -0
- package/src/analytics/analytics.js +306 -0
- package/src/command-builder/architect-base-command-module.d.ts +30 -0
- package/src/command-builder/architect-base-command-module.js +165 -0
- package/src/command-builder/architect-command-module.d.ts +25 -0
- package/src/command-builder/architect-command-module.js +134 -0
- package/src/command-builder/command-module.d.ts +89 -0
- package/src/command-builder/command-module.js +198 -0
- package/{utilities/package-json.js → src/command-builder/command-runner.d.ts} +2 -2
- package/src/command-builder/command-runner.js +168 -0
- package/src/command-builder/schematics-command-module.d.ts +43 -0
- package/src/command-builder/schematics-command-module.js +333 -0
- package/src/command-builder/utilities/command.d.ts +13 -0
- package/src/command-builder/utilities/command.js +27 -0
- package/src/command-builder/utilities/json-help.d.ts +36 -0
- package/src/command-builder/utilities/json-help.js +94 -0
- package/src/command-builder/utilities/json-schema.d.ts +40 -0
- package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +18 -0
- package/src/command-builder/utilities/normalize-options-middleware.js +59 -0
- package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +2 -2
- package/{models → src/command-builder/utilities}/schematic-engine-host.js +30 -17
- package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
- package/src/command-builder/utilities/schematic-workflow.js +68 -0
- package/src/commands/add/cli.d.ts +33 -0
- package/{commands/add-impl.js → src/commands/add/cli.js} +108 -80
- package/src/commands/add/long-description.md +7 -0
- package/src/commands/analytics/cli.d.ts +16 -0
- package/src/commands/analytics/cli.js +35 -0
- package/src/commands/analytics/info/cli.d.ts +16 -0
- package/src/commands/analytics/info/cli.js +26 -0
- package/src/commands/analytics/settings/cli.d.ts +35 -0
- package/src/commands/analytics/settings/cli.js +61 -0
- package/src/commands/build/cli.d.ts +16 -0
- package/src/commands/build/cli.js +23 -0
- package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
- package/src/commands/cache/clean/cli.d.ts +17 -0
- package/src/commands/cache/clean/cli.js +32 -0
- package/src/commands/cache/cli.d.ts +17 -0
- package/src/commands/cache/cli.js +38 -0
- package/src/commands/cache/info/cli.d.ts +20 -0
- package/src/commands/cache/info/cli.js +82 -0
- package/src/commands/cache/long-description.md +53 -0
- package/src/commands/cache/settings/cli.d.ts +27 -0
- package/src/commands/cache/settings/cli.js +42 -0
- package/src/commands/cache/utilities.d.ts +11 -0
- package/src/commands/cache/utilities.js +49 -0
- package/src/commands/completion/cli.d.ts +16 -0
- package/src/commands/completion/cli.js +31 -0
- package/src/commands/completion/long-description.md +1 -0
- package/src/commands/config/cli.d.ts +24 -0
- package/src/commands/config/cli.js +168 -0
- package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
- package/src/commands/deploy/cli.d.ts +17 -0
- package/src/commands/deploy/cli.js +49 -0
- package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
- package/src/commands/doc/cli.d.ts +23 -0
- package/{commands/doc-impl.js → src/commands/doc/cli.js} +41 -12
- package/src/commands/e2e/cli.d.ts +18 -0
- package/src/commands/e2e/cli.js +35 -0
- package/src/commands/extract-i18n/cli.d.ts +15 -0
- package/src/commands/extract-i18n/cli.js +20 -0
- package/src/commands/generate/cli.d.ts +39 -0
- package/src/commands/generate/cli.js +145 -0
- package/src/commands/lint/cli.d.ts +17 -0
- package/src/commands/lint/cli.js +28 -0
- package/{commands/lint-long.md → src/commands/lint/long-description.md} +0 -0
- package/src/commands/make-this-awesome/cli.d.ts +17 -0
- package/{commands/easter-egg-impl.js → src/commands/make-this-awesome/cli.js} +17 -10
- package/src/commands/new/cli.d.ts +27 -0
- package/src/commands/new/cli.js +82 -0
- package/src/commands/run/cli.d.ts +25 -0
- package/src/commands/run/cli.js +83 -0
- package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
- package/src/commands/serve/cli.d.ts +16 -0
- package/src/commands/serve/cli.js +21 -0
- package/src/commands/test/cli.d.ts +16 -0
- package/src/commands/test/cli.js +23 -0
- package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
- package/{commands/update-impl.d.ts → src/commands/update/cli.d.ts} +26 -9
- package/{commands/update-impl.js → src/commands/update/cli.js} +363 -316
- package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
- package/src/commands/update/schematic/index.js +33 -20
- package/src/commands/version/cli.d.ts +18 -0
- package/{commands/version-impl.js → src/commands/version/cli.js} +56 -74
- package/src/typings-bazel.d.ts +14 -0
- package/src/typings.d.ts +1 -14
- package/{utilities → src/utilities}/color.d.ts +0 -0
- package/{utilities → src/utilities}/color.js +5 -1
- package/{utilities → src/utilities}/config.d.ts +7 -6
- package/{utilities → src/utilities}/config.js +39 -93
- package/src/utilities/environment-options.d.ts +12 -0
- package/src/utilities/environment-options.js +24 -0
- package/{utilities → src/utilities}/find-up.d.ts +0 -0
- package/{utilities → src/utilities}/find-up.js +5 -1
- package/{utilities → src/utilities}/json-file.d.ts +0 -0
- package/{utilities → src/utilities}/json-file.js +1 -0
- package/{utilities → src/utilities}/log-file.d.ts +0 -0
- package/{utilities → src/utilities}/log-file.js +0 -0
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +69 -0
- package/src/utilities/package-manager.d.ts +41 -0
- package/src/utilities/package-manager.js +287 -0
- package/{utilities → src/utilities}/package-metadata.d.ts +15 -37
- package/{utilities → src/utilities}/package-metadata.js +15 -27
- package/{utilities → src/utilities}/package-tree.d.ts +2 -2
- package/{utilities → src/utilities}/package-tree.js +5 -1
- package/{utilities → src/utilities}/project.d.ts +0 -0
- package/{utilities → src/utilities}/project.js +6 -7
- package/{utilities → src/utilities}/prompt.d.ts +2 -0
- package/{utilities → src/utilities}/prompt.js +25 -4
- package/{utilities → src/utilities}/spinner.d.ts +0 -0
- package/{utilities → src/utilities}/spinner.js +0 -0
- package/{utilities → src/utilities}/tty.d.ts +0 -0
- package/{utilities → src/utilities}/tty.js +0 -0
- package/{models → src/utilities}/version.d.ts +2 -1
- package/{models → src/utilities}/version.js +6 -6
- package/bin/postinstall/analytics-prompt.js +0 -27
- package/bin/postinstall/script.js +0 -16
- package/commands/add-impl.d.ts +0 -21
- package/commands/add.d.ts +0 -42
- package/commands/add.js +0 -10
- package/commands/add.json +0 -54
- package/commands/add.md +0 -10
- package/commands/analytics-impl.d.ts +0 -13
- package/commands/analytics-impl.js +0 -80
- package/commands/analytics-long.md +0 -8
- package/commands/analytics.d.ts +0 -46
- package/commands/analytics.js +0 -31
- package/commands/analytics.json +0 -37
- package/commands/build-impl.d.ts +0 -14
- package/commands/build-impl.js +0 -21
- package/commands/build.d.ts +0 -30
- package/commands/build.js +0 -10
- package/commands/build.json +0 -16
- package/commands/config-impl.d.ts +0 -15
- package/commands/config-impl.js +0 -167
- package/commands/config.d.ts +0 -34
- package/commands/config.js +0 -10
- package/commands/config.json +0 -43
- package/commands/definitions.json +0 -66
- package/commands/deploy-impl.d.ts +0 -15
- package/commands/deploy-impl.js +0 -36
- package/commands/deploy.d.ts +0 -30
- package/commands/deploy.js +0 -10
- package/commands/deploy.json +0 -34
- package/commands/doc-impl.d.ts +0 -13
- package/commands/doc.d.ts +0 -39
- package/commands/doc.js +0 -14
- package/commands/doc.json +0 -46
- package/commands/e2e-impl.d.ts +0 -16
- package/commands/e2e-impl.js +0 -36
- package/commands/e2e-long.md +0 -4
- package/commands/e2e.d.ts +0 -29
- package/commands/e2e.js +0 -10
- package/commands/e2e.json +0 -17
- package/commands/easter-egg-impl.d.ts +0 -12
- package/commands/easter-egg.d.ts +0 -14
- package/commands/easter-egg.js +0 -10
- package/commands/easter-egg.json +0 -12
- package/commands/extract-i18n-impl.d.ts +0 -14
- package/commands/extract-i18n-impl.js +0 -32
- package/commands/extract-i18n.d.ts +0 -29
- package/commands/extract-i18n.js +0 -10
- package/commands/extract-i18n.json +0 -17
- package/commands/generate-impl.d.ts +0 -18
- package/commands/generate-impl.js +0 -89
- package/commands/generate.d.ts +0 -37
- package/commands/generate.js +0 -10
- package/commands/generate.json +0 -31
- package/commands/help-impl.d.ts +0 -12
- package/commands/help-impl.js +0 -26
- package/commands/help-long.md +0 -7
- package/commands/help.d.ts +0 -17
- package/commands/help.js +0 -10
- package/commands/help.json +0 -13
- package/commands/lint-impl.d.ts +0 -16
- package/commands/lint-impl.js +0 -69
- package/commands/lint.d.ts +0 -29
- package/commands/lint.js +0 -10
- package/commands/lint.json +0 -36
- package/commands/new-impl.d.ts +0 -16
- package/commands/new-impl.js +0 -37
- package/commands/new.d.ts +0 -41
- package/commands/new.js +0 -10
- package/commands/new.json +0 -34
- package/commands/new.md +0 -16
- package/commands/run-impl.d.ts +0 -13
- package/commands/run-impl.js +0 -22
- package/commands/run.d.ts +0 -30
- package/commands/run.js +0 -10
- package/commands/run.json +0 -36
- package/commands/serve-impl.d.ts +0 -15
- package/commands/serve-impl.js +0 -24
- package/commands/serve.d.ts +0 -29
- package/commands/serve.js +0 -10
- package/commands/serve.json +0 -17
- package/commands/test-impl.d.ts +0 -15
- package/commands/test-impl.js +0 -22
- package/commands/test.d.ts +0 -29
- package/commands/test.js +0 -10
- package/commands/test.json +0 -17
- package/commands/update.d.ts +0 -61
- package/commands/update.js +0 -10
- package/commands/update.json +0 -78
- package/commands/version-impl.d.ts +0 -17
- package/commands/version.d.ts +0 -17
- package/commands/version.js +0 -10
- package/commands/version.json +0 -13
- package/commands.json +0 -20
- package/models/analytics.d.ts +0 -58
- package/models/analytics.js +0 -358
- package/models/architect-command.d.ts +0 -35
- package/models/architect-command.js +0 -376
- package/models/command-runner.d.ts +0 -24
- package/models/command-runner.js +0 -241
- package/models/command.d.ts +0 -34
- package/models/command.js +0 -143
- package/models/interface.d.ts +0 -196
- package/models/interface.js +0 -31
- package/models/parser.d.ts +0 -39
- package/models/parser.js +0 -349
- package/models/schematic-command.d.ts +0 -55
- package/models/schematic-command.js +0 -485
- package/utilities/INITIAL_COMMIT_MESSAGE.txt +0 -8
- package/utilities/install-package.d.ts +0 -16
- package/utilities/install-package.js +0 -193
- package/utilities/json-schema.d.ts +0 -17
- package/utilities/package-json.d.ts +0 -249
- package/utilities/package-manager.d.ts +0 -15
- package/utilities/package-manager.js +0 -83
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export declare const analyticsDisabled: boolean;
|
|
9
|
+
export declare const analyticsShareDisabled: boolean;
|
|
10
|
+
export declare const isCI: boolean;
|
|
11
|
+
export declare const disableVersionCheck: boolean;
|
|
12
|
+
export declare const ngDebug: boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
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.ngDebug = exports.disableVersionCheck = exports.isCI = exports.analyticsShareDisabled = exports.analyticsDisabled = void 0;
|
|
11
|
+
function isPresent(variable) {
|
|
12
|
+
return typeof variable === 'string' && variable !== '';
|
|
13
|
+
}
|
|
14
|
+
function isDisabled(variable) {
|
|
15
|
+
return isPresent(variable) && (variable === '0' || variable.toLowerCase() === 'false');
|
|
16
|
+
}
|
|
17
|
+
function isEnabled(variable) {
|
|
18
|
+
return isPresent(variable) && (variable === '1' || variable.toLowerCase() === 'true');
|
|
19
|
+
}
|
|
20
|
+
exports.analyticsDisabled = isDisabled(process.env['NG_CLI_ANALYTICS']);
|
|
21
|
+
exports.analyticsShareDisabled = isDisabled(process.env['NG_CLI_ANALYTICS_SHARE']);
|
|
22
|
+
exports.isCI = isEnabled(process.env['CI']);
|
|
23
|
+
exports.disableVersionCheck = isEnabled(process.env['NG_DISABLE_VERSION_CHECK']);
|
|
24
|
+
exports.ngDebug = isEnabled(process.env['NG_DEBUG']);
|
|
File without changes
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* A decorator that memoizes methods and getters.
|
|
10
|
+
*
|
|
11
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
12
|
+
*
|
|
13
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
14
|
+
*/
|
|
15
|
+
export declare function memoize<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.memoize = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* A decorator that memoizes methods and getters.
|
|
13
|
+
*
|
|
14
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
15
|
+
*
|
|
16
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
17
|
+
*/
|
|
18
|
+
function memoize(target, propertyKey, descriptor) {
|
|
19
|
+
const descriptorPropertyName = descriptor.get ? 'get' : 'value';
|
|
20
|
+
const originalMethod = descriptor[descriptorPropertyName];
|
|
21
|
+
if (typeof originalMethod !== 'function') {
|
|
22
|
+
throw new Error('Memoize decorator can only be used on methods or get accessors.');
|
|
23
|
+
}
|
|
24
|
+
const cache = new Map();
|
|
25
|
+
return {
|
|
26
|
+
...descriptor,
|
|
27
|
+
[descriptorPropertyName]: function (...args) {
|
|
28
|
+
for (const arg of args) {
|
|
29
|
+
if (!isJSONSerializable(arg)) {
|
|
30
|
+
throw new Error(`Argument ${isNonPrimitive(arg) ? arg.toString() : arg} is JSON serializable.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const key = JSON.stringify(args);
|
|
34
|
+
if (cache.has(key)) {
|
|
35
|
+
return cache.get(key);
|
|
36
|
+
}
|
|
37
|
+
const result = originalMethod.apply(this, args);
|
|
38
|
+
cache.set(key, result);
|
|
39
|
+
return result;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.memoize = memoize;
|
|
44
|
+
/** Method to check if value is a non primitive. */
|
|
45
|
+
function isNonPrimitive(value) {
|
|
46
|
+
return ((value !== null && typeof value === 'object') ||
|
|
47
|
+
typeof value === 'function' ||
|
|
48
|
+
typeof value === 'symbol');
|
|
49
|
+
}
|
|
50
|
+
/** Method to check if the values are JSON serializable */
|
|
51
|
+
function isJSONSerializable(value) {
|
|
52
|
+
if (!isNonPrimitive(value)) {
|
|
53
|
+
// Can be seralized since it's a primitive.
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
let nestedValues;
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
// It's an array, check each item.
|
|
59
|
+
nestedValues = value;
|
|
60
|
+
}
|
|
61
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
62
|
+
// It's a plain object, check each value.
|
|
63
|
+
nestedValues = Object.values(value);
|
|
64
|
+
}
|
|
65
|
+
if (!nestedValues || nestedValues.some((v) => !isJSONSerializable(v))) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { PackageManager } from '../../lib/config/workspace-schema';
|
|
9
|
+
import { AngularWorkspace } from './config';
|
|
10
|
+
export interface PackageManagerUtilsContext {
|
|
11
|
+
globalConfiguration?: AngularWorkspace;
|
|
12
|
+
workspace?: AngularWorkspace;
|
|
13
|
+
root: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class PackageManagerUtils {
|
|
16
|
+
private readonly context;
|
|
17
|
+
constructor(context: PackageManagerUtilsContext);
|
|
18
|
+
/** Get the package manager name. */
|
|
19
|
+
get name(): PackageManager;
|
|
20
|
+
/** Get the package manager version. */
|
|
21
|
+
get version(): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the package manager is supported. If not, display a warning.
|
|
24
|
+
*/
|
|
25
|
+
ensureCompatibility(): void;
|
|
26
|
+
/** Install a single package. */
|
|
27
|
+
install(packageName: string, save?: 'dependencies' | 'devDependencies' | true, extraArgs?: string[], cwd?: string): Promise<boolean>;
|
|
28
|
+
/** Install all packages. */
|
|
29
|
+
installAll(extraArgs?: string[], cwd?: string): Promise<boolean>;
|
|
30
|
+
/** Install a single package temporary. */
|
|
31
|
+
installTemp(packageName: string, extraArgs?: string[]): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
tempNodeModules: string;
|
|
34
|
+
}>;
|
|
35
|
+
private getArguments;
|
|
36
|
+
private run;
|
|
37
|
+
private getVersion;
|
|
38
|
+
private getName;
|
|
39
|
+
private hasLockfile;
|
|
40
|
+
private getConfiguredPackageManager;
|
|
41
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PackageManagerUtils = void 0;
|
|
17
|
+
const core_1 = require("@angular-devkit/core");
|
|
18
|
+
const child_process_1 = require("child_process");
|
|
19
|
+
const fs_1 = require("fs");
|
|
20
|
+
const os_1 = require("os");
|
|
21
|
+
const path_1 = require("path");
|
|
22
|
+
const semver_1 = require("semver");
|
|
23
|
+
const workspace_schema_1 = require("../../lib/config/workspace-schema");
|
|
24
|
+
const config_1 = require("./config");
|
|
25
|
+
const memoize_1 = require("./memoize");
|
|
26
|
+
const spinner_1 = require("./spinner");
|
|
27
|
+
class PackageManagerUtils {
|
|
28
|
+
constructor(context) {
|
|
29
|
+
this.context = context;
|
|
30
|
+
}
|
|
31
|
+
/** Get the package manager name. */
|
|
32
|
+
get name() {
|
|
33
|
+
return this.getName();
|
|
34
|
+
}
|
|
35
|
+
/** Get the package manager version. */
|
|
36
|
+
get version() {
|
|
37
|
+
return this.getVersion(this.name);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Checks if the package manager is supported. If not, display a warning.
|
|
41
|
+
*/
|
|
42
|
+
ensureCompatibility() {
|
|
43
|
+
if (this.name !== workspace_schema_1.PackageManager.Npm) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const version = (0, semver_1.valid)(this.version);
|
|
48
|
+
if (!version) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if ((0, semver_1.satisfies)(version, '>=7 <7.5.6')) {
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
console.warn(`npm version ${version} detected.` +
|
|
54
|
+
' When using npm 7 with the Angular CLI, npm version 7.5.6 or higher is recommended.');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// npm is not installed.
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Install a single package. */
|
|
62
|
+
async install(packageName, save = true, extraArgs = [], cwd) {
|
|
63
|
+
const packageManagerArgs = this.getArguments();
|
|
64
|
+
const installArgs = [
|
|
65
|
+
packageManagerArgs.install,
|
|
66
|
+
packageName,
|
|
67
|
+
packageManagerArgs.silent,
|
|
68
|
+
];
|
|
69
|
+
if (save === 'devDependencies') {
|
|
70
|
+
installArgs.push(packageManagerArgs.saveDev);
|
|
71
|
+
}
|
|
72
|
+
return this.run([...installArgs, ...extraArgs], cwd);
|
|
73
|
+
}
|
|
74
|
+
/** Install all packages. */
|
|
75
|
+
async installAll(extraArgs = [], cwd) {
|
|
76
|
+
const packageManagerArgs = this.getArguments();
|
|
77
|
+
const installArgs = [packageManagerArgs.silent];
|
|
78
|
+
if (packageManagerArgs.installAll) {
|
|
79
|
+
installArgs.push(packageManagerArgs.installAll);
|
|
80
|
+
}
|
|
81
|
+
return this.run([...installArgs, ...extraArgs], cwd);
|
|
82
|
+
}
|
|
83
|
+
/** Install a single package temporary. */
|
|
84
|
+
async installTemp(packageName, extraArgs) {
|
|
85
|
+
const tempPath = await fs_1.promises.mkdtemp((0, path_1.join)((0, fs_1.realpathSync)((0, os_1.tmpdir)()), 'angular-cli-packages-'));
|
|
86
|
+
// clean up temp directory on process exit
|
|
87
|
+
process.on('exit', () => {
|
|
88
|
+
try {
|
|
89
|
+
(0, fs_1.rmdirSync)(tempPath, { recursive: true, maxRetries: 3 });
|
|
90
|
+
}
|
|
91
|
+
catch { }
|
|
92
|
+
});
|
|
93
|
+
// NPM will warn when a `package.json` is not found in the install directory
|
|
94
|
+
// Example:
|
|
95
|
+
// npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
|
|
96
|
+
// npm WARN .ng-temp-packages-84Qi7y No description
|
|
97
|
+
// npm WARN .ng-temp-packages-84Qi7y No repository field.
|
|
98
|
+
// npm WARN .ng-temp-packages-84Qi7y No license field.
|
|
99
|
+
// While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
|
|
100
|
+
// because of missing fields.
|
|
101
|
+
await fs_1.promises.writeFile((0, path_1.join)(tempPath, 'package.json'), JSON.stringify({
|
|
102
|
+
name: 'temp-cli-install',
|
|
103
|
+
description: 'temp-cli-install',
|
|
104
|
+
repository: 'temp-cli-install',
|
|
105
|
+
license: 'MIT',
|
|
106
|
+
}));
|
|
107
|
+
// setup prefix/global modules path
|
|
108
|
+
const packageManagerArgs = this.getArguments();
|
|
109
|
+
const tempNodeModules = (0, path_1.join)(tempPath, 'node_modules');
|
|
110
|
+
// Yarn will not append 'node_modules' to the path
|
|
111
|
+
const prefixPath = this.name === workspace_schema_1.PackageManager.Yarn ? tempNodeModules : tempPath;
|
|
112
|
+
const installArgs = [
|
|
113
|
+
...(extraArgs !== null && extraArgs !== void 0 ? extraArgs : []),
|
|
114
|
+
`${packageManagerArgs.prefix}="${prefixPath}"`,
|
|
115
|
+
packageManagerArgs.noLockfile,
|
|
116
|
+
];
|
|
117
|
+
return {
|
|
118
|
+
success: await this.install(packageName, true, installArgs, tempPath),
|
|
119
|
+
tempNodeModules,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
getArguments() {
|
|
123
|
+
switch (this.name) {
|
|
124
|
+
case workspace_schema_1.PackageManager.Yarn:
|
|
125
|
+
return {
|
|
126
|
+
silent: '--silent',
|
|
127
|
+
saveDev: '--dev',
|
|
128
|
+
install: 'add',
|
|
129
|
+
prefix: '--modules-folder',
|
|
130
|
+
noLockfile: '--no-lockfile',
|
|
131
|
+
};
|
|
132
|
+
case workspace_schema_1.PackageManager.Pnpm:
|
|
133
|
+
return {
|
|
134
|
+
silent: '--silent',
|
|
135
|
+
saveDev: '--save-dev',
|
|
136
|
+
install: 'add',
|
|
137
|
+
installAll: 'install',
|
|
138
|
+
prefix: '--prefix',
|
|
139
|
+
noLockfile: '--no-lockfile',
|
|
140
|
+
};
|
|
141
|
+
default:
|
|
142
|
+
return {
|
|
143
|
+
silent: '--quiet',
|
|
144
|
+
saveDev: '--save-dev',
|
|
145
|
+
install: 'install',
|
|
146
|
+
installAll: 'install',
|
|
147
|
+
prefix: '--prefix',
|
|
148
|
+
noLockfile: '--no-package-lock',
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async run(args, cwd = process.cwd()) {
|
|
153
|
+
const spinner = new spinner_1.Spinner();
|
|
154
|
+
spinner.start('Installing packages...');
|
|
155
|
+
return new Promise((resolve) => {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
const bufferedOutput = [];
|
|
158
|
+
const childProcess = (0, child_process_1.spawn)(this.name, args, {
|
|
159
|
+
stdio: 'pipe',
|
|
160
|
+
shell: true,
|
|
161
|
+
cwd,
|
|
162
|
+
}).on('close', (code) => {
|
|
163
|
+
if (code === 0) {
|
|
164
|
+
spinner.succeed('Packages successfully installed.');
|
|
165
|
+
resolve(true);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
spinner.stop();
|
|
169
|
+
bufferedOutput.forEach(({ stream, data }) => stream.write(data));
|
|
170
|
+
spinner.fail('Packages installation failed, see above.');
|
|
171
|
+
resolve(false);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
(_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
|
|
175
|
+
(_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
getVersion(name) {
|
|
179
|
+
try {
|
|
180
|
+
return (0, child_process_1.execSync)(`${name} --version`, {
|
|
181
|
+
encoding: 'utf8',
|
|
182
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
183
|
+
env: {
|
|
184
|
+
...process.env,
|
|
185
|
+
// NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
|
|
186
|
+
NO_UPDATE_NOTIFIER: '1',
|
|
187
|
+
NPM_CONFIG_UPDATE_NOTIFIER: 'false',
|
|
188
|
+
},
|
|
189
|
+
}).trim();
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
getName() {
|
|
196
|
+
const packageManager = this.getConfiguredPackageManager();
|
|
197
|
+
if (packageManager) {
|
|
198
|
+
return packageManager;
|
|
199
|
+
}
|
|
200
|
+
const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
|
|
201
|
+
const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
|
|
202
|
+
const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
|
|
203
|
+
// PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
|
|
204
|
+
// Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
|
|
205
|
+
// The result of this method is not stored in a variable because it's memoized.
|
|
206
|
+
if (hasNpmLock) {
|
|
207
|
+
// Has NPM lock file.
|
|
208
|
+
if (!hasYarnLock && !hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
|
|
209
|
+
// Only NPM lock file and NPM binary is available.
|
|
210
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
// No NPM lock file.
|
|
215
|
+
if (hasYarnLock && this.getVersion(workspace_schema_1.PackageManager.Yarn)) {
|
|
216
|
+
// Yarn lock file and Yarn binary is available.
|
|
217
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
218
|
+
}
|
|
219
|
+
else if (hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Pnpm)) {
|
|
220
|
+
// PNPM lock file and PNPM binary is available.
|
|
221
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
|
|
225
|
+
// Doesn't have NPM installed.
|
|
226
|
+
const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
|
|
227
|
+
const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
|
|
228
|
+
if (hasYarn && !hasPnpm) {
|
|
229
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
230
|
+
}
|
|
231
|
+
else if (!hasYarn && hasPnpm) {
|
|
232
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// TODO: This should eventually inform the user of ambiguous package manager usage.
|
|
236
|
+
// Potentially with a prompt to choose and optionally set as the default.
|
|
237
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
238
|
+
}
|
|
239
|
+
hasLockfile(packageManager) {
|
|
240
|
+
let lockfileName;
|
|
241
|
+
switch (packageManager) {
|
|
242
|
+
case workspace_schema_1.PackageManager.Yarn:
|
|
243
|
+
lockfileName = 'yarn.lock';
|
|
244
|
+
break;
|
|
245
|
+
case workspace_schema_1.PackageManager.Pnpm:
|
|
246
|
+
lockfileName = 'pnpm-lock.yaml';
|
|
247
|
+
break;
|
|
248
|
+
case workspace_schema_1.PackageManager.Npm:
|
|
249
|
+
default:
|
|
250
|
+
lockfileName = 'package-lock.json';
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
return (0, fs_1.existsSync)((0, path_1.join)(this.context.root, lockfileName));
|
|
254
|
+
}
|
|
255
|
+
getConfiguredPackageManager() {
|
|
256
|
+
var _a;
|
|
257
|
+
const getPackageManager = (source) => {
|
|
258
|
+
if (source && (0, core_1.isJsonObject)(source)) {
|
|
259
|
+
const value = source['packageManager'];
|
|
260
|
+
if (typeof value === 'string') {
|
|
261
|
+
return value;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return undefined;
|
|
265
|
+
};
|
|
266
|
+
let result;
|
|
267
|
+
const { workspace: localWorkspace, globalConfiguration: globalWorkspace } = this.context;
|
|
268
|
+
if (localWorkspace) {
|
|
269
|
+
const project = (0, config_1.getProjectByCwd)(localWorkspace);
|
|
270
|
+
if (project) {
|
|
271
|
+
result = getPackageManager((_a = localWorkspace.projects.get(project)) === null || _a === void 0 ? void 0 : _a.extensions['cli']);
|
|
272
|
+
}
|
|
273
|
+
result !== null && result !== void 0 ? result : (result = getPackageManager(localWorkspace.extensions['cli']));
|
|
274
|
+
}
|
|
275
|
+
if (!result) {
|
|
276
|
+
result = getPackageManager(globalWorkspace === null || globalWorkspace === void 0 ? void 0 : globalWorkspace.extensions['cli']);
|
|
277
|
+
}
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
__decorate([
|
|
282
|
+
memoize_1.memoize
|
|
283
|
+
], PackageManagerUtils.prototype, "getVersion", null);
|
|
284
|
+
__decorate([
|
|
285
|
+
memoize_1.memoize
|
|
286
|
+
], PackageManagerUtils.prototype, "getName", null);
|
|
287
|
+
exports.PackageManagerUtils = PackageManagerUtils;
|
|
@@ -6,24 +6,15 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
|
-
import {
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
description: string;
|
|
14
|
-
'dist-tags': {
|
|
15
|
-
[name: string]: string;
|
|
16
|
-
};
|
|
17
|
-
versions: {
|
|
18
|
-
[version: string]: JsonSchemaForNpmPackageJsonFiles;
|
|
19
|
-
};
|
|
20
|
-
time: {
|
|
21
|
-
modified: string;
|
|
22
|
-
created: string;
|
|
23
|
-
[version: string]: string;
|
|
24
|
-
};
|
|
9
|
+
import type { Manifest, Packument } from 'pacote';
|
|
10
|
+
export interface PackageMetadata extends Packument, NgPackageManifestProperties {
|
|
11
|
+
tags: Record<string, PackageManifest>;
|
|
12
|
+
versions: Record<string, PackageManifest>;
|
|
25
13
|
}
|
|
26
|
-
export
|
|
14
|
+
export interface NpmRepositoryPackageJson extends PackageMetadata {
|
|
15
|
+
requestedName?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare type NgAddSaveDependency = 'dependencies' | 'devDependencies' | boolean;
|
|
27
18
|
export interface PackageIdentifier {
|
|
28
19
|
type: 'git' | 'tag' | 'version' | 'range' | 'file' | 'directory' | 'remote';
|
|
29
20
|
name: string;
|
|
@@ -33,31 +24,18 @@ export interface PackageIdentifier {
|
|
|
33
24
|
fetchSpec: string;
|
|
34
25
|
rawSpec: string;
|
|
35
26
|
}
|
|
36
|
-
export interface
|
|
37
|
-
name: string;
|
|
38
|
-
version: string;
|
|
39
|
-
license?: string;
|
|
40
|
-
private?: boolean;
|
|
41
|
-
deprecated?: boolean;
|
|
42
|
-
dependencies: Record<string, string>;
|
|
43
|
-
devDependencies: Record<string, string>;
|
|
44
|
-
peerDependencies: Record<string, string>;
|
|
45
|
-
optionalDependencies: Record<string, string>;
|
|
27
|
+
export interface NgPackageManifestProperties {
|
|
46
28
|
'ng-add'?: {
|
|
47
|
-
save?:
|
|
29
|
+
save?: NgAddSaveDependency;
|
|
48
30
|
};
|
|
49
31
|
'ng-update'?: {
|
|
50
|
-
migrations
|
|
51
|
-
packageGroup
|
|
32
|
+
migrations?: string;
|
|
33
|
+
packageGroup?: string[] | Record<string, string>;
|
|
34
|
+
packageGroupName?: string;
|
|
35
|
+
requirements?: string[] | Record<string, string>;
|
|
52
36
|
};
|
|
53
37
|
}
|
|
54
|
-
export interface
|
|
55
|
-
name: string;
|
|
56
|
-
tags: {
|
|
57
|
-
[tag: string]: PackageManifest | undefined;
|
|
58
|
-
};
|
|
59
|
-
versions: Record<string, PackageManifest>;
|
|
60
|
-
'dist-tags'?: unknown;
|
|
38
|
+
export interface PackageManifest extends Manifest, NgPackageManifestProperties {
|
|
61
39
|
}
|
|
62
40
|
export declare function fetchPackageMetadata(name: string, logger: logging.LoggerApi, options?: {
|
|
63
41
|
registry?: string;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -31,10 +35,9 @@ const lockfile = __importStar(require("@yarnpkg/lockfile"));
|
|
|
31
35
|
const fs_1 = require("fs");
|
|
32
36
|
const ini = __importStar(require("ini"));
|
|
33
37
|
const os_1 = require("os");
|
|
34
|
-
const pacote = __importStar(require("pacote"));
|
|
35
38
|
const path = __importStar(require("path"));
|
|
36
|
-
const npmPackageJsonCache = new Map();
|
|
37
39
|
let npmrc;
|
|
40
|
+
const npmPackageJsonCache = new Map();
|
|
38
41
|
function ensureNpmrc(logger, usingYarn, verbose) {
|
|
39
42
|
if (!npmrc) {
|
|
40
43
|
try {
|
|
@@ -166,16 +169,6 @@ function normalizeOptions(rawOptions, location = process.cwd(), existingNormaliz
|
|
|
166
169
|
}
|
|
167
170
|
return options;
|
|
168
171
|
}
|
|
169
|
-
function normalizeManifest(rawManifest) {
|
|
170
|
-
// TODO: Fully normalize and sanitize
|
|
171
|
-
return {
|
|
172
|
-
dependencies: {},
|
|
173
|
-
devDependencies: {},
|
|
174
|
-
peerDependencies: {},
|
|
175
|
-
optionalDependencies: {},
|
|
176
|
-
...rawManifest,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
172
|
async function fetchPackageMetadata(name, logger, options) {
|
|
180
173
|
const { usingYarn, verbose, registry } = {
|
|
181
174
|
registry: undefined,
|
|
@@ -184,25 +177,18 @@ async function fetchPackageMetadata(name, logger, options) {
|
|
|
184
177
|
...options,
|
|
185
178
|
};
|
|
186
179
|
ensureNpmrc(logger, usingYarn, verbose);
|
|
187
|
-
const
|
|
180
|
+
const { packument } = await Promise.resolve().then(() => __importStar(require('pacote')));
|
|
181
|
+
const response = await packument(name, {
|
|
188
182
|
fullMetadata: true,
|
|
189
183
|
...npmrc,
|
|
190
184
|
...(registry ? { registry } : {}),
|
|
191
185
|
});
|
|
192
186
|
// Normalize the response
|
|
193
187
|
const metadata = {
|
|
194
|
-
|
|
188
|
+
...response,
|
|
195
189
|
tags: {},
|
|
196
|
-
versions: {},
|
|
197
190
|
};
|
|
198
|
-
if (response.versions) {
|
|
199
|
-
for (const [version, manifest] of Object.entries(response.versions)) {
|
|
200
|
-
metadata.versions[version] = normalizeManifest(manifest);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
191
|
if (response['dist-tags']) {
|
|
204
|
-
// Store this for use with other npm utility packages
|
|
205
|
-
metadata['dist-tags'] = response['dist-tags'];
|
|
206
192
|
for (const [tag, version] of Object.entries(response['dist-tags'])) {
|
|
207
193
|
const manifest = metadata.versions[version];
|
|
208
194
|
if (manifest) {
|
|
@@ -219,22 +205,24 @@ exports.fetchPackageMetadata = fetchPackageMetadata;
|
|
|
219
205
|
async function fetchPackageManifest(name, logger, options = {}) {
|
|
220
206
|
const { usingYarn = false, verbose = false, registry } = options;
|
|
221
207
|
ensureNpmrc(logger, usingYarn, verbose);
|
|
222
|
-
const
|
|
208
|
+
const { manifest } = await Promise.resolve().then(() => __importStar(require('pacote')));
|
|
209
|
+
const response = await manifest(name, {
|
|
223
210
|
fullMetadata: true,
|
|
224
211
|
...npmrc,
|
|
225
212
|
...(registry ? { registry } : {}),
|
|
226
213
|
});
|
|
227
|
-
return
|
|
214
|
+
return response;
|
|
228
215
|
}
|
|
229
216
|
exports.fetchPackageManifest = fetchPackageManifest;
|
|
230
|
-
function getNpmPackageJson(packageName, logger, options = {}) {
|
|
217
|
+
async function getNpmPackageJson(packageName, logger, options = {}) {
|
|
231
218
|
const cachedResponse = npmPackageJsonCache.get(packageName);
|
|
232
219
|
if (cachedResponse) {
|
|
233
220
|
return cachedResponse;
|
|
234
221
|
}
|
|
235
222
|
const { usingYarn = false, verbose = false, registry } = options;
|
|
236
223
|
ensureNpmrc(logger, usingYarn, verbose);
|
|
237
|
-
const
|
|
224
|
+
const { packument } = await Promise.resolve().then(() => __importStar(require('pacote')));
|
|
225
|
+
const resultPromise = packument(packageName, {
|
|
238
226
|
fullMetadata: true,
|
|
239
227
|
...npmrc,
|
|
240
228
|
...(registry ? { registry } : {}),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { NgAddSaveDependency } from './package-metadata';
|
|
9
9
|
interface PackageJson {
|
|
10
10
|
name: string;
|
|
11
11
|
version: string;
|
|
@@ -17,7 +17,7 @@ interface PackageJson {
|
|
|
17
17
|
migrations?: string;
|
|
18
18
|
};
|
|
19
19
|
'ng-add'?: {
|
|
20
|
-
save?:
|
|
20
|
+
save?: NgAddSaveDependency;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export interface PackageTreeNode {
|