From a832eacb8484a0ff2ababd81a70640aac74be496 Mon Sep 17 00:00:00 2001 From: Huakun Shen Date: Mon, 24 Feb 2025 06:36:17 -0500 Subject: [PATCH] Prepare for release: Update version, add demo image, and improve JSON parsing --- README.md | 45 +++++------------------------------------ package.json | 6 ++++-- src/routes/+page.svelte | 2 ++ 3 files changed, 11 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 78c83dd..104f5b8 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,8 @@ -# Kunkun Custom UI Extension Template (SvelteKit) +# Kunkun JSON Extension -[Custom UI Extension Documentation](https://docs.kunkun.sh/extensions/custom-ui-ext/) +## Features -This is a template for a custom UI extension. +- Format JSON String +- Visualize JSON String -This type of extension is basically a static website. You can use any frontend framework you like, this template uses [SvelteKit](https://svelte.dev/). - -It is assumed that you have some knowledge of frontend development with SvelteKit. - -## Development - -Development is the same as developing a normal website. - -```bash -pnpm install -pnpm dev -pnpm build -``` - -- To develop and preview the extension in Kunkun, you need to run the `Add Dev Extension` command in Kunkun, and register this extension's path. - -In `package.json`, `"devMain"` is the url for development server, and `"main"` is the path to static `.html` file for production. - -To load the extension in development mode, you have to enable it with `Toggle Dev Extension Live Load Mode` command in Kunkun. A `Live` badge will be shown on the commands. This indicates that dev extensions will be loaded from `devMain` instead of `main`. - -## Advanced - -### Rendering Mode - -This is a Meta-Framework template, and already configured with SSG rendering mode. -Please do not enable SSR unless you know what you are doing. -There will not be a JS runtime in production, and Kunkun always load the extension as static files. - -The main benefit of using a meta-framework is that it comes with routing, and will output multiple `.html` files, which makes multi-command support much easier. - -## Verify Build and Publish - -```bash -npx kksh@latest verify --publish # run basic verification -``` - -See [Documentation](https://docs.kunkun.sh/guides/extensions/publish/design/) for more details on how to publish your extension. You will need to publish your extension package to npm or jsr first with GitHub actioin, then register it on Kunkun's website. +![](https://i.imgur.com/Ez0HVfS.png) diff --git a/package.json b/package.json index 05c1f8b..e487f51 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "git", "url": "https://github.com/kunkunsh/kunkun-ext-json" }, - "version": "0.0.9", + "version": "0.1.0", "license": "MIT", "kunkun": { "name": "JSON Formatter/Inspector", @@ -16,7 +16,9 @@ "type": "iconify", "value": "tabler:json" }, - "demoImages": [], + "demoImages": [ + "https://i.imgur.com/Ez0HVfS.png" + ], "permissions": [ "clipboard:write-text", "clipboard:read-text" diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 39f139d..de6704d 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -24,9 +24,11 @@ right: 0.5 }); ui.hideMoveButton(); + loadJsonFromClipboard(); }); $effect(() => { + if (!rawJson) return; try { jsonData = JSON.parse(rawJson); } catch (error) {