D
Deno

help

How can I create a seqential deno task to pass args to child task?

Jjlandowner1/12/2024
Hi, I read the docs and created tasks in deno.json like this. https://docs.deno.com/runtime/manual/tools/task_runner#executing-a-task
{
"tasks": {
"task-all": "deno task task-a && deno task task-b",
"task-a": "echo 'this task requires args'",
"task-b": "echo 'this task must run after task-a'"
}
}
{
"tasks": {
"task-all": "deno task task-a && deno task task-b",
"task-a": "echo 'this task requires args'",
"task-b": "echo 'this task must run after task-a'"
}
}
task-a requires args so it can run independently with deno task task-a ARGS I have to run task-b after task-a so I have to do with deno task task-a ARGS && deno task task-b. It is redundant so I created task-all task. I intended to run this deno task task-all ARGS. But in reality each tasks are executed as deno task task-a (no args) and deno task task-b ARGS. How can I create a seqential task to achive this?
Task Runner | Deno Docs
deno task provides a cross platform way to define and execute custom commands
Jjlandowner1/12/2024
I tried to specify $1 but it still does not work.
"task-all": "deno task task-a $1 && deno task task-b",
"task-all": "deno task task-a $1 && deno task task-b",
DAHDeno AI Helper1/12/2024
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided in your message, it seems like you're trying to pass arguments to a task within your deno.json configuration, and you want these arguments to be used by task-a but not by task-b. From what you've described, it looks like you're encountering an issue where task-all is not passing the arguments to task-a as you intended. Unfortunately, the Deno task runner does not currently support passing arguments to individual tasks when they are composed using &&. As a workaround, you might consider writing a small Deno script that programmatically invokes the tasks with the necessary arguments. This script could use Deno's subprocess API (Deno.run) to execute the tasks with more control over the arguments. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. If you need further assistance, you might want to reach out to the Deno community or check for updates in the Deno documentation or GitHub repository for any new features or patterns that could help with your use case.
Jjlandowner1/12/2024
Thanks, bot. It makes sense. Where should I ask for double-check the accuracy of this advice?
LLeokuma1/12/2024
@dsherret Can you double check the bot's answer? Sorry for pinging you
Ddsherret1/12/2024
yeah, unfortunately like npm run, there's no way to do that out of the box once things start becoming complicated, you may want to extract it out to a script and use dax https://github.com/dsherret/dax?tab=readme-ov-file#executing-commands
Jjlandowner1/12/2024
@Leokuma @dsherret Thank you for checking the answer and more information <:deno_thankyou:1181938324273893376>

Looking for more? Join the community!

Recommended Posts
Using SCSS with FreshHi, I'm starting to get into Fresh for building simple static websites. Right now I want to use my Has anyone used React Material UI with Deno Fresh? Is this possible and also what are the componenetHas anyone used React Material UI with Deno Fresh? Is this possible and also what are the componenetJSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements'I have a core program, and from that I have auxiliary components: test, web app, cli app. Initially Using Deno.Command to run tailwindcss with watch flag not workingIf I do `new Deno.Command(Deno.execPath(), {args:["run", "-A", "npm:tailwindcss", "-i", "./styles.csESBuild SASS PluginHey, I have developed this Plugin: https://github.com/DenoPlayground/esbuild-plugin-sass But I havCan't spawn a shell properly using Deno!```ts const bash = (() => { const bashProc = spawn("bash"); bashProc.stdout.on("data", (data: sHow to optimize imports on deno deploy?I have a medium project (44 files) deployed on deno deploy, where works. But, I'm getting inconsistLSP complains about missing package mongodbVS Code keeps complaining about "uncached or missing npm package: mongodb". `Cache "npm:mongodb" andnode.js to Deno remix template migrationI would like to migrate one of the templates in remix from node.js to Deno. I am not sure how to do How to pass value from one form to another?I want to design a form which has two input text field. What users type in field 1 will be passed toHow to build a Response object with the 'url' property setWriting unit tests. Some functions parse Response objects. How do I create some where the `url` propWhy Deno is not a library?For example, I'd like to embed JavaScript (Deno) on FreeBasic or Rust to able Users to write JavaScr`deno cache` consistently failing with the same errorerror: error sending request for url (https://deno.land/std@0.152.0/http/negotiation.ts): dispatch tDoes fetch() support upgrading the connection to a websocket?What happens when `fetch()` gets the response ``` HTTP/1.1 101 Switching Protocols connection: upgrError: Not implemented: crypto.Sign``` Error: Not implemented: crypto.Sign at notImplemented (https://deno.land/std@0.177.1/node/_uHow can I access req object inside a render() function from fresh plugin?Is it possible?