File tree 3 files changed +60
-33
lines changed
3 files changed +60
-33
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,12 @@ async function main() {
22
22
)
23
23
24
24
step ( 'Publishing package...' )
25
- await publishPackage ( pkgDir , version . includes ( 'beta' ) ? 'beta' : undefined )
25
+ const releaseTag = version . includes ( 'beta' )
26
+ ? 'beta'
27
+ : version . includes ( 'alpha' )
28
+ ? 'alpha'
29
+ : undefined
30
+ await publishPackage ( pkgDir , releaseTag )
26
31
}
27
32
28
33
main ( ) . catch ( ( err ) => {
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ async function main(): Promise<void> {
62
62
if ( targetVersion . includes ( 'beta' ) && ! args . tag ) {
63
63
args . tag = 'beta'
64
64
}
65
+ if ( targetVersion . includes ( 'alpha' ) && ! args . tag ) {
66
+ args . tag = 'alpha'
67
+ }
65
68
66
69
const { yes } : { yes : boolean } = await prompts ( {
67
70
type : 'confirm' ,
Original file line number Diff line number Diff line change @@ -94,42 +94,61 @@ export function step(msg: string) {
94
94
95
95
export function getVersionChoices ( currentVersion : string ) {
96
96
const currentBeta = currentVersion . includes ( 'beta' )
97
+ const currentAlpha = currentVersion . includes ( 'alpha' )
98
+ const isStable = ! currentBeta && ! currentAlpha
97
99
98
- const inc : ( i : ReleaseType ) => string = ( i ) =>
99
- semver . inc ( currentVersion , i , 'beta' ) !
100
+ function inc ( i : ReleaseType , tag = currentAlpha ? 'alpha' : 'beta' ) {
101
+ return semver . inc ( currentVersion , i , tag ) !
102
+ }
100
103
101
- const versionChoices = [
104
+ let versionChoices = [
102
105
{
103
106
title : 'next' ,
104
- value : inc ( currentBeta ? 'prerelease' : 'patch' )
105
- } ,
106
- ...( currentBeta
107
- ? [
108
- {
109
- title : 'stable' ,
110
- value : inc ( 'patch' )
111
- }
112
- ]
113
- : [
114
- {
115
- title : 'beta-minor' ,
116
- value : inc ( 'preminor' )
117
- } ,
118
- {
119
- title : 'beta-major' ,
120
- value : inc ( 'premajor' )
121
- } ,
122
- {
123
- title : 'minor' ,
124
- value : inc ( 'minor' )
125
- } ,
126
- {
127
- title : 'major' ,
128
- value : inc ( 'major' )
129
- }
130
- ] ) ,
131
- { value : 'custom' , title : 'custom' }
132
- ] . map ( ( i ) => {
107
+ value : inc ( isStable ? 'patch' : 'prerelease' )
108
+ }
109
+ ]
110
+
111
+ if ( isStable ) {
112
+ versionChoices . push (
113
+ {
114
+ title : 'beta-minor' ,
115
+ value : inc ( 'preminor' )
116
+ } ,
117
+ {
118
+ title : 'beta-major' ,
119
+ value : inc ( 'premajor' )
120
+ } ,
121
+ {
122
+ title : 'alpha-minor' ,
123
+ value : inc ( 'preminor' , 'alpha' )
124
+ } ,
125
+ {
126
+ title : 'alpha-major' ,
127
+ value : inc ( 'premajor' , 'alpha' )
128
+ } ,
129
+ {
130
+ title : 'minor' ,
131
+ value : inc ( 'minor' )
132
+ } ,
133
+ {
134
+ title : 'major' ,
135
+ value : inc ( 'major' )
136
+ }
137
+ )
138
+ } else if ( currentAlpha ) {
139
+ versionChoices . push ( {
140
+ title : 'beta' ,
141
+ value : inc ( 'patch' ) + '-beta.0'
142
+ } )
143
+ } else {
144
+ versionChoices . push ( {
145
+ title : 'stable' ,
146
+ value : inc ( 'patch' )
147
+ } )
148
+ }
149
+ versionChoices . push ( { value : 'custom' , title : 'custom' } )
150
+
151
+ versionChoices = versionChoices . map ( ( i ) => {
133
152
i . title = `${ i . title } (${ i . value } )`
134
153
return i
135
154
} )
You can’t perform that action at this time.
0 commit comments