From 7ce3af685b030334e244c6edba1e629e4f09713d Mon Sep 17 00:00:00 2001 From: Pinta365 Date: Fri, 1 Mar 2024 16:32:55 +0100 Subject: [PATCH] jsr.json and readme update --- README.md | 39 +++++++++++++++++++++++++++++++++++---- deno.json | 9 ++------- jsr.json | 8 ++++++++ scripts/build_npm.ts | 1 - 4 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 jsr.json diff --git a/README.md b/README.md index 20f9fb1..7fcc0a5 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,48 @@ # OURA_API -[Deno](https://deno.land/x/oura_api) library to interact with v2 of the [Oura API](https://cloud.ouraring.com/v2/docs). +Library to interact with v2 of the [Oura API](https://cloud.ouraring.com/v2/docs). -The library is also available for Node.js via a [NPM package](https://www.npmjs.com/package/oura_api). +Available for **Deno** and **Bun** through [JSR Package](https://jsr.io/@pinta365/oura-api) and for Node.js via a [NPM package](https://www.npmjs.com/package/oura_api). +Deno users can also use the [deno.land/x package](https://deno.land/x/oura_api). --- ## Example usage -### Deno +### Deno and Bun -Change the import URL to include the latest version number. Example: `https://deno.land/x/oura_api@0.4.0/mod.ts` +**Deno install notes** + +Through JSR and imports map +``` +deno add @pinta365/oura-api + +import { Oura } from "@pinta365/oura-api"; +``` +Or directly from deno.land/x +``` +import { Oura } from "https://deno.land/x/oura_api/mod.ts"; +``` + +> [!NOTE] +>If you're importing the package from deno.land/x the example code will use the latest version but you should always change import URL +>to include a specific version number. Example: https://deno.land/x/oura_api@0.4.0/mod.ts + +--- + +**Bun Install notes** +``` +bunx jsr add @pinta365/oura-api + +import { Oura } from "@pinta365/oura-api"; +``` ```javascript +//from deno.land/x (Deno) import { Oura, DateFormat } from "https://deno.land/x/oura_api/mod.ts"; +//or from JSR (Deno and Bun) +//import { Oura, DateFormat } from "@pinta365/oura-api"; + // Replace 'YOUR_ACCESS_TOKEN' with your actual access token const accessToken = "YOUR_ACCESS_TOKEN"; @@ -36,6 +65,8 @@ try { Install package. ``` npm install oura_api --save + +const Api = require('oura_api'); ``` Code example. ```javascript diff --git a/deno.json b/deno.json index 91ba16f..cadf501 100644 --- a/deno.json +++ b/deno.json @@ -1,12 +1,7 @@ { - "name": "@pinta365/oura-api", - "version": "0.5.3", - "exports": "./mod.ts", - "exclude": [ - "npm" - ], "tasks": { - "build_npm": "deno run -A scripts/build_npm.ts" + "build_npm": "deno run -A scripts/build_npm.ts", + "publish_jsr": "deno publish --config jsr.json" }, "lint": { "include": ["src"] diff --git a/jsr.json b/jsr.json new file mode 100644 index 0000000..6a4395f --- /dev/null +++ b/jsr.json @@ -0,0 +1,8 @@ +{ + "name": "@pinta365/oura-api", + "version": "0.5.5", + "exports": "./mod.ts", + "exclude": [ + "scripts" + ] +} \ No newline at end of file diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index e25cd7f..5d02150 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -9,7 +9,6 @@ await build({ //scriptModule: false, test: false, shims: { - undici: true, deno: "dev", }, package: {