From fcee5cd05a72b004d2fc746f041ddb7e1c8777b9 Mon Sep 17 00:00:00 2001 From: lixinnan Date: Mon, 22 Jul 2024 10:54:18 +0800 Subject: [PATCH] Differences in synchronization codes between blue and yellow areas Signed-off-by: lixinnan Change-Id: Id182fcf273124aea23f16ed2d6b745d36f5bc3ac --- babel.config.js | 3 +-- uglify-source.js | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) 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); }