Skip to content

Commit 266233c

Browse files
clydinfilipesilva
authored andcommitted
refactor(@angular/cli): convert ini and @yarnpkg/lockfile usage from require to import
The removal of require usage supports the eventual shift to an ESM output for the CLI package.
1 parent 6f4bf38 commit 266233c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
declare module '@yarnpkg/lockfile' {
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11+
export function parse(data: string): Record<string, any>;
12+
}
13+
14+
declare module 'ini' {
15+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
16+
export function parse(data: string): Record<string, any>;
17+
}
18+
919
declare module 'npm-pick-manifest' {
1020
function pickManifest(
1121
metadata: import('../utilities/package-metadata').PackageMetadata,

packages/angular/cli/utilities/package-metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
*/
88

99
import { logging } from '@angular-devkit/core';
10+
import * as lockfile from '@yarnpkg/lockfile';
1011
import { existsSync, readFileSync } from 'fs';
12+
import * as ini from 'ini';
1113
import { homedir } from 'os';
1214
import * as path from 'path';
1315
import { JsonSchemaForNpmPackageJsonFiles } from './package-json';
1416

15-
const lockfile = require('@yarnpkg/lockfile');
16-
const ini = require('ini');
1717
const pacote = require('pacote');
1818

1919
const npmPackageJsonCache = new Map<string, Promise<Partial<NpmRepositoryPackageJson>>>();

0 commit comments

Comments
 (0)