!368 fix card without abc

Merge pull request !368 from 卡哥/OpenHarmony-3.1-Release
This commit is contained in:
openharmony_ci
2022-09-02 02:07:12 +00:00
committed by Gitee
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -75,7 +75,11 @@ 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 +108,13 @@ function checkWorksFile(assetPath, workerFile) {
return true;
}
function writeFileSync(inputString, output, jsBundleFile) {
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)) {
if (fs.existsSync(output) && isToBin) {
let fileSize = fs.statSync(output).size;
intermediateJsBundle.push({path: output, size: fileSize});
}
+1 -1
View File
@@ -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));
}