-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathviteBuild.js
33 lines (24 loc) · 831 Bytes
/
viteBuild.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//const shell = require('shelljs');
//shell.mv('./dist/assets/*.ttf', './dist/');
//const shell = require('shelljs');
//shell.mv('./dist/assets/*.woff', './dist/');
//shell.mv('./dist/assets/*.woff2', './dist/');
/*
import pkg from 'glob';
const { glob } = pkg;
import * as fs from 'fs';
import JavaScriptObfuscator from 'javascript-obfuscator';
const obfuscate = async () => {
const files = glob.sync('dist/assets/main.js');
for (const file of files) {
const code = await fs.promises.readFile(file, 'utf-8');
const obfuscationResult = await JavaScriptObfuscator.obfuscate(code, {
compact: true,
simplify: true,
});
const obfuscatedCode = obfuscationResult.getObfuscatedCode();
await fs.promises.writeFile(file, obfuscatedCode, 'utf-8');
}
};
obfuscate().catch(console.error);
*/