D
Deno

help

Chaining Tasks and using --watch

Eelekram3/31/2023
Is there a way to chain Deno tasks or something to that accord? I'd like to run esbuild from the command line to bundle/transpile some client JS and then have Deno start my dev webserver in watch mode. So each time a file is touched it runs esbuild and then Deno again.
Hhexagon56k3/31/2023
You could try out pup with the watch functionality and a chained command (never try chaining commands in pup, open an issue if it doesn't work) https://github.com/Hexagon/pup/blob/main/docs/examples/watcher/pup.jsonc Manual at https://hexagon.github.io/pup Config should be something like this
{
"processes": [
{
"id": "demo-watch",
"cmd": ["deno", "run", "bundler.js", "&&", "deno", "run", "script.js"],
"autostart": true, // When watching, we want autostart
"restart": "always", // The process will just be killed when a file change is detected, configure to always restart
"restartDelayMs": 1000, // Default is 10000, which is too long for development, set this to 1000
"watch": ["./"] // Watch the entire current directory
}
]
}
{
"processes": [
{
"id": "demo-watch",
"cmd": ["deno", "run", "bundler.js", "&&", "deno", "run", "script.js"],
"autostart": true, // When watching, we want autostart
"restart": "always", // The process will just be killed when a file change is detected, configure to always restart
"restartDelayMs": 1000, // Default is 10000, which is too long for development, set this to 1000
"watch": ["./"] // Watch the entire current directory
}
]
}
Eelekram4/1/2023
This looks interesting. I will check it out - thanks I was hoping there would be a more straight forward Deno way to do this though...
ABAltair 680b4/1/2023
Pup ^
Hhexagon56k4/1/2023
It could be done with a one liner too (if it works at all right now), check out the "single command usage" section of https://hexagon.github.io/pup/usage.html#single-command-usage
Pup - The Manual
Usage
Universal Process Manager
Hhexagon56k4/1/2023
If you want to avoid installing, you can run pup directly from the deno.land url and put everything in a deno task "deno task up", which would make it very slim Nope, chaining does not work using a single process in pup. Will have to work on that
Eelekram4/1/2023
All good. I ended up compiling esbuild and calling it when initialising the app with Deno.run. I will come back and look at pup when the project goes into production. Thank you for your help šŸ™
ABAltair 680b4/2/2023
I have a dev server that might interest you. https://github.com/nhrones/HotServe Added preact jsx to HotServe example

Looking for more? Join the community!

Recommended Posts
How to setup deno for Lunarvim?I've followed the steps to install the LSP for deno, but the completion and formatter doesn't work Unexpected token 'export' (deno_core)Playing around with ModuleLoaders, but doesn't seem to make a difference Scripts containing the expglobal is not definedWhy Deno doesn't have global like node.js? There is globalThis, but some things from npm packages arUsing querySelector on NodeI am doing something like: ```ts const nodeList: NodeList = document.querySelectorAll(".foo"); constSimpler way to read a file relative to current module?So I wrote a little helper function for reading the text content of a file relative to the current merror: BadResource: Bad resource IDI'm writing tests for https://github.com/deno-libs/tinyhttp/pull/9. ```js import { describe, expectRecent deployment not working?Hi there I have an api that was working just fine not sure what happen but new deployments are not wHow do you get the path to a file relative to the module which is referencing it?```ts const GET_PROGRAM_QUERY = Deno.readFileSync("./GetProgram.gql"); ``` GetProgram.gql is a fileInvestigating memory leak after adding new app dependencyHi, I added an OpenTelemetry metrics reporting loop to a Deno program and found that Deno began leakVScode deno lint blew up again after update.It seems every time there's an extension update VScode lint blows up and will stop recognizing top limport cache not workingI can't install cache of my http imports:Why isn't this error caught?Basic code example: ``` try { Deno.remove("fakefile"); } catch (err) { console.log("File doesn'tUsing dynamic import with npm compatibility gives intermittent error "__DENO_NODE_GLOBAL_THIS_167935This is pretty hard to google because the number at the end of the error changes everytime it happenGraphql codegendoes anyone have a solution to generate the sdk using graphq-request with Deno?Deno Third Party Modules Web HooksIs there a way to see the webhook payload URL a package you have published is listening for?Does Deno Deploy support location based analytics?The free version does not seem to support it. Does the paid version support it?IPC solution for a process manageršŸ‘‹ I'm at day 7 of working on Pup (https://github.com/hexagon/pup) - a universal process manager rSpecifying config remotely or jsx on installI'm struggling quite a lot here. I originally recommended using this command: ```bash deno install -Is it possible to know what version of a dynamically-imported module was just imported?Right now, you can run code like `import('npm:lodash')`, which will get the latest version of lodashWhy am I getting an "Uncaught DOM Exception" in the Deno CLI?To replicate: 1. `deno` in the command line to initialize a Deno REPL ``` // Get an array of random