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): add the "add" cli command #20976

Merged
merged 9 commits into from
Jan 17, 2024

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Jan 2, 2024

Adds a new command for installing and initializing a package: add.

Initialization is done by invoking the <package>:init generator. If the @nx/angular plugin is installed, it will also look for an ng-add generator if the init generator is not found.

Examples usage:

Install the @nx/react package matching the currently installed nx version (for non-core nx plugins, it will install their latest version) and run its @nx/react:init generator:

 nx add @nx/react

Install the version 17.0.0 of the @nx/react package and run its @nx/react:init generator:

 nx add @nx/[email protected]

If the package being added doesn't contain an init generator (or ng-add in Angular workspaces), it will safely handle it by only installing the package and logging a message stating there's nothing to initialize.

Docs: https://nx-dev-git-fork-leosvelperez-core-add-command-nrwl.vercel.app/nx-api/nx/documents/add

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #

Copy link

vercel bot commented Jan 2, 2024

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

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jan 17, 2024 6:50pm

@leosvelperez leosvelperez force-pushed the core/add-command branch 2 times, most recently from 48de65f to 092ab5e Compare January 17, 2024 09:34
Copy link
Collaborator

@isaacplmann isaacplmann left a comment

Choose a reason for hiding this comment

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

Docs look good. Is it possible to have nx add @nx/react install the version that matches nx? Instead of whatever the latest version of the plugin is?

Copy link
Member

@AgentEnder AgentEnder left a comment

Choose a reason for hiding this comment

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

Looks good, 2 small changes

packages/nx/src/command-line/add/add.ts Outdated Show resolved Hide resolved
@leosvelperez leosvelperez enabled auto-merge (squash) January 17, 2024 18:44
@leosvelperez leosvelperez merged commit 28438bb into nrwl:master Jan 17, 2024
6 checks passed
@leosvelperez leosvelperez deleted the core/add-command branch January 18, 2024 07:54
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 Jan 24, 2024
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.

5 participants