Fifth-Normal-Form
Fifth-Normal-Form
DDeno
Created by avem on 12/3/2024 in #help
Worried about cold start
Kv as server-side local-first
11 replies
DDeno
Created by Robbie on 11/28/2024 in #help
Replacing `fs.createWriteStream()` with Deno equivalent
Naming is hard 😣
9 replies
DDeno
Created by Bruno Skvorc on 11/27/2024 in #help
Without using a framework, how do I compile natively supported TS in Deno into static JS?
For a working example see: https://nhrones.github.io/Hot_BuenoCache/ Click the see-the-code link on the bottom left of the page!
Or just go to the repo:
https://github.com/nhrones/Hot_BuenoCache
6 replies
DDeno
Created by Bruno Skvorc on 11/27/2024 in #help
Without using a framework, how do I compile natively supported TS in Deno into static JS?
You could try a simple util like https://jsr.io/@ndh/build Or, even better; roll-your-own! Create the following module -- builder.ts
import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.0";
import { build, stop } from "npm:esbuild@0.24.0";

/** builds and bundles an entrypoint into a single ESM output. */
export async function buildIt() {
await build({
plugins: [...denoPlugins({})],
entryPoints: ["./src/main.ts"],
outfile: "./dist/bundle.js",
bundle: true,
minify: false,
keepNames: true,
banner: { js: `// @ts-nocheck
// deno-lint-ignore-file`},
format: "esm"
}).catch((e: Error) => console.info(e));
stop();
}

buildIt()
console.log('bundle.js was built!')
import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.0";
import { build, stop } from "npm:esbuild@0.24.0";

/** builds and bundles an entrypoint into a single ESM output. */
export async function buildIt() {
await build({
plugins: [...denoPlugins({})],
entryPoints: ["./src/main.ts"],
outfile: "./dist/bundle.js",
bundle: true,
minify: false,
keepNames: true,
banner: { js: `// @ts-nocheck
// deno-lint-ignore-file`},
format: "esm"
}).catch((e: Error) => console.info(e));
stop();
}

