@@ -7,7 +7,7 @@ const microApp = require('@micro-app/core');
77const chalk = require ( 'chalk' ) . default ;
88const logger = microApp . logger ;
99
10- module . exports = ( ) => {
10+ module . exports = args => {
1111 const microAppConfig = microApp . self ( ) ;
1212 if ( ! microAppConfig ) return ;
1313
@@ -25,9 +25,11 @@ module.exports = () => {
2525 const gitPath = gitURL . replace ( / ^ g i t \+ / ig, '' ) . split ( '#' ) [ 0 ] ;
2626 const gitBranch = deployCfg . branch || gitURL . split ( '#' ) [ 1 ] || 'master' ;
2727
28- const commitHash = ( ( shelljs . exec ( 'git rev-parse --verify HEAD' , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
28+ const currBranch = ( ( shelljs . exec ( 'git rev-parse --abbrev-ref HEAD' , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
29+ const commitHash = ( ( shelljs . exec ( `git rev-parse origin/${ currBranch } ` , { silent : true } ) || { } ) . stdout || '' ) . trim ( ) ;
30+ // const commitHash = ((shelljs.exec('git rev-parse --verify HEAD', { silent: true }) || {}).stdout || '').trim();
2931
30- const gitRoot = path . resolve ( microAppConfig . root , '.gittest ' ) ;
32+ const gitRoot = path . resolve ( microAppConfig . root , '.git ' ) ;
3133 if ( fs . statSync ( gitRoot ) . isDirectory ( ) ) {
3234 const deployDir = path . resolve ( gitRoot , 'micro-deploy' ) ;
3335 if ( fs . existsSync ( deployDir ) ) {
@@ -38,6 +40,7 @@ module.exports = () => {
3840 const execStr = `git clone "${ gitPath } " -b ${ gitBranch } "${ deployDir } "` ;
3941 logger . logo ( `Deploy: ${ chalk . blueBright ( gitPath ) } ` ) ;
4042 logger . logo ( `Branch: ${ chalk . blueBright ( gitBranch ) } ` ) ;
43+ logger . logo ( `Hash: ${ chalk . blueBright ( commitHash ) } ` ) ;
4144 const result = shelljs . exec ( execStr , { silent : true } ) ;
4245 if ( result . code ) {
4346 logger . logo ( `${ result . code } : ${ chalk . yellow ( result . stderr . trim ( ) . split ( '\n' ) . reverse ( ) [ 0 ] ) } ` ) ;
0 commit comments