Huakun Shen e21bef154e
Feature: install extension from JSR (#53)
* chore: upgrade many dependencies

* fix: @kksh/svelte, migrate 5

* refactor: move dialog plugin code out of ui package

* chore: disable check-types in api build.ts

Causing build error in kunkun-services

* feat: add jsr package

* feat: implement jsr package with API and parsers for jsr

* feat: modify API, add function to extract linked github repo from html

* perf: improve jsr package API with @hk/jsr-client

* feat: add jsr package version table for publishing extension

* fix: dependency and type incompatibility in ui package

* feat: add validateJsrPackageAsKunkunExtension function in jsr package

* feat: improve jsr table

* feat: add a ElementAlert component

* feat: update ElementAlert UI

* chore: update deno.lock

* chore: enable submodule support in jsr-publish workflow

* chore: bump version to 0.0.48 in jsr.json

* feat: regenerate supabase types, add author_id

* Move @kksh/jsr package to @kksh/api

* update deno.lock

* chore: change @tauri-plugin/plugin-upload version from git url to version

* feat: add rounded corner for ElementAlert

* chore: update deno.lock

* chore: bump version to 0.0.51 in jsr.json and update import paths for ExtPackageJson

* feat: add publishExtJSR API to SupabaseAPI

* refactor: replace "@hk/jsr-client" from jsr with @huakunshen/jsr-client from npm

* chore: update  deno.lock

* feat: update validateJsrPackageAsKunkunExtension return type

* refactor: improve error message

* feat: add metadata to ext_publish, update database.types.ts

* feat: add models module for Supabase with ExtPublishMetadata and source type enumeration

* feat: support installing JSR package as extension

Since JSR overwrites package.json with its own code to be compatible with npm, causing manifest parsing to be impossible. I add metadata field to ext_publish.
When extension comes from jsr, kunkun app will fetch the original package.json from jsr and overwrite the one modified by jsr.

* fix: add missing dep @tauri-apps/plugin-upload to @kksh/extension

* chore: update version to 0.0.52 in version.ts
2025-01-10 08:23:18 -05:00
..
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00

Kunkun Custom UI Extension Template (SvelteKit)

Custom UI Extension Documentation

This is a template for a custom UI extension.

This type of extension is basically a static website. You can use any frontend framework you like, this template uses SvelteKit.

It is assumed that you have some knowledge of frontend development with SvelteKit.

Development

Development is the same as developing a normal website.

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

pnpm build # make sure the build npm script works
npx kksh@latest verify # Verify some basic settings before publishing

It is recommended to build the extension with the same environment our CI uses.

The docker image used by our CI is huakunshen/kunkun-ext-builder:latest.

You can use the following command to build the extension with the same environment our CI uses. This requires you to have docker installed, and the shell you are using has access to it via docker command.

npx kksh@latest build # Build the extension with

pnpm is used to install dependencies and build the extension.

The docker image environment also has node, pnpm, npm, bun, deno installed. If your build failed, try debug with huakunshen/kunkun-ext-builder:latest image in interative mode and bind your extension volume to /workspace.

After build successfully, you should find a tarball file ends with .tgz in the root of your extension. The tarball is packaged with npm pack command. You can uncompress it to see if it contains all the necessary files.

This tarball is the final product that will be published and installed in Kunkun. You can further verify your extension by installing this tarball directly in Kunkun.

After verifying the tarball, it's ready to be published.

Fork KunkunExtensions repo, add your extension to the extensions directory, and create a PR.

Once CI passed and PR merged, you can use your extension in Kunkun.