react-native-update-cli 1.46.2 → 2.0.1

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 (68) hide show
  1. package/README.md +603 -1
  2. package/README.zh-CN.md +601 -0
  3. package/cli.json +39 -3
  4. package/lib/api.js +5 -5
  5. package/lib/app.js +1 -1
  6. package/lib/bundle.js +30 -28
  7. package/lib/exports.js +65 -0
  8. package/lib/index.js +100 -9
  9. package/lib/locales/en.js +2 -1
  10. package/lib/locales/zh.js +2 -1
  11. package/lib/module-manager.js +125 -0
  12. package/lib/modules/app-module.js +223 -0
  13. package/lib/modules/bundle-module.js +188 -0
  14. package/lib/modules/index.js +42 -0
  15. package/lib/modules/package-module.js +16 -0
  16. package/lib/modules/user-module.js +402 -0
  17. package/lib/modules/version-module.js +16 -0
  18. package/lib/package.js +40 -9
  19. package/lib/provider.js +341 -0
  20. package/lib/user.js +3 -3
  21. package/lib/utils/app-info-parser/apk.js +1 -1
  22. package/lib/utils/app-info-parser/ipa.js +2 -2
  23. package/lib/utils/app-info-parser/resource-finder.js +35 -35
  24. package/lib/utils/app-info-parser/xml-parser/manifest.js +2 -2
  25. package/lib/utils/app-info-parser/zip.js +3 -6
  26. package/lib/utils/check-plugin.js +1 -1
  27. package/lib/utils/git.js +1 -1
  28. package/lib/utils/i18n.js +3 -1
  29. package/lib/utils/index.js +4 -4
  30. package/lib/utils/latest-version/cli.js +3 -3
  31. package/lib/utils/latest-version/index.js +4 -4
  32. package/lib/versions.js +2 -2
  33. package/package.json +4 -4
  34. package/src/api.ts +7 -7
  35. package/src/app.ts +2 -2
  36. package/src/bundle.ts +44 -32
  37. package/src/exports.ts +30 -0
  38. package/src/index.ts +118 -16
  39. package/src/locales/en.ts +1 -0
  40. package/src/locales/zh.ts +1 -0
  41. package/src/module-manager.ts +149 -0
  42. package/src/modules/app-module.ts +205 -0
  43. package/src/modules/bundle-module.ts +202 -0
  44. package/src/modules/index.ts +19 -0
  45. package/src/modules/package-module.ts +11 -0
  46. package/src/modules/user-module.ts +406 -0
  47. package/src/modules/version-module.ts +8 -0
  48. package/src/package.ts +59 -25
  49. package/src/provider.ts +341 -0
  50. package/src/types.ts +126 -0
  51. package/src/user.ts +4 -3
  52. package/src/utils/app-info-parser/apk.js +62 -52
  53. package/src/utils/app-info-parser/app.js +5 -5
  54. package/src/utils/app-info-parser/ipa.js +69 -57
  55. package/src/utils/app-info-parser/resource-finder.js +50 -54
  56. package/src/utils/app-info-parser/utils.js +59 -54
  57. package/src/utils/app-info-parser/xml-parser/binary.js +366 -354
  58. package/src/utils/app-info-parser/xml-parser/manifest.js +145 -137
  59. package/src/utils/app-info-parser/zip.js +1 -1
  60. package/src/utils/check-plugin.ts +4 -2
  61. package/src/utils/dep-versions.ts +13 -6
  62. package/src/utils/git.ts +1 -1
  63. package/src/utils/i18n.ts +3 -1
  64. package/src/utils/index.ts +8 -10
  65. package/src/utils/latest-version/cli.ts +4 -4
  66. package/src/utils/latest-version/index.ts +17 -17
  67. package/src/utils/plugin-config.ts +3 -3
  68. package/src/versions.ts +3 -3
