Copied build script changes.

This commit is contained in:
flash 2024-02-10 15:57:12 +00:00
parent 2e44950f0d
commit 00c8444631
2 changed files with 10 additions and 1 deletions

View file

@ -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...');

View file

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