Skip to content

Commit

Permalink
feat: improved logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Nov 12, 2018
1 parent 3bb5886 commit 058b5e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions packages/@moonreach/nodepack/src/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/** @typedef {import('../lib/PackPlugin.js').PackPluginApply} PackPluginApply */

const { info, error, done } = require('@moonreach/nodepack-utils')
const { info, error, done, log, chalk } = require('@moonreach/nodepack-utils')

/** @type {PackPluginApply} */
module.exports = (api, options) => {
api.registerCommand('build', {
description: 'Build the app for production',
usage: 'nodepack build [entry]',
}, async (args) => {
info('Preparing production pack...')
info(chalk.blue('Preparing production pack...'))

if (args._ && typeof args._[0] === 'string') {
options.entry = args._[0]
Expand All @@ -31,7 +31,8 @@ module.exports = (api, options) => {
return reject(`Build failed with errors.`)
}

done('Build complete! Your app is ready for production.')
done(chalk.green('Build complete! Your app is ready for production.'))
log(chalk.dim(api.resolve(webpackConfig.output.path)))
resolve()
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/@moonreach/nodepack/src/commands/dev.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/** @typedef {import('../lib/PackPlugin.js').PackPluginApply} PackPluginApply */

const path = require('path')
const { info, error } = require('@moonreach/nodepack-utils')
const { info, error, chalk } = require('@moonreach/nodepack-utils')

/** @type {PackPluginApply} */
module.exports = (api, options) => {
api.registerCommand('dev', {
description: 'Build and live-reload the app',
usage: 'nodepack dev [entry]',
}, async (args) => {
info('Preparing development pack...')
info(chalk.blue('Preparing development pack...'))

if (args._ && typeof args._[0] === 'string') {
options.entry = args._[0]
Expand Down Expand Up @@ -39,9 +39,9 @@ module.exports = (api, options) => {

if (child) {
child.kill()
info('App restarting')
info(chalk.blue('App restarting...'))
} else {
info('App starting')
info(chalk.blue('App starting...'))
}

const file = api.resolve(path.join(webpackConfig.output.path, webpackConfig.output.filename))
Expand Down

0 comments on commit 058b5e7

Please sign in to comment.