Copied build script changes.
This commit is contained in:
parent
2e44950f0d
commit
00c8444631
2 changed files with 10 additions and 1 deletions
9
build.js
9
build.js
|
@ -5,6 +5,7 @@ const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const postcss = require('postcss');
|
const postcss = require('postcss');
|
||||||
const htmlminify = require('html-minifier-terser').minify;
|
const htmlminify = require('html-minifier-terser').minify;
|
||||||
|
const childProcess = require('child_process');
|
||||||
const utils = require('./src/utils.js');
|
const utils = require('./src/utils.js');
|
||||||
const assproc = require('./src/assproc.js');
|
const assproc = require('./src/assproc.js');
|
||||||
|
|
||||||
|
@ -100,6 +101,14 @@ const htmlMinifyOptions = {
|
||||||
FUTAMI_URL: config.common_url,
|
FUTAMI_URL: config.common_url,
|
||||||
MAMI_URL: config.modern_url,
|
MAMI_URL: config.modern_url,
|
||||||
AMI_URL: config.compat_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...');
|
console.log('Ensuring assets directory exists...');
|
||||||
|
|
|
@ -59,7 +59,7 @@ exports.process = async function(root, options) {
|
||||||
const bvProps = [];
|
const bvProps = [];
|
||||||
|
|
||||||
for(const bvName in options.buildVars)
|
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)
|
if(Object.keys(bvProps).length > 0)
|
||||||
output += `Object.defineProperties(${bvTarget}, { ${bvProps.join(', ')} });\n`;
|
output += `Object.defineProperties(${bvTarget}, { ${bvProps.join(', ')} });\n`;
|
||||||
|
|
Loading…
Reference in a new issue