File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,16 @@ const { values, positionals } = parseArgs({
37
37
version : {
38
38
type : 'boolean' ,
39
39
} ,
40
+ // Deprecated
41
+ watch : {
42
+ type : 'boolean' ,
43
+ short : 'w' ,
44
+ } ,
40
45
} ,
41
46
allowPositionals : true ,
42
47
} )
43
48
49
+ // --help
44
50
if ( values . help || positionals . length === 0 ) {
45
51
console . log ( `Usage: json-server [options] <file>
46
52
Options:
@@ -52,6 +58,7 @@ Options:
52
58
process . exit ( )
53
59
}
54
60
61
+ // --version
55
62
if ( values . version ) {
56
63
const pkg = JSON . parse (
57
64
readFileSync ( join ( __dirname , '../package.json' ) , 'utf8' ) ,
@@ -60,6 +67,15 @@ if (values.version) {
60
67
process . exit ( )
61
68
}
62
69
70
+ // Handle --watch
71
+ if ( values . watch ) {
72
+ console . log (
73
+ chalk . yellow (
74
+ '--watch/-w can be omitted, JSON Server 1+ watches for file changes by default' ,
75
+ ) ,
76
+ )
77
+ }
78
+
63
79
// App args and options
64
80
const file = positionals [ 0 ] ?? ''
65
81
const port = parseInt ( values . port ?? process . env [ 'PORT' ] ?? '3000' )
You can’t perform that action at this time.
0 commit comments