buildIt()
console.log('bundle.js was built!')
Just modify the entrypoints and outfile to suit your needs. You can also specify to bundle or not, and minification or not. Add the above module to you project root. Then just to run:
deno run -A --quiet builder.ts
You could also add this as a task in deno.json called build.
6 replies
DDeno
Created by artpods56 on 11/17/2024 in #help
Cant configure Tailwind with DaisyUI using Deno inside of Docker | Error: Cannot find module daisyui
This is great info, and will help me in the future. Thanks for this.
13 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
30 replies
DDeno
Created by Kevin Tale on 11/25/2024 in #help
cannot publish package to jsr but it uses a shared file
There is a new Discord server for JSR
https://discord.gg/hMqvhAn9xG. Perhaps you could get help there.
3 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
in the server ...
if (isIndexHtml) {
// inject html with our hot refresh script
const body = await inject(fullPath)
// create appropriate headers
const headers = new Headers()
headers.set("content-type", "text/html; charset=utf-8")
// don't cache this - we expect frequent dev changes
headers.append("Cache-Control", "no-store")
return new Response(body, { status: 200, headers });
if (isIndexHtml) {
// inject html with our hot refresh script
const body = await inject(fullPath)
// create appropriate headers
const headers = new Headers()
headers.set("content-type", "text/html; charset=utf-8")
// don't cache this - we expect frequent dev changes
headers.append("Cache-Control", "no-store")
return new Response(body, { status: 200, headers });
30 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
Be aware that I'm making many link changes to the code as I move all utilities to JSR. The config utility is in flux as well as the builder utility. Its all there in public repos, but as I untangle the local references to move all to JSR, it may not work without reference errors. I got lazy with these and used local refs for the dependencies. I'll have it all moved in a day or two. The auto-config is not required. I use it in all dev-tools because I'm lazy. I like to just type 'serve' or 'hot' in any project to get coding. I'm just a hobbyist trying to learn Web-Dev.
30 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
Yes! Whenever index.html is requested, we inject the WebSocket code to the end of the text being sent to the browser. The file itself is never modified. Any .ts-code change forces a new build/bundle to ./dist/bundle.js . This new bundle, or any change to the html or CSS files force either a globalThis.location.reload() or a remove-then-reinstall stylesheets style-refresh by way of the WebSocket.
30 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
Yes! But long ago😆 I just put it back in a public repo, so that I can move all my junk to JSR.
30 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
It is a bit dated, but still works great for me. I'm currently moving all my utilities to JSR so there may be broken links. I have Hot installed locally and use it often.
30 replies
DDeno
Created by Kevin Tale on 11/22/2024 in #help
How to add a simple live reload?
An example WebSocket refresh that is injected on serve, and does not modify the html file. It simply modifies the text sent to the browser. https://github.com/nhrones/Devtools_Hot/blob/main/injector.ts This server auto-starts the browser, then on any ./src/ or ./dist/ change, it builds/bundles and then auto-refreshes the browser.
It injects the WebSocket code (above) whenever the request URL is for '/' or 'index.html' https://github.com/nhrones/Devtools_Hot/blob/main/server.ts The unique feature is that the watch-function will distinguish between a code change or a stylesheet change. For a stylesheet, it simply refreshes the styles without disturbing the app.
30 replies
DDeno
Created by MrGVSV on 11/10/2024 in #help
Access default TypeScript compiler options
2 replies
DDeno
Created by Bloxs on 10/27/2024 in #help
Running Fresh app on Windows with pm2
Just curious -- what is pm2? Ahh a process manager.
You may like pup https://github.com/Hexagon/pup
3 replies
DDeno
Created by 3Dxg on 10/26/2024 in #help
window install problem
That looks incorrect. the line
Deno was installed successfully to C:\Users\yadav.deno\bin\deno.exe
Deno was installed successfully to C:\Users\yadav.deno\bin\deno.exe
Should have been
Deno was installed successfully to C:\Users\yadav\.deno\bin\deno.exe
Deno was installed successfully to C:\Users\yadav\.deno\bin\deno.exe
Note the missing backslash between yadav and ,deno. Check that first path to see if it has a \bin folder in it.
If so something went wrong! Deno may have been added correctly in the path environment variable.
Please check your path environment variable.
in powershell enter $env:Path
It should contain:
C:\Users\yadav\.deno\bin
C:\Users\yadav\.deno\bin
If it does, Deno may have been installed accidentally in the folder:
C:\Users\yadav.deno\bin
C:\Users\yadav.deno\bin
rather than where it should be:
C:\Users\yadav\.deno\bin
C:\Users\yadav\.deno\bin
If so, I would report this as a bug.
11 replies
DDeno
Created by Nestum on 10/17/2024 in #help
Create a desktop app using Deno + Svelte with Compile
This was just now updated to fix Windows issue. Works great!
7 replies
DDeno
Created by fro.profesional on 1/21/2024 in #help
deno kv watch vs broadcast channel
Many moons ago -- pre KV -- I also used BroadcastChannel for webrtc signaling in Deploy for a multi-user dice game. It worked very well back then. I think post KV it was somehow crippled.
7 replies
DDeno
Created by Phatso on 8/12/2024 in #help
Importing local files (streaming large JSON files)
I've used this in my in-mem DB code.
// the hundredK.json file contains 100,000 user objects
// [
// [0,{"id":0,"value":{"id":0,"first":"Tough","last":"Republic","age":55}}],
// [1,{"id":1,"value":{"id":1,"first":"Impassioned","last":"Stock","age":10}}],
// ...
// ]
import * as largeJson from './hundredK.json' assert {type: 'json'};
type User = { id: number, first: string, last: string, age: number }
//@ts-ignore
const UserMap: Map<number, User> = new Map(largeJson.default)
console.log(UserMap.get(1))
console.log(UserMap.get(99990))

// To save the contents of the map to a file
Deno.writeTextFileSync("hundredKJson.json", JSON.stringify([...UserMap.entries()]))
// the hundredK.json file contains 100,000 user objects
// [
// [0,{"id":0,"value":{"id":0,"first":"Tough","last":"Republic","age":55}}],
// [1,{"id":1,"value":{"id":1,"first":"Impassioned","last":"Stock","age":10}}],
// ...
// ]
import * as largeJson from './hundredK.json' assert {type: 'json'};
type User = { id: number, first: string, last: string, age: number }
//@ts-ignore
const UserMap: Map<number, User> = new Map(largeJson.default)
console.log(UserMap.get(1))
console.log(UserMap.get(99990))

// To save the contents of the map to a file
Deno.writeTextFileSync("hundredKJson.json", JSON.stringify([...UserMap.entries()]))
6 replies
DDeno
Created by Fifth-Normal-Form on 4/10/2024 in #help
Deno Clean
@Deno AI Helper Does Deno add to, or modify the Windows Registry?
6 replies