jradxl
jradxl
DDeno
Created by jradxl on 10/7/2024 in #help
Deno Add syntax?
It's clear that deno add jsr:@luca/cases works. But why doesn't deno add cliffy@v1.0.0-rc.7 error: cliffy@v1.0.0-rc.7 was not found in either jsr or npm. work? Neither does, from documentation deno add @std/path @std/assert error: @std/path is missing a prefix. Did you mean deno add jsr:@std/path? Has the use of deno.land/x been removed from deno add? Or is there some other way of getting deno add to find the latest for me, automatically.
10 replies
DDeno
Created by jradxl on 9/30/2024 in #help
Deno import use for local files?
I'm using Deno (v2) as an alternative to Bash Scripting, and I'm looking for an equivalent to Bash's Source statement, to include any common functions I might write. Of course, import { something } from "./myfunctions,ts" works fine as a relative path, And an absolute path works too, import { something } from "/home/john/.deno/mylibraries/myfunctions.ts". But this hard codes my username in the path. I have found that dynamic imports can be used to avoid this , const myhome = Deno.env.get("HOME") const libpath = myhome + "/.deno/mylibraries/myfunctions.ts"; const myfunctions = await import(libpath); I also thought that a webserver might work, import { something } from "http://localhost/myfunctions.ts"; and it nearly does, shown by the intelisense in vscode, but running gives the error, Expected a JavaScript or TypeScript module, but identified a Unknown module Are their any other/better ways of importing modules? I don't want to make my files public so don't want to use Github Perhaps I could self-host Gitea But all seem overly complex compared to Bash's Source command. Suggestions, please?
11 replies