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

Revert "fix(core): nx should not break if packages were not installed… #18784

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Aug 22, 2023

… (#18687)"

This reverts commit 20acfbe.

Current Behavior

There is an issue for pnpm users where the project graph being calculated without node_modules appears to be successful even though the results differ from the project graph which would be calculated when node_modules are not present. The npm nodes are basically not added to the graph and the dependencies are drawn anyways.

  1. When a file has a import which doesn't match the package name such as a deep import (import 'dotenv/config'), the file is deemed to have a dependency to npm:dotenv/config when it should actually depend on npm:dotenv.
  2. With the new create nodes and create dependencies APIs this ideally shouldn't be possible because all dependencies should be drawn between 2 nodes.

Expected Behavior

There needs to be another solution for this. If the correct graph cannot be produced without node_modules then the creation should fail. If we want the project graph to succeed without node_modules then we need to produce the right project graph without the node_modules.

This command should produce the same correct dependencies:

 pnpm store prune && nx reset && rm -rf node_modules && pnpm i && node -e "JSON.parse(require('fs').readFileSync('node_modules/.cache/nx/file-map.json').toString()).projectFileMap.nx.filter(f => f.file === 'packages/nx/src/adapter/ngcli-adapter.ts').forEach(f => console.log(f))"

Related Issue(s)

Fixes #

@FrozenPandaz FrozenPandaz requested a review from a team as a code owner August 22, 2023 23:22
@FrozenPandaz FrozenPandaz requested a review from Cammisuli August 22, 2023 23:22
@vercel
Copy link

vercel bot commented Aug 22, 2023

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

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2023 11:29pm

@FrozenPandaz FrozenPandaz enabled auto-merge (squash) August 22, 2023 23:23
@FrozenPandaz FrozenPandaz merged commit 9c380d9 into nrwl:master Aug 23, 2023
@FrozenPandaz FrozenPandaz deleted the revert-install branch August 23, 2023 00:22
FrozenPandaz added a commit that referenced this pull request Aug 23, 2023
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants