[1] Run <script> 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:
{
"name": "root",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "workspaces"
}
]
}
},
"workspaces": [
"packages/foo",
"packages/bar"
]
}
Which is equivalent to:
{
"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).
{
"name": "foo",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "dependencies"
}
]
}
},
"dependencies": {
"bar",
"baz"
}
}
Which is equivalent to:
{
"name": "foo",
"scripts": {
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
"../bar:build",
"../baz:build"
]
}
}
}
[1] Run
<script>in all of my workspaces (parent → child).With Wireit, you can already just do
npm run build -wsto 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:{ "name": "root", "scripts": { "build": "wireit" }, "wireit": { "build": { "dependencies": [ { "script": "build", "packages": "workspaces" } ] } }, "workspaces": [ "packages/foo", "packages/bar" ] }Which is equivalent to:
{ "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).
{ "name": "foo", "scripts": { "build": "wireit" }, "wireit": { "build": { "dependencies": [ { "script": "build", "packages": "dependencies" } ] } }, "dependencies": { "bar", "baz" } }Which is equivalent to:
{ "name": "foo", "scripts": { "build": "wireit" }, "wireit": { "build": { "dependencies": [ "../bar:build", "../baz:build" ] } } }