Deno

D

Deno

Chat about Deno, a modern runtime for JavaScript and TypeScript.

Join

Best way to compile & distribute a Deno CLI program?

Hey! I made a Deno CLI I would like to share, It is a CLI program that I would like the user to install. What is the best way about doing this? I would like this CLI to be installed globally as well, and cross platform.

Using discord.js in Deno?

Apparently Deno supports discord.js now. Awesome. But now I can't make it work. According to debug logs, the Websocket connection is timing out. What could be happening?...

Type alias with inherited type parameter constraints

Is there any way to do this? I want SVLTN to just be a short-name alias for SomeVeryLongTypeName, and I want it to have the same parameter types, but I don't want to have to specify all of them explicitly. ```ts type SomeVeryLongTypeName<A extends ..., B extends ..., ...> = ... type SVLTN<A extends ..., B extends ..., ...> = SomeVeryLongTypeName<A, B, ...>...

Fresh: global state

Is it possible to have a global state that can be accessed from anywhere? Currently I'm passing the Request object to many deeply nested server-rendered components, because I need to read the request hostname from it. I wish there was a way I could skip passing it through props.

Run Deno on Linux without /proc mounted

I have a few automatic scripts using deno to run stuff, and wanted to migrate them to another Machine. For various reasons deno doesn't run on the new Host (mainly missing Libraries) so I wanted to run deno in a chroot. However that fails, because /proc is not mounted in the chroot and for some reason deno seems to rely on /proc/self/exe. Is there a way to not need that? Or do I need to mount /proc in the chroot?

Running deno in distroless image does not work well

Hey, I have the following Dockerfile: ```dockerfile FROM node:lts AS build WORKDIR /app...

Reasons to choose Node.js

I've been tasked to write a list of pros/cons of Deno in comparison to Node.js. I am quite honestly having a hard time formulating that many "pros" of Node.js. Could someone please let me know: what good reasons are there to choose Node.js today?...

Reejs not working on Deno v1.34

``js deno run -A npm:reejs [INFO] Saving important data... [TIP] If the error in your code is in any of the following extensions (.ts, .tsx, .jsx), kindly not focus on the line number as the line numbers depict the compiled code and not the original one. Add DEBUG=true` to your environment variables to see the original code. TypeError: Could not resolve 'node:repl' from 'file:///home/ren/.cache/deno/npm/registry.npmjs.org/@reejs/imports/2.1.13/nativeImport.js'....

Uncaught (in promise) eof for websocket

/root/.pm2/logs/twitter-follow-checker-error.log last 15 lines: 0|twitter | ^ 0|twitter | at alert_new_follow (file:///root/projects/twitter_v2_deno/watchers/alert_newfollow.ts:49:61) 0|twitter | at eventLoopTick (ext:core/01core.js:183:11) 0|twitter | at async file:///root/projects/twitter_v2_deno/cron.ts:10:1...

Deno hangs on error

Why does Deno hang when XML.parse throws an error? ``` let text = '<xml><xbrli:xbrl><hi>Hello</hi></xbrli:xbrl></xml>' import * as XML from "https://deno.land/x/xml/mod.ts"...

[SOLVED] deno.lock keeps getting populated with dependencies I don't need

I have tried to use a syntax highlighter before and have since removed it from my project, but every time I save any file, the deno.lock gets populated with these dependencies again, despite the fact that they are not used anywhere in my project. How can I make this stop?

What a method prefixed with `#` means?

This is perhaps the stupidest question ever. But I often see method with names prefixed with a # character in typescript. What does it mean? Google does not seems to know either. example: https://deno.land/std@0.187.0/streams/text_line_stream.ts?source#L40...

Logger names and prefixes

Is there any obvious way on how to configure std/log so that loggers named my-prefix/foo/bar and my-prefix/hello/world attach to the same handlers automatically? In other words, can I configure logger handlers based on logger name prefix?...

Deno and `npm:mongodb` problem with `node:`?

``` ❯ deno check --reload main.ts error: Relative import path "net" not prefixed with / or ./ or ../ and not in import map from "file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/mongodb/5.6.0/mongodb.d.ts" If you want to use a built-in Node module, add a "node:" prefix (ex. "node:net"). at file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/mongodb/5.6.0/mongodb.d.ts:29:29...

DiscordJS "Error: Not implemented: ClientRequest.options.createConnection"

```ts import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags, Client } from "npm:@discordjs/core@0.6.0" import { REST } from "npm:@discordjs/rest@1.7.1" import { WebSocketManager } from "npm:@discordjs/ws@0.8.3" ...

Using Superagent in Deno?

Has anyone managed to make Superagent work nicely in Deno? ``` _ { type: "error",...

Oak – ctx.assert with custom response headers

Am I doing this wrong? No extra custom headers are being set in the response as far as I can see in cURL: ```ts ctx.assert( !missingHeaders,...

npm:undici doesn't work

https://github.com/denoland/deno/issues/16710 Marked as resolved by this issue but does not work in my environment ```ts import { request } from "npm:undici"...

how to specify giving error or warning for a lint rule?

I'm new to Deno couldn't find a way to make a lint rule give error instead of error ```json { "lint": {...