From 3749c8f129b63821ae8d445163447918c1ce917f Mon Sep 17 00:00:00 2001 From: Ahn <27772165+ahnpnl@users.noreply.github.com> Date: Sun, 28 Aug 2022 12:02:06 +0200 Subject: [PATCH] build(devs-infra): check if `git` command is available for postbuild (#3779) --- scripts/post-build.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/post-build.js b/scripts/post-build.js index d2185953f2..fa3eccd89a 100644 --- a/scripts/post-build.js +++ b/scripts/post-build.js @@ -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()