Files
lnreader-plugins/scripts/terser.ts
T
Rider21 c6c5c99c1c Feat(plugin)Add Foxteller (#984)
* test

* optimization

* terser@5.31.0 => terser@5.31.1
2024-06-12 19:12:52 +07:00

20 lines
465 B
TypeScript

const { minify_sync } = require('terser');
import * as fs from 'fs';
const config = {
compress: {
arrows: false,
},
mangle: {},
ecma: 5, // specify one of: 5, 2015, 2016, etc.
enclose: false, // or specify true, or "args:values"
module: true,
toplevel: true,
};
export const minify = function (path: string) {
const code = fs.readFileSync(path).toString();
const result = minify_sync(code, config);
fs.writeFileSync(path, result.code);
};