Skip to content

Commit 4272394

Browse files
c121914yuFinleyGe
andauthored
Install packages (#258)
* Install packages * fix: tag union field * chore: update scripts/install-all.ts * fix: build tools --------- Co-authored-by: FinleyGe <[email protected]>
1 parent 0ee9fda commit 4272394

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

bun.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
},
6969
"devDependencies": {
7070
"@babel/preset-typescript": "^7.27.1",
71+
"@types/babel__generator": "^7.27.0",
72+
"@types/babel__traverse": "^7.28.0",
7173
},
7274
},
7375
"runtime": {
@@ -417,6 +419,10 @@
417419

418420
"@ts-rest/open-api": ["@ts-rest/[email protected]", "", { "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=="],
419421

422+
"@types/babel__generator": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="],
423+
424+
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
425+
420426
"@types/body-parser": ["@types/[email protected]", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="],
421427

422428
"@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.2.23" } }, "sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A=="],

modules/tool/build/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ const tool = process.argv[2] || '*';
77

88
export const buildAllTools = async () => {
99
// read all tools, and build them
10+
// check the existence of the tool directory
11+
12+
if (!existsSync(toolsSourceDir)) {
13+
console.log(`Tool directory ${toolsSourceDir} does not exist, skip build`);
14+
return;
15+
}
16+
1017
const tools = await readdir(toolsSourceDir);
1118
const promises: Promise<void>[] = [];
1219
for await (const tool of tools) {

modules/tool/controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export async function getTool(toolId: string): Promise<ToolType | undefined> {
1919
}
2020

2121
export function getToolTags(): z.infer<typeof ToolTagListSchema> {
22-
return Object.entries(ToolTagsNameMap).map(([type, name]) => ({
23-
type: type as z.infer<typeof ToolTagEnum>,
22+
return Object.entries(ToolTagsNameMap).map(([id, name]) => ({
23+
id: id as z.infer<typeof ToolTagEnum>,
2424
name
2525
}));
2626
}

modules/tool/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"build:marketplace": "bun run ./build/build-json.ts"
66
},
77
"devDependencies": {
8-
"@babel/preset-typescript": "^7.27.1"
8+
"@babel/preset-typescript": "^7.27.1",
9+
"@types/babel__generator": "^7.27.0",
10+
"@types/babel__traverse": "^7.28.0"
911
},
1012
"dependencies": {
1113
"@babel/generator": "^7.28.3",

modules/tool/type/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ToolSchema, VersionListItemSchema } from './tool';
44

55
export const ToolTagListSchema = z.array(
66
z.object({
7-
type: z.string(),
7+
id: z.string(),
88
name: I18nStringStrictSchema
99
})
1010
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"test": "vitest run",
1111
"build:runtime": "bun --cwd runtime build",
1212
"start": "NODE_ENV=production node --env-file-if-exists=runtime/.env.local dist/index.js",
13-
"build:pkg": "bun --cwd modules/tool build",
13+
"build:pkg": "bun tsc && bun --cwd modules/tool build",
1414
"build:sdk": "bun run --cwd sdk build",
1515
"build:marketplace": "bun run build:pkg && bun ./modules/tool/build/build-json.ts",
1616
"deploy:marketplace-data": "bun --env-file=.env.marketplace.local ./scripts/deploy-marketplace.ts",

scripts/install-all.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ async function installWithConcurrency(tasks: InstallTask[], concurrency: number)
6262
}
6363

6464
async function installInSubdirs(dir: string) {
65+
// check if dir exists
66+
if (!existsSync(dir)) {
67+
console.log(`Directory ${dir} does not exist, skip installation`);
68+
return;
69+
}
70+
6571
const entries = readdirSync(dir, { withFileTypes: true });
6672
const tasks: InstallTask[] = [];
6773

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fastgpt-sdk/plugin",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "fastgpt-plugin sdk",
55
"main": "dist/client.js",
66
"types": "dist/client.d.ts",

0 commit comments

Comments
 (0)