优化lite工程的图片编译

Signed-off-by: fanjiaojiao <fanjiaojiao@huawei.com>
This commit is contained in:
fanjiaojiao
2022-08-31 17:51:47 +08:00
parent 6b716075f6
commit b02fc316cb
2 changed files with 2 additions and 6 deletions
+1 -6
View File
@@ -16,7 +16,6 @@
const Jimp = require('jimp');
const fs = require('fs');
const _path = require('path');
const { readManifest} = require('../../main.product');
/**
* Find all image paths in png、jpg、bmp、jpeg format in the directory.
* @param {String} imgPath The path of build folder.
@@ -38,10 +37,6 @@ async function img2bin(imgPath) {
const header = (image.bitmap.width << WIDTH_BIT_OFFSET) +
(image.bitmap.height << HEIGHT_BIT_OFFSET);
process.env.aceManifestPath = process.env.aceManifestPath || path.resolve(process.env.projectPath, 'manifest.json');
const manifest = readManifest(process.env.aceManifestPath)
const version = parseInt(manifest.minPlatformVersion);
let binFileOffset = 0;
binView.setUint32(binFileOffset, COLOR_MODE, true);
binFileOffset += 4;
@@ -70,7 +65,7 @@ async function img2bin(imgPath) {
binFileOffset += 1;
});
if (version <=6) {
if (process.env.PLATFORM_VERSION_version <=6) {
const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin');
fs.writeFileSync(binPath1, Buffer.from(binBuffer));
}
+1
View File
@@ -131,6 +131,7 @@ function setConfigs(env) {
if (version <= 4) {
process.env.PLATFORM_VERSION = PLATFORM.VERSION3;
}
process.env.PLATFORM_VERSION_version = version;
}
module.exports = (env) => {