@@ -1,24 +1,27 @@
1
- function objectType (o) {
2
- return Object.prototype.toString.call(o).slice(8, -1).toLowerCase()
1
+ function objectType(o) {
2
+ return Object.prototype.toString.call(o).slice(8, -1).toLowerCase();
3
3
  }
4
4
 
5
- function isArray (o) {
6
- return objectType(o) === 'array'
5
+ function isArray(o) {
6
+ return objectType(o) === 'array';
7
7
  }
8
8
 
9
- function isObject (o) {
10
- return objectType(o) === 'object'
9
+ function isObject(o) {
10
+ return objectType(o) === 'object';
11
11
  }
12
12
 
13
- function isPrimitive (o) {
14
- return o === null || ['boolean', 'number', 'string', 'undefined'].includes(objectType(o))
13
+ function isPrimitive(o) {
14
+ return (
15
+ o === null ||
16
+ ['boolean', 'number', 'string', 'undefined'].includes(objectType(o))
17
+ );
15
18
  }
16
19
 
17
- function isBrowser () {
20
+ function isBrowser() {
18
21
  return (
19
22
  typeof process === 'undefined' ||
20
23
  Object.prototype.toString.call(process) !== '[object process]'
21
- )
24
+ );
22
25
  }
23
26
 
24
27
  /**
@@ -26,48 +29,48 @@ function isBrowser () {
26
29
  * @param {Object} apkInfo // json info parsed from .apk file
27
30
  * @param {Object} resourceMap // resourceMap
28
31
  */
29
- function mapInfoResource (apkInfo, resourceMap) {
30
- iteratorObj(apkInfo)
31
- return apkInfo
32
- function iteratorObj (obj) {
32
+ function mapInfoResource(apkInfo, resourceMap) {
33
+ iteratorObj(apkInfo);
34
+ return apkInfo;
35
+ function iteratorObj(obj) {
33
36
  for (const i in obj) {
34
37
  if (isArray(obj[i])) {
35
- iteratorArray(obj[i])
38
+ iteratorArray(obj[i]);
36
39
  } else if (isObject(obj[i])) {
37
- iteratorObj(obj[i])
40
+ iteratorObj(obj[i]);
38
41
  } else if (isPrimitive(obj[i])) {
39
42
  if (isResources(obj[i])) {
40
- obj[i] = resourceMap[transKeyToMatchResourceMap(obj[i])]
43
+ obj[i] = resourceMap[transKeyToMatchResourceMap(obj[i])];
41
44
  }
42
45
  }
43
46
  }
44
47
  }
45
48
 
46
- function iteratorArray (array) {
47
- const l = array.length
49
+ function iteratorArray(array) {
50
+ const l = array.length;
48
51
  for (let i = 0; i < l; i++) {
49
52
  if (isArray(array[i])) {
50
- iteratorArray(array[i])
53
+ iteratorArray(array[i]);
51
54
  } else if (isObject(array[i])) {
52
- iteratorObj(array[i])
55
+ iteratorObj(array[i]);
53
56
  } else if (isPrimitive(array[i])) {
54
57
  if (isResources(array[i])) {
55
- array[i] = resourceMap[transKeyToMatchResourceMap(array[i])]
58
+ array[i] = resourceMap[transKeyToMatchResourceMap(array[i])];
56
59
  }
57
60
  }
58
61
  }
59
62
  }
60
63
 
61
- function isResources (attrValue) {
62
- if (!attrValue) return false
64
+ function isResources(attrValue) {
65
+ if (!attrValue) return false;
63
66
  if (typeof attrValue !== 'string') {
64
- attrValue = attrValue.toString()
67
+ attrValue = attrValue.toString();
65
68
  }
66
- return attrValue.indexOf('resourceId:') === 0
69
+ return attrValue.indexOf('resourceId:') === 0;
67
70
  }
68
71
 
69
- function transKeyToMatchResourceMap (resourceId) {
70
- return '@' + resourceId.replace('resourceId:0x', '').toUpperCase()
72
+ function transKeyToMatchResourceMap(resourceId) {
73
+ return '@' + resourceId.replace('resourceId:0x', '').toUpperCase();
71
74
  }
72
75
  }
73
76
 
@@ -75,62 +78,64 @@ function mapInfoResource (apkInfo, resourceMap) {
75
78
  * find .apk file's icon path from json info
76
79
  * @param info // json info parsed from .apk file
77
80
  */
78
- function findApkIconPath (info) {
81
+ function findApkIconPath(info) {
79
82
  if (!info.application.icon || !info.application.icon.splice) {
80
- return ''
83
+ return '';
81
84
  }
82
85
  const rulesMap = {
83
86
  mdpi: 48,
84
87
  hdpi: 72,
85
88
  xhdpi: 96,
86
89
  xxdpi: 144,
87
- xxxhdpi: 192
88
- }
89
- const resultMap = {}
90
- const maxDpiIcon = { dpi: 120, icon: '' }
90
+ xxxhdpi: 192,
91
+ };
92
+ const resultMap = {};
93
+ const maxDpiIcon = { dpi: 120, icon: '' };
91
94
 
92
95
  for (const i in rulesMap) {
93
96
  info.application.icon.some((icon) => {
94
97
  if (icon && icon.indexOf(i) !== -1) {
95
- resultMap['application-icon-' + rulesMap[i]] = icon
96
- return true
98
+ resultMap['application-icon-' + rulesMap[i]] = icon;
99
+ return true;
97
100
  }
98
- })
101
+ });
99
102
 
100
103
  // get the maximal size icon
101
104
  if (
102
105
  resultMap['application-icon-' + rulesMap[i]] &&
103
106
  rulesMap[i] >= maxDpiIcon.dpi
104
107
  ) {
105
- maxDpiIcon.dpi = rulesMap[i]
106
- maxDpiIcon.icon = resultMap['application-icon-' + rulesMap[i]]
108
+ maxDpiIcon.dpi = rulesMap[i];
109
+ maxDpiIcon.icon = resultMap['application-icon-' + rulesMap[i]];
107
110
  }
108
111
  }
109
112
 
110
113
  if (Object.keys(resultMap).length === 0 || !maxDpiIcon.icon) {
111
- maxDpiIcon.dpi = 120
112
- maxDpiIcon.icon = info.application.icon[0] || ''
113
- resultMap['applicataion-icon-120'] = maxDpiIcon.icon
114
+ maxDpiIcon.dpi = 120;
115
+ maxDpiIcon.icon = info.application.icon[0] || '';
116
+ resultMap['applicataion-icon-120'] = maxDpiIcon.icon;
114
117
  }
115
- return maxDpiIcon.icon
118
+ return maxDpiIcon.icon;
116
119
  }
117
120
 
118
121
  /**
119
122
  * find .ipa file's icon path from json info
120
123
  * @param info // json info parsed from .ipa file
121
124
  */
122
- function findIpaIconPath (info) {
125
+ function findIpaIconPath(info) {
123
126
  if (
124
127
  info.CFBundleIcons &&
125
128
  info.CFBundleIcons.CFBundlePrimaryIcon &&
126
129
  info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles &&
127
130
  info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length
128
131
  ) {
129
- return info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1]
132
+ return info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[
133
+ info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1
134
+ ];
130
135
  } else if (info.CFBundleIconFiles && info.CFBundleIconFiles.length) {
131
- return info.CFBundleIconFiles[info.CFBundleIconFiles.length - 1]
136
+ return info.CFBundleIconFiles[info.CFBundleIconFiles.length - 1];
132
137
  } else {
133
- return '.app/Icon.png'
138
+ return '.app/Icon.png';
134
139
  }
135
140
  }
136
141
 
@@ -138,20 +143,20 @@ function findIpaIconPath (info) {
138
143
  * transform buffer to base64
139
144
  * @param {Buffer} buffer
140
145
  */
141
- function getBase64FromBuffer (buffer) {
142
- return 'data:image/png;base64,' + buffer.toString('base64')
146
+ function getBase64FromBuffer(buffer) {
147
+ return 'data:image/png;base64,' + buffer.toString('base64');
143
148
  }
144
149
 
145
150
  /**
146
151
  * 去除unicode空字符
147
152
  * @param {String} str
148
153
  */
149
- function decodeNullUnicode (str) {
154
+ function decodeNullUnicode(str) {
150
155
  if (typeof str === 'string') {
151
156
  // eslint-disable-next-line
152
- str = str.replace(/\u0000/g, '')
157
+ str = str.replace(/\u0000/g, '');
153
158
  }
154
- return str
159
+ return str;
155
160
  }
156
161
 
157
162
  module.exports = {
@@ -163,5 +168,5 @@ module.exports = {
163
168
  findApkIconPath,
164
169
  findIpaIconPath,
165
170
  getBase64FromBuffer,
166
- decodeNullUnicode
167
- }
171
+ decodeNullUnicode,
172
+ };