mirror of
https://github.com/openharmony/developtools_ace-js2bundle.git
synced 2026-07-20 21:59:23 -04:00
!378 fix card type with i18n file copy bug
Merge pull request !378 from 卡哥/OpenHarmony-3.2-Beta2
This commit is contained in:
@@ -87,7 +87,10 @@ 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), key, true);
|
||||
} else if (output && path.extname(key) === '.json' &&
|
||||
process.env.DEVICE_LEVEL === 'card' && !checkI18n(key)) {
|
||||
writeFileSync(assets[key].source(), path.resolve(output, key), key, false);
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -98,6 +101,15 @@ class GenAbcPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
function checkI18n(key) {
|
||||
const outI18nPath = path.resolve(output, 'i18n', key);
|
||||
const projectI18nPath = outI18nPath.replace(output, process.env.projectPath);
|
||||
if (fs.existsSync(projectI18nPath)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkWorksFile(assetPath, workerFile) {
|
||||
if (workerFile === null) {
|
||||
if (assetPath.search("./workers/") !== 0) {
|
||||
@@ -113,16 +125,18 @@ function checkWorksFile(assetPath, workerFile) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function writeFileSync(inputString, output, jsBundleFile) {
|
||||
function writeFileSync(inputString, output, jsBundleFile, isToBin) {
|
||||
const parent = path.join(output, '..');
|
||||
if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) {
|
||||
mkDir(parent);
|
||||
}
|
||||
fs.writeFileSync(output, inputString);
|
||||
if (!isToBin) {
|
||||
return;
|
||||
}
|
||||
if (fs.existsSync(output)) {
|
||||
let fileSize = fs.statSync(output).size;
|
||||
intermediateJsBundle.push({path: output, size: fileSize});
|
||||
|
||||
@@ -228,7 +228,7 @@ function setArkPlugin(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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user