@@ -27,12 +27,22 @@ import { promisify } from 'util';
27
27
import chalk from 'chalk' ;
28
28
import Listr from 'listr' ;
29
29
import { prepare as prepareFirestoreForRelease } from './prepare-firestore-for-exp-release' ;
30
+ import * as yargs from 'yargs' ;
31
+
32
+ const argv = yargs
33
+ . options ( {
34
+ dryRun : {
35
+ type : 'boolean' ,
36
+ default : false
37
+ }
38
+ } )
39
+ . help ( ) . argv ;
30
40
31
41
const writeFile = promisify ( _writeFile ) ;
32
42
const git = simpleGit ( projectRoot ) ;
33
43
const FIREBASE_UMBRELLA_PACKAGE_NAME = 'firebase-exp' ;
34
44
35
- async function publishExpPackages ( ) {
45
+ async function publishExpPackages ( { dryRun } : { dryRun : boolean } ) {
36
46
try {
37
47
/**
38
48
* Welcome to the firebase release CLI!
@@ -68,28 +78,36 @@ async function publishExpPackages() {
68
78
const versions = await updatePackageNamesAndVersions ( packagePaths ) ;
69
79
70
80
/**
71
- * Release packages to NPM
81
+ * Do not publish to npm and create tags if it's a dryrun
72
82
*/
73
- await publishToNpm ( packagePaths ) ;
74
-
75
- /**
76
- * reset the working tree to recover package names with -exp in the package.json files,
77
- * then bump patch version of firebase-exp (the umbrella package) only
78
- */
79
- const firebaseExpVersion = new Map < string , string > ( ) ;
80
- firebaseExpVersion . set (
81
- FIREBASE_UMBRELLA_PACKAGE_NAME ,
82
- versions . get ( FIREBASE_UMBRELLA_PACKAGE_NAME )
83
- ) ;
84
- const firebaseExpPath = packagePaths . filter ( p =>
85
- p . includes ( FIREBASE_UMBRELLA_PACKAGE_NAME )
86
- ) ;
87
- await resetWorkingTreeAndBumpVersions ( firebaseExpPath , firebaseExpVersion ) ;
83
+ if ( ! dryRun ) {
84
+ /**
85
+ * Release packages to NPM
86
+ */
87
+ await publishToNpm ( packagePaths ) ;
88
+
89
+ /**
90
+ * reset the working tree to recover package names with -exp in the package.json files,
91
+ * then bump patch version of firebase-exp (the umbrella package) only
92
+ */
93
+ const firebaseExpVersion = new Map < string , string > ( ) ;
94
+ firebaseExpVersion . set (
95
+ FIREBASE_UMBRELLA_PACKAGE_NAME ,
96
+ versions . get ( FIREBASE_UMBRELLA_PACKAGE_NAME )
97
+ ) ;
98
+ const firebaseExpPath = packagePaths . filter ( p =>
99
+ p . includes ( FIREBASE_UMBRELLA_PACKAGE_NAME )
100
+ ) ;
101
+ await resetWorkingTreeAndBumpVersions (
102
+ firebaseExpPath ,
103
+ firebaseExpVersion
104
+ ) ;
88
105
89
- /**
90
- * push to github
91
- */
92
- await commitAndPush ( versions ) ;
106
+ /**
107
+ * push to github
108
+ */
109
+ await commitAndPush ( versions ) ;
110
+ }
93
111
} catch ( err ) {
94
112
/**
95
113
* Log any errors that happened during the process
@@ -347,4 +365,4 @@ async function getCurrentSha() {
347
365
return ( await git . revparse ( [ '--short' , 'HEAD' ] ) ) . trim ( ) ;
348
366
}
349
367
350
- publishExpPackages ( ) ;
368
+ publishExpPackages ( argv ) ;
0 commit comments