new(all): Node.js v22 and ts-node.
This commit is contained in:
parent
d5884636cc
commit
2bbeac175c
6 changed files with 26 additions and 12 deletions
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
20
boot.mjs
20
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.
|
||||
|
|
|
@ -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": [
|
||||
|
|
|
@ -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<any> {
|
||||
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];
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"strict": false,
|
||||
"allowJs": true,
|
||||
"downlevelIteration": true,
|
||||
"baseUrl": "./",
|
||||
|
|
Loading…
Add table
Reference in a new issue