Skip to content

Commit

Permalink
Verify that the entry module argument for quick commands exists, to a…
Browse files Browse the repository at this point in the history
…void a confusing error message

Fixes #441
  • Loading branch information
insin committed Mar 16, 2020
1 parent 44297ea commit c69e2ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Unreleased (in `master`)

## Changed

- Validate that the entry module for quick commands (`nwb react`, `nwb preact`, `nwb inferno`) exists, to avoid a confusing error message [[#441](https://github.com/insin/nwb/issues/441)]

# 0.24.3 / 2020-03-14

## Changed
Expand Down
7 changes: 7 additions & 0 deletions src/quickCommands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
import fs from 'fs'
import path from 'path'

import runSeries from 'run-series'
Expand Down Expand Up @@ -40,6 +41,9 @@ export function build(args: Object, appConfig: QuickAppConfig, cb: ErrBack) {
if (args._.length === 1) {
return cb(new UserError('An entry module must be specified.'))
}
if (!fs.existsSync(args._[1])) {
return cb(new UserError(`${args._[1]} does not exist.`))
}

let dist = args._[2] || 'dist'

Expand Down Expand Up @@ -187,6 +191,9 @@ export function serve(args: Object, appConfig: QuickAppConfig, cb: ErrBack) {
if (args._.length === 1) {
return cb(new UserError('An entry module must be specified.'))
}
if (!fs.existsSync(args._[1])) {
return cb(new UserError(`${args._[1]} does not exist.`))
}

runSeries([
(cb) => install(appConfig.getQuickDependencies(), {args, check: true}, cb),
Expand Down

0 comments on commit c69e2ba

Please sign in to comment.