File tree 5 files changed +86
-2
lines changed
5 files changed +86
-2
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,29 @@ import { watchFile } from 'fs'
6
6
7
7
const defaultCommand = 'dev'
8
8
const commands = new Set ( [
9
- defaultCommand ,
10
9
'init' ,
11
10
'build' ,
12
- 'start'
11
+ 'start' ,
12
+ defaultCommand
13
13
] )
14
14
15
15
let cmd = process . argv [ 2 ]
16
16
let args
17
17
18
+ if ( new Set ( [ '--help' , '-h' ] ) . has ( cmd ) ) {
19
+ console . log ( `
20
+ Usage
21
+ $ next <command>
22
+
23
+ Available commands
24
+ ${ Array . from ( commands ) . join ( ', ' ) }
25
+
26
+ For more information run a command with the --help flag
27
+ $ next init --help
28
+ ` )
29
+ process . exit ( 0 )
30
+ }
31
+
18
32
if ( commands . has ( cmd ) ) {
19
33
args = process . argv . slice ( 3 )
20
34
} else {
Original file line number Diff line number Diff line change @@ -11,6 +11,20 @@ const argv = parseArgs(process.argv.slice(2), {
11
11
boolean : [ 'h' ]
12
12
} )
13
13
14
+ if ( argv . help ) {
15
+ console . log ( `
16
+ Description
17
+ Compiles the application for production deployment
18
+
19
+ Usage
20
+ $ next build <dir>
21
+
22
+ <dir> represents where the compiled .next folder should go.
23
+ If no directory is provided, .next will be created in the current directory
24
+ ` )
25
+ process . exit ( 0 )
26
+ }
27
+
14
28
const dir = resolve ( argv . _ [ 0 ] || '.' )
15
29
16
30
build ( dir )
Original file line number Diff line number Diff line change @@ -16,6 +16,25 @@ const argv = parseArgs(process.argv.slice(2), {
16
16
}
17
17
} )
18
18
19
+ if ( argv . help ) {
20
+ console . log ( `
21
+ Description
22
+ Starts the application in development mode (hot-code reloading, error
23
+ reporting, etc)
24
+
25
+ Usage
26
+ $ next dev <dir> -p <port number>
27
+
28
+ <dir> represents where the compiled .next folder should go.
29
+ If no directory is provided, .next will be created in the current directory
30
+
31
+ Options
32
+ --port, -p A port number on which to start the application
33
+ --help, -p Displays this message
34
+ ` )
35
+ process . exit ( 0 )
36
+ }
37
+
19
38
const dir = resolve ( argv . _ [ 0 ] || '.' )
20
39
21
40
const srv = new Server ( { dir, dev : true } )
Original file line number Diff line number Diff line change @@ -11,6 +11,23 @@ const argv = parseArgs(process.argv.slice(2), {
11
11
boolean : [ 'h' ]
12
12
} )
13
13
14
+ if ( argv . help ) {
15
+ console . log ( `
16
+ Description
17
+ Scaffolds a simple project structure to get started quickly
18
+
19
+ Usage
20
+ $ next init <dir>
21
+
22
+ If no directory is provided the current directory will be used.
23
+
24
+ Options
25
+ --help, -p Displays this message
26
+ ` )
27
+
28
+ process . exit ( 0 )
29
+ }
30
+
14
31
const dir = resolve ( argv . _ [ 0 ] || '.' )
15
32
16
33
if ( basename ( dir ) === 'pages' ) {
Original file line number Diff line number Diff line change @@ -15,6 +15,26 @@ const argv = parseArgs(process.argv.slice(2), {
15
15
}
16
16
} )
17
17
18
+ if ( argv . help ) {
19
+ console . log ( `
20
+ Description
21
+ Starts the application in production mode.
22
+ The application should be compiled with \`next build\` first.
23
+
24
+ Usage
25
+ $ next start <dir> -p <port>
26
+
27
+ <dir> is the directory that contains the compiled .next folder
28
+ created by running \`next build\`.
29
+ If no directory is provided, the current directory will be assumed.
30
+
31
+ Options
32
+ --port, -p A port number on which to start the application
33
+ --help, -p Displays this message
34
+ ` )
35
+ process . exit ( 0 )
36
+ }
37
+
18
38
const dir = resolve ( argv . _ [ 0 ] || '.' )
19
39
20
40
const srv = new Server ( { dir } )
You can’t perform that action at this time.
0 commit comments