Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/tool/packages/dbops/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineToolSet({
en: 'Database Operations'
},
type: ToolTypeEnum.tools,
icon: 'core/workflow/template/datasource',
// icon: 'core/workflow/template/datasource',
description: {
'zh-CN':
'数据库操作工具集,包含 MySQL、PostgreSQL、Microsoft SQL Server、Oracle、ClickHouse 数据库操作功能',
Expand Down
1 change: 1 addition & 0 deletions modules/tool/packages/dbops/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion modules/tool/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const LoadToolsByFilename = async (
type: rootMod.type,
courseUrl: rootMod.courseUrl,
author: rootMod.author,
icon,
icon: findToolIcon(toolId),
toolDirName: `${toolSource}/${filename}`,
toolSource
});
Expand Down
53 changes: 28 additions & 25 deletions scripts/dev.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { isProd } from '@/constants';
import { copyIcons } from 'modules/tool/utils/icon';
import path from 'path';
import { watch } from 'fs/promises';
import { $ } from 'bun';
import { addLog } from '@/utils/log';
import { DevServer } from './devServer';
import fs from 'fs/promises';

async function copyDevIcons() {
if (isProd) return;
Expand All @@ -28,29 +26,34 @@ async function copyDevIcons() {
})
]);
}
await copyDevIcons();

// watch the worker.ts change and build it

// (async () => {
// const watcher = watch(path.join(__dirname, '..', 'src', 'worker', 'worker.ts'));
// for await (const _event of watcher) {
// addLog.debug(`Worker file changed, rebuilding...`);
// }
// })();

// build the worker
// await $`bun run build:worker`;
// run the main server
// (async () => {
// const watcher = watch(path.join(__dirname, '..', 'src'));
// for await (const _event of watcher) {
// addLog.debug(`Worker file changed, rebuilding...`);
// // rerun the server
// await $`bun run build:worker`;
// await $`bun run src/index.ts`;
// }
// })();
async function checkToolDir() {
const toolsDir = path.join(__dirname, '..', 'modules', 'tool', 'packages');

try {
const entries = await fs.readdir(toolsDir, { withFileTypes: true });

for (const entry of entries) {
if (!entry.isDirectory()) continue;

const dirPath = path.join(toolsDir, entry.name);
const indexPath = path.join(dirPath, 'index.ts');

try {
await fs.access(indexPath);
} catch {
// index.ts doesn't exist, remove the directory
await fs.rm(dirPath, { recursive: true, force: true });
console.log(`Removed tool directory without index.ts: ${entry.name}`);
}
}
} catch (error) {
console.error('Error checking tool directories:', error);
}
}

await copyDevIcons();
await checkToolDir();

const server = new DevServer();
await server.start();
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { initModels } from '@model/init';
import { setupProxy } from './utils/setupProxy';
import { initWorkflowTemplates } from '@workflow/init';
import { connectMongo, connectionMongo, MONGO_URL } from '@/mongo';
import { refreshVersionKey } from './cache';
import { SystemCacheKeyEnum } from './cache/type';

const requestSizeLimit = '10mb';
const app = express().use(
Expand All @@ -34,6 +36,7 @@ try {

// Modules
await Promise.all([initTools(), initModels(), initWorkflowTemplates()]);
await refreshVersionKey(SystemCacheKeyEnum.systemTool);

const PORT = parseInt(process.env.PORT || '3000');
const server = app.listen(PORT, (error?: Error) => {
Expand Down