Skip to content

Commit

Permalink
removed import aliases from the JS library
Browse files Browse the repository at this point in the history
Added publishing to JSR
fixed an issue where taplo would try to validate files in node_modules
  • Loading branch information
TheOnlyTails committed May 21, 2024
1 parent da221a3 commit 5e4fc86
Show file tree
Hide file tree
Showing 19 changed files with 720 additions and 66 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish package to npm
name: Publish package

on:
release:
Expand All @@ -20,30 +20,40 @@ jobs:
working-directory: ./api
steps:
- uses: actions/checkout@v4
name: Checkout
with:
ref: ${{ github.ref }}

- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 21
registry-url: https://registry.npmjs.org/

- uses: pnpm/action-setup@v2
name: Setup pnpm
with:
version: 9

- run: pnpm version from-git --no-commit-hooks --no-git-tag-version --allow-same-version
- name: Update package.json
run: pnpm version from-git --no-commit-hooks --no-git-tag-version --allow-same-version

- run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install --frozen-lockfile

- run: pnpm run generate && pnpm run build:lib
- name: Generate JSON schemas and build library
run: pnpm run generate && pnpm run build:lib

- run: |
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
pnpm publish --provenance --no-git-checks --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to JSR
run: npx jsr publish --provenance --allow-slow-types

- name: Push version changes to main branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
674 changes: 674 additions & 0 deletions api/LICENSE

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions api/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@linku/sona",
"version": "0.3.2",
"exports": {
".": "./src/lib/index.ts",
"./utils": "./src/lib/utils.ts",
"./client": "./src/lib/client.ts"
},
"publish": {
"include": ["src", "generated", "raw", "README.md", "LICENSE"],
"exclude": ["*.test.*"]
}
}
2 changes: 1 addition & 1 deletion api/src/lib/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hc } from "hono/client";
import type { AppType } from "$server";
import type { AppType } from "../server";

export const client = (args?: { baseUrl?: string; fetch?: (typeof globalThis)["fetch"] }) => {
const { baseUrl = "https://api.linku.la", fetch = globalThis.fetch } = args ?? {};
Expand Down
4 changes: 2 additions & 2 deletions api/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod";
import { Book, CoinedEra, UsageCategory, WritingSystem } from "$lib/utils";
import { Book, CoinedEra, UsageCategory, WritingSystem } from "./utils";

export type * from "$lib/types";
export type * from "./types";

const YearMonth = z.string().regex(/^20\d{2}-(0[1-9]|1[0-2])$/g);
// Word data
Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Font, LocalizedWord, ParametersTranslation, Sign } from "$lib";
import type { Font, LocalizedWord, ParametersTranslation, Sign } from "./index";

export type WordRepresentations = LocalizedWord["representations"];
export type WordAudio = LocalizedWord["audio"];
Expand Down
2 changes: 1 addition & 1 deletion api/src/server/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Languages } from "$lib";
import type { Languages } from "../lib";
import { zValidator } from "@hono/zod-validator";
import { z } from "zod";

Expand Down
9 changes: 2 additions & 7 deletions api/src/server/v1/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import {
filterObject,
keys,
langIdCoalesce,
langValidator
} from "$server/utils";
import { fetchFile, versions, type FilesToVariables } from "$server/versioning";
import { filterObject, keys, langIdCoalesce, langValidator } from "../utils";
import { fetchFile, versions, type FilesToVariables } from "../versioning";
import { zValidator } from "@hono/zod-validator";
import { Hono, type MiddlewareHandler } from "hono";
import { HTTPException } from "hono/http-exception";
Expand Down
2 changes: 1 addition & 1 deletion api/src/server/versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SitelenPonaTranslation,
Word,
Words,
} from "$lib";
} from "../lib";
import { Hono } from "hono";
import type { z } from "zod";
import apiV1 from "./v1";
Expand Down
6 changes: 0 additions & 6 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,5 @@
/* If your code runs in the DOM: */
"lib": ["es2022", "dom", "dom.iterable"],
"types": ["vite/client", "./vite-env.d.ts"],
"paths": {
"$server": ["./src/server"],
"$server/*": ["./src/server/*"],
"$lib": ["./src/lib"],
"$lib/*": ["./src/lib/*"]
}
}
}
11 changes: 2 additions & 9 deletions api/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pages from "@hono/vite-cloudflare-pages";
import devServer from "@hono/vite-dev-server";
import { getEnv } from "@hono/vite-dev-server/cloudflare-pages";
import { type UserConfigExport, defineConfig } from "vite";
import { resolve } from "node:path";
import dts from "vite-plugin-dts";
import { exec } from "node:child_process";
import { defineConfig, type UserConfigExport } from "vite";
import dts from "vite-plugin-dts";

