Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit c69e2ba

Browse files
committed
Verify that the entry module argument for quick commands exists, to avoid a confusing error message
Fixes #441
1 parent 44297ea commit c69e2ba

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Unreleased (in `master`)
2+
3+
## Changed
4+
5+
- 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)]
6+
17
# 0.24.3 / 2020-03-14
28

39
## Changed

src/quickCommands.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @flow
2+
import fs from 'fs'
23
import path from 'path'
34

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

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

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

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

0 commit comments

Comments
 (0)