Replies: 1 comment
-
I think you're taking the The motivation behind tasks is to abstract common complex tasks that you need to run daily. A typical use case is that there is a deno run -A --watch-hmr my-app.ts Now you could of course always type out the whole command by hand yourself. This gets very tedious though. You could put this in a shell file, but then have to deal with different developers using different shells and operating systems, which all have a different syntax. Windows has PowerShell, macOS has zsh and linux typically has bash or sometimes fish. It's not something you want to bother with as a developer, and neither should your team mates. So what if you could just call We can solve this headache by adding a This all can be solved with tasks. Let's add a task for development setup of our imaginary project: {
"tasks": {
"dev": "deno run -A --watch-hmr my-app.ts"
}
} This means now you can just call |
Beta Was this translation helpful? Give feedback.
-
Previous discussion here but I got no feedback there, so I'm bringing it over here.
Apparently,
deno run
is going out the window for certain things, but this is confusing me as a Deno beginner:Hi! Thank you for your explanation.
I'm new to
deno
, and it's not really clear to me howdeno task
fits here because of how the docs explaindeno task
(emphasis mine):Suppose I want to execute
npm:create-svelte@latest
. This is not a command specific to a codebase, and therefore "not a task"! It is a command meant to initialize a codebase.Suppose I were to generalize a bit, and define a codebase to be "my home directory". Then, I guess I would put a
deno.json
file there, with something like? (not sure)I am not sure about the above because setting up a
deno.json
just to do adeno run
seems very circular......to the point where I did not expect it to work.
Yet it did! And when it did, I was surprised, and tried a bare
deno run -A npm:create-svelte@latest
.......which also worked? Huh. I made sure I've enabled
DENO_FUTURE
:So, why does this work now? I am using:
So...is
deno task
the recommended way to run something likenpm:create-svelte
or isdeno run
still the way to go?Beta Was this translation helpful? Give feedback.
All reactions