@@ -17,6 +17,7 @@ const noDeploy = args.has("--no-deploy");
1717const isBackend = args . has ( "--be" ) ;
1818const isDryRun = args . has ( "--dry" ) ;
1919const noSyncCheck = args . has ( "--no-sync-check" ) ;
20+ const hotfix = args . has ( "--hotfix" ) ;
2021
2122const PROJECT_ROOT = path . resolve ( __dirname , "../../../" ) ;
2223
@@ -235,27 +236,31 @@ const createGithubRelease = async (version, changelogContent) => {
235236} ;
236237
237238const main = async ( ) => {
238- console . log ( " Starting release process..." ) ;
239+ console . log ( ` Starting ${ hotfix ? "hotfix" : " release" } process...` ) ;
239240
240- checkBranchSync ( ) ;
241+ if ( ! hotfix ) checkBranchSync ( ) ;
241242
242243 checkUncommittedChanges ( ) ;
243244
244- const changelogContent = await generateChangelog ( ) ;
245+ let changelogContent ;
246+ let newVersion ;
247+ if ( ! hotfix ) {
248+ changelogContent = await generateChangelog ( ) ;
245249
246- console . log ( changelogContent ) ;
250+ console . log ( changelogContent ) ;
247251
248- if ( ! readlineSync . keyInYN ( "Changelog looks good?" ) ) {
249- console . log ( "Exiting." ) ;
250- process . exit ( 1 ) ;
251- }
252-
253- const currentVersion = getCurrentVersion ( ) ;
254- const newVersion = incrementVersion ( currentVersion ) ;
252+ if ( ! readlineSync . keyInYN ( "Changelog looks good?" ) ) {
253+ console . log ( "Exiting." ) ;
254+ process . exit ( 1 ) ;
255+ }
255256
257+ const currentVersion = getCurrentVersion ( ) ;
258+ newVersion = incrementVersion ( currentVersion ) ;
259+ console . log ( `New version: ${ newVersion } ` ) ;
260+ }
256261 buildProject ( ) ;
257262
258- if ( ! readlineSync . keyInYN ( `Ready to release ${ newVersion } ?` ) ) {
263+ if ( ! hotfix && ! readlineSync . keyInYN ( `Ready to release ${ newVersion } ?` ) ) {
259264 console . log ( "Exiting." ) ;
260265 process . exit ( 1 ) ;
261266 }
@@ -269,16 +274,22 @@ const main = async () => {
269274 }
270275
271276 if ( ! noDeploy ) purgeCache ( ) ;
272- updatePackage ( newVersion ) ;
273- createCommitAndTag ( newVersion ) ;
274- try {
275- await createGithubRelease ( newVersion , changelogContent ) ;
276- } catch ( e ) {
277- console . error ( `Failed to create release on GitHub: ${ e } ` ) ;
278- console . log ( "Please create the release manually." ) ;
277+ if ( ! hotfix ) {
278+ updatePackage ( newVersion ) ;
279+ createCommitAndTag ( newVersion ) ;
280+ try {
281+ await createGithubRelease ( newVersion , changelogContent ) ;
282+ } catch ( e ) {
283+ console . error ( `Failed to create release on GitHub: ${ e } ` ) ;
284+ console . log ( "Please create the release manually." ) ;
285+ }
279286 }
280287
281- console . log ( `Release ${ newVersion } completed successfully.` ) ;
288+ if ( hotfix ) {
289+ console . log ( "Hotfix completed successfully." ) ;
290+ } else {
291+ console . log ( `Release ${ newVersion } completed successfully.` ) ;
292+ }
282293 process . exit ( 0 ) ;
283294} ;
284295
0 commit comments