Skip to content

Commit ec136a6

Browse files
authored
Adds workspace command (#61)
* Adds workspace command * Update 0000-workspaces-command.md * Update 0000-workspaces-command.md
1 parent b79f28d commit ec136a6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

accepted/0000-workspaces-command.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
- Start Date: 2017-05-04
2+
- RFC PR:
3+
4+
# Summary
5+
6+
This document specify a new command, that can be used to execute subcommands inside a project workspaces.
7+
8+
# Motivation
9+
10+
With the addition of the Workspace feature, it will become handy to be able to execute commands inside other workspaces than the one in the current directory.
11+
12+
# Detailed design
13+
14+
This RFC suggests to add the following commands:
15+
16+
## `yarn exec <binary-name> ...`
17+
18+
Execute a shell command inside the same environment than the one used when running scripts. For example, running `yarn exec env` will print something similar to this:
19+
20+
```
21+
PWD=/path/to/project
22+
npm_config_user_agent=yarn/0.23.4 npm/? node/v7.10.0 darwin x64
23+
npm_node_execpath=/usr/bin/node
24+
...
25+
```
26+
27+
## `yarn workspace <workspace-name> <command-name> ...`
28+
29+
This command will execute the specified sub-command inside the workspace that is being referenced by `<workspace-name>`.
30+
31+
Recursion aside, it's essentially an alias for:
32+
33+
```
34+
$> (cd $(yarn workspace <workspace-name> exec pwd) && yarn <command-name> ...)
35+
```
36+
37+
# Drawbacks
38+
39+
- We will still have the issue of requiring the `--` separator to forward any command line option (`yarn workspace test install -- --production`). It's an important issue, something we really should tackle sooner than later.

0 commit comments

Comments
 (0)