From 6e5c7bf308ddcb2be756cb84c6c7119b612e4e28 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 10 Sep 2023 08:22:28 +0200 Subject: [PATCH 1/2] Use export-subst gitattribute to allow tarball builds For example it would do the following: let subst = "d3bf557c"; --- .gitattributes | 1 + build/webpack.prod.conf.js | 13 ++++++++++--- changelog.d/export-subst-hash.fix | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .gitattributes create mode 100644 changelog.d/export-subst-hash.fix diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..c5b9ea10e1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/build/webpack.prod.conf.js export-subst diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 7de9372132..664290a59f 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -11,9 +11,16 @@ var env = process.env.NODE_ENV === 'testing' ? require('../config/test.env') : config.build.env -let commitHash = require('child_process') - .execSync('git rev-parse --short HEAD') - .toString(); +let commitHash = (() => { + let subst = "$Format:%h$"; + if(!subst.match(/Format:/)) { + return subst; + } else { + return require('child_process') + .execSync('git rev-parse --short HEAD') + .toString(); + } +})(); var webpackConfig = merge(baseWebpackConfig, { mode: 'production', diff --git a/changelog.d/export-subst-hash.fix b/changelog.d/export-subst-hash.fix new file mode 100644 index 0000000000..fb0d85cbb4 --- /dev/null +++ b/changelog.d/export-subst-hash.fix @@ -0,0 +1 @@ +Use export-subst gitattribute to allow tarball builds From c05b1b90726e0b47b6e80f0bfe4d880f2f45fa2e Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 15 Sep 2023 06:45:02 +0000 Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s) --- build/webpack.prod.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 664290a59f..7a108f68d8 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -12,7 +12,7 @@ var env = process.env.NODE_ENV === 'testing' : config.build.env let commitHash = (() => { - let subst = "$Format:%h$"; + const subst = "$Format:%h$"; if(!subst.match(/Format:/)) { return subst; } else {