Deno

D

Deno

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

Join

Basic Mocking example for `override global or imported objects` does not work

I am following the example https://docs.deno.com/examples/testing_tutorial/#basic-mocking and when run with deno test --no-check the example fails with: ``` getUserDetails formats the name correctly => ./service_test.ts:5:6 error: TypeError: Cannot assign to read only property 'getUserFromDB' of object '[object Module]'...

Avoid newline at the end of Deno.stdout.(write/writeSync)

Here is my use case: I have a cli that outputs some command like git clone <url> and I want to print editable string in terminal so that I could replace the <url> with the actual repo url. ```ts...

Writing the whole buffer to stdout

TL;DR: How to i make sure an entire buffer is written to stdout before continuing? Hello! I'm naively implementing the language server protocol in Deno, based on some youtube tutorials 🤣 I've noticed quite some jank, errors, and dead handlers in my clients, for example, this complaint from neovim:...
No description

What is the proper way to write crons in a Fresh project?

Importing files calling Deno.cron() in the dependency tree of dev.ts would halt the build process during deno deploy. Is there a recommended way to add crons to a Fresh project?...

Deno KV on deno deploy

Why can I not setup Deno KV or see the Deno KV tab on dash.deno.com? It's been a couple of months since I went on the dashboard but I tried creating a new Deno Deploy project and setup deno kv but it won't work. Every time I try to open my poject in the dashboard I get redirected to this page......
No description

Deno compile: LoadLibraryExW failed

Hi fellow Deno + Turso devs, I need help. I am getting Uncaught (in promise) TypeError: LoadLibraryExW failed (attached screenshot) on running the compiled version (executable) with Using drizzle w/ all permission enabled (-A)...
No description

kv.watch() not working

for await (const entry of kv.watch([['chat']])) console.log(entry);
for await (const entry of kv.watch([['chat']])) console.log(entry);
The only thing this does is immediately prints the following: ```...

Debugging tests with Vitest

I am trying to launch tests in debugger. According to vitest documentation https://vitest.dev/guide/debugging.html#node-inspector-e-g-chrome-devtools running it as vitest --inspect-brk --no-file-parallelism should work just fine. So I tried:
deno run -A npm:vitest --inspect-brk --no-file-parallelism
deno run -A npm:vitest --inspect-brk --no-file-parallelism
...

Google OAuth2 flow with Deno Fresh

Asking for a little assistance with my Google auth flow- specifically for nuances with redirecting and creating/accessing cookies (I use a "token" cookie for auth). Here's my current flow, please advise where something looks "off": 1. User clicks Google OAuth link and does the OAuth "dance" with Google in a popup. 2. Google OAuth redirects to my redirect_url 3. At my redirect URL, I create a token and set it as a cookie, then redirect to my authenticated home route *with a 302 response and a "location" header. (Should I be using Response.redirect("/") here instead of a 302? ...

wich version i need to use of deno webview2 modules?

I want to use webview2 bindings with deno, and I found three different versions, option 2 seemed to me the most ideal but I had to look for other bindings because of the long start time, wrong ipc binding etc., option 1 doesn't have the features I want (like fullscren borderless window). Also, how do I reflect the always on top feature to webvew, when I do, it makes the cmd screen always on top https://github.com/webview/webview_deno https://github.com/zephraph/webview...

Using something like environment variables in fresh🍋

Is there anything I could use to use different (environment) variables in fresh? It is sort of implied in deno.json already: ```json "start": "deno run -A --watch=static/,routes/ dev.ts", "build": "deno run -A dev.ts build"...

migrate node to deno

easiest way to migrate node application to deno app

Jsr modules with package.json

I noticed that if I have a package.json my project doesn't see the jsr deps in deno.json

Uncaught (in promise) TypeError: Relative import path "@payloadcms/next/withPayload" not prefixed

Trying to deno-ify my payloadcms project, and I'm facing import issues related to deno.json. ```json { "name": "@project/backend",...

Deno + Vite + devServer (SSR) issue with missing symbol

This has been a deal breaker for us to consider Deno for a new large app, so I thought I'd share a minimal reproduction so we can get further: https://github.com/soundstep/deno-vite-ssr-playground/tree/deno-vite-plugin?tab=readme-ov-file#known-issues See the readme for usage and issue....

When to use deno add compared to import with a prefix?

As the title says, I can import like this:
import { parse } from "jsr:@std/csv/parse";
import { parse } from "jsr:@std/csv/parse";
...

on deno fresh or other deno frontend it takes at least 6 seconds for changes in the code to show up

whenever I change a component, layout, text etc it takes a lot more time to show up in localhost than when I use npm. Am I missing some obvious thing to do or this is just how it works? >.>...

deno+vite+tailwind

https://github.com/bpmooch/deno-vite-template I am having issues using tailwind with a deno+vite template. I created a github repository with a small reproduction of the issue. make will run deno run -A --node-modules-dir npm:vite. I get an error when running that command, complaining about the vite.config.ts. Has anyone gotten deno + vite + tailwind working?...

Is there any deno2+vue3 sample project?

Excuse me, is there a sample project for deno and vue as I won't be able to configure it after switching over, so thought I'd ask for help, thanks a lot!

The requested module 'npm:@jest/globals' does not provide an export named 'describe'

I am doing some exercies on exercism in the Typescript track, but I want to run my solutions locally on my machine using deno. So I have a folder, and in it I have two files (two-fer.ts and two-fer.test.ts): ...