Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): improve packages recognition when the package version is an external package #29529

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

newsiberian
Copy link

Current Behavior

After updating from [email protected] to [email protected] our docusaurus dep starts blocking us from running any nx command because of the error described in the linked issue

The "nx/js/dependencies-and-lockfile" plugin threw an error while creating dependencies: Target project does not exist: npm:react-helmet-async@npm:@slorber/react-helmet-async@*

Expected Behavior

Packages with such deps, like: "react-helmet-async": "npm:@slorber/react-helmet-async@*" shouldn't break any nx command

Related Issue(s)

Fixes #27285

@newsiberian newsiberian requested a review from a team as a code owner January 6, 2025 20:57
@newsiberian newsiberian requested a review from Cammisuli January 6, 2025 20:57
Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jan 6, 2025 8:59pm

Copy link

nx-cloud bot commented Jan 6, 2025

View your CI Pipeline Execution ↗ for commit ae7459c.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 34m 11s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m 3s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=cb4a9... ✅ Succeeded 28s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 27s View ↗
nx documentation --no-dte ✅ Succeeded 1m 6s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-06 21:41:00 UTC

@newsiberian
Copy link
Author

@Cammisuli can this PR be reviewed, please?

Copy link
Member

@Cammisuli Cammisuli left a comment

Choose a reason for hiding this comment

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

I don't believe having the npm specific checks in the project graph builder is the best place for this. The reason for this is that the builder itself should be technology/package agnostic. The project graph will contain much more types of external nodes than just npm. For example, there could be cargo, gradle, pip, etc.

We should fix the area that is actually adding the external nodes which would be in the js plugin here:

if (!lockFileNeedsReprocessing(lockFileHash)) {
const nodes = readCachedParsedLockFile().externalNodes;
parsedLockFile.externalNodes = nodes;
return {
externalNodes: nodes,
};
}
const externalNodes = getLockFileNodes(
packageManager,
lockFileContents,
lockFileHash,
context
);
parsedLockFile.externalNodes = externalNodes;
return {
externalNodes,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistent "Failed to process project graph"
2 participants