From 00c8444631a4ed576aca93cd05d46bc3e4f04d03 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sat, 10 Feb 2024 15:57:12 +0000 Subject: [PATCH] Copied build script changes. --- build.js | 9 +++++++++ src/assproc.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build.js b/build.js index 59f201d..666a82e 100644 --- a/build.js +++ b/build.js @@ -5,6 +5,7 @@ const path = require('path'); const util = require('util'); const postcss = require('postcss'); const htmlminify = require('html-minifier-terser').minify; +const childProcess = require('child_process'); const utils = require('./src/utils.js'); const assproc = require('./src/assproc.js'); @@ -100,6 +101,14 @@ const htmlMinifyOptions = { FUTAMI_URL: config.common_url, MAMI_URL: config.modern_url, AMI_URL: config.compat_url, + GIT_HASH: await (() => { + return new Promise((resolve, reject) => { + childProcess.exec('git log --pretty="%H" -n1 HEAD', (err, stdout) => { + if(err) reject(err); + else resolve(stdout.trim()); + }); + }); + })(), }; console.log('Ensuring assets directory exists...'); diff --git a/src/assproc.js b/src/assproc.js index 8fb7dec..bf457ca 100644 --- a/src/assproc.js +++ b/src/assproc.js @@ -59,7 +59,7 @@ exports.process = async function(root, options) { const bvProps = []; for(const bvName in options.buildVars) - bvProps.push(`${bvName}: { value: ${JSON.stringify(options.buildVars[bvName])}, writable: false }`); + bvProps.push(`${bvName}: { value: ${JSON.stringify(options.buildVars[bvName])} }`); if(Object.keys(bvProps).length > 0) output += `Object.defineProperties(${bvTarget}, { ${bvProps.join(', ')} });\n`;