This would make it easier to re-use deno tasks in other tasks that have different environment variables.
{
"tasks": {
"run": "export APP_ENV ?= production && deno run --allow-read=. --allow-write=. scripts/run.js",
"run-dev": "export APP_ENV = development && deno task run"
},
}
Currently that short hand won't work and will give you the following error.
$ deno task run
Task run export APP_ENV ?= production && deno run --allow-read=. --allow-write=. scripts/run.js
error: Error parsing script 'run'.
Caused by:
Globs are currently not supported, but will be soon.
?= production && deno run --allow-read=. --allow-write=. scripts/run.js
~
Since the shorthand doesn't work currently, you have to either repeat or move the common part to a separate task. The downside to the second shorthand example below is that people might use run without APP_ENV set.
{
"tasks": {
"run": "export APP_ENV = production && deno run --allow-read=. --allow-write=. scripts/run.js",
"run-dev": "export APP_ENV = development && deno run --allow-read=. --allow-write=. scripts/run.js"
},
}
{
"tasks": {
"run": "deno run --allow-read=. --allow-write=. scripts/run.js",
"run-prod": "export APP_ENV = production && deno task run"
"run-dev": "export APP_ENV = development && deno task run"
},
}