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

RFC: npm workspaces - Config management #273

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

Conversation

ruyadorno
Copy link
Contributor

@ruyadorno ruyadorno commented Nov 4, 2020

Adds a workspaces config management workflow.

See RFC

@ruyadorno ruyadorno added the Agenda will be discussed at the Open RFC call label Nov 4, 2020
@ljharb
Copy link
Contributor

ljharb commented Nov 4, 2020

Per discussion on the call today, i have questions about how “add” works with a glob, or how “rm” works when the package to be removed is already included in a glob.

@ruyadorno
Copy link
Contributor Author

To elaborate a bit more the confusion comes from the fact that supporting globs can get confusing really fast, one of the examples mentioned during the weekly meeting was trying to add negative globs, e.g: npm ws add !test and how that can lead to hazardous results given different expectations from users.

So the tricky question is what is a behavior that would be reasonable and actually helpful for the majority of users with regards to add/remove.

npm workspaces ls on the other hand seems to have no contention at all and might be implemented regardless of the decision on add and/or remove in this RFC.

@Christian24
Copy link

I am generally in favor of adding some commands to make working with workspaces easy. I generally like how lerna makes using workspaces easy, but we shouldn't attempt to rebuild lerna.

  • Maybe something like workspace init to start a guide which helps with initial setup would be cool?
  • Git submodules might also be an interesting as inspiration: https://git-scm.com/book/en/v2/Git-Tools-Submodules
  • Especially something like foreach might be nice, for things like audit etc. However, since this isn't config management feel free to tell me to shut up @ruyadorno ;)

@Christian24
Copy link

@ruyadorno you had mentioned on the call there have been talks with the team behind lerna, so it might be cool to add that as a kind of context. Additionally. a link to I think workspaces v2 is what it is called would be nice here too, so people can follow up with the previous discussion.

@ruyadorno ruyadorno removed the Agenda will be discussed at the Open RFC call label Dec 9, 2020
@ruyadorno
Copy link
Contributor Author

@ruyadorno you had mentioned on the call there have been talks with the team behind lerna, so it might be cool to add that as a kind of context. Additionally. a link to I think workspaces v2 is what it is called would be nice here too, so people can follow up with the previous discussion.

@Christian24 I mentioned that in the context of the RFC for running commands: #117 we do have a bunch of the conversations documented there 😊


$ npm workspaces ls

$ npm workspaces add ./packages/dep-a
Copy link

@jamiebuilds jamiebuilds Apr 6, 2021

Choose a reason for hiding this comment

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

Reading npm workspaces add <package> I would not expect it to mutate the root config. I would expect it to mirror npm workspaces install <package> in #117 since npm add/rm are already aliases to install/uninstall dependencies.

I think npm workspaces <subcommand> can either be a command that operates on package.json#workspaces or every <workspaces>/package.json mixing and matching is confusing.

One thing we did in Bolt was have a bolt project/p command that allowed you to run commands on the root package containing all the workspaces.

Alternatives:

  • npm workspaces-config add/rm
  • npm project workspaces add/rm
  • npm workspaces add-workspace/rm-workspace

@darcyclarke darcyclarke added the Agenda will be discussed at the Open RFC call label Jun 18, 2021
@darcyclarke darcyclarke removed the Agenda will be discussed at the Open RFC call label Jul 21, 2021
@settings settings bot removed the Proposal label Sep 21, 2021
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.

5 participants