diff --git a/bun.lock b/bun.lock index f6b1fc56..187ffccc 100644 --- a/bun.lock +++ b/bun.lock @@ -68,6 +68,8 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.27.1", + "@types/babel__generator": "^7.27.0", + "@types/babel__traverse": "^7.28.0", }, }, "runtime": { @@ -417,6 +419,10 @@ "@ts-rest/open-api": ["@ts-rest/open-api@3.52.1", "", { "dependencies": { "@anatine/zod-openapi": "^1.12.0", "openapi3-ts": "^2.0.2" }, "peerDependencies": { "@ts-rest/core": "~3.52.0", "zod": "^3.22.3" } }, "sha512-VY91g6HFzCe1/fNgX4Y3HzaJbIdztCGHTg34drkh7bKgtNOizLJLXV0wwIkMwLGvjhRHojJxnwYxHjGMIkScwg=="], + "@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="], + + "@types/babel__traverse": ["@types/babel__traverse@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="], + "@types/body-parser": ["@types/body-parser@1.19.6", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="], "@types/bun": ["@types/bun@1.2.23", "", { "dependencies": { "bun-types": "1.2.23" } }, "sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A=="], diff --git a/modules/tool/build/index.ts b/modules/tool/build/index.ts index fce438dd..eef16eb5 100644 --- a/modules/tool/build/index.ts +++ b/modules/tool/build/index.ts @@ -7,6 +7,13 @@ const tool = process.argv[2] || '*'; export const buildAllTools = async () => { // read all tools, and build them + // check the existence of the tool directory + + if (!existsSync(toolsSourceDir)) { + console.log(`Tool directory ${toolsSourceDir} does not exist, skip build`); + return; + } + const tools = await readdir(toolsSourceDir); const promises: Promise[] = []; for await (const tool of tools) { diff --git a/modules/tool/controller.ts b/modules/tool/controller.ts index 99133ffa..a242df59 100644 --- a/modules/tool/controller.ts +++ b/modules/tool/controller.ts @@ -19,8 +19,8 @@ export async function getTool(toolId: string): Promise { } export function getToolTags(): z.infer { - return Object.entries(ToolTagsNameMap).map(([type, name]) => ({ - type: type as z.infer, + return Object.entries(ToolTagsNameMap).map(([id, name]) => ({ + id: id as z.infer, name })); } diff --git a/modules/tool/package.json b/modules/tool/package.json index 4be8c97e..e0030d8e 100644 --- a/modules/tool/package.json +++ b/modules/tool/package.json @@ -5,7 +5,9 @@ "build:marketplace": "bun run ./build/build-json.ts" }, "devDependencies": { - "@babel/preset-typescript": "^7.27.1" + "@babel/preset-typescript": "^7.27.1", + "@types/babel__generator": "^7.27.0", + "@types/babel__traverse": "^7.28.0" }, "dependencies": { "@babel/generator": "^7.28.3", diff --git a/modules/tool/type/api.ts b/modules/tool/type/api.ts index 43e2762e..883ea78e 100644 --- a/modules/tool/type/api.ts +++ b/modules/tool/type/api.ts @@ -4,7 +4,7 @@ import { ToolSchema, VersionListItemSchema } from './tool'; export const ToolTagListSchema = z.array( z.object({ - type: z.string(), + id: z.string(), name: I18nStringStrictSchema }) ); diff --git a/package.json b/package.json index 5e430444..74cf61c9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test": "vitest run", "build:runtime": "bun --cwd runtime build", "start": "NODE_ENV=production node --env-file-if-exists=runtime/.env.local dist/index.js", - "build:pkg": "bun --cwd modules/tool build", + "build:pkg": "bun tsc && bun --cwd modules/tool build", "build:sdk": "bun run --cwd sdk build", "build:marketplace": "bun run build:pkg && bun ./modules/tool/build/build-json.ts", "deploy:marketplace-data": "bun --env-file=.env.marketplace.local ./scripts/deploy-marketplace.ts", diff --git a/scripts/install-all.ts b/scripts/install-all.ts index f0ca8b1b..2a09cd8f 100644 --- a/scripts/install-all.ts +++ b/scripts/install-all.ts @@ -62,6 +62,12 @@ async function installWithConcurrency(tasks: InstallTask[], concurrency: number) } async function installInSubdirs(dir: string) { + // check if dir exists + if (!existsSync(dir)) { + console.log(`Directory ${dir} does not exist, skip installation`); + return; + } + const entries = readdirSync(dir, { withFileTypes: true }); const tasks: InstallTask[] = []; diff --git a/sdk/package.json b/sdk/package.json index 361a915f..f1458ca0 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@fastgpt-sdk/plugin", - "version": "0.2.0", + "version": "0.2.1", "description": "fastgpt-plugin sdk", "main": "dist/client.js", "types": "dist/client.d.ts",