mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
955f6817c4
* 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
35 lines
644 B
JavaScript
Executable file
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)
|
|
})
|