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

feat(core): version option should display global and local installation separately #15911

Merged

Conversation

AgentEnder
Copy link
Member

Current Behavior

nx --version only reports the locally installed Nx version, and throws when outside of a workspace

Expected Behavior

nx --version can report the global Nx version if available, and doesn't throw if running it outside of a workspace.

Related Issue(s)

Fixes #15825

@vercel
Copy link

vercel bot commented Mar 27, 2023

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

Name Status Preview Comments Updated
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 29, 2023 at 9:04PM (UTC)

packages/nx/bin/nx.ts Show resolved Hide resolved
? null
: require('../package.json').version;

process.env.GLOBAL_NX_VERSION ??= GLOBAL_NX_VERSION;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is set on process.env just so we can reach it in report? Could we set it on global instead? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

We could - we don't currently set anything on global though. I'll leave it up to you, if you want it swapped we can swap it out but I honestly think the resulting code will be uglier and the potential side effects more prominent

packages/nx/src/command-line/nx-commands.ts Show resolved Hide resolved
packages/nx/bin/nx.ts Show resolved Hide resolved
@FrozenPandaz FrozenPandaz merged commit 3575028 into nrwl:master Mar 30, 2023
3 checks passed
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

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 Apr 5, 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.

nx --version should not check if in a nx workspace
2 participants