new(all): Node.js v22 and ts-node.

This commit is contained in:
me@rodrigorodriguez.com 2024-09-24 14:30:01 -03:00
parent 441dea2c22
commit 30994a3a28
7 changed files with 22 additions and 27 deletions

16
.vscode/launch.json vendored
View file

@ -5,25 +5,25 @@
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"sourceMaps": true, "sourceMaps": true,
"name": "Debug Program", "name": "Debug Program with Nodemon",
"runtimeExecutable": "node", "runtimeExecutable": "npx",
"runtimeArgs": ["nodemon", "--exec", "tsx"], // Use nodemon with tsx
"program": "${workspaceRoot}/boot.mjs", "program": "${workspaceRoot}/boot.mjs",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"env": { "env": {
"NODE_ENV": "development", "NODE_ENV": "development",
"NODE_NO_WARNINGS":"1" "NODE_NO_WARNINGS": "1"
}, },
"args": [ "args": [
"--no-deprecation", "--require", "${workspaceRoot}/suppress-node-warnings.cjs"
"--loader ts-node/esm",
"--require ${workspaceRoot}/suppress-node-warnings.cjs",
], ],
"skipFiles": [ "skipFiles": [
"node_modules/**/*.js", "node_modules/**/*.js",
"<node_internals>/**" "<node_internals>/**"
], ],
"outFiles": [ "outFiles": [
"${workspaceRoot}/dist/**/*.js"], "${workspaceRoot}/dist/**/*.js"
],
"stopOnEntry": false, "stopOnEntry": false,
"console": "integratedTerminal" "console": "integratedTerminal"
} }

View file

@ -6,8 +6,8 @@ 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' assert { type: 'json' }; import pjson from './package.json';
import {GBUtil} from './dist/src/util.js' import {GBUtil} from './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.
@ -22,19 +22,7 @@ try {
}); });
}; };
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.

View file

@ -1,7 +1,6 @@
{ {
"name": "botserver", "name": "botserver",
"version": "5.0.0", "version": "5.0.0",
"type": "module",
"description": "General Bot Community Edition open-core server.", "description": "General Bot Community Edition open-core server.",
"main": "./boot.mjs", "main": "./boot.mjs",
"bugs": "https://github.com/pragmatismo-io/BotServer/issues", "bugs": "https://github.com/pragmatismo-io/BotServer/issues",
@ -15,7 +14,7 @@
"Alan Perdomo <alanperdomo@hotmail.com>" "Alan Perdomo <alanperdomo@hotmail.com>"
], ],
"engines": { "engines": {
"node": "=20.17.0" "node": "=22.9.0"
}, },
"license": "AGPL-3.0", "license": "AGPL-3.0",
"preferGlobal": true, "preferGlobal": true,
@ -171,6 +170,7 @@
"node-html-parser": "6.1.13", "node-html-parser": "6.1.13",
"node-nlp": "4.27.0", "node-nlp": "4.27.0",
"node-tesseract-ocr": "2.2.1", "node-tesseract-ocr": "2.2.1",
"nodemon": "^3.1.7",
"npm": "10.8.3", "npm": "10.8.3",
"open": "10.1.0", "open": "10.1.0",
"open-docxtemplater-image-module": "1.0.3", "open-docxtemplater-image-module": "1.0.3",
@ -249,6 +249,7 @@
"super-strong-password-generator-es": "2.0.2", "super-strong-password-generator-es": "2.0.2",
"travis-deploy-once": "5.0.11", "travis-deploy-once": "5.0.11",
"tslint": "6.1.3", "tslint": "6.1.3",
"tsx": "^4.19.1",
"vitest": "2.0.5" "vitest": "2.0.5"
}, },
"eslintConfig": { "eslintConfig": {

5
packages/nodemon.json Normal file
View file

@ -0,0 +1,5 @@
{
"watch": ["src", "packages"],
"ext": "ts",
"exec": "tsx"
}

View file

@ -380,7 +380,7 @@ function shutdown() {
GBLogEx.info(0, 'General Bots API server closed.'); GBLogEx.info(0, 'General Bots API server closed.');
process.exit(0); process.exit(0);
}); });
}); });
} }

View file

@ -31,7 +31,7 @@
/** /**
* @fileoverview General Bots local utility. * @fileoverview General Bots local utility.
*/ */
'use strict'; 'use strict';
import * as YAML from 'yaml'; import * as YAML from 'yaml';
import SwaggerClient from 'swagger-client'; import SwaggerClient from 'swagger-client';

View file

@ -1,6 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"strict": false, "rootDir": "./",
"strict": true,
"allowJs": true, "allowJs": true,
"downlevelIteration": true, "downlevelIteration": true,
"baseUrl": "./", "baseUrl": "./",