File tree 2 files changed +19
-0
lines changed
packages/nx-heroku/src/executors
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -69,3 +69,14 @@ export async function getGitRemoteBranch(options: {
69
69
) ;
70
70
return stdout ?. trim ( ) ;
71
71
}
72
+
73
+ /**
74
+ * @returns {Promise<string> } size (eg: 1.06 GiB)
75
+ */
76
+ export async function getGitRepoSizePack ( ) : Promise < string > {
77
+ const { stdout } = await exec (
78
+ `git count-objects -H -v | grep 'size-pack' | cut -d':' -f2` ,
79
+ { encoding : 'utf-8' }
80
+ ) ;
81
+ return stdout ?. trim ( ) ;
82
+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Inject, Service } from 'typedi';
4
4
import { Environment , EXECUTOR_CONTEXT } from '../../common/constants' ;
5
5
import {
6
6
getGitEmail ,
7
+ getGitRepoSizePack ,
7
8
getGitUserName ,
8
9
setGitEmail ,
9
10
setGitUserName ,
@@ -73,9 +74,16 @@ export class HerokuDeployService extends HerokuBaseService<DeployExecutorSchema>
73
74
) ;
74
75
// If the Repo clone is shallow, make it unshallow
75
76
if ( isShallow === 'true\n' ) {
77
+ this . logger . warn (
78
+ 'The git repository is shallow, fetching all commits to get the correct size of the repository'
79
+ ) ;
76
80
await exec ( 'git fetch --prune --unshallow' ) ;
77
81
}
78
82
83
+ // show git repo size
84
+ const size = await getGitRepoSizePack ( ) ;
85
+ this . logger . info ( `Git repo size: ${ size } ` ) ;
86
+
79
87
await this . setupHerokuAuth ( ) ;
80
88
}
81
89
You can’t perform that action at this time.
0 commit comments