jh5_app_build 1.0.21 → 1.0.22

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.
Files changed (2) hide show
  1. package/lib/build_std.js +49 -0
  2. package/package.json +1 -1
package/lib/build_std.js CHANGED
@@ -46,12 +46,22 @@ module.exports = async (cmd, buildCfg) => {
46
46
  // apk配置
47
47
  let apkConfig = makeAndGetDir(`${buildCfg.rootPath}/apk_cfg`);
48
48
 
49
+ // 读取数据
50
+ var apkinfoObj = {
51
+ appName: "" // apk名称
52
+ };
53
+ try {
54
+ apkinfoObj = JSON.parse(fs.readFileSync(apkConfig + "/apkinfo.json", 'utf-8'));
55
+ } catch (error) {
56
+ }
57
+
49
58
  // 清理数据
50
59
  console.log(`delete temp file ...`);
51
60
  await jutils.jfile_utils.deleteFolder(stdBinDir + "/assets/device_webapi");
52
61
  await jutils.jfile_utils.deleteFolder(stdBinDir + "/assets/h5app");
53
62
  await jutils.jfile_utils.deleteFolder(stdBinDir + "/assets/jext");
54
63
  await jutils.jfile_utils.deleteFolder(stdBinDir + "/assets/screen");
64
+ await jutils.jfile_utils.deleteFolder(stdBinDir + "/build");
55
65
 
56
66
  // 修改版本号
57
67
  let platformVer = jutils.getUUID();
@@ -154,6 +164,44 @@ module.exports = async (cmd, buildCfg) => {
154
164
  }
155
165
  }
156
166
 
167
+ // 添加图标
168
+ try {
169
+ await makeDirAndCopy(`${apkConfig}/icon.png`, stdBinDir + "/res/mipmap/icon.png");
170
+ } catch (error) {
171
+ }
172
+
173
+ // 修改其他信息
174
+ try {
175
+ var AndroidManifestPath = stdBinDir + "/AndroidManifest.xml";
176
+ var AndroidManifestPathBak = stdBinDir + "/AndroidManifestBak.xml";
177
+ // 备份
178
+ if (!fs.existsSync(AndroidManifestPathBak)) {
179
+ fs.copyFileSync(AndroidManifestPath, AndroidManifestPathBak);
180
+ }
181
+ var anfData = fs.readFileSync(AndroidManifestPathBak);
182
+
183
+ // 修改应用名
184
+ if (apkinfoObj.appName) {
185
+ let tmpName = Buffer.from("7A3657B017788420AE749039F9D25A2E", 'utf16le');
186
+ var nameIndex = anfData.indexOf(tmpName);
187
+ if (nameIndex > 0) {
188
+ let toName = Buffer.from(apkinfoObj.appName, 'utf16le');
189
+ // 清空
190
+ for (let index = 0; index < tmpName.length; index++) {
191
+ anfData[nameIndex + index] = 0;
192
+ }
193
+ // 写入名
194
+ for (let index = 0; index < toName.length; index++) {
195
+ anfData[nameIndex + index] = toName[index];
196
+ }
197
+ }
198
+ }
199
+
200
+ // 写入
201
+ fs.writeFileSync(AndroidManifestPath, anfData);
202
+ } catch (error) {
203
+ }
204
+
157
205
  // 需要web
158
206
  if (!buildCfg.platform.includes("noweb")) {
159
207
  // 添加框架二进制
@@ -195,6 +243,7 @@ module.exports = async (cmd, buildCfg) => {
195
243
  }
196
244
 
197
245
  }
246
+
198
247
  // 添加设备信息
199
248
  try {
200
249
  let pkgInfo = os.networkInterfaces();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jh5_app_build",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "jaskle jh5_app_build",
5
5
  "main": "./bin/jh5_app_build.js",
6
6
  "registry": true,