Update project configuration and dependencies for version 0.0.6

- Add .prettierrc for code formatting
- Update package and jsr.json version to 0.0.6
- Upgrade @kksh/api dependency to version 0.1.1
- Refactor imports in source files to align with new structure
This commit is contained in:
Huakun Shen 2025-02-06 22:22:09 -05:00
parent 00ba6e0255
commit 2e7e6361e3
No known key found for this signature in database
8 changed files with 139 additions and 132 deletions

4
.prettierrc Normal file
View File

@ -0,0 +1,4 @@
{
"semi": false,
"trailingComma": "none"
}

View File

@ -1,6 +1,6 @@
import { watch } from "fs"
import { join } from "path"
import { refreshTemplateWorkerExtension } from "@kksh/api/dev"
import { refreshTemplateWorkerCommand } from "@kksh/api/dev"
import { $ } from "bun"
const entrypoints = ["./src/index.ts"]
@ -11,7 +11,7 @@ async function build() {
await $`bun build --minify --target=browser --outdir=./dist ${entrypoint}`
}
if (Bun.argv.includes("dev")) {
await refreshTemplateWorkerExtension()
await refreshTemplateWorkerCommand()
}
} catch (error) {
console.error(error)

BIN
bun.lockb

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "@kunkun/kunkun-ext-browser-bookmark",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",
"exports": "./mod.ts",
"publish": {

View File

@ -6,7 +6,7 @@
"name": "Huakun",
"url": "https://huakunshen.com"
},
"version": "0.0.5",
"version": "0.0.6",
"repository": "https://github.com/kunkunsh/kunkun-ext-browser-bookmark",
"type": "module",
"kunkun": {
@ -98,7 +98,7 @@
"build": "bun build.ts"
},
"dependencies": {
"@kksh/api": "^0.0.48",
"@kksh/api": "^0.1.1",
"i18next": "^23.15.1",
"valibot": "^0.40.0"
},

View File

@ -1,4 +1,4 @@
import { fs, os, path, shell, toast } from "@kksh/api/ui/worker"
import { fs, os, path, shell, toast } from "@kksh/api/ui/template"
import * as v from "valibot"
import { ChromeBookmarksFile } from "./types"
import type { Browser, ChromeBookmark, Platform } from "./types"

View File

@ -1,26 +1,19 @@
import {
Action,
app,
expose,
Form,
fs,
Icon,
IconEnum,
List,
NodeNameEnum,
open,
os,
path,
shell,
toast,
ui,
WorkerExtension
} from "@kksh/api/ui/worker"
import { ChromeBookmarks, createBookmarkLoader, type Bookmark } from "./bookmark"
import { setupI18n, t } from "./i18n"
import type { Platform } from "./types"
TemplateUiCommand
} from "@kksh/api/ui/template"
import { createBookmarkLoader, type Bookmark } from "./bookmark"
function bookmarkToItem(bookmark: Bookmark, options: { browserIcon: Icon }): List.Item {
function bookmarkToItem(
bookmark: Bookmark,
options: { browserIcon: Icon }
): List.Item {
return new List.Item({
title: bookmark.name,
subTitle: bookmark.subtitle,
@ -45,7 +38,7 @@ function bookmarkToItem(bookmark: Bookmark, options: { browserIcon: Icon }): Lis
})
}
class BrowserBookmark extends WorkerExtension {
class BrowserBookmark extends TemplateUiCommand {
async onFormSubmit(value: Record<string, any>): Promise<void> {
console.log("Form submitted", value)
toast.success(`Form submitted: ${JSON.stringify(value)}`)
@ -55,7 +48,8 @@ class BrowserBookmark extends WorkerExtension {
ui.setSearchBarPlaceholder("Search for bookmarks")
ui.render(new List.List({}))
// const platform: Platform = await os.platform()
const [chromeBookmarks, edgeBookmarks, firefoxBookmarks] = await Promise.all([
const [chromeBookmarks, edgeBookmarks, firefoxBookmarks] =
await Promise.all([
createBookmarkLoader("chrome").then((loader) => loader?.load() ?? []),
createBookmarkLoader("edge").then((loader) => loader?.load() ?? []),
createBookmarkLoader("firefox").then((loader) => loader?.load() ?? [])
@ -70,7 +64,10 @@ class BrowserBookmark extends WorkerExtension {
subtitle: "Firefox",
items: firefoxBookmarks.map((bookmark) =>
bookmarkToItem(bookmark, {
browserIcon: new Icon({ type: IconEnum.Iconify, value: "logos:firefox" })
browserIcon: new Icon({
type: IconEnum.Iconify,
value: "logos:firefox"
})
})
)
})
@ -84,7 +81,10 @@ class BrowserBookmark extends WorkerExtension {
subtitle: "Chrome",
items: chromeBookmarks.map((bookmark) =>
bookmarkToItem(bookmark, {
browserIcon: new Icon({ type: IconEnum.Iconify, value: "logos:chrome" })
browserIcon: new Icon({
type: IconEnum.Iconify,
value: "logos:chrome"
})
})
)
})
@ -97,7 +97,10 @@ class BrowserBookmark extends WorkerExtension {
subtitle: "Edge",
items: edgeBookmarks.map((bookmark) =>
bookmarkToItem(bookmark, {
browserIcon: new Icon({ type: IconEnum.Iconify, value: "logos:microsoft-edge" })
browserIcon: new Icon({
type: IconEnum.Iconify,
value: "logos:microsoft-edge"
})
})
)
})

View File

@ -1,4 +1,4 @@
import { os } from "@kksh/api/ui/worker"
import { os } from "@kksh/api/ui/template"
import * as v from "valibot"
export type Platform = Awaited<ReturnType<typeof os.platform>>