1
1
#!/usr/bin/env node
2
2
import yargs from 'yargs'
3
3
import { join , resolve } from 'path'
4
+ import { rcFile } from 'rc-config-loader'
5
+
4
6
import {
5
7
values ,
6
8
publishPackage ,
@@ -16,6 +18,7 @@ import { showInstallations, cleanInstallations } from './installations'
16
18
import { checkManifest } from './check'
17
19
import { makeConsoleColored , disabledConsoleOutput } from './console'
18
20
import { PublishPackageOptions } from './publish'
21
+ import { readRcConfig } from './rc'
19
22
20
23
const updateFlags = [ 'update' , 'upgrade' , 'up' ]
21
24
@@ -30,7 +33,9 @@ const getVersionMessage = () => {
30
33
31
34
makeConsoleColored ( )
32
35
33
- if ( process . argv . includes ( '--quiet' ) ) {
36
+ const rcArgs = readRcConfig ( )
37
+
38
+ if ( process . argv . includes ( '--quiet' ) || rcArgs . quiet ) {
34
39
disabledConsoleOutput ( )
35
40
}
36
41
@@ -49,6 +54,8 @@ const getPublishOptions = (
49
54
private : argv . private ,
50
55
scripts : argv . scripts ,
51
56
update : argv . update || argv . upgrade ,
57
+ workspaceResolve : argv . workspaceResolve ,
58
+ devMod : argv . devMod ,
52
59
...override ,
53
60
}
54
61
}
87
94
. default ( 'sig' , true )
88
95
. default ( 'scripts' , true )
89
96
. default ( 'dev-mod' , true )
97
+ . default ( 'workspace-resolve' , true )
98
+ . default ( rcArgs )
90
99
. alias ( 'script' , 'scripts' )
91
- . boolean ( [ 'push' , 'push-safe' ] . concat ( publishFlags ) )
100
+ . boolean ( [ 'push' ] . concat ( publishFlags ) )
92
101
} ,
93
102
handler : ( argv ) => {
94
103
return publishPackage ( getPublishOptions ( argv ) )
@@ -103,6 +112,9 @@ yargs
103
112
. default ( 'force' , undefined )
104
113
. default ( 'sig' , true )
105
114
. default ( 'scripts' , true )
115
+ . default ( 'dev-mod' , true )
116
+ . default ( 'workspace-resolve' , true )
117
+ . default ( rcArgs )
106
118
. alias ( 'script' , 'scripts' )
107
119
. boolean ( [ 'safe' ] . concat ( publishFlags ) )
108
120
. option ( 'replace' , { describe : 'Force package content replacement' } )
@@ -141,6 +153,7 @@ yargs
141
153
. alias ( 'D' , 'dev' )
142
154
. boolean ( '-W' )
143
155
. alias ( 'save-dev' , 'dev' )
156
+ . default ( rcArgs )
144
157
. help ( true )
145
158
} ,
146
159
handler : ( argv ) => {
@@ -158,7 +171,7 @@ yargs
158
171
command : 'link' ,
159
172
describe : 'Link package from yalc repo to the project' ,
160
173
builder : ( ) => {
161
- return yargs . help ( true )
174
+ return yargs . default ( rcArgs ) . help ( true )
162
175
} ,
163
176
handler : ( argv ) => {
164
177
return addPackages ( argv . _ . slice ( 1 ) , {
@@ -172,7 +185,10 @@ yargs
172
185
command : 'update' ,
173
186
describe : 'Update packages from yalc repo' ,
174
187
builder : ( ) => {
175
- return yargs . boolean ( [ ...updateFlags ] ) . help ( true )
188
+ return yargs
189
+ . boolean ( [ ...updateFlags ] )
190
+ . default ( rcArgs )
191
+ . help ( true )
176
192
} ,
177
193
handler : ( argv ) => {
178
194
return updatePackages ( argv . _ . slice ( 1 ) , {
@@ -185,7 +201,7 @@ yargs
185
201
command : 'remove' ,
186
202
describe : 'Remove packages from the project' ,
187
203
builder : ( ) => {
188
- return yargs . boolean ( [ 'retreat' , 'all' ] ) . help ( true )
204
+ return yargs . boolean ( [ 'retreat' , 'all' ] ) . default ( rcArgs ) . help ( true )
189
205
} ,
190
206
handler : ( argv ) => {
191
207
return removePackages ( argv . _ . slice ( 1 ) , {
0 commit comments