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(commands): Add workspace from v1 #371

Merged
merged 17 commits into from
Aug 23, 2019

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Aug 21, 2019

What's the problem this PR addresses?

Adds yarn workspace some-workspace run script from v1. Enables adding a package to a single workspace without having to cd into it.

How did you fix it?

  1. find the workspace in a project whose stringified ident equals the arg
  2. run the sub-command as the command in the directory of the found workspace

Which packages would need a new release (if any)?

  • @berry/plugin-workspace-tools

Have you run yarn version [major|minor|patch] --deferred in those packages?

  • Yes

packages/plugin-workspace-tools/package.json Outdated Show resolved Hide resolved
category: `Workspace-related commands`,
description: `run a command on the specified namespace`,
details: `
This command will run a given sub-command on a single workspace.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be a fine place to add a note regarding the "global scripts" behavior (search for "colon" in the changelog)? I don't see it documented elsewhere at the moment 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

To be fair I completely misinterpreted this feature initially. I thought if I have a workspace docs with a script start then yarn run docs:start would automatically work. I didn't realize I actually had to prefix every nested script which is why I would still prefer yarn workspace docs start.

But I agree that it'd be nice to add a note about yarn docs:start being equivalent to yarn workspace docs run docs:start.

@arcanis
Copy link
Member

arcanis commented Aug 21, 2019

It seems like I broke the unit tests, I'll check this.

If you also could add a test or two in packages/acceptance-tests/pkg-test-specs/sources/commands/workspace.ts, it would be 💯

eps1lon and others added 2 commits August 21, 2019 16:14
Co-Authored-By: Maël Nison <nison.mael@gmail.com>
Object {
"code": 1,
"stderr": "",
"stdout": "Usage Error: Couldn't find a script named \\"workspace package-a print\\".
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know how I tell the test to pick up the new command. I copied the .yarnrc.yml setup from foreach.test.js which is part of the same plugin as far as I can tell.

Copy link
Member

Choose a reason for hiding this comment

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

It's because you used run('foo bar baz') instead of run('foo', 'bar', 'baz')

@arcanis
Copy link
Member

arcanis commented Aug 22, 2019

I'm not sure if that's on purpose, but your PRs seem protected against being edited by reviewers. It's too bad because I had some changes (merge and the test fix) to push on it 😅

@eps1lon
Copy link
Member Author

eps1lon commented Aug 23, 2019

I'm not sure if that's on purpose, but your PRs seem protected against being edited by reviewers. It's too bad because I had some changes (merge and the test fix) to push on it

Seems like an issue with github. I guess you can still branch off and open a PR on my fork.

Screenshot from 2019-08-23 03-58-08

@arcanis
Copy link
Member

arcanis commented Aug 23, 2019

It was late and I was running the wrong command (push origin HEAD instead of push origin HEAD:feat/command/workspace), my apologies!

@arcanis arcanis merged commit 120cf4c into yarnpkg:master Aug 23, 2019
@eps1lon eps1lon deleted the feat/command/workspace branch August 23, 2019 07:27
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.

2 participants