Skip to content

Commit

Permalink
build(devs-infra): check if git command is available for postbuild (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Aug 28, 2022
1 parent 404bb26 commit 3749c8f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/post-build.js
Expand Up @@ -2,10 +2,14 @@ const { computePackageDigest } = require('./lib/bundle')
const execa = require('execa')
const { generatedPath, rawCompilerOptionsFileName } = require('./lib/paths')

if (execa.sync('git', ['diff-index', '--name-only', 'HEAD']).stdout.includes(rawCompilerOptionsFileName)) {
throw new Error(
`Tsconfig options have changed. Please check the modified generated ${generatedPath} and commit the change`
)
try {
execa.sync('git', ['--version'])
if (execa.sync('git', ['diff-index', '--name-only', 'HEAD']).stdout.includes(rawCompilerOptionsFileName)) {
throw new Error(
`Tsconfig options have changed. Please check the modified generated ${generatedPath} and commit the change`
)
}
} catch (e) {
console.log('git command is not available. Skip checking generated types')
}

computePackageDigest()

0 comments on commit 3749c8f

Please sign in to comment.