Fix benchmark runners
This commit is contained in:
parent
184569f660
commit
cc0d78b9da
|
@ -1,9 +1,9 @@
|
|||
const minifyHtml = require("@minify-html/node");
|
||||
const { htmlOnly, run } = require("../common");
|
||||
|
||||
const minifyHtmlCfg = minifyHtml.createConfiguration({
|
||||
const minifyHtmlCfg = {
|
||||
minify_css: !htmlOnly,
|
||||
minify_js: !htmlOnly,
|
||||
});
|
||||
};
|
||||
|
||||
run((src) => minifyHtml.minify(src, minifyHtmlCfg));
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = {
|
|||
console.log(
|
||||
JSON.stringify(
|
||||
fs.readdirSync(inputDir).map((name) => {
|
||||
const src = fs.readFileSync(path.join(inputDir, name), "utf8");
|
||||
const src = fs.readFileSync(path.join(inputDir, name));
|
||||
|
||||
const out = minifierFn(src);
|
||||
const len = Buffer.from(out).length;
|
||||
|
|
|
@ -27,4 +27,4 @@ const htmlMinifierCfg = {
|
|||
useShortDoctype: true,
|
||||
};
|
||||
|
||||
run((src) => htmlMinifier.minify(src, htmlMinifierCfg));
|
||||
run((src) => htmlMinifier.minify(src.toString(), htmlMinifierCfg));
|
||||
|
|
|
@ -42,4 +42,4 @@ const plugins = htmlOnly ? [] : [jsCssPlugin];
|
|||
|
||||
const minifier = new minimize({ plugins });
|
||||
|
||||
run((src) => minifier.parse(src));
|
||||
run((src) => minifier.parse(src.toString()));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const lib = require(".");
|
||||
const fs = require("fs");
|
||||
|
||||
const cfgObj = {};
|
||||
const cfg = {};
|
||||
let input;
|
||||
let output;
|
||||
const args = process.argv.slice(2);
|
||||
|
@ -14,13 +14,12 @@ while ((arg = args.shift()) !== undefined) {
|
|||
if (name === "output") {
|
||||
output = args.shift();
|
||||
} else {
|
||||
cfgObj[name.replace(/-/g, "_")] = true;
|
||||
cfg[name.replace(/-/g, "_")] = true;
|
||||
}
|
||||
} else {
|
||||
input = arg;
|
||||
}
|
||||
}
|
||||
|
||||
const cfg = lib.createConfiguration(cfgObj);
|
||||
const min = lib.minify(fs.readFileSync(input), cfg);
|
||||
fs.writeFileSync(output, min);
|
||||
|
|
Loading…
Reference in New Issue