diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 8ebddbd..3ebd50e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,9 +21,9 @@ jobs: with: ref: main - name: Setup Deno - uses: denoland/setup-deno@v1 + uses: denoland/setup-deno@v2 with: - deno-version: v1.x + deno-version: v2.x - name: prepare run: | mkdir build @@ -37,15 +37,10 @@ jobs: with: ref: synolib2 path: "synolib2" - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - name: Draw the rest of the owl run: | cd synolib2 - npm ci - npm run example build + deno task example_build mkdir ../build/next cp ./example/index.* ../build/next/ cd .. diff --git a/README.md b/README.md index cc040bd..3ed5a80 100644 --- a/README.md +++ b/README.md @@ -31,17 +31,15 @@ An example running in the browser is located in `example/index.html` and To build the example, use ```sh -npm run example +deno task example_build ``` or for a live-reloading server use ```sh -npm run example serve +deno task example_serve ``` -(Both require `npm install` first) - The example page uses query parameters for options: - `q=TAXON` for the search term (Latin name, CoL-URI, taxon-name-URI or @@ -54,14 +52,7 @@ e.g. http://localhost:8000/?q=Sadayoshia%20miyakei&show_col= ## Building for npm/web -To build the library for use in web projects, use - -```sh -npm run build -``` - -This will place the built library in `./build/mod.js`. - -Note that this does not (yet) generate `.d.ts` typings. +The library is to be published as-is (in typescript) to jsr.io. -(Requires `npm install` first) +It can be used from there in with other deno or node/npm projects. There is no +building step neccesary on our side. diff --git a/SynonymGroup.ts b/SynonymGroup.ts index 99411ff..4c1cc0e 100644 --- a/SynonymGroup.ts +++ b/SynonymGroup.ts @@ -1,4 +1,4 @@ -import { SparqlEndpoint, SparqlJson } from "./mod.ts"; +import type { SparqlEndpoint, SparqlJson } from "./mod.ts"; /** Finds all synonyms of a taxon */ export class SynonymGroup implements AsyncIterable { @@ -60,7 +60,7 @@ export class SynonymGroup implements AsyncIterable { * * @readonly */ - treatments = new Map(); + treatments: Map = new Map(); /** * Whether to show taxa deprecated by CoL that would not have been found otherwise. diff --git a/deno.jsonc b/deno.jsonc index 0941f01..1013d43 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,12 @@ { + "name": "@plazi/synolib", + "version": "3.0.0", + "exports": "./mod.ts", + "publish": { + "include": ["./*.ts", "README.md", "LICENSE"], + "exclude": ["./build_example.ts"] + }, "compilerOptions": { - "target": "esnext", "lib": [ "dom", "dom.iterable", diff --git a/example/cli.ts b/example/cli.ts index e211e34..666f4c0 100644 --- a/example/cli.ts +++ b/example/cli.ts @@ -1,5 +1,10 @@ import * as Colors from "https://deno.land/std@0.214.0/fmt/colors.ts"; -import { Name, SparqlEndpoint, SynonymGroup, Treatment } from "../mod.ts"; +import { + type Name, + SparqlEndpoint, + SynonymGroup, + type Treatment, +} from "../mod.ts"; const HIDE_COL_ONLY_SYNONYMS = true; const START_WITH_SUBTAXA = false; @@ -115,7 +120,7 @@ async function logTreatment( ) { const details = await trt.details; console.log( - ` ${trtColor[type]("●")} ${details.creators} ${details.date} “${ + ` ${trtColor[type]("●")} ${details.creators} ${trt.date} “${ Colors.italic(details.title || Colors.dim("No Title")) }” ${Colors.magenta(trt.url)}`, ); @@ -167,7 +172,7 @@ async function justify(name: Name): Promise { const parent = await justify(name.justification.parent); return `is, according to ${ Colors.italic( - `${details.creators} ${details.date} “${ + `${details.creators} ${name.justification.treatment.date} “${ Colors.italic(details.title || Colors.dim("No Title")) }” ${Colors.magenta(name.justification.treatment.url)}`, )