jh5_app_build 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build_japp.js +13 -1
- package/package.json +1 -1
package/lib/build_japp.js
CHANGED
|
@@ -10,6 +10,9 @@ var AdmZip = require('adm-zip');
|
|
|
10
10
|
module.exports = async (cmd, buildCfg) => {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
12
|
(async () => {
|
|
13
|
+
// 待删除列表
|
|
14
|
+
var deleteList = [];
|
|
15
|
+
|
|
13
16
|
// 读取sh脚本
|
|
14
17
|
var shDataStr = fs.readFileSync(buildCfg.rootPath + "/jbuild_data/repair.sh", "utf8");
|
|
15
18
|
|
|
@@ -20,6 +23,12 @@ module.exports = async (cmd, buildCfg) => {
|
|
|
20
23
|
zlib: { level: 9 }
|
|
21
24
|
});
|
|
22
25
|
output.on('close', function () {
|
|
26
|
+
// 清理
|
|
27
|
+
for (const iterator of deleteList) {
|
|
28
|
+
fs.unlinkSync(iterator);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 完成
|
|
23
32
|
console.log(archive.pointer() + ' total bytes');
|
|
24
33
|
console.log(`build success:${buildCfg.outpath}`);
|
|
25
34
|
resolve();
|
|
@@ -127,7 +136,8 @@ module.exports = async (cmd, buildCfg) => {
|
|
|
127
136
|
var zipEntries = myZip.getEntries();
|
|
128
137
|
zipEntries.forEach(function (zipEntry) {
|
|
129
138
|
let tmpFile = path.resolve(`${buildCfg.rootPath}/jbuild_data/${zipEntry.entryName}.tmp`);
|
|
130
|
-
fs.writeFileSync(tmpFile,
|
|
139
|
+
fs.writeFileSync(tmpFile, zipEntry.getData());
|
|
140
|
+
deleteList.push(tmpFile);
|
|
131
141
|
archive.file(tmpFile, { name: "update_a20/" + zipEntry.entryName });
|
|
132
142
|
});
|
|
133
143
|
|
|
@@ -144,6 +154,7 @@ module.exports = async (cmd, buildCfg) => {
|
|
|
144
154
|
try {
|
|
145
155
|
let tmpFile = path.resolve(`${buildCfg.rootPath}/jbuild_data/repair.sh.tmp`);
|
|
146
156
|
fs.writeFileSync(tmpFile, shDataStr);
|
|
157
|
+
deleteList.push(tmpFile);
|
|
147
158
|
archive.file(tmpFile, { name: "update_a20/repair.sh" });
|
|
148
159
|
} catch (error) {
|
|
149
160
|
}
|
|
@@ -155,6 +166,7 @@ module.exports = async (cmd, buildCfg) => {
|
|
|
155
166
|
|
|
156
167
|
let tmpFile = path.resolve(`${buildCfg.rootPath}/jbuild_data/build_info.txt`);
|
|
157
168
|
fs.writeFileSync(tmpFile, JSON.stringify(pkgInfo, null, 4));
|
|
169
|
+
deleteList.push(tmpFile);
|
|
158
170
|
archive.file(tmpFile, { name: "update_a20/build_info.txt" });
|
|
159
171
|
} catch (error) {
|
|
160
172
|
}
|