add quser app
This commit is contained in:
30
packages/list/bun.config.mjs
Normal file
30
packages/list/bun.config.mjs
Normal file
@@ -0,0 +1,30 @@
|
||||
// @ts-check
|
||||
import { resolvePath, getDevInputs } from '@kevisual/use-config/env';
|
||||
import { execSync } from 'node:child_process';
|
||||
import glob from 'fast-glob';
|
||||
|
||||
const files = await glob(['src/defines/*.ts', 'src/query/*.ts', 'src/router/*.ts']);
|
||||
const inputs = getDevInputs(files);
|
||||
const external = ['@kevisual/router'];
|
||||
for (let input of inputs) {
|
||||
const entry = input.path;
|
||||
const naming = input.naming;
|
||||
/**
|
||||
* @type {import('bun').BuildConfig}
|
||||
*/
|
||||
await Bun.build({
|
||||
target: 'node',
|
||||
format: 'esm',
|
||||
entrypoints: [resolvePath(entry, { meta: import.meta })],
|
||||
outdir: resolvePath('./dist', { meta: import.meta }),
|
||||
|
||||
naming: {
|
||||
entry: naming + '.js',
|
||||
},
|
||||
external: external,
|
||||
env: 'KEVISUAL_*',
|
||||
});
|
||||
|
||||
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
|
||||
execSync(cmd, { stdio: 'inherit' });
|
||||
}
|
||||
18
packages/list/package.json
Normal file
18
packages/list/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@kevisual/query-list",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "bun bun.config.mjs"
|
||||
},
|
||||
"keywords": [],
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.6.2",
|
||||
"type": "module"
|
||||
}
|
||||
27
packages/list/src/defines/query-shop-define.ts
Normal file
27
packages/list/src/defines/query-shop-define.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { QueryUtil } from '@kevisual/router/define';
|
||||
|
||||
export const shopDefine = QueryUtil.create({
|
||||
getRegistry: {
|
||||
path: 'shop',
|
||||
key: 'get-registry',
|
||||
description: '获取应用商店注册表信息',
|
||||
},
|
||||
|
||||
listInstalled: {
|
||||
path: 'shop',
|
||||
key: 'list-installed',
|
||||
description: '列出当前已安装的所有应用',
|
||||
},
|
||||
|
||||
install: {
|
||||
path: 'shop',
|
||||
key: 'install',
|
||||
description: '安装指定的应用,可以指定 id、type、force 和 yes 参数',
|
||||
},
|
||||
|
||||
uninstall: {
|
||||
path: 'shop',
|
||||
key: 'uninstall',
|
||||
description: '卸载指定的应用,可以指定 id 和 type 参数',
|
||||
},
|
||||
});
|
||||
19
packages/list/src/query/query-shop.ts
Normal file
19
packages/list/src/query/query-shop.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { shopDefine } from '../defines/query-shop-define.ts';
|
||||
|
||||
import { BaseQuery, DataOpts, Query } from '@kevisual/query/query';
|
||||
|
||||
export { shopDefine };
|
||||
|
||||
export class QueryApp extends BaseQuery {
|
||||
appDefine = shopDefine;
|
||||
constructor(opts?: { query: Query }) {
|
||||
super(opts!);
|
||||
this.appDefine.query = this.query;
|
||||
}
|
||||
get chain() {
|
||||
return this.appDefine.queryChain;
|
||||
}
|
||||
getInstall(data: any, opts?: DataOpts) {
|
||||
return this.appDefine.queryChain('install').post(data, opts);
|
||||
}
|
||||
}
|
||||
18
packages/list/tsconfig.json
Normal file
18
packages/list/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@kevisual/types/json/frontend.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./node_modules/@kevisual"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
}
|
||||
@@ -54,4 +54,9 @@ export const appDefine = QueryUtil.create({
|
||||
key: 'detectVersionList',
|
||||
description: '检测版本列表并同步 MinIO 数据',
|
||||
},
|
||||
publicList: {
|
||||
path: 'app',
|
||||
key: 'public-list',
|
||||
description: '获取公开应用列表',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user