From 248ea563b87e37e4af6bff407f700054107051cb Mon Sep 17 00:00:00 2001 From: dev2a Date: Sat, 29 Dec 2018 19:18:07 +0100 Subject: [PATCH 1/8] [Chore] Add coverage badge --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 5acbf83..d2e05fe 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,5 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/83770719db9d4480a1f2162c3399c325)](https://www.codacy.com/app/icfr/laravel-node-queue_2?utm_source=github.com&utm_medium=referral&utm_content=artis-auxilium/laravel-node-queue&utm_campaign=Badge_Grade) +[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/83770719db9d4480a1f2162c3399c325)](https://www.codacy.com/app/icfr/laravel-node-queue_2?utm_source=github.com&utm_medium=referral&utm_content=artis-auxilium/laravel-node-queue&utm_campaign=Badge_Coverage) # node server for Laravel queue From 27ae9bb139dc4ad9ffb40f007708651ab0ca7736 Mon Sep 17 00:00:00 2001 From: dev2a Date: Sat, 29 Dec 2018 20:00:54 +0100 Subject: [PATCH 2/8] [Fix] Add env file if not present --- scripts/install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index ffabc36..bb916ee 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,6 +2,9 @@ MODULE_DIR=$(pwd) BIN_DIR="${MODULE_DIR}/bin" PROJECT_DIR=$(realpath ../..) +if [ -f "${PROJECT_DIR}/.env"]; then + touch "${PROJECT_DIR}/.env" +fi if [ -d "${PROJECT_DIR}/Config" ]; then echo "app allready installed" exit 0 From 587117354d2acf101104a5c0fa324acc04e2f799 Mon Sep 17 00:00:00 2001 From: dev2a Date: Sat, 29 Dec 2018 20:21:38 +0100 Subject: [PATCH 3/8] [Fix] inconsistent return --- .eslintrc | 2 +- Commands/init.js | 3 ++- Commands/laravelConfig.js | 3 ++- Commands/missingJob.js | 6 ++++-- Commands/modelsCreator.js | 3 ++- lib/Config.js | 3 +-- lib/Mail.js | 9 ++++++--- lib/db-models/lib/Model-export.js | 11 +++++++---- lib/shell/lib/Shell.js | 3 +-- lib/shell/lib/plugins/help.js | 12 ++++++++---- lib/shell/lib/plugins/router.js | 8 ++++---- lib/shell/lib/routes/shellOnly.js | 2 +- lib/utils.js | 1 + 13 files changed, 40 insertions(+), 26 deletions(-) diff --git a/.eslintrc b/.eslintrc index 58664ac..5a704c4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -37,7 +37,7 @@ "accessor-pairs": 2, "block-scoped-var": 2, "complexity": [2, 15], - "consistent-return": 0, + "consistent-return": 2, "curly": 2, "default-case": 1, "dot-location": 0, diff --git a/Commands/init.js b/Commands/init.js index 1bdc26f..259a9e9 100644 --- a/Commands/init.js +++ b/Commands/init.js @@ -25,7 +25,8 @@ var checkArtisan = function checkArtisan(cmdRes) { return new Promise(function promiseCheckArtisan(resolve, reject) { var test = cmdRes.match(/\s*Laravel\s+Framework\s+(version)?\s+(.*)/); if (test) { - return resolve(test); + resolve(test); + return; } reject(new Error('not a laravel framework')); }); diff --git a/Commands/laravelConfig.js b/Commands/laravelConfig.js index a81ac2d..a2e1bb8 100644 --- a/Commands/laravelConfig.js +++ b/Commands/laravelConfig.js @@ -20,7 +20,8 @@ var prepareTmpFolder = function prepareTmpFolder() { unsafeCleanup: true }, function tmpDirCallback(err, name) { if (err) { - return reject(err); + reject(err); + return; } fs.mkdir(name + '/Config-laravel') .then(function tmpdirOk() { diff --git a/Commands/missingJob.js b/Commands/missingJob.js index fca0883..6da6c36 100644 --- a/Commands/missingJob.js +++ b/Commands/missingJob.js @@ -92,11 +92,13 @@ module.exports = { if (!app.config('app')) { res.red('app config missing').ln(); res.yellow('see manual for setup config from laravel').ln(); - return res.prompt(); + res.prompt(); + return; } if (Object.keys(app.config('app.job', [])).length === 0) { res.yellow('no job in Config/app.js').ln(); - return res.prompt(); + res.prompt(); + return; } global.queueOption = {}; Job = includeAll({ diff --git a/Commands/modelsCreator.js b/Commands/modelsCreator.js index b2d28d7..886e02e 100644 --- a/Commands/modelsCreator.js +++ b/Commands/modelsCreator.js @@ -9,7 +9,8 @@ module.exports = { function: function run(req, res) { if (app.config('core.modelsCreator.models').length === 0) { res.yellow('Please add models to import in Config/core.js').ln(); - return res.prompt(); + res.prompt(); + return; } var dbModels = require('../lib/db-models'); dbModels() diff --git a/lib/Config.js b/lib/Config.js index e59057d..0ad5ad2 100644 --- a/lib/Config.js +++ b/lib/Config.js @@ -1,5 +1,4 @@ 'use strict'; -/* global app */ var include = require('include-all'); var fs = require('fs'); @@ -30,7 +29,7 @@ var Config = function Config(appdir, logger) { Config.prototype.get = function get(key, def) { var reduce = function reduce(obj, index) { if (!obj) { - return; + return null; } return obj[index]; }; diff --git a/lib/Mail.js b/lib/Mail.js index e680c80..6e6211b 100644 --- a/lib/Mail.js +++ b/lib/Mail.js @@ -71,12 +71,15 @@ Mail.prototype.send = function sendMail(callback) { self.mailer.sendMail(mailOptions, function mailerSendMail(err, info) { if (err) { if (callback) { - return callback(err); + callback(err); + return; } - return reject(err); + reject(err); + return; } if (callback) { - return callback(null, info); + callback(null, info); + return; } resolve(info); }); diff --git a/lib/db-models/lib/Model-export.js b/lib/db-models/lib/Model-export.js index 982c4f8..72340dc 100644 --- a/lib/db-models/lib/Model-export.js +++ b/lib/db-models/lib/Model-export.js @@ -29,13 +29,16 @@ ModelExport.prototype.createOutputDir = function createOutputDir() { return new Promise(function PromiseCreateOutputDir(resolve) { fs.stat(self.dir, function statDir(err, stats) { if (err || !stats.isDirectory()) { - return fs.mkdir(self.dir, function mkdir(mkdirErr) { + fs.mkdir(self.dir, function mkdir(mkdirErr) { if (!mkdirErr) { - return resolve(true); + resolve(true); + return; } }); + return; } - return resolve(true); + resolve(true); + return; }); }); }; @@ -105,7 +108,7 @@ ModelExport.prototype.createModels = function createModels() { } //for future association self.associate[lowerName] = modelName; - return generatePromises.push(self.generateTemps({ + generatePromises.push(self.generateTemps({ tableName: table, modelName: modelName, fields: results[1][table] diff --git a/lib/shell/lib/Shell.js b/lib/shell/lib/Shell.js index 9081c90..2e347d8 100644 --- a/lib/shell/lib/Shell.js +++ b/lib/shell/lib/Shell.js @@ -1,5 +1,4 @@ 'use strict'; -/* global app */ /*eslint no-magic-numbers: 0 */ var EventEmitter, Interface, Request, Response, shell, events, readline; @@ -219,7 +218,7 @@ shell = (function exportShell(_super) { } else if (this.parent) { return this.parent.set(setting); } - + return this; }; Shell.prototype.prompt = function prompt() { diff --git a/lib/shell/lib/plugins/help.js b/lib/shell/lib/plugins/help.js index 3464448..be1e98d 100644 --- a/lib/shell/lib/plugins/help.js +++ b/lib/shell/lib/plugins/help.js @@ -50,7 +50,8 @@ module.exports = function help(settings) { var route = routes[shell.routeName[command]]; if (!route) { res.red('command ' + command + ' not found'); - return res.prompt(); + res.prompt(); + return; } res.yellow('Help:').ln(); res.print(pad('', firstPad)).white(route.description).ln().ln(); @@ -90,7 +91,8 @@ module.exports = function help(settings) { res.ln(); }); - return res.prompt(); + res.prompt(); + return; } var routeText; res.yellow('Available commands:'); @@ -102,14 +104,16 @@ module.exports = function help(settings) { res.print(pad('', firstPad)).green(routeText).white(rte.description).ln(); } }); - return res.prompt(); + res.prompt(); + return; }; console.log('add routes'); shell.cmd('help {command(([\\w\\:])*)?}', 'Show this message', shell.help.bind(shell)); shell.cmd('', shell.help.bind(shell)); if (shell.isShell && settings.introduction) { text = typeof settings.introduction === 'string' ? settings.introduction : introduction; - return shell.styles.println(text); + shell.styles.println(text); + return; } }; diff --git a/lib/shell/lib/plugins/router.js b/lib/shell/lib/plugins/router.js index 218cca0..06542d0 100644 --- a/lib/shell/lib/plugins/router.js +++ b/lib/shell/lib/plugins/router.js @@ -59,10 +59,10 @@ var match = function match(req, routes) { if ((/^\-\-/).test(arg)) { arg = arg.replace('--', ''); route.options[arg] = true; - return; + return ; } if (keyArg >= keys.length) { - return; + return ; } param = keys.shift(); key = param.key; @@ -83,7 +83,7 @@ var match = function match(req, routes) { req._route_index = routeKey; // throw new Error('missing parameter'); routeOk = route; - return false; + return; } }); // console.debug('routes:',routes); @@ -121,7 +121,7 @@ module.exports = function router(settings) { var args, route; args = Array.prototype.slice.call(arguments); if (!args[0]) { - return; + return this; } route = {}; route.command = args.shift(); diff --git a/lib/shell/lib/routes/shellOnly.js b/lib/shell/lib/routes/shellOnly.js index 04c9701..e1501bd 100644 --- a/lib/shell/lib/routes/shellOnly.js +++ b/lib/shell/lib/routes/shellOnly.js @@ -13,5 +13,5 @@ module.exports = function shellOnly(req, res, next) { res.prompt(); return; } - return next(); + next(); }; diff --git a/lib/utils.js b/lib/utils.js index b32a37a..29151c4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -41,6 +41,7 @@ module.exports = { return path.normalize(dir + '/..'); } } + throw new Error('Workspace not found'); } }; From 2472a6a570024c3332d4278f86fda7a36509d3df Mon Sep 17 00:00:00 2001 From: dev2a Date: Sat, 29 Dec 2018 20:22:20 +0100 Subject: [PATCH 4/8] [Chore] Fix typo --- lib/shell/lib/Shell.js | 2 +- lib/shell/lib/plugins/history.js | 4 ++-- readme.md | 4 ++-- test/lib/shell/routes/testMiddlewares.js | 6 ++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/shell/lib/Shell.js b/lib/shell/lib/Shell.js index 2e347d8..efec0eb 100644 --- a/lib/shell/lib/Shell.js +++ b/lib/shell/lib/Shell.js @@ -15,7 +15,7 @@ Interface = require('readline').Interface; var console; Interface.prototype.setPrompt = (function setPrompt(parent) { - return function returnSetPromt() { + return function returnSetPrompt() { var args = Array.prototype.slice.call(arguments); if (!args[1]) { args[1] = Styles.unstyle(args[0]).length; diff --git a/lib/shell/lib/plugins/history.js b/lib/shell/lib/plugins/history.js index c495901..be76737 100644 --- a/lib/shell/lib/plugins/history.js +++ b/lib/shell/lib/plugins/history.js @@ -14,7 +14,7 @@ History plugin Persistent command history over multiple sessions. Options passed during creation are: - `shell` , (required) A reference to your shell application. -- `name` , Identify your project history file, default to the hash of the exectuted file +- `name` , Identify your project history file, default to the hash of the executed file - `dir` , Location of the history files, defaults to `"#{process.env['HOME']}/.node_shell"` */ @@ -56,6 +56,6 @@ module.exports = function history(settings) { return parent.apply(this, arguments); }; })(Interface.prototype._addHistory); - return null; + return; }; diff --git a/readme.md b/readme.md index d2e05fe..b189eca 100644 --- a/readme.md +++ b/readme.md @@ -23,7 +23,7 @@ Install laravel-queue npm install --save laravel-queue ``` -After init the apllication +After init the application ``` ./artisan init @@ -32,7 +32,7 @@ After init the apllication It ask for laravel project path then ask for command path (relative to laravel project path) then when asked add this to Console/kernel.php -> if your commands folder is not standart(e.g app/Console/Commands), +> if your commands folder is not standard(e.g app/Console/Commands), dont forget to change namespace of the class ```php diff --git a/test/lib/shell/routes/testMiddlewares.js b/test/lib/shell/routes/testMiddlewares.js index 745ae4a..8360d16 100644 --- a/test/lib/shell/routes/testMiddlewares.js +++ b/test/lib/shell/routes/testMiddlewares.js @@ -53,7 +53,6 @@ module.exports = { res.print('message from function'); res.prompt(); - // throw new Error('testr'); } ]); app.start(); @@ -80,14 +79,13 @@ module.exports = { app.cmd('test:middleware', [ shell.routes.confirm('are you sure'), function afterMiddleware(req, res) { - // throw new Error('testr'); res.print('message from function'); res.prompt(); } ]); app.start(); }, - 'test shellonly Middelware No': function confirmMiddelwareNo(test) { + 'test shell only Middelware No': function confirmMiddelwareNo(test) { var stdout = []; process.argv = ['node', appdir + '/artisan', 'test:middleware']; bddStdin(''); @@ -115,7 +113,7 @@ module.exports = { ]); app.start(); }, - 'test shellonly Middelware Yes': function confirmMiddelwareYes(test) { + 'test shell only Middelware Yes': function confirmMiddelwareYes(test) { var stdout = []; process.argv = ['node', appdir + '/artisan']; bddStdin('', 'test:middleware\n', 'quit\n'); From dabf29af37f70a924689d6e72c0b05656310f03b Mon Sep 17 00:00:00 2001 From: dev2a Date: Wed, 2 Jan 2019 22:26:38 +0100 Subject: [PATCH 5/8] [Fix] execute app --- data/base/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/base/index.js b/data/base/index.js index 7c27bc5..04cab49 100644 --- a/data/base/index.js +++ b/data/base/index.js @@ -1,6 +1,6 @@ /* eslint global-require: 0 */ try { - require('laravel-queue/bootstrap/app'); + require('laravel-queue/bootstrap/app')(); } catch(e) { console.log(e.message); } From 05b204d8ca99fb6f187abfb8d391a1ab6fe013a1 Mon Sep 17 00:00:00 2001 From: dev2a Date: Wed, 2 Jan 2019 22:29:02 +0100 Subject: [PATCH 6/8] [Test] Return empty string in intercept stdout --- Commands/init.js | 2 +- test/Commands/testInit.js | 1 + test/Commands/testLaravelConfig.js | 7 ++++++- test/Commands/testMakeCommand.js | 2 ++ test/Commands/testMissingJob.js | 1 + test/Commands/testModelsCreator.js | 1 + test/bootstrap/testInitCommand.js | 1 + test/bootstrap/testInitIndex.js | 1 + test/data/laravel_fake/artisan | 2 +- test/lib/shell/plugins/testHelp.js | 3 +++ test/lib/shell/plugins/testHistory.js | 1 + test/lib/shell/plugins/testRouter.js | 1 + test/lib/shell/routes/testMiddlewares.js | 6 ++++++ 13 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Commands/init.js b/Commands/init.js index 259a9e9..e6e080d 100644 --- a/Commands/init.js +++ b/Commands/init.js @@ -101,7 +101,7 @@ var writeConf = function writeConf() { comment += "*\n"; comment += "* config:\n"; comment += "* key: name of the config in laravel\n"; - comment += "* inport: - true import without ask\n"; + comment += "* import: - true import without ask\n"; comment += "* - false don't import\n"; comment += "* asis: true same as laravel\n"; comment += "* false look for a file with the key name in lib/config folder\n"; diff --git a/test/Commands/testInit.js b/test/Commands/testInit.js index b7e467b..c00c7dc 100644 --- a/test/Commands/testInit.js +++ b/test/Commands/testInit.js @@ -99,6 +99,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testLaravelConfig.js b/test/Commands/testLaravelConfig.js index c69efb8..8ac75ab 100644 --- a/test/Commands/testLaravelConfig.js +++ b/test/Commands/testLaravelConfig.js @@ -58,7 +58,7 @@ module.exports = { stdout.push(txt); } - // return ''; + return ''; }); app.init({ chdir: appdir + '/' @@ -155,6 +155,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -196,6 +197,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -239,6 +241,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -273,6 +276,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -326,6 +330,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testMakeCommand.js b/test/Commands/testMakeCommand.js index e2154d2..b57852f 100644 --- a/test/Commands/testMakeCommand.js +++ b/test/Commands/testMakeCommand.js @@ -31,6 +31,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -62,6 +63,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testMissingJob.js b/test/Commands/testMissingJob.js index d3d435f..97ecc05 100644 --- a/test/Commands/testMissingJob.js +++ b/test/Commands/testMissingJob.js @@ -34,6 +34,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testModelsCreator.js b/test/Commands/testModelsCreator.js index 7594044..f4f60ab 100644 --- a/test/Commands/testModelsCreator.js +++ b/test/Commands/testModelsCreator.js @@ -189,6 +189,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/bootstrap/testInitCommand.js b/test/bootstrap/testInitCommand.js index 8122ed5..cfd1949 100644 --- a/test/bootstrap/testInitCommand.js +++ b/test/bootstrap/testInitCommand.js @@ -51,6 +51,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); rewire('../utils/bootstrap'); app.init({ diff --git a/test/bootstrap/testInitIndex.js b/test/bootstrap/testInitIndex.js index c7d3ee7..eb810a7 100644 --- a/test/bootstrap/testInitIndex.js +++ b/test/bootstrap/testInitIndex.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); var appTest = rewire('../../bootstrap/app'); var fakeRedis = new FakeRedis(); diff --git a/test/data/laravel_fake/artisan b/test/data/laravel_fake/artisan index 2bf96ec..84de961 100644 --- a/test/data/laravel_fake/artisan +++ b/test/data/laravel_fake/artisan @@ -26,7 +26,7 @@ if (isset($argv[1])) { $config = [ 'app' => [ 'env' => 'testing', - 'debug' => true, + 'debug' => false, 'url' => 'http://localhost', 'timezone' => 'UTC', 'locale' => 'en', diff --git a/test/lib/shell/plugins/testHelp.js b/test/lib/shell/plugins/testHelp.js index 370b3f7..866dff6 100644 --- a/test/lib/shell/plugins/testHelp.js +++ b/test/lib/shell/plugins/testHelp.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.argv = ['node', appdir + '/artisan']; bddStdin('help\n', 'quit\n'); @@ -52,6 +53,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); bddStdin('help\n', 'quit\n'); app.init({ @@ -80,6 +82,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.argv = ['node', appdir + '/artisan']; bddStdin('help test\n', 'help test:second\n', 'help test:third\n', 'help not:found\n', 'quit\n'); diff --git a/test/lib/shell/plugins/testHistory.js b/test/lib/shell/plugins/testHistory.js index 1deeedd..7acb45f 100644 --- a/test/lib/shell/plugins/testHistory.js +++ b/test/lib/shell/plugins/testHistory.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/lib/shell/plugins/testRouter.js b/test/lib/shell/plugins/testRouter.js index e98da9c..c589c27 100644 --- a/test/lib/shell/plugins/testRouter.js +++ b/test/lib/shell/plugins/testRouter.js @@ -27,6 +27,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/lib/shell/routes/testMiddlewares.js b/test/lib/shell/routes/testMiddlewares.js index 8360d16..33646df 100644 --- a/test/lib/shell/routes/testMiddlewares.js +++ b/test/lib/shell/routes/testMiddlewares.js @@ -36,6 +36,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -65,6 +66,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -93,6 +95,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -121,6 +124,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -147,6 +151,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -179,6 +184,7 @@ module.exports = { test.equal(Math.round((end - start) / second), 2, 'time equal'); res.prompt(); test.done(); + unhookIntercept(); } ]); app.start(); From 2535820a8cd6a8e246dd25a3c104a832e4d72bde Mon Sep 17 00:00:00 2001 From: dev2a Date: Thu, 3 Jan 2019 11:29:07 +0100 Subject: [PATCH 7/8] [Feat] Remove bluebird --- Commands/laravelConfig.js | 1 - lib/Mail.js | 1 - lib/db-models/lib/Model-export.js | 1 - package-lock.json | 2 +- package.json | 1 - test/Commands/testLaravelConfig.js | 7 +++---- 6 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Commands/laravelConfig.js b/Commands/laravelConfig.js index a2e1bb8..0fdb72b 100644 --- a/Commands/laravelConfig.js +++ b/Commands/laravelConfig.js @@ -2,7 +2,6 @@ /* global app,appdir */ /* eslint global-require: 0 */ -var Promise = require('bluebird'); var shelljs = require('shelljs'); var utils = require('../lib/utilsCmd'); var fs = require('fs-promise'); diff --git a/lib/Mail.js b/lib/Mail.js index 6e6211b..4286ba5 100644 --- a/lib/Mail.js +++ b/lib/Mail.js @@ -2,7 +2,6 @@ /* global appdir,app */ // var console = app.logger(config('core.log.prefix') + ':mail'); -var Promise = require('bluebird'); var ect = require('ect'); var defaults = require('lodash/defaults'); var nodemailer = require('nodemailer'); diff --git a/lib/db-models/lib/Model-export.js b/lib/db-models/lib/Model-export.js index 72340dc..b021416 100644 --- a/lib/db-models/lib/Model-export.js +++ b/lib/db-models/lib/Model-export.js @@ -1,7 +1,6 @@ 'use strict'; /* global app */ /* eslint new-cap: 0*/ -var Promise = require('bluebird'); var console = app.logger(app.config('core.log.prefix') + ':model-export'); var _ = require('lodash'); _.mixin(require('lodash-inflection')); diff --git a/package-lock.json b/package-lock.json index d2da82d..4036078 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "laravel-queue", - "version": "1.1.5", + "version": "1.1.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c158a89..dd42612 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "license": "MIT", "dependencies": { "bee-queue": "^0.3.0", - "bluebird": "~3.5.3", "colors": "~1.3.3", "debug-logger": "^0.4.1", "diff": "~3.5.0", diff --git a/test/Commands/testLaravelConfig.js b/test/Commands/testLaravelConfig.js index 8ac75ab..7036a2d 100644 --- a/test/Commands/testLaravelConfig.js +++ b/test/Commands/testLaravelConfig.js @@ -6,7 +6,6 @@ var rewire = require('rewire'); var each = require('lodash/each'); var intercept = require('intercept-stdout'); -var promise = require('bluebird'); var BddStdin = require('../utils/bdd-stdin'); var shell = require('../../lib/shell'); var fs = require('fs-promise'); @@ -41,10 +40,10 @@ module.exports = { process.argv = ['node', appdir + '/artisan', 'laravel:config']; var fsMock = { writeFile: function writeFile() { - return promise.reject(new Error('file not writable')); + return Promise.reject(new Error('file not writable')); }, mkdir: function mkdir() { - return promise.resolve(); + return Promise.resolve(); } }; laravelConfig.__set__({ @@ -91,7 +90,7 @@ module.exports = { var fsMock = clone(fs); fsMock.writeFile = function writeFile(file, content) { if ((/Config\/app\.js$/).test(file)) { - return promise.reject(new Error('file not writable')); + return Promise.reject(new Error('file not writable')); } return fs.writeFile(file, content); }; From f9d7e05fcde1a56c37c9eef05e4ae9daca93eb69 Mon Sep 17 00:00:00 2001 From: dev2a Date: Thu, 3 Jan 2019 11:34:56 +0100 Subject: [PATCH 8/8] v1.1.8 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4036078..0b6c7a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "laravel-queue", - "version": "1.1.7", + "version": "1.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dd42612..3083c03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "laravel-queue", - "version": "1.1.7", + "version": "1.1.8", "description": "run job from laravel", "main": "index.js", "homepage": "https://github.com/icfr/laravel-node-queue",