diff --git a/.vscode/launch.json b/.vscode/launch.json index f948be78..b5e438ba 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,16 +5,22 @@ "type": "node", "request": "launch", "name": "Debug Program", - "program": "${workspaceRoot}/dist/src/app.js", + "program": "${workspaceRoot}/boot.js", "cwd": "${workspaceRoot}", "env": { "NODE_ENV": "development" }, - "args":["--no-deprecation"], - "skipFiles": ["node_modules/**/*.js"], - "outFiles": ["${workspaceRoot}/dist/*.js"], + "args": [ + "--no-deprecation" + ], + "skipFiles": [ + "node_modules/**/*.js" + ], + "outFiles": [ + "${workspaceRoot}/dist/*.js" + ], "stopOnEntry": false, "console": "integratedTerminal" } ] -} +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e7d6fb2..ac7ea92f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,30 +1,3 @@ -## [1.3.2](https://github.com/pragmatismo-io/BotServer/compare/1.3.1...1.3.2) (2019-05-26) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure. ([2ccae38](https://github.com/pragmatismo-io/BotServer/commit/2ccae38)) -* **core.gbapp:** Self-replication on Azure. ([4b7d29d](https://github.com/pragmatismo-io/BotServer/commit/4b7d29d)) - -## [1.3.1](https://github.com/pragmatismo-io/BotServer/compare/1.3.0...1.3.1) (2019-05-25) - - -### Bug Fixes - -* **core.gbapp:** Azure deployment. ([f1b8eb2](https://github.com/pragmatismo-io/BotServer/commit/f1b8eb2)) -* **core.gbapp:** Azure deployment. ([49e1743](https://github.com/pragmatismo-io/BotServer/commit/49e1743)) -* **core.gbapp:** Azure Deployment. ([f8fab38](https://github.com/pragmatismo-io/BotServer/commit/f8fab38)) -* **core.gbapp:** ESNext in tsconfig.json to match MSFT. ([01b8dd5](https://github.com/pragmatismo-io/BotServer/commit/01b8dd5)) -* **core.gbapp:** Fixing loading of instances. ([bc9c588](https://github.com/pragmatismo-io/BotServer/commit/bc9c588)) -* **core.gbapp:** Investigating BASIC broken. ([f0ec25e](https://github.com/pragmatismo-io/BotServer/commit/f0ec25e)) -* **core.gbapp:** package.json artifacts sync. ([01d34a6](https://github.com/pragmatismo-io/BotServer/commit/01d34a6)) -* **core.gbapp:** Publishing in Azure. ([4d6779e](https://github.com/pragmatismo-io/BotServer/commit/4d6779e)) -* **core.gbapp:** Removing POC code. ([56f46f4](https://github.com/pragmatismo-io/BotServer/commit/56f46f4)) -* **kb.gbapp:** Typo fix. ([ba26578](https://github.com/pragmatismo-io/BotServer/commit/ba26578)) -* **whatsapp.gblib:** Enabling Whatsapp. ([4351b87](https://github.com/pragmatismo-io/BotServer/commit/4351b87)) -* **whatsapp.gblib:** Enabling Whatsapp. ([74f5936](https://github.com/pragmatismo-io/BotServer/commit/74f5936)) -* **whatsapp.lib:** Enabling Whatsapp. ([85249e5](https://github.com/pragmatismo-io/BotServer/commit/85249e5)) - # [1.3.0](https://github.com/pragmatismo-io/BotServer/compare/1.2.2...1.3.0) (2019-05-12) diff --git a/boot.js b/boot.js new file mode 100644 index 00000000..b8224477 --- /dev/null +++ b/boot.js @@ -0,0 +1,4 @@ +#! /usr/bin / env node +const GBServer = require("./dist/src/app").GBServer +process.env.PWD = __dirname; +GBServer.run(); \ No newline at end of file diff --git a/gbot.cmd b/gbot.cmd index 243b11c5..4e2690a4 100644 --- a/gbot.cmd +++ b/gbot.cmd @@ -12,4 +12,4 @@ ECHO Compiling... CALL tsc :ALLSET -node dist/src/app.js +node app.js diff --git a/package.json b/package.json index 8a5fd116..a0e9e707 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "botserver", - "version": "1.3.2", + "version": "1.3.0", "description": "General Bot Community Edition open-core server.", - "main": "./src/app.ts", + "main": "./boot.js", "bugs": "https://github.com/pragmatismo-io/BotServer/issues", "homepage": "https://github.com/pragmatismo-io/BotServer/#readme", "contributors": [ @@ -15,7 +15,7 @@ "license": "AGPL-3.0", "preferGlobal": true, "bin": { - "gbot": "./dist/src/app.js" + "gbot": "./boot.js" }, "repository": { "type": "git", @@ -31,7 +31,7 @@ "test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ", "pretest": "npm run build", "coveralls": "npm run test && nyc report --reporter=text-lcov | coveralls", - "start": "node ./dist/src/app.js", + "start": "node ./boot.js", "watch:build": "tsc --watch", "watch:server": "nodemon './dist/index.js' --watch './dist'", "posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll", @@ -245,4 +245,4 @@ "post-merge": [] } } -} +} \ No newline at end of file diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 9fc0e1a4..1d0d7d96 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -93,7 +93,7 @@ export class GBDeployer { (resolve: any, reject: any): any => { GBLog.info(`PWD ${process.env.PWD}...`); let totalPackages = 0; - let paths = [urlJoin(process.env.PWD, '..', GBDeployer.deployFolder)]; + let paths = [urlJoin(process.env.PWD, GBDeployer.deployFolder)]; const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); if (additionalPath !== undefined && additionalPath !== '') { paths = paths.concat(additionalPath.toLowerCase().split(';')); @@ -404,15 +404,22 @@ export class GBDeployer { return { generalPackages, totalPackages }; } + private isSystemPackage(name: string): Boolean { + const names = ['core.gbapp', 'admin.gbapp', 'azuredeployer.gbapp', 'customer-satisfaction.gbapp', 'kb.gbapp']; + + return names.indexOf(name) > -1; + } + private deployAppPackages(gbappPackages: string[], core: any, appPackages: any[]) { let appPackagesProcessed = 0; gbappPackages.forEach(e => { - // Skips .gbapp inside deploy folder. - if (!e.startsWith('packages')) { - GBLog.info(`Deploying app: ${e}...`); + const filenameOnly = Path.basename(e); + // Skips .gbapp inside deploy folder. + if (this.isSystemPackage(filenameOnly) === false) { + + GBLog.info(`Deploying app: ${e}...`); let folder = Path.join(e, 'node_modules'); - let if (!Fs.existsSync(folder)) { GBLog.info(`Installing modules for ${e}...`); child_process.execSync('npm install', { cwd: e }); diff --git a/src/app.ts b/src/app.ts index 5b0be517..7367e727 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,4 +1,3 @@ -#! /usr/bin / env node /*****************************************************************************\ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | @@ -72,19 +71,11 @@ export class GBServer { public static run() { GBLog.info(`The Bot Server is in STARTING mode...`); - process.env.PWD = __dirname; - - // Creates a basic HTTP server that will serve several URL, one for each bot instance. - GBServer.globals = new RootData(); const port = GBConfigService.getServerPort(); const server = express(); server.use(bodyParser.json()); - server.use( - bodyParser.urlencoded({ - extended: true - }) - ); + server.use(bodyParser.urlencoded({ extended: true })); server.listen(port, () => { (async () => { @@ -171,7 +162,3 @@ export class GBServer { }); } } - -// First line to run. - -GBServer.run(); diff --git a/web.config b/web.config index 63d1eaf3..4e041961 100644 --- a/web.config +++ b/web.config @@ -2,7 +2,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -35,5 +35,3 @@ - - \ No newline at end of file