Deno

D

Deno

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

Join

API server with Postgres on Deno Deploy ConnectionParamsError

Hi everyone, I’ve been following the "API server with Postgres" tutorial (https://docs.deno.com/deploy/tutorials/tutorial-postgres/) and have set everything up successfully. For my project, I decided to go with Supabase. However, when I try to test the setup in the playground, I’m running into an error:
ConnectionParamsError: Missing connection parameters: database at assertRequiredOptions (https://deno.land/x/postgres@v0.19.3/connection/connection_params.ts:250:11)...
No description

I cannot make deno exclude dist/ directory

👋 I'm trying to make deno exclude the dist/ directory from formatting but couldn't. I tried the exclude and fmt.exclude fields in deno.json and tried different values—dist, dist/, dist/*—but nothing worked. Every single time I run deno fmt (in the same directory where my deno.json is), I see that the files in dist/ directory are also formatted. It's not a dealbreaker but being unable to get something so small and simple is quite annoying. Is this a bug or am I doing something wrong? Thanks!...

Writing a script to check which process is locking a file on Windows?

I want to write a TypeScript script which lets me check which process is locking a file on Windows. I would like to run it using Deno. I checked through the packages of the standard library to see what might be relevant, and the fs package stood out, but it doesn't provide any functions that may be relevant. ...

loadEnvFile

Hi. Looking at https://docs.deno.com/api/node/process/~/Process.loadEnvFile It looks like process.loadEnvFile is implemented in deno (using 2.1.9) but it isn't found. What do I not understand?...

Compiled executable fails to run as service

I'm trying to setup a deno script as a windows service. I created a DLL in C and am loading with Deno.dlopen. I can start the service when using deno run service.ts, but it immeadiatly fails to start if compiled with deno compile service.ts and the .exe is added to the service

how to use .ts files (or their compiled .js equivalents) in the browser?

Does Deno have a builtin way to compile ts into js for such purposes, or is there a design pattern that is recommended to make this possible, or am I stuck using webpack? I am playing with the Node crypto lib and I want to use the functions I've written in the browser's socket.io client-side code to encrypt the data that gets sent to the socket.io/deno server-side code....

Fresh defer load

So, I've been having some problems with fresh, but been working it out, kinda. The problem now is fetching. I'm fetching from both the github api and the gitlab api, but I don't want the user to notice it that much, I'll just add a Loading ... message there. The thing, how can I do it with fresh? In other frameworks, I could just return a promise and it would just defer for me, or the usage of some kind of a suspense would do that, but I haven't seen anything on the docs about defer load or returning a promise from the loader. Is there just no conventional way of doing it? Do I need to do it the "old" way (create an api endpoint, return the data, call fetch on an island and pray it works)?...

Workspace - container per app?

Is anyone using workspaces with separate containers for each app, without having to include the entire monorepo in the image? Currently Deno errors out with "Could not find config file for workspace member".

VS Code Deno formatter doesn't read deno.jsonc

I have a deno setup with this config in the root of my project: { "fmt": { "include": ["/*.ts", "/*.tsx"],...

Build and bundle TS into JS

Im starting a pretty muhc new, minimal Ts project that I would like to use Deno to host, and then have a (as much as possible) zero config that bundles all my code (from one entry point) into javascript that can be hosed elsewhere. But, how to do it? seems simple enough but seems like it's very hard to get a "primer" working with zero config. Please help. My other option would obviously be to host on deno deploy, but it's so un-intuitive how to host there. #deploy #bundle #build...

Read dependency directory

Is it possible for a library to read its own non-importable files? I'm publishing some static files in a library. I'd like for that library to copy the files wherever the user wants. Is there a way without transforming those files into importable JSON or JS files? Library:...

Import type: css ?

is there a way to allow this in deno LSP:
import style from './xxx.css' with { type: 'css' };
import style from './xxx.css' with { type: 'css' };
I get "Importing these modules is not supported." deno-ts(6263) ...

How do i import local npm pacakge in deno project?

I'm unable to import npm local package in deno project

Deno.dlopen does not support flags

I am looking to integrate the SDL3 lib, and wanting to get the callback path to work. However, it requires a flag to be enabled, to allow the function pointers to be called. https://wiki.libsdl.org/SDL3/SDL_MAIN_USE_CALLBACKS ```c #define SDL_MAIN_USE_CALLBACKS 1...

Compiled Deno project can't import typescript code

Does Deno compile remove its ability to import typescript code? This only work in deno run, but fails on the deno compile bynary ```async function importjs(js: string, filename = "importedjs") { const dataUri = "data:text/typescript;charset=utf-8," +...

deno compile optimizations

i'm relatively new to deno and find the compilation part interesting. reading the reference, it seems to bundle the deno runtime in the binary. my question is, is there anything else the compilation does? are there any form of ahead-of-time optimizations done? i'm looking into compiling my hono apps and am wondering of all the potential benefits of doing so. thank you....

How to initialize global variable so it can be accessed without globalThis?

I'm hacking on a large existing codebase using Deno. This codebase uses a number of global variables like this:
if( __DEV__ && ... )
if( __DEV__ && ... )
...

Workspace documentation lacks explanation of `exports` member in deno.json

I was reading the documentation on workspaces and monorepos. It shows usage of the exports member ina deno.json file. The example shows it as a single string. There's no explanation of the exports member in the documenation for workspaces, monorepos, nor the "deno.json and package.json" help page, either. I am trying to understand how I can share commonly used enums across all of my microservices; but, I got confused. If my enums are declared in individual *.ts files (e.g. Statuses.ts, ExpirationTypes.ts, etc), how do I mark this up in my root-level and module-level deno.json files such that I can access the enums from within all modules? Specific example:...

Unable to log in to deno deploy

When logging in with a GitHub account on "deno deploy," an error message is displayed: "Cannot read properties of null (reading 'id')."
No description

Proper way to install deno on NixOS

I have just installed deno through: curl -fsSL https://deno.land/install.sh | sh But i am on nixos, what should be the proper way to install and run deno on NixOS?...
No description
Next