File tree Expand file tree Collapse file tree 3 files changed +312
-269
lines changed
Expand file tree Collapse file tree 3 files changed +312
-269
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,18 @@ module.exports = isHook => {
2323 return ;
2424 }
2525 const gitPath = gitURL . replace ( / ^ g i t \+ / ig, '' ) . split ( '#' ) [ 0 ] ;
26- const gitBranch = deployCfg . branch || gitURL . split ( '#' ) [ 1 ] || 'master' ;
26+ let gitBranch = deployCfg . branch || gitURL . split ( '#' ) [ 1 ] || 'master' ;
27+ const currBranch = ( ( shelljs . exec ( 'git rev-parse --abbrev-ref HEAD' , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
28+ if ( typeof gitBranch === 'object' ) {
29+ // 继承当前分支
30+ if ( currBranch && gitBranch . extends === true ) {
31+ gitBranch = currBranch ;
32+ } else if ( gitBranch . name ) {
33+ gitBranch = gitBranch . name ;
34+ } else {
35+ gitBranch = 'master' ;
36+ }
37+ }
2738 const gitMessage = deployCfg . message && ` | ${ deployCfg . message } ` || '' ;
2839
2940 const gitUser = deployCfg . user || { } ;
@@ -38,7 +49,6 @@ module.exports = isHook => {
3849 if ( isHook ) {
3950 commitHash = ( ( shelljs . exec ( 'git rev-parse --verify HEAD' , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
4051 } else {
41- const currBranch = ( ( shelljs . exec ( 'git rev-parse --abbrev-ref HEAD' , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
4252 commitHash = ( ( shelljs . exec ( `git rev-parse origin/${ currBranch } ` , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
4353 }
4454
Original file line number Diff line number Diff line change 11{
22 "name" : " @micro-app/cli" ,
3- "version" : " 0.0.50 " ,
3+ "version" : " 0.0.55-beta.1 " ,
44 "description" : " micro app cli" ,
55 "bin" : {
66 "micro-app" : " ./bin/micro-app.js" ,
3232 "eslint-config-2o3t" : " ^1.1.17"
3333 },
3434 "dependencies" : {
35- "@micro-app/core" : " ^0.0.50 " ,
35+ "@micro-app/core" : " ^0.0.54 " ,
3636 "chalk" : " ^2.4.2" ,
3737 "commander" : " ^2.19.0" ,
3838 "opn" : " ^5.5.0" ,
You can’t perform that action at this time.
0 commit comments