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

workspaces! #161

Open
zkat opened this issue Feb 25, 2023 · 3 comments
Open

workspaces! #161

zkat opened this issue Feb 25, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@zkat
Copy link
Member

zkat commented Feb 25, 2023

We should support some kind of workspaces.

I really like the idea of basically basing these on how Cargo works:

  1. "Virtual Workspaces" can be created by having a blank toplevel project and a bunch of same-level packages.
  2. "Hierarchical Workspace" can be created by having a "primary" package at the root, and a bunch of its "dependencies" in workspace directories.
  3. important: I really really want to have workspace-level dependency versions, so you can specify a dependency version once, in your workspace definition, and just do something like "dependencies": { "my-dep": "workspace" }
  4. I'm not sure I care enough about compatibility with NPM workspaces.

Some inspiration on design:

  1. Turborepo: https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks
  2. pnpm workspaces: https://pnpm.io/workspaces
  3. bit: https://bit.dev/blog/painless-monorepo-dependency-management-with-bit-l4f9fzyw/
  4. cargo workspaces: https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html
  5. wireit: https://github.com/google/wireit

Annoyingly, there's a lot of inconsistencies as to what's called "workspaces", and what the host project is called:

  1. Cargo refers to the host project as a workspace, and its children as members, but they're referred to on the CLI with the -p/--package flag.
  2. PNPM has a pnpm-workspace.yaml file with a packages: field, and uses -r/--recursive to run certain commands across all workspace packages. It uses the -w/--workspace flag to refer to the host/root project.
  3. NPM uses a "workspaces": {...} field and seems to refer to the host project as a "root project" or "project root". The -w/--workspace flag, as opposed to in NPM, refers to the individual packages, not the root project.
  4. Yarn also uses a "workspaces": {...} field, which is probably the source of NPM's naming, but refers to the host project as a "worktree". It does not seem to have any configuration for either recursive execution (like PNPM) or package targeting (like Cargo or NPM).

So basically everyone is horrible and there's no right answer.

I personally like PNPM's approach the best because it's the clearest and most consistent.

@zkat zkat added enhancement New feature or request help wanted Extra attention is needed labels Feb 25, 2023
@ThatOneCalculator
Copy link

Support for pnpm workspaces would be amazing, I use them for most of my big projects :)

@spa5k
Copy link

spa5k commented Sep 28, 2023

any progress on it?

@zkat
Copy link
Member Author

zkat commented Sep 28, 2023

Not yet, no. I’m working on fixing some other stuff first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Backlog
Development

No branches or pull requests

3 participants