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",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"name": "Debug Program with Nodemon",
|
"name": "Debug Program",
|
||||||
"runtimeExecutable": "npx",
|
"runtimeExecutable": "node",
|
||||||
"runtimeArgs": ["nodemon", "--ext","ts","--exec", "tsx"],
|
|
||||||
"program": "${workspaceRoot}/boot.mjs",
|
"program": "${workspaceRoot}/boot.mjs",
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -28,4 +27,4 @@
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
20
boot.mjs
20
boot.mjs
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env node
|
#!/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 fs from 'fs/promises';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { exec } from 'child_process';
|
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.
|
// Displays version of Node JS being used at runtime and others attributes.
|
||||||
|
|
||||||
|
@ -17,12 +17,24 @@ var __dirname = process.env.PWD || process.cwd();
|
||||||
try {
|
try {
|
||||||
var run = async () => {
|
var run = async () => {
|
||||||
|
|
||||||
import('./src/app.js').then(async (gb)=> {
|
import('./dist/src/app.js').then(async (gb)=> {
|
||||||
await gb.GBServer.run()
|
await gb.GBServer.run()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var processDist = async () => {
|
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();
|
await run();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Installing modules if it has not been done yet.
|
// Installing modules if it has not been done yet.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"description": "General Bot Community Edition open-core server.",
|
"description": "General Bot Community Edition open-core server.",
|
||||||
"main": "./boot.mjs",
|
"main": "./boot.mjs",
|
||||||
|
"type":"module",
|
||||||
"bugs": "https://github.com/pragmatismo-io/BotServer/issues",
|
"bugs": "https://github.com/pragmatismo-io/BotServer/issues",
|
||||||
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
|
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
|
|
@ -63,7 +63,6 @@ import { WebAutomationServices } from './WebAutomationServices.js';
|
||||||
import { KeywordsExpressions } from './KeywordsExpressions.js';
|
import { KeywordsExpressions } from './KeywordsExpressions.js';
|
||||||
import { ChatServices } from '../../llm.gblib/services/ChatServices.js';
|
import { ChatServices } from '../../llm.gblib/services/ChatServices.js';
|
||||||
import mime from 'mime-types';
|
import mime from 'mime-types';
|
||||||
import exts from '../../../extensions.json' assert { type: 'json' };
|
|
||||||
import { SecService } from '../../security.gbapp/services/SecService.js';
|
import { SecService } from '../../security.gbapp/services/SecService.js';
|
||||||
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
|
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
|
||||||
import retry from 'async-retry';
|
import retry from 'async-retry';
|
||||||
|
@ -2615,7 +2614,10 @@ export class SystemKeywords {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getExtensionInfo(ext: any): Promise<any> {
|
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]) {
|
if (array[0]) {
|
||||||
return 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) {
|
public async deployKb(core: IGBCoreService, deployer: GBDeployer, localPath: string, min: GBMinInstance) {
|
||||||
const packageName = path.basename(localPath);
|
const packageName = path.basename(localPath);
|
||||||
const instance = await core.loadInstanceByBotId(min.botId);
|
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);
|
const p = await deployer.deployPackageToStorage(instance.instanceId, packageName);
|
||||||
await this.importKbPackage(min, localPath, p, instance);
|
await this.importKbPackage(min, localPath, p, instance);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "./",
|
"rootDir": "./",
|
||||||
"strict": true,
|
"strict": false,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
|
|
Loading…
Add table
Reference in a new issue