2019-12-30 12:51:11 -03:00
|
|
|
#!/usr/bin/env node
|
2019-07-23 14:41:39 +00:00
|
|
|
|
2022-11-18 22:39:14 -03:00
|
|
|
import Fs from 'fs';
|
|
|
|
import Path from 'path';
|
|
|
|
import { exec } from 'child_process';
|
2023-02-24 10:18:04 -03:00
|
|
|
import pjson from './package.json' assert { type: 'json' };
|
2019-07-23 14:41:39 +00:00
|
|
|
|
2020-01-08 17:52:46 -03:00
|
|
|
// Displays version of Node JS being used at runtime and others attributes.
|
2023-02-24 10:18:04 -03:00
|
|
|
console.log(``);
|
|
|
|
console.log(``);
|
2023-02-26 06:05:57 -03:00
|
|
|
console.log(` █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® `);
|
|
|
|
console.log(`██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ `);
|
|
|
|
console.log(`██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ `);
|
|
|
|
console.log(`██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ `);
|
|
|
|
console.log(` █████ █████ █ ███ █████ ██ ██ ██ ██ ██████ ████ █████ █ ███ 3.0`);
|
2023-03-26 19:33:58 -03:00
|
|
|
process.stdout.write(` botserver@${pjson.version}, botlib@${pjson.dependencies.botlib}, botbuilder@${pjson.dependencies.botbuilder}, node@${process.version.replace('v', '')}, ${process.platform} ${process.arch} `);
|
2023-02-26 06:05:57 -03:00
|
|
|
|
2021-01-08 13:03:44 -03:00
|
|
|
var now = () => {
|
2023-02-24 10:18:04 -03:00
|
|
|
return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + ' UTC';
|
|
|
|
};
|
2023-02-24 19:26:09 -03:00
|
|
|
var __dirname = process.env.PWD || process.cwd();
|
2019-12-30 12:51:11 -03:00
|
|
|
try {
|
2023-02-24 10:18:04 -03:00
|
|
|
var run = () => {
|
2023-02-26 06:05:57 -03:00
|
|
|
import('./dist/src/app.js').then((gb)=> {
|
2023-03-13 14:20:18 -03:00
|
|
|
console.log(`\n`);
|
2023-02-26 06:05:57 -03:00
|
|
|
gb.GBServer.run()
|
|
|
|
});
|
2023-02-24 10:18:04 -03:00
|
|
|
};
|
|
|
|
var processDist = () => {
|
|
|
|
if (!Fs.existsSync('dist')) {
|
2023-03-26 19:33:58 -03:00
|
|
|
console.log(`\n`);
|
|
|
|
console.log(`Generall Bots: Compiling...`);
|
2023-02-24 10:18:04 -03:00
|
|
|
exec(Path.join(__dirname, 'node_modules/.bin/tsc'), (err, stdout, stderr) => {
|
|
|
|
if (err) {
|
|
|
|
console.error(err);
|
|
|
|
return;
|
2019-07-23 14:41:39 +00:00
|
|
|
}
|
2023-02-24 10:18:04 -03:00
|
|
|
run();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
run();
|
|
|
|
}
|
|
|
|
};
|
2019-07-23 14:41:39 +00:00
|
|
|
|
2023-02-24 10:18:04 -03:00
|
|
|
// Installing modules if it has not been done yet.
|
2020-01-08 17:52:46 -03:00
|
|
|
|
2023-02-24 10:18:04 -03:00
|
|
|
if (!Fs.existsSync('node_modules')) {
|
2023-03-26 19:33:58 -03:00
|
|
|
console.log(`\n`);
|
|
|
|
console.log(`Generall Bots: Installing modules for the first time, please wait...`);
|
2023-02-24 10:18:04 -03:00
|
|
|
exec('npm install', (err, stdout, stderr) => {
|
|
|
|
if (err) {
|
|
|
|
console.error(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
processDist();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
processDist();
|
|
|
|
}
|
2019-12-30 12:51:11 -03:00
|
|
|
} catch (e) {
|
2023-02-24 10:18:04 -03:00
|
|
|
console.log(e);
|
2019-07-23 14:41:39 +00:00
|
|
|
}
|