diff --git a/babel.config.js b/babel.config.js index a52444c..889d9b0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -31,7 +31,7 @@ module.exports = function(api) { '@babel/plugin-transform-arrow-functions', {spec: true}, ] - ] + ]; plugins.push(...liteArray); } return { @@ -40,4 +40,3 @@ module.exports = function(api) { comments: false }; }; - diff --git a/uglify-source.js b/uglify-source.js index 24129da..2e08230 100644 --- a/uglify-source.js +++ b/uglify-source.js @@ -13,32 +13,33 @@ * limitations under the License. */ -const fs = require('fs') -const path = require('path') -const uglifyJS = require('uglify-js') +const fs = require('fs'); +const path = require('path'); +const uglifyJS = require('uglify-js'); -readCode(process.argv[2]) +const SOURCE_POSITION = 2; +readCode(process.argv[SOURCE_POSITION]); function readCode(inputPath) { if (fs.existsSync(inputPath)) { - const files = fs.readdirSync(inputPath) + const files = fs.readdirSync(inputPath); files.forEach(function(file) { - const filePath = path.join(inputPath, file) + const filePath = path.join(inputPath, file); if (fs.existsSync(filePath)) { - const fileStat = fs.statSync(filePath) + const fileStat = fs.statSync(filePath); if (fileStat.isFile()) { - const code = fs.readFileSync(filePath, 'utf-8') - uglifyCode(code,filePath) + const code = fs.readFileSync(filePath, 'utf-8'); + uglifyCode(code, filePath); } if (fileStat.isDirectory()) { - readCode(filePath) + readCode(filePath); } } - }) + }); } } function uglifyCode(code, outPath) { - const uglifyCode = uglifyJS.minify(code).code - fs.writeFileSync(outPath, uglifyCode) + const uglifyCode = uglifyJS.minify(code).code; + fs.writeFileSync(outPath, uglifyCode); }