1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/bin/next-build
Stephen Sauceda 955f6817c4 Add cli usage information (#423)
* add cli usage: `next init`

* add cli usage: `next --help`

* add cli usage: `next build --help`

* add cli usage: `next dev --help`

* add cli usage: `next init --help`

* add cli usage: `next start --help`

* use set

* build, start and dev all accept a directory

* typo and conciseness
2016-12-18 12:28:34 -08:00

35 lines
644 B
JavaScript
Executable file

#!/usr/bin/env node
import { resolve } from 'path'
import parseArgs from 'minimist'
import build from '../server/build'
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help'
},
boolean: ['h']
})
if (argv.help) {
console.log(`
Description
Compiles the application for production deployment
Usage
$ next build <dir>
<dir> represents where the compiled .next folder should go.
If no directory is provided, .next will be created in the current directory
`)
process.exit(0)
}
const dir = resolve(argv._[0] || '.')
build(dir)
.catch((err) => {
console.error(err)
process.exit(1)
})