Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Jan 12, 2026

This commit removes the resolve dependency from @angular/cli and replaces its usage with native require.resolve via createRequire. The findPackageJson utility is now only used in migration-only scenarios where the Node.js module caching behavior that prompted the original use of resolve is no longer a concern. This reduces the package dependency footprint.

…ire.resolve

This commit removes the `resolve` dependency from `@angular/cli` and replaces its usage with native `require.resolve` via `createRequire`.
The `findPackageJson` utility is now only used in migration-only scenarios where the Node.js module caching behavior that prompted the original use of `resolve` is no longer a concern.
This reduces the package dependency footprint.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Jan 12, 2026
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 12, 2026
@clydin clydin requested a review from alan-agius4 January 12, 2026 21:52
@clydin clydin marked this pull request as ready for review January 12, 2026 21:53
This commit removes the unused `package-tree.ts` utilities, including `getProjectDependencies`, `readPackageJson`, and `PackageTreeNode`.
The `findPackageJson` function, which was the only remaining used part, has been moved directly into `commands/update/cli.ts` where it is consumed.
function findPackageJson(workspaceDir: string, packageName: string): string | undefined {
try {
const projectRequire = createRequire(path.join(workspaceDir, 'package.json'));
const packageJsonPath = projectRequire.resolve(`${packageName}/package.json`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a small gotcha for this which is that exports fields can mess with resolving package.json. But 99.9% of the time, an Angular app shouldn't have an exports field (and 90% of the remaining time, people should've added package.json to their exports).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/cli target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants