diff --git a/package.json b/package.json index 74c044a..48189de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/query-awesome", - "version": "0.0.1", + "version": "0.0.2", "description": "", "main": "index.js", "scripts": { @@ -23,7 +23,8 @@ "@kevisual/router": "^0.0.20", "@kevisual/types": "^0.0.10", "@kevisual/use-config": "^1.0.17", - "fast-glob": "^3.3.3" + "fast-glob": "^3.3.3", + "tsup": "^8.4.0" }, "exports": { ".": { diff --git a/packages/list/bun.config.mjs b/packages/list/bun.config.mjs new file mode 100644 index 0000000..6c5a660 --- /dev/null +++ b/packages/list/bun.config.mjs @@ -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' }); +} diff --git a/packages/list/package.json b/packages/list/package.json new file mode 100644 index 0000000..86f3f9a --- /dev/null +++ b/packages/list/package.json @@ -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 (https://www.xiongxiao.me)", + "license": "MIT", + "packageManager": "pnpm@10.6.2", + "type": "module" +} \ No newline at end of file diff --git a/packages/list/src/defines/query-shop-define.ts b/packages/list/src/defines/query-shop-define.ts new file mode 100644 index 0000000..fd56294 --- /dev/null +++ b/packages/list/src/defines/query-shop-define.ts @@ -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 参数', + }, +}); diff --git a/packages/list/src/query/query-shop.ts b/packages/list/src/query/query-shop.ts new file mode 100644 index 0000000..8d26ea5 --- /dev/null +++ b/packages/list/src/query/query-shop.ts @@ -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); + } +} diff --git a/packages/list/tsconfig.json b/packages/list/tsconfig.json new file mode 100644 index 0000000..8f93311 --- /dev/null +++ b/packages/list/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "@kevisual/types/json/frontend.json", + "compilerOptions": { + "baseUrl": ".", + "typeRoots": [ + "./node_modules/@types", + "./node_modules/@kevisual" + ], + "paths": { + "@/*": [ + "src/*" + ] + }, + }, + "include": [ + "src/**/*", + ], +} \ No newline at end of file diff --git a/packages/query-app/src/defines/app.ts b/packages/query-app/src/defines/app.ts index 7e0102d..dad6043 100644 --- a/packages/query-app/src/defines/app.ts +++ b/packages/query-app/src/defines/app.ts @@ -54,4 +54,9 @@ export const appDefine = QueryUtil.create({ key: 'detectVersionList', description: '检测版本列表并同步 MinIO 数据', }, + publicList: { + path: 'app', + key: 'public-list', + description: '获取公开应用列表', + }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4398ff3..29421c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,11 @@ importers: fast-glob: specifier: ^3.3.3 version: 3.3.3 + tsup: + specifier: ^8.4.0 + version: 8.4.0(typescript@5.8.3) + + packages/list: {} packages/query-app: {} @@ -86,6 +91,18 @@ importers: specifier: ^8.4.0 version: 8.4.0(typescript@5.8.3) + submodules/query-upload: + devDependencies: + '@types/node': + specifier: ^22.13.14 + version: 22.15.18 + eventsource: + specifier: ^3.0.6 + version: 3.0.7 + tsup: + specifier: ^8.4.0 + version: 8.4.0(typescript@5.8.3) + packages: '@babel/code-frame@7.27.1': diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..11c8758 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# query-awesome + +对 kevisual 相关的query router 的模块整理 \ No newline at end of file