Skip to content

Commit

Permalink
Fix build script from upgraded closure compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
keleko34 committed Feb 4, 2020
1 parent ec8f0a5 commit f769a98
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 60 deletions.
20 changes: 11 additions & 9 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
var base = process.cwd().replace(/\\/g,'/'),
fs = require('fs'),
closureCompiler = require('google-closure-compiler-js').compile,
flags = {};
const { unlink, readFileSync, writeFileSync } = require('fs')
base = process.cwd().replace(/\\/g,'/'),
closureCompiler = require('google-closure-compiler-js'),
flags = {};

console.log("Building Pikantny Library...");

flags.jsCode = [{src: fs.readFileSync(base+'/pikantny.js','utf8')}];
flags.jsCode = [{src: readFileSync(base+'/pikantny.js','utf8')}];
flags.compilationLevel = 'SIMPLE';
fs.unlinkSync(base+'/pikantny.min.js');
fs.writeFileSync(base+'/pikantny.min.js',closureCompiler(flags).compiledCode);

console.log("Finished Building Minified Library..");
flags.rewritePolyfills = false;
unlink(base+'/pikantny.min.js', (err) => {
if(err && !err.code === 'ENOENT') return;
writeFileSync(base+'/pikantny.min.js',closureCompiler(flags).compiledCode);
console.log("Finished Building Minified Library..");
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "pikantny.min.js",
"scripts": {
"test": "node ./test/run.js",
"debug": "node --inspect-brk ./test/run.js",
"build": "node ./build.js"
},
"repository": {
Expand Down
Loading

0 comments on commit f769a98

Please sign in to comment.