11import { execSync } from 'child_process' 13export const submoduleTarPath = async ({submodulePtPath}: {submodulePtPath: string}) => { 14 const submoduleAbsPath = `${ptDir}/${submodulePtPath}` 16 const gitShaInSubmodule = execSync('git rev-parse HEAD', {cwd: submoduleAbsPath, encoding: 'utf8'}).trim() 17 const tarHash = calcReqHash([submodulePtPath, gitShaInSubmodule, '1']) 19 const tarFileName = `submodule-${submodulePtPath.replace(/\//g, '-')}-${tarHash}.tar.gz` 20 const tarFilePtPath = `tmpdockertars/${tarFileName}` 23 if (isVeryVerbose) console.log(chalkGreen('cacheHit submodule tar!'), tarFilePtPath) 26 if (isVeryVerbose) console.log(chalkYellow('writing submodule tar..'), tarFilePtPath) 30 '-zcvf', `${ptDir}/${tarFilePtPath}`, 32 '--exclude', 'node_modules', 35 ], {env: {...process.env, GZIP: '-n'}}) 39 `# submodule: ${submodulePtPath}`, 40 `ADD ${tarFilePtPath} .`, 44 const tarSpec = { type: 'submodule', tarPath: tarFilePtPath, submodulePath: submodulePtPath } 46 return {dfCpTarStr, tarSpec}