Commit 71296cce authored by Arunoda Susiripala's avatar Arunoda Susiripala

Add the verbose mode.

parent 311e4ca0
...@@ -9,9 +9,13 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production' ...@@ -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'))) { ...@@ -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)
......
...@@ -7,7 +7,7 @@ import getConfig from './config' ...@@ -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) { ...@@ -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 = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment