From 77d07fd29309c64c2ad1f3364c687b78e31bc68c Mon Sep 17 00:00:00 2001 From: lizhouze Date: Thu, 1 Sep 2022 16:27:58 +0800 Subject: [PATCH 1/5] lizhouze@huawei.com Signed-off-by: lizhouze --- ace-loader/src/genAbc-plugin.js | 8 +++++--- ace-loader/webpack.rich.config.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index 91be94d..a776e2d 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -75,7 +75,9 @@ class GenAbcPlugin { newContent = `\n\n\n\n\n\n\n\n\n\n\n\n\n\n` + newContent; } const keyPath = key.replace(/\.js$/, firstFileEXT) - writeFileSync(newContent, path.resolve(output, keyPath), key); + writeFileSync(newContent, path.resolve(output, keyPath), true); + } else if (output && path.extname(key) === '.json' && process.env.DEVICE_LEVEL === 'card') { + writeFileSync(assets[key].source(), path.resolve(output, key.replace(/\.json$/, '.json')), false); } }) }); @@ -104,13 +106,13 @@ function checkWorksFile(assetPath, workerFile) { return true; } -function writeFileSync(inputString, output, jsBundleFile) { +function writeFileSync(inputString, output, itToBin) { const parent = path.join(output, '..'); if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) { mkDir(parent); } fs.writeFileSync(output, inputString); - if (fs.existsSync(output)) { + if (fs.existsSync(output) && itToBin) { let fileSize = fs.statSync(output).size; intermediateJsBundle.push({path: output, size: fileSize}); } diff --git a/ace-loader/webpack.rich.config.js b/ace-loader/webpack.rich.config.js index da3ca9b..0337e8a 100644 --- a/ace-loader/webpack.rich.config.js +++ b/ace-loader/webpack.rich.config.js @@ -216,7 +216,7 @@ function notPreview(env, workerFile) { } config.plugins.push(new GenAbcPlugin(process.env.buildPath, arkDir, nodeJs, workerFile, env.buildMode === 'debug')) - if (env.buildMode === 'release' && process.env.DEVICE_LEVEL !== 'card') { + if (env.buildMode === 'release') { config.output.path = path.join(process.env.cachePath, "releaseAssets", path.basename(process.env.buildPath)); } From 5d6544c9051335851b567848add4e1d3f7021fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E5=93=A5?= Date: Thu, 1 Sep 2022 10:40:03 +0000 Subject: [PATCH 2/5] update ace-loader/src/genAbc-plugin.js. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 卡哥 --- ace-loader/src/genAbc-plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index a776e2d..6982a78 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -106,13 +106,13 @@ function checkWorksFile(assetPath, workerFile) { return true; } -function writeFileSync(inputString, output, itToBin) { +function writeFileSync(inputString, output, isToBin) { const parent = path.join(output, '..'); if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) { mkDir(parent); } fs.writeFileSync(output, inputString); - if (fs.existsSync(output) && itToBin) { + if (fs.existsSync(output) && isToBin) { let fileSize = fs.statSync(output).size; intermediateJsBundle.push({path: output, size: fileSize}); } From f43f64daccc4ce93d47b78f2165b141e000213ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E5=93=A5?= Date: Thu, 1 Sep 2022 10:45:07 +0000 Subject: [PATCH 3/5] update ace-loader/src/genAbc-plugin.js. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 卡哥 --- ace-loader/src/genAbc-plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index 6982a78..794e012 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -77,7 +77,8 @@ class GenAbcPlugin { const keyPath = key.replace(/\.js$/, firstFileEXT) writeFileSync(newContent, path.resolve(output, keyPath), true); } else if (output && path.extname(key) === '.json' && process.env.DEVICE_LEVEL === 'card') { - writeFileSync(assets[key].source(), path.resolve(output, key.replace(/\.json$/, '.json')), false); + writeFileSync(assets[key].source(), path.resolve(output, key.replace(/\.json$/, '.json')), + false); } }) }); From 3c870cf8ae7357c7fa328236b21bae660ed4320b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E5=93=A5?= Date: Thu, 1 Sep 2022 10:50:44 +0000 Subject: [PATCH 4/5] update ace-loader/src/genAbc-plugin.js. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 卡哥 --- ace-loader/src/genAbc-plugin.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index 794e012..9182250 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -76,9 +76,10 @@ class GenAbcPlugin { } const keyPath = key.replace(/\.js$/, firstFileEXT) writeFileSync(newContent, path.resolve(output, keyPath), true); - } else if (output && path.extname(key) === '.json' && process.env.DEVICE_LEVEL === 'card') { - writeFileSync(assets[key].source(), path.resolve(output, key.replace(/\.json$/, '.json')), - false); + } else if (output && path.extname(key) === '.json' + && process.env.DEVICE_LEVEL === 'card') { + writeFileSync(assets[key].source(), + path.resolve(output, key.replace(/\.json$/, '.json')), false); } }) }); From cca2efc21b521256ac378fca5ab92f6decbb7edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E5=93=A5?= Date: Thu, 1 Sep 2022 10:52:00 +0000 Subject: [PATCH 5/5] update ace-loader/src/genAbc-plugin.js. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 卡哥 --- ace-loader/src/genAbc-plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index 9182250..b196ddb 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -76,8 +76,8 @@ class GenAbcPlugin { } const keyPath = key.replace(/\.js$/, firstFileEXT) writeFileSync(newContent, path.resolve(output, keyPath), true); - } else if (output && path.extname(key) === '.json' - && process.env.DEVICE_LEVEL === 'card') { + } else if (output && path.extname(key) === '.json' && + process.env.DEVICE_LEVEL === 'card') { writeFileSync(assets[key].source(), path.resolve(output, key.replace(/\.json$/, '.json')), false); }