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.
- package/README.md +603 -1
- package/README.zh-CN.md +601 -0
- package/cli.json +39 -3
- package/lib/api.js +5 -5
- package/lib/app.js +1 -1
- package/lib/bundle.js +30 -28
- package/lib/exports.js +65 -0
- package/lib/index.js +100 -9
- package/lib/locales/en.js +2 -1
- package/lib/locales/zh.js +2 -1
- package/lib/module-manager.js +125 -0
- package/lib/modules/app-module.js +223 -0
- package/lib/modules/bundle-module.js +188 -0
- package/lib/modules/index.js +42 -0
- package/lib/modules/package-module.js +16 -0
- package/lib/modules/user-module.js +402 -0
- package/lib/modules/version-module.js +16 -0
- package/lib/package.js +40 -9
- package/lib/provider.js +341 -0
- package/lib/user.js +3 -3
- package/lib/utils/app-info-parser/apk.js +1 -1
- package/lib/utils/app-info-parser/ipa.js +2 -2
- package/lib/utils/app-info-parser/resource-finder.js +35 -35
- package/lib/utils/app-info-parser/xml-parser/manifest.js +2 -2
- package/lib/utils/app-info-parser/zip.js +3 -6
- package/lib/utils/check-plugin.js +1 -1
- package/lib/utils/git.js +1 -1
- package/lib/utils/i18n.js +3 -1
- package/lib/utils/index.js +4 -4
- package/lib/utils/latest-version/cli.js +3 -3
- package/lib/utils/latest-version/index.js +4 -4
- package/lib/versions.js +2 -2
- package/package.json +4 -4
- package/src/api.ts +7 -7
- package/src/app.ts +2 -2
- package/src/bundle.ts +44 -32
- package/src/exports.ts +30 -0
- package/src/index.ts +118 -16
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/module-manager.ts +149 -0
- package/src/modules/app-module.ts +205 -0
- package/src/modules/bundle-module.ts +202 -0
- package/src/modules/index.ts +19 -0
- package/src/modules/package-module.ts +11 -0
- package/src/modules/user-module.ts +406 -0
- package/src/modules/version-module.ts +8 -0
- package/src/package.ts +59 -25
- package/src/provider.ts +341 -0
- package/src/types.ts +126 -0
- package/src/user.ts +4 -3
- package/src/utils/app-info-parser/apk.js +62 -52
- package/src/utils/app-info-parser/app.js +5 -5
- package/src/utils/app-info-parser/ipa.js +69 -57
- package/src/utils/app-info-parser/resource-finder.js +50 -54
- package/src/utils/app-info-parser/utils.js +59 -54
- package/src/utils/app-info-parser/xml-parser/binary.js +366 -354
- package/src/utils/app-info-parser/xml-parser/manifest.js +145 -137
- package/src/utils/app-info-parser/zip.js +1 -1
- package/src/utils/check-plugin.ts +4 -2
- package/src/utils/dep-versions.ts +13 -6
- package/src/utils/git.ts +1 -1
- package/src/utils/i18n.ts +3 -1
- package/src/utils/index.ts +8 -10
- package/src/utils/latest-version/cli.ts +4 -4
- package/src/utils/latest-version/index.ts +17 -17
- package/src/utils/plugin-config.ts +3 -3
- package/src/versions.ts +3 -3
|
@@ -1,216 +1,224 @@
|
|
|
1
1
|
// From https://github.com/openstf/adbkit-apkreader
|
|
2
|
-
const BinaryXmlParser = require('./binary')
|
|
2
|
+
const BinaryXmlParser = require('./binary');
|
|
3
3
|
|
|
4
|
-
const INTENT_MAIN = 'android.intent.action.MAIN'
|
|
5
|
-
const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER'
|
|
4
|
+
const INTENT_MAIN = 'android.intent.action.MAIN';
|
|
5
|
+
const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER';
|
|
6
6
|
|
|
7
7
|
class ManifestParser {
|
|
8
|
-
constructor
|
|
9
|
-
this.buffer = buffer
|
|
10
|
-
this.xmlParser = new BinaryXmlParser(this.buffer, options)
|
|
8
|
+
constructor(buffer, options = {}) {
|
|
9
|
+
this.buffer = buffer;
|
|
10
|
+
this.xmlParser = new BinaryXmlParser(this.buffer, options);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
collapseAttributes
|
|
14
|
-
const collapsed = Object.create(null)
|
|
15
|
-
for (
|
|
16
|
-
collapsed[attr.name] = attr.typedValue.value
|
|
13
|
+
collapseAttributes(element) {
|
|
14
|
+
const collapsed = Object.create(null);
|
|
15
|
+
for (const attr of Array.from(element.attributes)) {
|
|
16
|
+
collapsed[attr.name] = attr.typedValue.value;
|
|
17
17
|
}
|
|
18
|
-
return collapsed
|
|
18
|
+
return collapsed;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
parseIntents
|
|
22
|
-
target.intentFilters = []
|
|
23
|
-
target.metaData = []
|
|
21
|
+
parseIntents(element, target) {
|
|
22
|
+
target.intentFilters = [];
|
|
23
|
+
target.metaData = [];
|
|
24
24
|
|
|
25
|
-
return element.childNodes.forEach(element => {
|
|
25
|
+
return element.childNodes.forEach((element) => {
|
|
26
26
|
switch (element.nodeName) {
|
|
27
27
|
case 'intent-filter': {
|
|
28
|
-
const intentFilter = this.collapseAttributes(element)
|
|
28
|
+
const intentFilter = this.collapseAttributes(element);
|
|
29
29
|
|
|
30
|
-
intentFilter.actions = []
|
|
31
|
-
intentFilter.categories = []
|
|
32
|
-
intentFilter.data = []
|
|
30
|
+
intentFilter.actions = [];
|
|
31
|
+
intentFilter.categories = [];
|
|
32
|
+
intentFilter.data = [];
|
|
33
33
|
|
|
34
|
-
element.childNodes.forEach(element => {
|
|
34
|
+
element.childNodes.forEach((element) => {
|
|
35
35
|
switch (element.nodeName) {
|
|
36
36
|
case 'action':
|
|
37
|
-
intentFilter.actions.push(this.collapseAttributes(element))
|
|
38
|
-
break
|
|
37
|
+
intentFilter.actions.push(this.collapseAttributes(element));
|
|
38
|
+
break;
|
|
39
39
|
case 'category':
|
|
40
|
-
intentFilter.categories.push(this.collapseAttributes(element))
|
|
41
|
-
break
|
|
40
|
+
intentFilter.categories.push(this.collapseAttributes(element));
|
|
41
|
+
break;
|
|
42
42
|
case 'data':
|
|
43
|
-
intentFilter.data.push(this.collapseAttributes(element))
|
|
44
|
-
break
|
|
43
|
+
intentFilter.data.push(this.collapseAttributes(element));
|
|
44
|
+
break;
|
|
45
45
|
}
|
|
46
|
-
})
|
|
46
|
+
});
|
|
47
47
|
|
|
48
|
-
target.intentFilters.push(intentFilter)
|
|
49
|
-
break
|
|
48
|
+
target.intentFilters.push(intentFilter);
|
|
49
|
+
break;
|
|
50
50
|
}
|
|
51
51
|
case 'meta-data':
|
|
52
|
-
target.metaData.push(this.collapseAttributes(element))
|
|
53
|
-
break
|
|
52
|
+
target.metaData.push(this.collapseAttributes(element));
|
|
53
|
+
break;
|
|
54
54
|
}
|
|
55
|
-
})
|
|
55
|
+
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
parseApplication
|
|
59
|
-
const app = this.collapseAttributes(element)
|
|
58
|
+
parseApplication(element) {
|
|
59
|
+
const app = this.collapseAttributes(element);
|
|
60
60
|
|
|
61
|
-
app.activities = []
|
|
62
|
-
app.activityAliases = []
|
|
63
|
-
app.launcherActivities = []
|
|
64
|
-
app.services = []
|
|
65
|
-
app.receivers = []
|
|
66
|
-
app.providers = []
|
|
67
|
-
app.usesLibraries = []
|
|
68
|
-
app.metaData = []
|
|
61
|
+
app.activities = [];
|
|
62
|
+
app.activityAliases = [];
|
|
63
|
+
app.launcherActivities = [];
|
|
64
|
+
app.services = [];
|
|
65
|
+
app.receivers = [];
|
|
66
|
+
app.providers = [];
|
|
67
|
+
app.usesLibraries = [];
|
|
68
|
+
app.metaData = [];
|
|
69
69
|
|
|
70
|
-
element.childNodes.forEach(element => {
|
|
70
|
+
element.childNodes.forEach((element) => {
|
|
71
71
|
switch (element.nodeName) {
|
|
72
72
|
case 'activity': {
|
|
73
|
-
const activity = this.collapseAttributes(element)
|
|
74
|
-
this.parseIntents(element, activity)
|
|
75
|
-
app.activities.push(activity)
|
|
73
|
+
const activity = this.collapseAttributes(element);
|
|
74
|
+
this.parseIntents(element, activity);
|
|
75
|
+
app.activities.push(activity);
|
|
76
76
|
if (this.isLauncherActivity(activity)) {
|
|
77
|
-
app.launcherActivities.push(activity)
|
|
77
|
+
app.launcherActivities.push(activity);
|
|
78
78
|
}
|
|
79
|
-
break
|
|
79
|
+
break;
|
|
80
80
|
}
|
|
81
81
|
case 'activity-alias': {
|
|
82
|
-
const activityAlias = this.collapseAttributes(element)
|
|
83
|
-
this.parseIntents(element, activityAlias)
|
|
84
|
-
app.activityAliases.push(activityAlias)
|
|
82
|
+
const activityAlias = this.collapseAttributes(element);
|
|
83
|
+
this.parseIntents(element, activityAlias);
|
|
84
|
+
app.activityAliases.push(activityAlias);
|
|
85
85
|
if (this.isLauncherActivity(activityAlias)) {
|
|
86
|
-
app.launcherActivities.push(activityAlias)
|
|
86
|
+
app.launcherActivities.push(activityAlias);
|
|
87
87
|
}
|
|
88
|
-
break
|
|
88
|
+
break;
|
|
89
89
|
}
|
|
90
90
|
case 'service': {
|
|
91
|
-
const service = this.collapseAttributes(element)
|
|
92
|
-
this.parseIntents(element, service)
|
|
93
|
-
app.services.push(service)
|
|
94
|
-
break
|
|
91
|
+
const service = this.collapseAttributes(element);
|
|
92
|
+
this.parseIntents(element, service);
|
|
93
|
+
app.services.push(service);
|
|
94
|
+
break;
|
|
95
95
|
}
|
|
96
96
|
case 'receiver': {
|
|
97
|
-
const receiver = this.collapseAttributes(element)
|
|
98
|
-
this.parseIntents(element, receiver)
|
|
99
|
-
app.receivers.push(receiver)
|
|
100
|
-
break
|
|
97
|
+
const receiver = this.collapseAttributes(element);
|
|
98
|
+
this.parseIntents(element, receiver);
|
|
99
|
+
app.receivers.push(receiver);
|
|
100
|
+
break;
|
|
101
101
|
}
|
|
102
102
|
case 'provider': {
|
|
103
|
-
const provider = this.collapseAttributes(element)
|
|
103
|
+
const provider = this.collapseAttributes(element);
|
|
104
104
|
|
|
105
|
-
provider.grantUriPermissions = []
|
|
106
|
-
provider.metaData = []
|
|
107
|
-
provider.pathPermissions = []
|
|
105
|
+
provider.grantUriPermissions = [];
|
|
106
|
+
provider.metaData = [];
|
|
107
|
+
provider.pathPermissions = [];
|
|
108
108
|
|
|
109
|
-
element.childNodes.forEach(element => {
|
|
109
|
+
element.childNodes.forEach((element) => {
|
|
110
110
|
switch (element.nodeName) {
|
|
111
111
|
case 'grant-uri-permission':
|
|
112
|
-
provider.grantUriPermissions.push(
|
|
113
|
-
|
|
112
|
+
provider.grantUriPermissions.push(
|
|
113
|
+
this.collapseAttributes(element),
|
|
114
|
+
);
|
|
115
|
+
break;
|
|
114
116
|
case 'meta-data':
|
|
115
|
-
provider.metaData.push(this.collapseAttributes(element))
|
|
116
|
-
break
|
|
117
|
+
provider.metaData.push(this.collapseAttributes(element));
|
|
118
|
+
break;
|
|
117
119
|
case 'path-permission':
|
|
118
|
-
provider.pathPermissions.push(this.collapseAttributes(element))
|
|
119
|
-
break
|
|
120
|
+
provider.pathPermissions.push(this.collapseAttributes(element));
|
|
121
|
+
break;
|
|
120
122
|
}
|
|
121
|
-
})
|
|
123
|
+
});
|
|
122
124
|
|
|
123
|
-
app.providers.push(provider)
|
|
124
|
-
break
|
|
125
|
+
app.providers.push(provider);
|
|
126
|
+
break;
|
|
125
127
|
}
|
|
126
128
|
case 'uses-library':
|
|
127
|
-
app.usesLibraries.push(this.collapseAttributes(element))
|
|
128
|
-
break
|
|
129
|
+
app.usesLibraries.push(this.collapseAttributes(element));
|
|
130
|
+
break;
|
|
129
131
|
case 'meta-data':
|
|
130
|
-
app.metaData.push(this.collapseAttributes(element))
|
|
131
|
-
break
|
|
132
|
+
app.metaData.push(this.collapseAttributes(element));
|
|
133
|
+
break;
|
|
132
134
|
}
|
|
133
|
-
})
|
|
135
|
+
});
|
|
134
136
|
|
|
135
|
-
return app
|
|
137
|
+
return app;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
isLauncherActivity
|
|
139
|
-
return activity.intentFilters.some(
|
|
140
|
-
const hasMain = filter.actions.some(
|
|
140
|
+
isLauncherActivity(activity) {
|
|
141
|
+
return activity.intentFilters.some((filter) => {
|
|
142
|
+
const hasMain = filter.actions.some(
|
|
143
|
+
(action) => action.name === INTENT_MAIN,
|
|
144
|
+
);
|
|
141
145
|
if (!hasMain) {
|
|
142
|
-
return false
|
|
146
|
+
return false;
|
|
143
147
|
}
|
|
144
|
-
return filter.categories.some(
|
|
145
|
-
|
|
148
|
+
return filter.categories.some(
|
|
149
|
+
(category) => category.name === CATEGORY_LAUNCHER,
|
|
150
|
+
);
|
|
151
|
+
});
|
|
146
152
|
}
|
|
147
153
|
|
|
148
|
-
parse
|
|
149
|
-
const document = this.xmlParser.parse()
|
|
150
|
-
const manifest = this.collapseAttributes(document)
|
|
151
|
-
|
|
152
|
-
manifest.usesPermissions = []
|
|
153
|
-
manifest.usesPermissionsSDK23 = []
|
|
154
|
-
manifest.permissions = []
|
|
155
|
-
manifest.permissionTrees = []
|
|
156
|
-
manifest.permissionGroups = []
|
|
157
|
-
manifest.instrumentation = null
|
|
158
|
-
manifest.usesSdk = null
|
|
159
|
-
manifest.usesConfiguration = null
|
|
160
|
-
manifest.usesFeatures = []
|
|
161
|
-
manifest.supportsScreens = null
|
|
162
|
-
manifest.compatibleScreens = []
|
|
163
|
-
manifest.supportsGlTextures = []
|
|
164
|
-
manifest.application = Object.create(null)
|
|
165
|
-
|
|
166
|
-
document.childNodes.forEach(element => {
|
|
154
|
+
parse() {
|
|
155
|
+
const document = this.xmlParser.parse();
|
|
156
|
+
const manifest = this.collapseAttributes(document);
|
|
157
|
+
|
|
158
|
+
manifest.usesPermissions = [];
|
|
159
|
+
manifest.usesPermissionsSDK23 = [];
|
|
160
|
+
manifest.permissions = [];
|
|
161
|
+
manifest.permissionTrees = [];
|
|
162
|
+
manifest.permissionGroups = [];
|
|
163
|
+
manifest.instrumentation = null;
|
|
164
|
+
manifest.usesSdk = null;
|
|
165
|
+
manifest.usesConfiguration = null;
|
|
166
|
+
manifest.usesFeatures = [];
|
|
167
|
+
manifest.supportsScreens = null;
|
|
168
|
+
manifest.compatibleScreens = [];
|
|
169
|
+
manifest.supportsGlTextures = [];
|
|
170
|
+
manifest.application = Object.create(null);
|
|
171
|
+
|
|
172
|
+
document.childNodes.forEach((element) => {
|
|
167
173
|
switch (element.nodeName) {
|
|
168
174
|
case 'uses-permission':
|
|
169
|
-
manifest.usesPermissions.push(this.collapseAttributes(element))
|
|
170
|
-
break
|
|
175
|
+
manifest.usesPermissions.push(this.collapseAttributes(element));
|
|
176
|
+
break;
|
|
171
177
|
case 'uses-permission-sdk-23':
|
|
172
|
-
manifest.usesPermissionsSDK23.push(this.collapseAttributes(element))
|
|
173
|
-
break
|
|
178
|
+
manifest.usesPermissionsSDK23.push(this.collapseAttributes(element));
|
|
179
|
+
break;
|
|
174
180
|
case 'permission':
|
|
175
|
-
manifest.permissions.push(this.collapseAttributes(element))
|
|
176
|
-
break
|
|
181
|
+
manifest.permissions.push(this.collapseAttributes(element));
|
|
182
|
+
break;
|
|
177
183
|
case 'permission-tree':
|
|
178
|
-
manifest.permissionTrees.push(this.collapseAttributes(element))
|
|
179
|
-
break
|
|
184
|
+
manifest.permissionTrees.push(this.collapseAttributes(element));
|
|
185
|
+
break;
|
|
180
186
|
case 'permission-group':
|
|
181
|
-
manifest.permissionGroups.push(this.collapseAttributes(element))
|
|
182
|
-
break
|
|
187
|
+
manifest.permissionGroups.push(this.collapseAttributes(element));
|
|
188
|
+
break;
|
|
183
189
|
case 'instrumentation':
|
|
184
|
-
manifest.instrumentation = this.collapseAttributes(element)
|
|
185
|
-
break
|
|
190
|
+
manifest.instrumentation = this.collapseAttributes(element);
|
|
191
|
+
break;
|
|
186
192
|
case 'uses-sdk':
|
|
187
|
-
manifest.usesSdk = this.collapseAttributes(element)
|
|
188
|
-
break
|
|
193
|
+
manifest.usesSdk = this.collapseAttributes(element);
|
|
194
|
+
break;
|
|
189
195
|
case 'uses-configuration':
|
|
190
|
-
manifest.usesConfiguration = this.collapseAttributes(element)
|
|
191
|
-
break
|
|
196
|
+
manifest.usesConfiguration = this.collapseAttributes(element);
|
|
197
|
+
break;
|
|
192
198
|
case 'uses-feature':
|
|
193
|
-
manifest.usesFeatures.push(this.collapseAttributes(element))
|
|
194
|
-
break
|
|
199
|
+
manifest.usesFeatures.push(this.collapseAttributes(element));
|
|
200
|
+
break;
|
|
195
201
|
case 'supports-screens':
|
|
196
|
-
manifest.supportsScreens = this.collapseAttributes(element)
|
|
197
|
-
break
|
|
202
|
+
manifest.supportsScreens = this.collapseAttributes(element);
|
|
203
|
+
break;
|
|
198
204
|
case 'compatible-screens':
|
|
199
|
-
element.childNodes.forEach(screen => {
|
|
200
|
-
return manifest.compatibleScreens.push(
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
element.childNodes.forEach((screen) => {
|
|
206
|
+
return manifest.compatibleScreens.push(
|
|
207
|
+
this.collapseAttributes(screen),
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
break;
|
|
203
211
|
case 'supports-gl-texture':
|
|
204
|
-
manifest.supportsGlTextures.push(this.collapseAttributes(element))
|
|
205
|
-
break
|
|
212
|
+
manifest.supportsGlTextures.push(this.collapseAttributes(element));
|
|
213
|
+
break;
|
|
206
214
|
case 'application':
|
|
207
|
-
manifest.application = this.parseApplication(element)
|
|
208
|
-
break
|
|
215
|
+
manifest.application = this.parseApplication(element);
|
|
216
|
+
break;
|
|
209
217
|
}
|
|
210
|
-
})
|
|
218
|
+
});
|
|
211
219
|
|
|
212
|
-
return manifest
|
|
220
|
+
return manifest;
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
|
|
216
|
-
module.exports = ManifestParser
|
|
224
|
+
module.exports = ManifestParser;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const Unzip = require('isomorphic-unzip');
|
|
2
2
|
const { isBrowser, decodeNullUnicode } = require('./utils');
|
|
3
|
-
|
|
3
|
+
const { enumZipEntries, readEntry } = require('../../bundle');
|
|
4
4
|
|
|
5
5
|
class Zip {
|
|
6
6
|
constructor(file) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { plugins } from './plugin-config';
|
|
2
1
|
import { t } from './i18n';
|
|
2
|
+
import { plugins } from './plugin-config';
|
|
3
3
|
|
|
4
4
|
interface BundleParams {
|
|
5
5
|
sentry: boolean;
|
|
@@ -21,7 +21,9 @@ export async function checkPlugins(): Promise<BundleParams> {
|
|
|
21
21
|
console.log(t('pluginDetected', { name: plugin.name }));
|
|
22
22
|
}
|
|
23
23
|
} catch (err) {
|
|
24
|
-
console.warn(
|
|
24
|
+
console.warn(
|
|
25
|
+
t('pluginDetectionError', { name: plugin.name, error: err }),
|
|
26
|
+
);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -3,8 +3,12 @@ const currentPackage = require(`${process.cwd()}/package.json`);
|
|
|
3
3
|
const _depVersions: Record<string, string> = {};
|
|
4
4
|
|
|
5
5
|
if (currentPackage) {
|
|
6
|
-
const depKeys = currentPackage.dependencies
|
|
7
|
-
|
|
6
|
+
const depKeys = currentPackage.dependencies
|
|
7
|
+
? Object.keys(currentPackage.dependencies)
|
|
8
|
+
: [];
|
|
9
|
+
const devDepKeys = currentPackage.devDependencies
|
|
10
|
+
? Object.keys(currentPackage.devDependencies)
|
|
11
|
+
: [];
|
|
8
12
|
const dedupedDeps = [...new Set([...depKeys, ...devDepKeys])];
|
|
9
13
|
|
|
10
14
|
for (const dep of dedupedDeps) {
|
|
@@ -20,9 +24,12 @@ if (currentPackage) {
|
|
|
20
24
|
|
|
21
25
|
export const depVersions = Object.keys(_depVersions)
|
|
22
26
|
.sort() // Sort the keys alphabetically
|
|
23
|
-
.reduce(
|
|
24
|
-
obj
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
.reduce(
|
|
28
|
+
(obj, key) => {
|
|
29
|
+
obj[key] = _depVersions[key]; // Rebuild the object with sorted keys
|
|
30
|
+
return obj;
|
|
31
|
+
},
|
|
32
|
+
{} as Record<string, string>,
|
|
33
|
+
);
|
|
27
34
|
|
|
28
35
|
// console.log({ depVersions });
|
package/src/utils/git.ts
CHANGED
package/src/utils/i18n.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
1
|
import os from 'os';
|
|
3
2
|
import path from 'path';
|
|
4
|
-
import pkg from '../../package.json';
|
|
5
|
-
import AppInfoParser from './app-info-parser';
|
|
6
|
-
import { satisfies } from 'compare-versions';
|
|
7
3
|
import chalk from 'chalk';
|
|
4
|
+
import { satisfies } from 'compare-versions';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import pkg from '../../package.json';
|
|
8
7
|
import latestVersion from '../utils/latest-version';
|
|
8
|
+
import AppInfoParser from './app-info-parser';
|
|
9
9
|
import { checkPlugins } from './check-plugin';
|
|
10
10
|
|
|
11
11
|
import { read } from 'read';
|
|
@@ -88,16 +88,14 @@ export async function getAppInfo(fn: string) {
|
|
|
88
88
|
}),
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
const updateJsonFile =
|
|
92
|
-
/rawfile\/update.json
|
|
93
|
-
);
|
|
91
|
+
const updateJsonFile =
|
|
92
|
+
await appInfoParser.parser.getEntryFromHarmonyApp(/rawfile\/update.json/);
|
|
94
93
|
let appCredential = {};
|
|
95
94
|
if (updateJsonFile) {
|
|
96
95
|
appCredential = JSON.parse(updateJsonFile.toString()).harmony;
|
|
97
96
|
}
|
|
98
|
-
const metaJsonFile =
|
|
99
|
-
/rawfile\/meta.json
|
|
100
|
-
);
|
|
97
|
+
const metaJsonFile =
|
|
98
|
+
await appInfoParser.parser.getEntryFromHarmonyApp(/rawfile\/meta.json/);
|
|
101
99
|
let metaData: Record<string, any> = {};
|
|
102
100
|
if (metaJsonFile) {
|
|
103
101
|
metaData = JSON.parse(metaJsonFile.toString());
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { dirname } from 'path';
|
|
1
3
|
import {
|
|
2
4
|
blue,
|
|
3
5
|
bold,
|
|
@@ -12,16 +14,14 @@ import {
|
|
|
12
14
|
underline,
|
|
13
15
|
yellow,
|
|
14
16
|
} from '@colors/colors/safe';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
+
import semverDiff from 'semver/functions/diff';
|
|
18
|
+
import semverMajor from 'semver/functions/major';
|
|
17
19
|
import latestVersion, {
|
|
18
20
|
type Package,
|
|
19
21
|
type PackageJson,
|
|
20
22
|
type LatestVersionPackage,
|
|
21
23
|
type LatestVersionOptions,
|
|
22
24
|
} from '.';
|
|
23
|
-
import semverMajor from 'semver/functions/major';
|
|
24
|
-
import semverDiff from 'semver/functions/diff';
|
|
25
25
|
|
|
26
26
|
interface TableColumn {
|
|
27
27
|
label: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
2
|
import type {
|
|
3
|
-
RequestOptions as HttpRequestOptions,
|
|
4
3
|
Agent,
|
|
4
|
+
RequestOptions as HttpRequestOptions,
|
|
5
5
|
IncomingMessage,
|
|
6
6
|
} from 'http';
|
|
7
7
|
import type { RequestOptions as HttpsRequestOptions } from 'https';
|
|
8
|
-
import { join, dirname, resolve as pathResolve, parse } from 'path';
|
|
9
|
-
import { npm, yarn } from 'global-dirs';
|
|
10
8
|
import { homedir } from 'os';
|
|
9
|
+
import { dirname, join, parse, resolve as pathResolve } from 'path';
|
|
11
10
|
import { URL } from 'url';
|
|
11
|
+
import { npm, yarn } from 'global-dirs';
|
|
12
12
|
|
|
13
|
-
import getRegistryUrl from 'registry-auth-token/registry-url';
|
|
14
13
|
import registryAuthToken from 'registry-auth-token';
|
|
15
|
-
import
|
|
14
|
+
import getRegistryUrl from 'registry-auth-token/registry-url';
|
|
16
15
|
import gt from 'semver/functions/gt';
|
|
16
|
+
import maxSatisfying from 'semver/ranges/max-satisfying';
|
|
17
17
|
|
|
18
18
|
interface RegistryVersions {
|
|
19
19
|
/**
|
|
@@ -132,9 +132,10 @@ interface LatestVersion {
|
|
|
132
132
|
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the `npm registry url` instead.
|
|
133
133
|
* @returns {Promise<LatestVersionPackage[]>}
|
|
134
134
|
*/
|
|
135
|
-
(
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
(
|
|
136
|
+
item: PackageJson,
|
|
137
|
+
options?: LatestVersionOptions,
|
|
138
|
+
): Promise<LatestVersionPackage[]>;
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
141
|
* Get latest version of a single package.
|
|
@@ -161,9 +162,10 @@ interface LatestVersion {
|
|
|
161
162
|
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the npm registry url instead.
|
|
162
163
|
* @returns {Promise<LatestVersionPackage[]>}
|
|
163
164
|
*/
|
|
164
|
-
(
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
(
|
|
166
|
+
items: Package[],
|
|
167
|
+
options?: LatestVersionOptions,
|
|
168
|
+
): Promise<LatestVersionPackage[]>; // eslint-disable-line @typescript-eslint/unified-signatures
|
|
167
169
|
}
|
|
168
170
|
type PackageRange = `${'@' | ''}${string}@${string}`;
|
|
169
171
|
type Package = PackageRange | string; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents
|
|
@@ -225,7 +227,7 @@ const downloadMetadata = (
|
|
|
225
227
|
};
|
|
226
228
|
const authInfo = registryAuthToken(pkgUrl.toString(), { recursive: true });
|
|
227
229
|
if (authInfo && requestOptions.headers) {
|
|
228
|
-
requestOptions.headers.authorization = `${authInfo.type} ${authInfo.token}`;
|
|
230
|
+
(requestOptions.headers as any).authorization = `${authInfo.type} ${authInfo.token}`;
|
|
229
231
|
}
|
|
230
232
|
if (options?.requestOptions) {
|
|
231
233
|
requestOptions = { ...requestOptions, ...options.requestOptions };
|
|
@@ -362,11 +364,9 @@ const getInstalledVersion = (
|
|
|
362
364
|
?.version as string;
|
|
363
365
|
} else if (location === 'globalYarn') {
|
|
364
366
|
// Make sure package is globally installed by Yarn
|
|
365
|
-
const yarnGlobalPkg = require(
|
|
366
|
-
yarn.packages,
|
|
367
|
-
|
|
368
|
-
'package.json',
|
|
369
|
-
));
|
|
367
|
+
const yarnGlobalPkg = require(
|
|
368
|
+
pathResolve(yarn.packages, '..', 'package.json'),
|
|
369
|
+
);
|
|
370
370
|
if (!yarnGlobalPkg?.dependencies?.[pkgName]) {
|
|
371
371
|
return undefined;
|
|
372
372
|
}
|
package/src/versions.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { get, getAllPackages, post, put, uploadFile } from './api';
|
|
|
2
2
|
import { question, saveToLocal } from './utils';
|
|
3
3
|
import { t } from './utils/i18n';
|
|
4
4
|
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { satisfies } from 'compare-versions';
|
|
7
|
+
import type { Package, Platform, Version } from './types';
|
|
5
8
|
import { getPlatform, getSelectedApp } from './app';
|
|
6
9
|
import { choosePackage } from './package';
|
|
7
10
|
import { depVersions } from './utils/dep-versions';
|
|
8
11
|
import { getCommitInfo } from './utils/git';
|
|
9
|
-
import type { Package, Platform, Version } from 'types';
|
|
10
|
-
import { satisfies } from 'compare-versions';
|
|
11
|
-
import chalk from 'chalk';
|
|
12
12
|
|
|
13
13
|
interface VersionCommandOptions {
|
|
14
14
|
appId?: string;
|