This is a minimal sample package for new package ecosystem JavaScript Registry (JSR) by Deno, it works both in javascript and typescript.
this package have one property oneDay
which return total number of milliseconds in a day i.e. 86400000
- Install Deno runtime in your system; check deno official page
- check Deno version using
Deno --version
; below is the output from my system
deno 1.41.1 (release, aarch64-apple-darwin)
v8 12.1.285.27
typescript 5.3.3
- Initialize deno project
deno init <project-name>
it will create 3 files
- deno.json
- main.ts
- main_test.ts
- Run deno task
deno task server
task name mentioned in deno.json > tasks property
open localhost:8000 and check
npx jsr i @xkeshav/day
above command will add entry in your package.json file as below
"dependencies": {
"@xkeshav/day": "npm:@jsr/xkeshav__day@^1.1.1"
}
import { oneDay } from '@xkeshav/day';
// named export
console.log({ oneDay });