export default defineConfig((async ({ mode }) => ({
build: {
Expand All @@ -20,12 +19,6 @@ export default defineConfig((async ({ mode }) => ({
minify: true,
outDir: "dist",
},
resolve: {
alias: {
$lib: resolve(__dirname, "src/lib"),
$server: resolve(__dirname, "src/server"),
},
},
define: {
__BRANCH__: await new Promise<string>((resolve, reject) =>
exec("git branch --show-current", (e, stdout, stderr) => {
Expand Down
6 changes: 1 addition & 5 deletions fonts/metadata/Xim Sans Conlang.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#:schema ../../api/generated/font.json
id = "Xim Sans Conlang"
creator = ["Ximco"]
features = [
"supports cartouches",
"codepoints only",
"combined glyphs",
]
features = ["supports cartouches", "codepoints only", "combined glyphs"]
filename = "Xim-Sans-Conlang.otf"
last_updated = "2024-04"
license = "-"
Expand Down
6 changes: 1 addition & 5 deletions fonts/metadata/YU SITELEN LEKO PONA.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#:schema ../../api/generated/font.json
id = "YU SITELEN LEKO PONA"
creator = ["miukumauku"]
features = [
"ASCII transcription",
"ku suli",
"UCSUR-compliant",
]
features = ["ASCII transcription", "ku suli", "UCSUR-compliant"]
filename = "YU-SITELEN-LEKO-PONA.ttf"
last_updated = "2024-04"
license = "-"
Expand Down
6 changes: 1 addition & 5 deletions fonts/metadata/linja Lensa.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#:schema ../../api/generated/font.json
id = "linja Lensa"
creator = ["Lens+Lantern"]
features = [
"ASCII input",
"supports cartouches",
"long pi",
]
features = ["ASCII input", "supports cartouches", "long pi"]
filename = "Fresnel-LinjaLensa.otf"
last_updated = "2024-04"
license = "-"
Expand Down
6 changes: 1 addition & 5 deletions fonts/metadata/linja laso.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#:schema ../../api/generated/font.json
id = "linja laso"
creator = ["mute ante"]
features = [
"ASCII transcription",
"UCSUR-compliant",
"cartouches",
]
features = ["ASCII transcription", "UCSUR-compliant", "cartouches"]
filename = "linja_laso.ttf"
last_updated = "2024-04"
license = "OFL"
Expand Down
2 changes: 1 addition & 1 deletion fonts/metadata/linja lili.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#:schema ../../api/generated/font.json
id = "linja lili"
creator = ["NemoStein"]
features = ["ASCII transcription","UCSUR compliant","cartouches",]
features = ["ASCII transcription", "UCSUR compliant", "cartouches"]
filename = "linja_lili.ttf"
last_updated = "2024-04"
license = "-"
Expand Down
7 changes: 1 addition & 6 deletions fonts/metadata/linja waso Bold.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#:schema ../../api/generated/font.json
id = "linja waso Bold"
creator = ["jan Maku (ItMarki)"]
features = [
"UCSUR-compliant",
"ku suli",
"supports cartouches",
"extended pi",
]
features = ["UCSUR-compliant", "ku suli", "supports cartouches", "extended pi"]
filename = "linja-waso-lili-Bold.ttf"
last_updated = "2024-04"
license = "OFL"
Expand Down
7 changes: 1 addition & 6 deletions fonts/metadata/linja waso Light.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#:schema ../../api/generated/font.json
id = "linja waso Light"
creator = ["jan Maku (ItMarki)"]
features = [
"UCSUR-compliant",
"ku suli",
"supports cartouches",
"extended pi",
]
features = ["UCSUR-compliant", "ku suli", "supports cartouches", "extended pi"]
filename = "linja-waso-lili-Light.ttf"
last_updated = "2024-04"
license = "OFL"
Expand Down
1 change: 1 addition & 0 deletions taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude = ["node_modules/**/*.toml"]

0 comments on commit 5e4fc86

Please sign in to comment.