@@ -9,14 +9,15 @@ const currentVersion = require('../package.json').version
9
9
const versionIncrements = [
10
10
'patch' ,
11
11
'minor' ,
12
- 'major' ,
13
- 'prepatch' ,
14
- 'preminor' ,
15
- 'premajor' ,
16
- 'prerelease'
12
+ 'major'
17
13
]
18
14
19
- const inc = ( i ) => semver . inc ( currentVersion , i , 'alpha' )
15
+ const tags = [
16
+ 'latest' ,
17
+ 'next'
18
+ ]
19
+
20
+ const inc = ( i ) => semver . inc ( currentVersion , i )
20
21
const bin = ( name ) => path . resolve ( __dirname , `../node_modules/.bin/${ name } ` )
21
22
const run = ( bin , args , opts = { } ) => execa ( bin , args , { stdio : 'inherit' , ...opts } )
22
23
const step = ( msg ) => console . log ( chalk . cyan ( msg ) )
@@ -46,20 +47,27 @@ async function main() {
46
47
throw new Error ( `Invalid target version: ${ targetVersion } ` )
47
48
}
48
49
49
- const { yes } = await prompt ( {
50
+ const { tag } = await prompt ( {
51
+ type : 'select' ,
52
+ name : 'tag' ,
53
+ message : 'Select tag type' ,
54
+ choices : tags
55
+ } )
56
+
57
+ console . log ( tag )
58
+
59
+ const { yes : tagOk } = await prompt ( {
50
60
type : 'confirm' ,
51
61
name : 'yes' ,
52
- message : `Releasing v${ targetVersion } . Confirm?`
62
+ message : `Releasing v${ targetVersion } with the " ${ tag } " tag . Confirm?`
53
63
} )
54
64
55
- if ( ! yes ) {
65
+ if ( ! tagOk ) {
56
66
return
57
67
}
58
68
59
69
// Run tests before release.
60
70
step ( '\nRunning tests...' )
61
- await run ( bin ( 'jest' ) , [ '--clearCache' ] )
62
- await run ( 'yarn' , [ 'lint:fail' ] )
63
71
await run ( 'yarn' , [ 'test' ] )
64
72
65
73
// Update the package version.
@@ -74,6 +82,16 @@ async function main() {
74
82
step ( '\nGenerating the changelog...' )
75
83
await run ( 'yarn' , [ 'changelog' ] )
76
84
85
+ const { yes : changelogOk } = await prompt ( {
86
+ type : 'confirm' ,
87
+ name : 'yes' ,
88
+ message : `Changelog generated. Does it look good?`
89
+ } )
90
+
91
+ if ( ! changelogOk ) {
92
+ return
93
+ }
94
+
77
95
// Commit changes to the Git.
78
96
step ( '\nCommitting changes...' )
79
97
await run ( 'git' , [ 'add' , '-A' ] )
@@ -82,8 +100,8 @@ async function main() {
82
100
// Publish the package.
83
101
step ( '\nPublishing the package...' )
84
102
await run ( 'yarn' , [
85
- 'publish' , '--tag' , 'next' , '--new-version' , targetVersion ,
86
- '--no-commit-hooks' , '--no- git-tag-version'
103
+ 'publish' , '--tag' , tag , '--new-version' , targetVersion , '--no-commit-hooks' ,
104
+ '--no-git-tag-version'
87
105
] )
88
106
89
107
// Push to GitHub.
0 commit comments