1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Merge pull request #46 from zeit/add/error-pages-dir

Error instead of warning on missing pages dir
This commit is contained in:
Naoyuki Kanezawa 2016-10-26 00:04:08 +09:00 committed by GitHub
commit cab1e90aad
4 changed files with 7 additions and 6 deletions

View file

@ -16,5 +16,5 @@ const dir = resolve(argv._[0] || '.')
build(dir) build(dir)
.catch((err) => { .catch((err) => {
console.error(err) console.error(err)
exit(1) process.exit(1)
}) })

View file

@ -27,13 +27,14 @@ clean(dir)
// Check if pages dir exists and warn if not // Check if pages dir exists and warn if not
if (!(await exists(join(dir, 'pages')))) { if (!(await exists(join(dir, 'pages')))) {
if (await exists(join(dir, '..', 'pages'))) { if (await exists(join(dir, '..', 'pages'))) {
console.warn('> No `pages` directory found. Did you mean to run `next` in the parent (`../`) directory?') console.error('> No `pages` directory found. Did you mean to run `next` in the parent (`../`) directory?')
} else { } else {
console.warn('> Couldn\'t find a `pages` directory. Please create one under the project root') console.error('> Couldn\'t find a `pages` directory. Please create one under the project root')
} }
process.exit(1)
} }
}) })
.catch((err) => { .catch((err) => {
console.error(err) console.error(err)
exit(1) process.exit(1)
}) })

View file

@ -34,7 +34,7 @@ exists(join(dir, 'package.json'))
}) })
.catch((err) => { .catch((err) => {
console.error(err) console.error(err)
exit(1) process.exit(1)
}) })
const basePackage = `{ const basePackage = `{

View file

@ -24,5 +24,5 @@ srv.start(argv.port)
}) })
.catch((err) => { .catch((err) => {
console.error(err) console.error(err)
exit(1) process.exit(1)
}) })