@@ -132,6 +132,28 @@ childProcess.execSync(`find build/npm -maxdepth 1 -name "*.tgz" -delete`, {
132
132
*/
133
133
const DRY_RUN = ! ! parsedArgs [ 'dry-run' ] ;
134
134
135
+ const pkgFiles = [
136
+ 'package.json' ,
137
+ 'build/npm/create-nx-workspace/package.json' ,
138
+ 'build/npm/create-nx-plugin/package.json' ,
139
+ 'build/npm/schematics/package.json' ,
140
+ 'build/npm/jest/package.json' ,
141
+ 'build/npm/cypress/package.json' ,
142
+ 'build/npm/storybook/package.json' ,
143
+ 'build/npm/angular/package.json' ,
144
+ 'build/npm/react/package.json' ,
145
+ 'build/npm/next/package.json' ,
146
+ 'build/npm/web/package.json' ,
147
+ 'build/npm/node/package.json' ,
148
+ 'build/npm/express/package.json' ,
149
+ 'build/npm/nest/package.json' ,
150
+ 'build/npm/workspace/package.json' ,
151
+ 'build/npm/cli/package.json' ,
152
+ 'build/npm/tao/package.json' ,
153
+ 'build/npm/eslint-plugin-nx/package.json' ,
154
+ 'build/npm/linter/package.json' ,
155
+ 'build/npm/nx-plugin/package.json'
156
+ ] ;
135
157
/**
136
158
* Set the static options for release-it
137
159
*/
@@ -147,28 +169,7 @@ const options = {
147
169
* All the package.json files that will have their version updated
148
170
* by release-it
149
171
*/
150
- pkgFiles : [
151
- 'package.json' ,
152
- 'build/npm/schematics/package.json' ,
153
- 'build/npm/create-nx-workspace/package.json' ,
154
- 'build/npm/create-nx-plugin/package.json' ,
155
- 'build/npm/jest/package.json' ,
156
- 'build/npm/cypress/package.json' ,
157
- 'build/npm/storybook/package.json' ,
158
- 'build/npm/angular/package.json' ,
159
- 'build/npm/react/package.json' ,
160
- 'build/npm/next/package.json' ,
161
- 'build/npm/web/package.json' ,
162
- 'build/npm/node/package.json' ,
163
- 'build/npm/express/package.json' ,
164
- 'build/npm/nest/package.json' ,
165
- 'build/npm/workspace/package.json' ,
166
- 'build/npm/cli/package.json' ,
167
- 'build/npm/tao/package.json' ,
168
- 'build/npm/eslint-plugin-nx/package.json' ,
169
- 'build/npm/linter/package.json' ,
170
- 'build/npm/nx-plugin/package.json'
171
- ] ,
172
+ pkgFiles : pkgFiles ,
172
173
increment : parsedVersion . version ,
173
174
requireUpstream : false ,
174
175
github : {
@@ -192,37 +193,46 @@ const options = {
192
193
requireCleanWorkingDir : false
193
194
} ;
194
195
195
- releaseIt ( options )
196
- . then ( output => {
197
- if ( DRY_RUN ) {
198
- console . warn ( 'WARNING: In DRY_RUN mode - not running publishing script' ) ;
199
- process . exit ( 0 ) ;
200
- return ;
201
- }
196
+ childProcess . execSync ( 'rm -rf ./build/packages/bazel' ) ;
197
+ childProcess . execSync ( 'rm -rf ./build/npm/bazel' ) ;
202
198
203
- // if (parsedArgs.nobazel) {
204
- childProcess . execSync ( 'rm -rf ./build/packages/bazel' ) ;
205
- childProcess . execSync ( 'rm -rf ./build/npm/bazel' ) ;
206
- // }
207
-
208
- /**
209
- * We always use either "latest" or "next" (i.e. no separate tags for alpha, beta etc)
210
- */
211
- const npmTag = parsedVersion . isPrerelease ? 'next' : 'latest' ;
212
- const npmPublishCommand = `./scripts/publish.sh ${
213
- output . version
214
- } ${ npmTag } ${ parsedArgs . local ? '--local' : '' } `;
215
- console . log ( 'Executing publishing script for all packages:' ) ;
216
- console . log ( `> ${ npmPublishCommand } ` ) ;
217
- console . log (
218
- `Note: You will need to authenticate with your NPM credentials`
219
- ) ;
220
- childProcess . execSync ( npmPublishCommand , {
199
+ if ( parsedArgs . local ) {
200
+ pkgFiles . forEach ( p => {
201
+ const content = JSON . parse ( fs . readFileSync ( p ) . toString ( ) ) ;
202
+ content . version = parsedVersion . version ;
203
+ fs . writeFileSync ( p , JSON . stringify ( content , null , 2 ) ) ;
204
+ } ) ;
205
+ childProcess . execSync (
206
+ `./scripts/publish.sh ${ parsedVersion . version } latest --local` ,
207
+ {
221
208
stdio : [ 0 , 1 , 2 ]
209
+ }
210
+ ) ;
211
+ process . exit ( 0 ) ;
212
+ } else {
213
+ releaseIt ( options )
214
+ . then ( output => {
215
+ if ( DRY_RUN ) {
216
+ console . warn (
217
+ 'WARNING: In DRY_RUN mode - not running publishing script'
218
+ ) ;
219
+ process . exit ( 0 ) ;
220
+ return ;
221
+ }
222
+ const npmTag = parsedVersion . isPrerelease ? 'next' : 'latest' ;
223
+ const npmPublishCommand = `./scripts/publish.sh ${ output . version } ${ npmTag } ` ;
224
+ console . log ( 'Executing publishing script for all packages:' ) ;
225
+ console . log ( `> ${ npmPublishCommand } ` ) ;
226
+ console . log (
227
+ `Note: You will need to authenticate with your NPM credentials`
228
+ ) ;
229
+ childProcess . execSync ( npmPublishCommand , {
230
+ stdio : [ 0 , 1 , 2 ]
231
+ } ) ;
232
+ process . exit ( 0 ) ;
233
+ } )
234
+ . catch ( err => {
235
+ console . error ( err . message ) ;
236
+ process . exit ( 1 ) ;
222
237
} ) ;
223
- process . exit ( 0 ) ;
224
- } )
225
- . catch ( err => {
226
- console . error ( err . message ) ;
227
- process . exit ( 1 ) ;
228
- } ) ;
238
+ }
0 commit comments