Add the verbose mode.

This commit is contained in:
Arunoda Susiripala 2017-05-08 18:53:08 -07:00
parent 311e4ca0ee
commit 71296cceb3
2 changed files with 12 additions and 4 deletions

View file

@ -9,9 +9,13 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help'
h: 'help',
v: 'verbose'
},
boolean: ['h']
boolean: ['h'],
default: {
v: false
}
})
if (argv.help) {
@ -44,7 +48,7 @@ if (!existsSync(join(dir, 'pages'))) {
printAndExit('> Couldn\'t find a `pages` directory. Please create one under the project root')
}
exportApp(dir)
exportApp(dir, { verbose: argv.verbose })
.catch((err) => {
console.error(err)
process.exit(1)

View file

@ -7,7 +7,7 @@ import getConfig from './config'
import { renderToHTML } from './render'
import { printAndExit } from '../lib/utils'
export default async function (dir) {
export default async function (dir, options) {
dir = resolve(dir)
const outDir = join(dir, '.out')
const nextDir = join(dir, '.next')
@ -66,6 +66,10 @@ export default async function (dir) {
}
for (const path of exportPaths) {
if (options.verbose) {
console.log(` exporing path: ${path}`)
}
const { page, query } = exportPathMap[path]
const req = { url: path }
const res = {}