File tree 5 files changed +67
-25
lines changed
5 files changed +67
-25
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,23 @@ module.exports = {
53
53
type : 'boolean' ,
54
54
default : true
55
55
} ,
56
+ commit : {
57
+ describe : 'Commit changes to git' ,
58
+ type : 'boolean' ,
59
+ default : true
60
+ } ,
61
+ tag : {
62
+ describe : 'Create release tag in git' ,
63
+ type : 'boolean' ,
64
+ default : true
65
+ } ,
66
+ push : {
67
+ describe : 'Push changes to GitHub' ,
68
+ type : 'boolean' ,
69
+ default : true
70
+ } ,
56
71
ghrelease : {
57
- describe : 'Genereate GitHub release' ,
72
+ describe : 'Generate GitHub release' ,
58
73
type : 'boolean' ,
59
74
default : true
60
75
} ,
Original file line number Diff line number Diff line change @@ -8,18 +8,17 @@ const getPathToPkg = require('../utils').getPathToPkg
8
8
9
9
const files = [ 'package.json' , 'CHANGELOG.md' ]
10
10
11
- function commit ( ) {
12
- let version
13
- return Promise . all ( [
14
- pify ( git . add . bind ( git ) ) ( files ) ,
15
- fs . readJson ( getPathToPkg ( ) )
16
- ] ) . then ( ( res ) => {
17
- version = res [ 1 ] . version
18
- return pify ( git . commit . bind ( git ) ) (
19
- `chore: release version v${ version } ` ,
20
- files
21
- )
22
- } ) . then ( ( ) => pify ( git . addTag . bind ( git ) ) ( `v${ version } ` ) )
11
+ async function commit ( ) {
12
+ await pify ( git . add . bind ( git ) ) ( files )
13
+
14
+ const {
15
+ version
16
+ } = await fs . readJson ( getPathToPkg ( ) )
17
+
18
+ await pify ( git . commit . bind ( git ) ) (
19
+ `chore: release version v${ version } ` ,
20
+ files
21
+ )
23
22
}
24
23
25
24
module . exports = commit
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
+ const git = require ( 'simple-git' ) ( process . cwd ( ) )
4
+ const pify = require ( 'pify' )
3
5
const execa = require ( 'execa' )
4
6
const { getPathToPkg } = require ( '../utils' )
5
7
6
8
const contributors = async ( ) => {
7
9
await execa ( 'git-authors-cli' , [ '--print' , 'false' ] )
8
- await execa ( 'git' , [
9
- 'commit' ,
10
- getPathToPkg ( ) ,
11
- '-m' ,
10
+
11
+ const res = await pify ( git . status . bind ( git ) ) ( )
12
+
13
+ if ( ! res . modified . length ) {
14
+ return
15
+ }
16
+
17
+ await pify ( git . commit . bind ( git ) ) (
12
18
'chore: update contributors' ,
13
- '--no-verify' ,
14
- '--allow-empty'
15
- ] )
19
+ getPathToPkg ( ) , {
20
+ '--no-verify' : true
21
+ }
22
+ )
16
23
}
17
24
18
25
module . exports = contributors
Original file line number Diff line number Diff line change @@ -12,15 +12,13 @@ const releaseChecks = require('./prerelease')
12
12
const bump = require ( './bump' )
13
13
const changelog = require ( './changelog' )
14
14
const commit = require ( './commit' )
15
+ const tag = require ( './tag' )
15
16
const contributors = require ( './contributors' )
16
17
const github = require ( './github' )
17
18
const publish = require ( './publish' )
18
19
const push = require ( './push' )
19
20
20
21
function release ( opts ) {
21
- // enable publishing for docs
22
- opts . publish = true
23
-
24
22
const tasks = new Listr ( [ {
25
23
title : 'Lint' ,
26
24
task : lint ,
@@ -47,10 +45,16 @@ function release (opts) {
47
45
enabled : ( ctx ) => ctx . changelog
48
46
} , {
49
47
title : 'Commit to Git' ,
50
- task : commit
48
+ task : commit ,
49
+ enabled : ( ctx ) => ctx . commit
50
+ } , {
51
+ title : 'Tag release' ,
52
+ task : tag ,
53
+ enabled : ( ctx ) => ctx . tag
51
54
} , {
52
55
title : 'Push to GitHub' ,
53
- task : push
56
+ task : push ,
57
+ enabled : ( ctx ) => ctx . push
54
58
} , {
55
59
title : 'Generate GitHub Release' ,
56
60
task : github ,
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const git = require ( 'simple-git' ) ( process . cwd ( ) )
4
+ const pify = require ( 'pify' )
5
+ const fs = require ( 'fs-extra' )
6
+
7
+ const getPathToPkg = require ( '../utils' ) . getPathToPkg
8
+
9
+ async function tag ( ) {
10
+ const {
11
+ version
12
+ } = await fs . readJson ( getPathToPkg ( ) )
13
+
14
+ await pify ( git . addTag . bind ( git ) ) ( `v${ version } ` )
15
+ }
16
+
17
+ module . exports = tag
You can’t perform that action at this time.
0 commit comments