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

BIN
bun.lockb

Binary file not shown.

View File

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

View File

@ -6,7 +6,7 @@
"name": "Huakun", "name": "Huakun",
"url": "https://huakunshen.com" "url": "https://huakunshen.com"
}, },
"version": "0.0.5", "version": "0.0.6",
"repository": "https://github.com/kunkunsh/kunkun-ext-browser-bookmark", "repository": "https://github.com/kunkunsh/kunkun-ext-browser-bookmark",
"type": "module", "type": "module",
"kunkun": { "kunkun": {
@ -98,7 +98,7 @@
"build": "bun build.ts" "build": "bun build.ts"
}, },
"dependencies": { "dependencies": {
"@kksh/api": "^0.0.48", "@kksh/api": "^0.1.1",
"i18next": "^23.15.1", "i18next": "^23.15.1",
"valibot": "^0.40.0" "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 * as v from "valibot"
import { ChromeBookmarksFile } from "./types" import { ChromeBookmarksFile } from "./types"
import type { Browser, ChromeBookmark, Platform } from "./types" import type { Browser, ChromeBookmark, Platform } from "./types"

View File

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