Open bartlomieju opened 3 days ago
fwiw, we found that we didn't need this so much in Wireit since you usually have a plain build
task that depends on the others:
{
"tasks": {
"build": {
"dependencies": ["build:frontend", "build:server", "build:queue"]
},
"build:frontend": "...",
"build:server": "...",
"build:queue": "...",
"serve": "..."
}
}
One case where we have wanted some wildcard like functionality is in running the same script in a monorepo dependencies instead of having to list each dependency out again in the Wireit config. ie, the "build" script for A runs the "build" script for B, C, and D, automatically if those are local monorepo dependencies with "build" scripts:
So instead of:
packages/a/package.json
{
"tasks": {
"build": {
"dependencies": ["../b:build", "../c:build", "../d:build"]
}
}
}
you'd have: packages/a/package.json
{
"tasks": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "dependencies"
}
]
}
}
}
Thanks for comment @justinfagnani. Would something like this work for you?
{
"tasks": {
"build": {
"command": "...",
"dependencies": ["./packages/*:<task_name>"]
}
}
}
That way we don't have to develop two separate features - just need to accept wildcards in "cross-package" dependencies.
@bartlomieju
Thanks for comment @justinfagnani. Would something like this work for you?
note that I'm not a potential user here, I'm just relaying my experience with Wireit :)
{ "tasks": { "build": { "command": "...", "dependencies": ["./packages/*:<task_name>"] } } }
That way we don't have to develop two separate features - just need to accept wildcards in "cross-package" dependencies.
This is semantically differently than running scripts in dependencies. Here you're saying to run scripts in every package under packages/*
. What the proposed new Wireit dependency type is saying to do is run the script in local dependencies or the current package.
The more complete example config would be:
{
"tasks": {
"build": {
"dependencies": [
{
"script": "build",
"packages": "dependencies"
}
]
}
},
"dependencies": {
"@foo/b": "^1.0.0",
"@foo/c": "^1.0.0",
"@foo/d": "^1.0.0"
}
}
Where @foo/{a,b,c}
are all packages in the local monorepo. This would not run the build
script in packages/e
, etc.
Running scripts in dependencies has been the main use case for wildcard-like functionality, because without that feature the config has to repeat data already in package dependencies. I would personally suggest starting with that rather than a general wildcard feature.
It would be great if one could do
deno task build:*
to run all tasks that start withbuild:
.Eg:
running
deno task build:*
would matchbuild:frontend
,build:server
andbuild:queue
and run them all in parallel.Somewhat related to https://github.com/denoland/deno/issues/26462