Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
Latest commit
25 lines (23 loc) · 851 Bytes
/
Copy pathbuild.js
File metadata and controls
25 lines (23 loc) · 851 Bytes
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
global.fs=require('fs');
global.uglify=require("uglify-es");
constSRC_DIR='./src/';
constDIST_DIR='./dist/';
letsourceFileNames=['ProcessStatus.js','Process.js','ProcessQueue.js','DecoratedProcess.js','DecoratedProcessQueue.js'];
letcode='';
letminifiedCode='';
sourceFileNames.forEach(fileName=>{
letoriginalCode=fs.readFileSync(SRC_DIR+fileName).toString('utf8');
letoriginalCodeLines=originalCode.split('\n');
originalCodeLines.forEach(line=>{
if(!/require(.*)/.test(line)&&!line.startsWith('module.exports')){
code+=line+'\n';
}
})
code+='\n';
});
minifiedCode=uglify.minify(code);
if(!fs.existsSync(DIST_DIR)){
fs.mkdirSync(DIST_DIR);
}
fs.writeFileSync(DIST_DIR+'process.js',code);
fs.writeFileSync(DIST_DIR+'process.min.js',minifiedCode.code);