From 0077d3ddcce9bae6d1eaf5c01c355d12aef51dfb Mon Sep 17 00:00:00 2001 From: Michele Belluco Date: Sat, 13 May 2017 15:26:02 +0200 Subject: [PATCH] no message --- lib/eve.js | 8 +++++--- lib/init.js | 5 +++-- lib/notify.js | 13 ++++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/eve.js b/lib/eve.js index a07b688..bd3982d 100755 --- a/lib/eve.js +++ b/lib/eve.js @@ -6,6 +6,8 @@ const path = require('path'); const pkg = require('../package.json'); const exec = require('child_process').exec; const ets = require('ets'); +const notify = require('./notify'); + program .version(pkg.version); @@ -44,7 +46,6 @@ program .action(function (type, unit, options) { const build = require('./build'); const scss = require('./scss'); - const notify = require('./notify'); build(type, unit, false, options, function (err, time, type) { if (err) return handleError(err, 'JS'); @@ -68,7 +69,7 @@ program const build = require('./build'); const scss = require('./scss'); const express = require('./express'); - const notify = require('./notify'); + const notify = require('./notify'); express(options, function (err, port) { console.log('Server started at port '.grey + (port + '').cyan); @@ -122,7 +123,8 @@ program const build = require('./build'); const scss = require('./scss'); const express = require('./express'); - const notify = require('./notify'); + const notify = require('./notify'); + options.rootPath = path.join('test', unit); express(options, function (err, port) { diff --git a/lib/init.js b/lib/init.js index c2a1d74..8f5618a 100644 --- a/lib/init.js +++ b/lib/init.js @@ -5,6 +5,7 @@ const spawn = require('child_process').spawn; const waterfall = require('async').waterfall; const colors = require('colors'); + module.exports = function (name, done) { var src = path.join(__dirname, '../resources/app-template'); var dest = path.join(process.cwd(), name); @@ -34,7 +35,7 @@ module.exports = function (name, done) { // }); npm.stderr.on('data', (data) => { - return next(data); + return next(data.toString()); }); npm.on('close', (code) => { @@ -50,7 +51,7 @@ module.exports = function (name, done) { // }); bower.stderr.on('data', (data) => { - return next(data); + return next(data.toString()); }); bower.on('close', (code) => { diff --git a/lib/notify.js b/lib/notify.js index 65eed85..8af1604 100644 --- a/lib/notify.js +++ b/lib/notify.js @@ -2,11 +2,18 @@ const _ = require('underscore'); const path = require('path'); const exec = require('child_process').exec; const NotificationCenter = require('node-notifier').NotificationCenter; -const pkgApp = require(path.resolve('package.json')); -const appName = pkgApp['name']; const everc = require('./everc')(); const defaultEditor = everc['editor']||''; +let pkgApp = {}; +try{ + pkgApp = require(path.resolve('package.json')); +}catch(e){ + pkgApp = {}; +} + +const appName = pkgApp['name']; + const getCommandLine = function getCommandLine() { switch (process.platform) { case 'darwin' : return 'open'; @@ -28,7 +35,7 @@ const n = function n(options, done) { options = _.defaults(options, { - title: `Eve: ${appName}`, + title: appName ? `Eve: ${appName}` : 'Eve', sound: false, group: 2 });