Skip to content

Commit 6f4bf38

Browse files
clydinfilipesilva
authored andcommitted
refactor(@angular/cli): convert npm-pick-manifest usage from require to import
The removal of require usage supports the eventual shift to an ESM output for the CLI package.
1 parent 0ba837b commit 6f4bf38

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

packages/angular/cli/commands/update-impl.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { NodeWorkflow } from '@angular-devkit/schematics/tools';
1111
import { execSync } from 'child_process';
1212
import * as fs from 'fs';
1313
import npa from 'npm-package-arg';
14+
import pickManifest from 'npm-pick-manifest';
1415
import * as path from 'path';
1516
import * as semver from 'semver';
1617
import { PackageManager } from '../lib/config/workspace-schema';
@@ -25,7 +26,6 @@ import { ensureCompatibleNpm, getPackageManager } from '../utilities/package-man
2526
import {
2627
PackageIdentifier,
2728
PackageManifest,
28-
PackageMetadata,
2929
fetchPackageManifest,
3030
fetchPackageMetadata,
3131
} from '../utilities/package-metadata';
@@ -37,11 +37,6 @@ import {
3737
} from '../utilities/package-tree';
3838
import { Schema as UpdateCommandSchema } from './update';
3939

40-
const pickManifest = require('npm-pick-manifest') as (
41-
metadata: PackageMetadata,
42-
selector: string,
43-
) => PackageManifest;
44-
4540
const NG_VERSION_9_POST_MSG = colors.cyan(
4641
'\nYour project has been updated to Angular version 9!\n' +
4742
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9',

packages/angular/cli/src/typings.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
declare module 'npm-pick-manifest' {
10+
function pickManifest(
11+
metadata: import('../utilities/package-metadata').PackageMetadata,
12+
selector: string,
13+
): import('../utilities/package-metadata').PackageManifest;
14+
export = pickManifest;
15+
}

0 commit comments

Comments
 (0)