w7a9q
w7a9q
Explore posts from servers
DDeno
Created by w7a9q on 12/17/2024 in #help
CRON on Deploy
Hey, is CRON working fine on Deploy? Maybe I don't know how to use it. I have created a file cron.ts a put there: Deno.cron('Run once a minute', '* * * * *', () => { console.log('Hello, cron!'); }); It deployed on prod but there is nothing in CRON tab.
1 replies
DDeno
Created by w7a9q on 12/9/2024 in #help
Zed code completion
Does anyone uses Zed with auto completion for Deno as in: https://zed.dev/docs/languages/deno My config:
"lsp": {
"deno": {
"settings": {
"deno": {
"enable": true
}
}
}
},
"languages": {
"TypeScript": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
],
"formatter": "language_server"
}
},
"lsp": {
"deno": {
"settings": {
"deno": {
"enable": true
}
}
}
},
"languages": {
"TypeScript": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
],
"formatter": "language_server"
}
},
and
"auto_install_extensions": {
"deno": true,
"svelte": true,
"zig": true
},
"auto_install_extensions": {
"deno": true,
"svelte": true,
"zig": true
},
What should I config?
5 replies
DDeno
Created by w7a9q on 12/8/2024 in #help
Exclude packages from test coverage
Hi, I would like to exclude the packages from the coverage when I run deno test --coverage. Currently I also get generated jsons inside coverage directory with url like this: "url": "file:///Users/johndoe/Workspace/Dev/lld-test/node_modules/.deno/[email protected]/node_modules/wawoff2/decompress.js"", How do I avoid it? Note that I have it excluded in my deno.json as:
"test": {
"exclude": ["node_modules"]
},
"test": {
"exclude": ["node_modules"]
},
3 replies
DDeno
Created by w7a9q on 12/7/2024 in #help
Types for global variables
I have defined a global variable: globalThis.Args = validateArguments(Deno.args); Now whenever I use it I get TS error: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.deno-ts(7017) How can I fix this?
3 replies
DDeno
Created by w7a9q on 11/20/2024 in #help
Converting package.json into deno.json
Is there any documentation about what properties deno.json have and what are the expected values? I'm unable to find any. I would like to put as many things as possible into deno.lock from the package.json. This would be really helpful.
2 replies
DDeno
Created by w7a9q on 11/17/2024 in #help
Deno project source control
Should I include deno.lock in the source control? Afaik, it is generated everytime deno install is used.
2 replies
DDeno
Created by w7a9q on 11/8/2024 in #help
Getting version out of deno.json
How can I get data from deno.json on runtime without exposing it to client?
5 replies
DDeno
Created by w7a9q on 11/3/2024 in #help
Zed Deno Support
No description
2 replies
NNuxt
Created by w7a9q on 11/2/2024 in #❓・help
Nitro in Deno
I have created a new Nitro project using deno run -A npm:giget@latest nitro nitro-app --install. It was successfull but after trying deno run dev I get an error saying:
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pathname')
at getPathname (ext:deno_node/_fs/_fs_stat.ts:177:49)
at ext:deno_node/_fs/_fs_stat.ts:151:13
at eventLoopTick (ext:core/01_core.js:175:7)
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pathname')
at getPathname (ext:deno_node/_fs/_fs_stat.ts:177:49)
at ext:deno_node/_fs/_fs_stat.ts:151:13
at eventLoopTick (ext:core/01_core.js:175:7)
Is there any fix for that or is it a bug in Deno itself?
5 replies
DDeno
Created by w7a9q on 11/2/2024 in #help
Cannot run Nitro project
I have created a new Nitro project using deno run -A npm:giget@latest nitro nitro-app --install. It was successfull but after trying deno run dev I get an error saying:
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pathname')
at getPathname (ext:deno_node/_fs/_fs_stat.ts:177:49)
at ext:deno_node/_fs/_fs_stat.ts:151:13
at eventLoopTick (ext:core/01_core.js:175:7)
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pathname')
at getPathname (ext:deno_node/_fs/_fs_stat.ts:177:49)
at ext:deno_node/_fs/_fs_stat.ts:151:13
at eventLoopTick (ext:core/01_core.js:175:7)
Is there any fix for that or is it a bug in Deno itself?
8 replies
DDeno
Created by w7a9q on 11/1/2024 in #help
Deno runs the whole script instead of the method
I have following test:
import { expect } from "jsr:@std/expect";
import { validateInput } from "./webp.ts";

