diff --git a/.vscode/launch.json b/.vscode/launch.json index 3636d14d..b23b2430 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,9 +5,8 @@ "type": "node", "request": "launch", "sourceMaps": true, - "name": "Debug Program with Nodemon", - "runtimeExecutable": "npx", - "runtimeArgs": ["nodemon", "--ext","ts","--exec", "tsx"], + "name": "Debug Program", + "runtimeExecutable": "node", "program": "${workspaceRoot}/boot.mjs", "cwd": "${workspaceRoot}", "env": { @@ -28,4 +27,4 @@ "console": "integratedTerminal" } ] -} +} \ No newline at end of file diff --git a/boot.mjs b/boot.mjs index 0ded1140..4c6cf2cd 100644 --- a/boot.mjs +++ b/boot.mjs @@ -1,13 +1,13 @@ #!/usr/bin/env node -process.stdout.write(`General Bots. BotServer@${pjson.version}, botlib@${pjson.dependencies.botlib}, node@${process.version.replace('v', '')}, ${process.platform} ${process.arch} `); +process.stdout.write(`General Bots VM: node@${process.version.replace('v', '')}, ${process.platform} ${process.arch} `); import fs from 'fs/promises'; import os from 'node:os'; import path from 'path'; import { exec } from 'child_process'; -import pjson from './package.json'; -import {GBUtil} from './src/util.js' + +import {GBUtil} from './dist/src/util.js' // Displays version of Node JS being used at runtime and others attributes. @@ -17,12 +17,24 @@ var __dirname = process.env.PWD || process.cwd(); try { var run = async () => { - import('./src/app.js').then(async (gb)=> { + import('./dist/src/app.js').then(async (gb)=> { await gb.GBServer.run() }); }; var processDist = async () => { + if (!await GBUtil.exists('dist')) { + console.log(`\n`); + console.log(`General Bots: Compiling...`); + exec(path.join(__dirname, 'node_modules/.bin/tsc'), async (err, stdout, stderr) => { + if (err) { + console.error(err); + return; + } await run(); + }); + } else { + await run(); + } }; // Installing modules if it has not been done yet. diff --git a/package.json b/package.json index dcb02347..19988d6f 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "5.0.0", "description": "General Bot Community Edition open-core server.", "main": "./boot.mjs", + "type":"module", "bugs": "https://github.com/pragmatismo-io/BotServer/issues", "homepage": "https://github.com/pragmatismo-io/BotServer/#readme", "contributors": [ diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index 6f924e01..a55347a8 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -63,7 +63,6 @@ import { WebAutomationServices } from './WebAutomationServices.js'; import { KeywordsExpressions } from './KeywordsExpressions.js'; import { ChatServices } from '../../llm.gblib/services/ChatServices.js'; import mime from 'mime-types'; -import exts from '../../../extensions.json' assert { type: 'json' }; import { SecService } from '../../security.gbapp/services/SecService.js'; import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js'; import retry from 'async-retry'; @@ -2615,7 +2614,10 @@ export class SystemKeywords { } public async getExtensionInfo(ext: any): Promise { - let array = exts.filter((v, i, a) => a[i]['extension'] === ext); + + // TODO: Load exts. + + let array = []; // exts.filter((v, i, a) => a[i]['extension'] === ext); if (array[0]) { return array[0]; } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index a51f3a06..486b02cf 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -1345,7 +1345,7 @@ export class KBService implements IGBKBService { public async deployKb(core: IGBCoreService, deployer: GBDeployer, localPath: string, min: GBMinInstance) { const packageName = path.basename(localPath); const instance = await core.loadInstanceByBotId(min.botId); - GBLogEx.info(min, `Publishing: ${path.basename(localPath)}`); + GBLogEx.info(min, `Publishing: ${path.basename(localPath)}...`); const p = await deployer.deployPackageToStorage(instance.instanceId, packageName); await this.importKbPackage(min, localPath, p, instance); diff --git a/tsconfig.json b/tsconfig.json index e9fd7dc6..c56c4d4d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "rootDir": "./", - "strict": true, + "strict": false, "allowJs": true, "downlevelIteration": true, "baseUrl": "./",