diff --git a/packages/strapi-utils/lib/models.js b/packages/strapi-utils/lib/models.js index 4cc6981971..4f416be13a 100755 --- a/packages/strapi-utils/lib/models.js +++ b/packages/strapi-utils/lib/models.js @@ -13,7 +13,7 @@ const _ = require('lodash'); // Following this discussion https://stackoverflow.com/questions/18082/validate-decimal-numbers-in-javascript-isnumeric this function is the best implem to determine if a value is a valid number candidate const isNumeric = (value) => { return !isNaN(parseFloat(value)) && isFinite(value); -} +}; /* eslint-disable prefer-template */ /* diff --git a/packages/strapi/bin/strapi-start.js b/packages/strapi/bin/strapi-start.js index f6b2d4bd1e..9f109f43c7 100755 --- a/packages/strapi/bin/strapi-start.js +++ b/packages/strapi/bin/strapi-start.js @@ -13,6 +13,7 @@ const cluster = require('cluster'); // Public dependencies const fs = require('fs'); const _ = require('lodash'); +const {cyan} = require('chalk'); // Logger. const { cli, logger } = require('strapi-utils'); @@ -27,7 +28,7 @@ const { cli, logger } = require('strapi-utils'); module.exports = function(appPath = '') { // Check that we're in a valid Strapi project. if (!cli.isStrapiApp()) { - return logger.error('This command can only be used inside a Strapi project.'); + return console.log(`⛔️ ${cyan('strapi start')} can only be used inside a Strapi project.`); } appPath = path.join(process.cwd(), appPath); diff --git a/packages/strapi/lib/Strapi.js b/packages/strapi/lib/Strapi.js index 152dfe90d5..d5b7c44b21 100755 --- a/packages/strapi/lib/Strapi.js +++ b/packages/strapi/lib/Strapi.js @@ -112,19 +112,21 @@ class Strapi extends EventEmitter { // Launch server. this.server.listen(this.config.port, err => { if (err) { - this.log.debug(`Server wasn't able to start properly.`); - console.error(err); + this.log.debug(`⚠️ Server wasn't able to start properly.`); + this.log.error(err); return this.stop(); } - this.log.info('Server started in ' + this.config.appPath); - this.log.info('Your server is running at ' + this.config.url); - this.log.debug('Time: ' + new Date()); - this.log.debug('Launched in: ' + (Date.now() - this.config.launchedAt) + ' ms'); - this.log.debug('Environment: ' + this.config.environment); - this.log.debug('Process PID: ' + process.pid); - this.log.debug(`Version: ${this.config.info.strapi} (node v${this.config.info.node})`); + this.log.info('Time: ' + new Date()); + this.log.info('Launched in: ' + (Date.now() - this.config.launchedAt) + ' ms'); + this.log.info('Environment: ' + this.config.environment); + this.log.info('Process PID: ' + process.pid); + this.log.info(`Version: ${this.config.info.strapi} (node v${this.config.info.node})`); this.log.info('To shut down your server, press + C at any time'); + console.log(); + this.log.info(`☄️ Admin panel: ${this.config.url}/admin`); + this.log.info(`⚡️ Server: ${this.config.url}`); + console.log(); // Emit started event. this.emit('server:started'); @@ -134,8 +136,8 @@ class Strapi extends EventEmitter { } }); } catch (err) { - this.log.debug(`Server wasn't able to start properly.`); - console.error(err); + this.log.debug(`⛔️ Server wasn't able to start properly.`); + this.log.error(err); this.stop(); } } @@ -154,7 +156,7 @@ class Strapi extends EventEmitter { this.server.on('error', err => { if (err.code === 'EADDRINUSE') { - this.log.debug(`Server wasn't able to start properly.`); + this.log.debug(`⛔️ Server wasn't able to start properly.`); this.log.error(`The port ${err.port} is already used by another application.`); this.stop(); return;