Deno.test("invalid input", () => {
const fn = validateInput;
const result = fn('/root', 55);
expect(result).toThrow();
});
import { expect } from "jsr:@std/expect";
import { validateInput } from "./webp.ts";

Deno.test("invalid input", () => {
const fn = validateInput;
const result = fn('/root', 55);
expect(result).toThrow();
});
When I run deno test it runs the whole webp.ts script instead of just the validateInput() method.
4 replies
DDeno
Created by w7a9q on 10/21/2024 in #help
Create SvelteKit project with Deno
Hey, how do I create SvelteKit project with Deno? Docs recommends this command: npx sv create myapp How does a Deno command doing this looks like?
3 replies
DDeno
Created by w7a9q on 9/28/2024 in #help
Corepack
Hey, does Deno support Corepack?
9 replies
NNuxt
Created by w7a9q on 9/13/2024 in #❓・help
Nitro bundler
What does Nitro use as a bundler?
2 replies
NNuxt
Created by w7a9q on 9/13/2024 in #❓・help
What bundler Nitro uses?
I have a Nitro project template. I would like to know what does it uses as a bundler, if anything.
1 replies
NNuxt
Created by w7a9q on 9/11/2024 in #❓・help
Nitro typecheck
Hey, is there a way to integrate typecheck into Nitro project? I want something like nuxt typecheck.
4 replies
NNuxt
Created by w7a9q on 7/12/2024 in #❓・help
Get body of the response
I'm trying to get the body of the response through H3. readBody() is only for request body. How do I get the one from response?
13 replies
NNuxt
Created by w7a9q on 7/10/2024 in #❓・help
async Nitro middleware
Hey, can Nitro middleware be async? I'm trying to figure it out but I get Nuxt error 402 HTTP method is not allowed. when I make middleware async.
8 replies
NNuxt
Created by w7a9q on 7/4/2024 in #❓・help
OpenAPI specs through Nitro
I'm trying to set up OpenAPI specs generation through Nitro but when I open http://localhost:3000/_nitro/swagger I get stuck at:
Unable to render this definition
The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
Unable to render this definition
The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
I'm trying to resolve this by specifying the version in nuxt.config.ts as:
experimental: {
openAPI: true,
},
openAPI: {
meta: {
title: 'Nitro Test Fixture',
description: 'Nitro Test Fixture API',
version: '2.0',
},
},
experimental: {
openAPI: true,
},
openAPI: {
meta: {
title: 'Nitro Test Fixture',
description: 'Nitro Test Fixture API',
version: '2.0',
},
},
But openAPI at root level gives type error:
Object literal may only specify known properties, and 'openAPI' does not exist in type '{ extends?: string | ... | (() => NitroConfig) | (string | undefined)[] | undefined; routeRules?: { [x: string]: { cache?: false | { base?: string | undefined; swr?: boolean | undefined; ... 6 more ...; varies?: (string | undefined)[] | undefined; } | undefined; ... 8 more ...; appMiddleware?: "auth" | ... 2 more .....'.ts(2353)
Object literal may only specify known properties, and 'openAPI' does not exist in type '{ extends?: string | ... | (() => NitroConfig) | (string | undefined)[] | undefined; routeRules?: { [x: string]: { cache?: false | { base?: string | undefined; swr?: boolean | undefined; ... 6 more ...; varies?: (string | undefined)[] | undefined; } | undefined; ... 8 more ...; appMiddleware?: "auth" | ... 2 more .....'.ts(2353)
http://localhost:3000/_nitro/openapi.json lists all the endpoints and starts with:
{
"openapi": "3.1.0",
"info": {
"title": "Nitro Server Routes",
"version": null
},
{
"openapi": "3.1.0",
"info": {
"title": "Nitro Server Routes",
"version": null
},
How do I correctly generate the specs?
2 replies
NNuxt
Created by w7a9q on 6/17/2024 in #❓・help
Mocking useStorage
I'm trying to mock useStorage() as in documentation: https://nuxt.com/docs/getting-started/testing#mocknuxtimport However I'm stuck at Error: Cannot find import "useStorage" to mock. Where should I take this import from when it's autoimported by Nitro?
4 replies