.armaan.s.
.armaan.s.
DDeno
Created by .armaan.s. on 9/3/2024 in #help
Enable VSCode Testing color output?
When using the Testing panel in VSCode, how can I enable color output in the Test Results terminal output? I've tried changing settings.json
// .vscode/settings.json
{
"deno.future": true,
"deno.env": {
"NO_COLOR": "0"
},
"deno.enablePaths": ["./backend"],
"deno.config": "./backend/deno.json"
}
// .vscode/settings.json
{
"deno.future": true,
"deno.env": {
"NO_COLOR": "0"
},
"deno.enablePaths": ["./backend"],
"deno.config": "./backend/deno.json"
}
but that hasn't worked. When I log the NO_COLOR env var in the test, it's "1" and the output is plain white. Is it a bug or am I missing something?
12 replies
DDeno
Created by .armaan.s. on 8/15/2024 in #help
Extract TypeScript types as JSON?
I have a Hono server and I want to extract / save the server routes type to either a .d.ts or a .json file. Ideally I would automate it using CLI commands but I can't even manually copy the types out of VSCode because the type get's truncated:
type RoutesType = {
[x: `/google/${string}`]: {
$get: {
input: {};
output: {
token: {
token: string;
expires_in: number;
} | undefined;
grantedScopes: string[] | undefined;
user: {
id?: string | undefined;
email?: string | undefined;
... 5 more ...;
locale?: string | undefined;
} | undefined;
};
outputFormat: "json";
status: StatusCode;
};
};
... 11 more ...;
"/static/*": {
...;
};
}
type RoutesType = {
[x: `/google/${string}`]: {
$get: {
input: {};
output: {
token: {
token: string;
expires_in: number;
} | undefined;
grantedScopes: string[] | undefined;
user: {
id?: string | undefined;
email?: string | undefined;
... 5 more ...;
locale?: string | undefined;
} | undefined;
};
outputFormat: "json";
status: StatusCode;
};
};
... 11 more ...;
"/static/*": {
...;
};
}
When you hover over the type in VSCode, most of the route types are hidden by ellipses. Is there a way to see the full type and is there a way to convert it to JSON, in a format like:
{
"output": {
"token": {
"OR": [
{
"token": "string",
"expires_in": "number",
},
"undefined"
]
}
}
}
{
"output": {
"token": {
"OR": [
{
"token": "string",
"expires_in": "number",
},
"undefined"
]
}
}
}
2 replies
DDeno
Created by .armaan.s. on 7/24/2024 in #help
--watch flag doesn't restart on file creation
How can I trigger Deno to restart when a new file is added? The deno run --watch ... command only seems to trigger when a file is modified or deleted but not when a new file is created. My workaround currently is to use Deno.watchFs(".") to detect file creation and then modify an existing file which triggers the process to restart. This isn't ideal and it would be great if --watch would also restart on file creation.
3 replies
DDeno
Created by .armaan.s. on 7/16/2024 in #help
node_modules / package.json Auto Import Fix?
I'm using package.json to manage my dependencies. I'm using VSCode with the Deno extension. The auto import suggestions always tries to import from a file in node_modules, e.g.
import { Hono } from "../node_modules/hono/dist/types/index.d.ts";
import { Hono } from "../node_modules/hono/dist/types/index.d.ts";
I want it to import like
import { Hono } from "hono";
import { Hono } from "hono";
Is there a way to configure the Deno extension to import like this?
2 replies