w7a9q
w7a9q
Explore posts from servers
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
NNuxt
Created by w7a9q on 6/10/2024 in #❓・help
useStorage in nuxt/test-utils
I'm trying to use useStorage() in vitest unit test. I'm using nuxt/test-utils package.
it('should return bool', async () => {
const code = 'XF4'
const result = await askTransistor(code);

const { getItem } = useStorage('trn_data')
const x = getItem(code)

expect(x).toEqual(true)
})
it('should return bool', async () => {
const code = 'XF4'
const result = await askTransistor(code);

const { getItem } = useStorage('trn_data')
const x = getItem(code)

expect(x).toEqual(true)
})
Normally in my code useStorage() is auto imported but in the test it's not the case. How can I make it work? This snipped fails at: ReferenceError: useStorage is not defined
8 replies
NNuxt
Created by w7a9q on 5/27/2024 in #❓・help
Test utils and Cypress
We would like to use @nuxt/test-utils with Vitest for unit testing and Cypress as a runner for browser testing. Is it possible or the support is only for Playwright?
3 replies