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

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), { const argv = parseArgs(process.argv.slice(2), {
alias: { alias: {
h: 'help' h: 'help',
v: 'verbose'
}, },
boolean: ['h'] boolean: ['h'],
default: {
v: false
}
}) })
if (argv.help) { 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') printAndExit('> Couldn\'t find a `pages` directory. Please create one under the project root')
} }
exportApp(dir) exportApp(dir, { verbose: argv.verbose })
.catch((err) => { .catch((err) => {
console.error(err) console.error(err)
process.exit(1) process.exit(1)

View file

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