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

87 lines
2.4 KiB
Svelte

<script lang="ts">
import { base } from '$app/paths';
import { clipboard, notification, ui, toast, dialog, shell } from '@kksh/api/ui/iframe';
import {
ModeToggle,
Button,
Command,
ModeWatcher,
Separator,
ThemeWrapper,
updateTheme
} from '@kksh/svelte5';
import { onMount } from 'svelte';
onMount(() => {
clipboard.readText().then((text) => {
console.log('clipboard text', text);
});
});
function showDialog() {
dialog
.open({ directory: false })
.then((res: any) => console.log(res))
.catch((err: any) => {
console.error(err);
});
}
async function testKkrpc() {
const { rpcChannel, process, command } = await shell.createDenoRpcChannel<
{},
{
echo: (paths: string[]) => Promise<string[]>;
}
>('$EXTENSION/deno-src/index.ts', [], {}, {});
command.stderr.on('data', (data) => {
'';
console.log('stderr', data);
});
// command.stdout.on('data', (data) => {
// console.log('stdout', data);
// });
const api = rpcChannel.getAPI();
await api
.echo([
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG',
'/Users/hk/Desktop/_DSC2594.ARW',
'/Users/hk/Desktop/_DSC2597.ARW',
'/Users/hk/Desktop/_DSC2598.ARW',
'/Users/hk/Desktop/DJI_20241128180028_0198_D.JPG'
])
.then(console.log)
.catch(console.error);
process.kill();
}
</script>
<div data-kunkun-drag-region class="h-12"></div>
<div class="container">
<Button onclick={showDialog}>Show Dialog</Button>
<Button onclick={testKkrpc}>Test kkrpc</Button>
</div>