Concise way to depend on scripts in child and dependency workspaces
- Dominant language
- TypeScript
- Stars
- 6.4k
- Forks
- 128
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
#### [1] Run `` in all of my workspaces (parent → child).
With Wireit, you can already just do `npm run build -ws` to run a given script in all workspaces, which is the standard npm workspaces approach. However it's not fully optimal, because npm doesn't parallelize. So we will also support a syntax like this:
```json
{
"name": "root",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "workspaces"
}
]
}
},
"workspaces": [
"packages/foo",
"packages/bar"
]
}
```
Which is equivalent to:
```json
{
"name": "root",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": {
[
"./packages/foo:build",
"./packages/bar:build"
]
}
}
}
}
```
#### [2] Run `<script>` in all of my dependencies (child → siblings).
Related, it is often useful to run some script in all of the current packages dependencies (where those dependencies are workspaces contained by the same workspace root).
```json
{
"name": "foo",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "dependencies"
}
]
}
},
"dependencies": {
"bar",
"baz"
}
}
```
Which is equivalent to:
```json
{
"name": "foo",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
"../bar:build",
"../baz:build"
]
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.