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`;