react-native-update-cli 2.8.5 → 2.9.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/lib/api.d.ts +18 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.js +5 -4
- package/lib/bundle-pack.d.ts +1 -0
- package/lib/bundle-pack.js +104 -0
- package/lib/bundle-runner.d.ts +20 -0
- package/lib/bundle-runner.js +404 -0
- package/lib/bundle.d.ts +6 -0
- package/lib/bundle.js +73 -471
- package/lib/diff.d.ts +13 -0
- package/lib/diff.js +144 -123
- package/lib/exports.d.ts +12 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +5 -13
- package/lib/install.d.ts +4 -0
- package/lib/locales/en.d.ts +137 -0
- package/lib/locales/zh.d.ts +136 -0
- package/lib/module-manager.d.ts +20 -0
- package/lib/module-manager.js +3 -9
- package/lib/modules/app-module.d.ts +2 -0
- package/lib/modules/app-module.js +84 -44
- package/lib/modules/bundle-module.d.ts +2 -0
- package/lib/modules/bundle-module.js +7 -8
- package/lib/modules/index.d.ts +6 -0
- package/lib/modules/package-module.d.ts +2 -0
- package/lib/modules/user-module.d.ts +2 -0
- package/lib/modules/user-module.js +55 -44
- package/lib/modules/version-module.d.ts +2 -0
- package/lib/package.d.ts +59 -0
- package/lib/package.js +110 -139
- package/lib/provider.d.ts +26 -0
- package/lib/provider.js +115 -217
- package/lib/types.d.ts +120 -0
- package/lib/user.d.ts +8 -0
- package/lib/utils/add-gitignore.d.ts +1 -0
- package/lib/utils/app-info-parser/aab.d.ts +22 -0
- package/lib/utils/app-info-parser/aab.js +0 -4
- package/lib/utils/app-info-parser/apk.d.ts +14 -0
- package/lib/utils/app-info-parser/apk.js +6 -4
- package/lib/utils/app-info-parser/app.d.ts +4 -0
- package/lib/utils/app-info-parser/app.js +3 -0
- package/lib/utils/app-info-parser/index.d.ts +16 -0
- package/lib/utils/app-info-parser/index.js +2 -0
- package/lib/utils/app-info-parser/ipa.d.ts +14 -0
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
- package/lib/utils/app-info-parser/utils.d.ts +31 -0
- package/lib/utils/app-info-parser/utils.js +1 -0
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +56 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +10 -0
- package/lib/utils/app-info-parser/zip.d.ts +18 -0
- package/lib/utils/app-info-parser/zip.js +7 -9
- package/lib/utils/check-lockfile.d.ts +1 -0
- package/lib/utils/check-plugin.d.ts +7 -0
- package/lib/utils/command-result.d.ts +3 -0
- package/lib/utils/command-result.js +35 -0
- package/lib/utils/constants.d.ts +9 -0
- package/lib/utils/dep-versions.d.ts +1 -0
- package/lib/utils/git.d.ts +8 -0
- package/lib/utils/http-helper.d.ts +4 -0
- package/lib/utils/i18n.d.ts +12 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +52 -22
- package/lib/utils/latest-version/cli.d.ts +1 -0
- package/lib/utils/latest-version/cli.js +24 -60
- package/lib/utils/latest-version/index.d.ts +146 -0
- package/lib/utils/latest-version/index.js +22 -22
- package/lib/utils/options.d.ts +4 -0
- package/lib/utils/options.js +63 -0
- package/lib/utils/plugin-config.d.ts +9 -0
- package/lib/utils/zip-entries.d.ts +3 -0
- package/lib/versions.d.ts +43 -0
- package/lib/workflow-runner.d.ts +2 -0
- package/lib/workflow-runner.js +25 -0
- package/package.json +20 -5
- package/src/api.ts +1 -1
- package/src/app.ts +20 -11
- package/src/bundle-pack.ts +51 -0
- package/src/bundle-runner.ts +463 -0
- package/src/bundle.ts +184 -571
- package/src/diff.ts +208 -174
- package/src/index.ts +15 -17
- package/src/module-manager.ts +15 -15
- package/src/modules/app-module.ts +120 -48
- package/src/modules/bundle-module.ts +21 -11
- package/src/modules/package-module.ts +0 -1
- package/src/modules/user-module.ts +117 -58
- package/src/package.ts +163 -138
- package/src/provider.ts +164 -240
- package/src/types.ts +13 -8
- package/src/utils/app-info-parser/aab.ts +0 -7
- package/src/utils/app-info-parser/apk.ts +9 -6
- package/src/utils/app-info-parser/app.ts +5 -1
- package/src/utils/app-info-parser/index.ts +11 -6
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +3 -0
- package/src/utils/app-info-parser/xml-parser/manifest.ts +3 -1
- package/src/utils/app-info-parser/zip.ts +12 -14
- package/src/utils/command-result.ts +24 -0
- package/src/utils/index.ts +138 -39
- package/src/utils/latest-version/cli.ts +22 -20
- package/src/utils/latest-version/index.ts +20 -20
- package/src/utils/options.ts +56 -0
- package/src/utils/zip-entries.ts +1 -1
- package/src/workflow-runner.ts +24 -0
- package/index.js +0 -1
|
@@ -1,5 +1,39 @@
|
|
|
1
|
-
import { appCommands } from '../app';
|
|
2
|
-
import type { CLIModule, CommandContext } from '../types';
|
|
1
|
+
import { appCommands, listApp } from '../app';
|
|
2
|
+
import type { CLIModule, CommandContext, Platform } from '../types';
|
|
3
|
+
import { getStringOption, toObjectState } from '../utils/options';
|
|
4
|
+
|
|
5
|
+
type WorkflowApp = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
platform: string;
|
|
9
|
+
version: string;
|
|
10
|
+
status: 'active' | 'inactive';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type AppAnalysis = {
|
|
14
|
+
totalApps: number;
|
|
15
|
+
activeApps: number;
|
|
16
|
+
inactiveApps: number;
|
|
17
|
+
platformDistribution: Record<Platform, number>;
|
|
18
|
+
issues: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const allPlatforms: Platform[] = ['ios', 'android', 'harmony'];
|
|
22
|
+
const emptyAppsData: Record<Platform, WorkflowApp[]> = {
|
|
23
|
+
ios: [],
|
|
24
|
+
android: [],
|
|
25
|
+
harmony: [],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AppWorkflowState = Record<string, unknown>;
|
|
29
|
+
|
|
30
|
+
function isPlatform(value: unknown): value is Platform {
|
|
31
|
+
return value === 'ios' || value === 'android' || value === 'harmony';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizePlatformOption(value: unknown): Platform | '' {
|
|
35
|
+
return isPlatform(value) ? value : '';
|
|
36
|
+
}
|
|
3
37
|
|
|
4
38
|
export const appModule: CLIModule = {
|
|
5
39
|
name: 'app',
|
|
@@ -17,12 +51,14 @@ export const appModule: CLIModule = {
|
|
|
17
51
|
description: 'Create the app',
|
|
18
52
|
execute: async (context: CommandContext) => {
|
|
19
53
|
console.log('Creating app in workflow');
|
|
20
|
-
const
|
|
54
|
+
const name = getStringOption(context.options, 'name');
|
|
55
|
+
const downloadUrl = getStringOption(context.options, 'downloadUrl');
|
|
56
|
+
const platform = normalizePlatformOption(context.options.platform);
|
|
21
57
|
await appCommands.createApp({
|
|
22
58
|
options: {
|
|
23
|
-
name
|
|
24
|
-
downloadUrl
|
|
25
|
-
platform
|
|
59
|
+
name,
|
|
60
|
+
downloadUrl,
|
|
61
|
+
platform,
|
|
26
62
|
},
|
|
27
63
|
});
|
|
28
64
|
return { appCreated: true };
|
|
@@ -31,14 +67,18 @@ export const appModule: CLIModule = {
|
|
|
31
67
|
{
|
|
32
68
|
name: 'select',
|
|
33
69
|
description: 'Select the created app',
|
|
34
|
-
execute: async (
|
|
70
|
+
execute: async (
|
|
71
|
+
context: CommandContext,
|
|
72
|
+
previousResult?: unknown,
|
|
73
|
+
) => {
|
|
35
74
|
console.log('Selecting app in workflow');
|
|
36
|
-
const
|
|
75
|
+
const state = toObjectState<AppWorkflowState>(previousResult, {});
|
|
76
|
+
const platform = normalizePlatformOption(context.options.platform);
|
|
37
77
|
await appCommands.selectApp({
|
|
38
78
|
args: [],
|
|
39
|
-
options: { platform
|
|
79
|
+
options: { platform },
|
|
40
80
|
});
|
|
41
|
-
return { ...
|
|
81
|
+
return { ...state, appSelected: true };
|
|
42
82
|
},
|
|
43
83
|
},
|
|
44
84
|
],
|
|
@@ -52,9 +92,9 @@ export const appModule: CLIModule = {
|
|
|
52
92
|
description: 'List all apps',
|
|
53
93
|
execute: async (context: CommandContext) => {
|
|
54
94
|
console.log('Listing all apps');
|
|
55
|
-
const
|
|
95
|
+
const platform = normalizePlatformOption(context.options.platform);
|
|
56
96
|
await appCommands.apps({
|
|
57
|
-
options: { platform
|
|
97
|
+
options: { platform },
|
|
58
98
|
});
|
|
59
99
|
return { appsListed: true };
|
|
60
100
|
},
|
|
@@ -62,14 +102,18 @@ export const appModule: CLIModule = {
|
|
|
62
102
|
{
|
|
63
103
|
name: 'select-target-app',
|
|
64
104
|
description: 'Select target app for operations',
|
|
65
|
-
execute: async (
|
|
105
|
+
execute: async (
|
|
106
|
+
context: CommandContext,
|
|
107
|
+
previousResult?: unknown,
|
|
108
|
+
) => {
|
|
66
109
|
console.log('Selecting target app');
|
|
67
|
-
const
|
|
110
|
+
const state = toObjectState<AppWorkflowState>(previousResult, {});
|
|
111
|
+
const platform = normalizePlatformOption(context.options.platform);
|
|
68
112
|
await appCommands.selectApp({
|
|
69
113
|
args: [],
|
|
70
|
-
options: { platform
|
|
114
|
+
options: { platform },
|
|
71
115
|
});
|
|
72
|
-
return { ...
|
|
116
|
+
return { ...state, targetAppSelected: true };
|
|
73
117
|
},
|
|
74
118
|
},
|
|
75
119
|
],
|
|
@@ -84,50 +128,70 @@ export const appModule: CLIModule = {
|
|
|
84
128
|
execute: async (context: CommandContext) => {
|
|
85
129
|
console.log('🔍 Scanning apps on all platforms...');
|
|
86
130
|
|
|
87
|
-
const
|
|
88
|
-
|
|
131
|
+
const appsData: Record<Platform, WorkflowApp[]> = {
|
|
132
|
+
ios: [],
|
|
133
|
+
android: [],
|
|
134
|
+
harmony: [],
|
|
135
|
+
};
|
|
89
136
|
|
|
90
|
-
for (const platform of
|
|
137
|
+
for (const platform of allPlatforms) {
|
|
91
138
|
console.log(` Scanning ${platform} platform...`);
|
|
92
139
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
140
|
+
try {
|
|
141
|
+
const rawApps = await listApp(platform);
|
|
142
|
+
const apps = rawApps.map((app, index) => ({
|
|
143
|
+
id: String(app.id ?? `${platform}-app-${index + 1}`),
|
|
144
|
+
name: app.name ?? `App ${index + 1}`,
|
|
145
|
+
platform: app.platform ?? platform,
|
|
146
|
+
version:
|
|
147
|
+
typeof (app as { version?: unknown }).version === 'string'
|
|
148
|
+
? ((app as { version?: string }).version ?? 'unknown')
|
|
149
|
+
: 'unknown',
|
|
150
|
+
status:
|
|
151
|
+
(app as { status?: unknown }).status === 'inactive'
|
|
152
|
+
? ('inactive' as const)
|
|
153
|
+
: ('active' as const),
|
|
154
|
+
}));
|
|
155
|
+
appsData[platform] = apps;
|
|
156
|
+
console.log(` ✅ Found ${apps.length} apps`);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
appsData[platform] = [];
|
|
159
|
+
console.warn(` ⚠️ Failed to scan ${platform}:`, error);
|
|
160
|
+
}
|
|
107
161
|
}
|
|
108
162
|
|
|
109
163
|
console.log('✅ Platform scanning completed');
|
|
110
164
|
|
|
111
|
-
return { platforms, appsData, scanned: true };
|
|
165
|
+
return { platforms: allPlatforms, appsData, scanned: true };
|
|
112
166
|
},
|
|
113
167
|
},
|
|
114
168
|
{
|
|
115
169
|
name: 'analyze-apps',
|
|
116
170
|
description: 'Analyze app status',
|
|
117
|
-
execute: async (
|
|
171
|
+
execute: async (
|
|
172
|
+
context: CommandContext,
|
|
173
|
+
previousResult?: unknown,
|
|
174
|
+
) => {
|
|
118
175
|
console.log('📊 Analyzing app status...');
|
|
119
176
|
|
|
120
|
-
const
|
|
121
|
-
const
|
|
177
|
+
const state = toObjectState<AppWorkflowState>(previousResult, {});
|
|
178
|
+
const appsData =
|
|
179
|
+
(state.appsData as Record<Platform, WorkflowApp[]> | undefined) ??
|
|
180
|
+
emptyAppsData;
|
|
181
|
+
const analysis: AppAnalysis = {
|
|
122
182
|
totalApps: 0,
|
|
123
183
|
activeApps: 0,
|
|
124
184
|
inactiveApps: 0,
|
|
125
|
-
platformDistribution: {
|
|
185
|
+
platformDistribution: {
|
|
186
|
+
ios: 0,
|
|
187
|
+
android: 0,
|
|
188
|
+
harmony: 0,
|
|
189
|
+
},
|
|
126
190
|
issues: [],
|
|
127
191
|
};
|
|
128
192
|
|
|
129
|
-
for (const
|
|
130
|
-
const platformApps =
|
|
193
|
+
for (const platform of allPlatforms) {
|
|
194
|
+
const platformApps = appsData[platform] ?? [];
|
|
131
195
|
analysis.totalApps += platformApps.length;
|
|
132
196
|
analysis.platformDistribution[platform] = platformApps.length;
|
|
133
197
|
|
|
@@ -150,20 +214,30 @@ export const appModule: CLIModule = {
|
|
|
150
214
|
|
|
151
215
|
if (analysis.issues.length > 0) {
|
|
152
216
|
console.log('⚠️ Issues found:');
|
|
153
|
-
|
|
217
|
+
for (const issue of analysis.issues) {
|
|
218
|
+
console.log(` - ${issue}`);
|
|
219
|
+
}
|
|
154
220
|
}
|
|
155
221
|
|
|
156
|
-
return { ...
|
|
222
|
+
return { ...state, analysis };
|
|
157
223
|
},
|
|
158
224
|
},
|
|
159
225
|
{
|
|
160
226
|
name: 'optimize-apps',
|
|
161
227
|
description: 'Optimize app configuration',
|
|
162
|
-
execute: async (
|
|
228
|
+
execute: async (
|
|
229
|
+
context: CommandContext,
|
|
230
|
+
previousResult?: unknown,
|
|
231
|
+
) => {
|
|
163
232
|
console.log('⚡ Optimizing app configuration...');
|
|
164
233
|
|
|
165
|
-
const
|
|
166
|
-
const
|
|
234
|
+
const state = toObjectState<AppWorkflowState>(previousResult, {});
|
|
235
|
+
const analysis = state.analysis as AppAnalysis | undefined;
|
|
236
|
+
if (!analysis) {
|
|
237
|
+
console.log(' No analysis data, skip optimization');
|
|
238
|
+
return { ...state, optimizations: [], optimized: false };
|
|
239
|
+
}
|
|
240
|
+
const optimizations: string[] = [];
|
|
167
241
|
|
|
168
242
|
if (analysis.inactiveApps > 0) {
|
|
169
243
|
console.log(' Handling inactive apps...');
|
|
@@ -175,16 +249,14 @@ export const appModule: CLIModule = {
|
|
|
175
249
|
optimizations.push('Create app groups');
|
|
176
250
|
}
|
|
177
251
|
|
|
178
|
-
// Simulate optimization process
|
|
179
252
|
for (const optimization of optimizations) {
|
|
180
253
|
console.log(` Executing: ${optimization}...`);
|
|
181
|
-
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
182
254
|
console.log(` ✅ ${optimization} completed`);
|
|
183
255
|
}
|
|
184
256
|
|
|
185
257
|
console.log('✅ App optimization completed');
|
|
186
258
|
|
|
187
|
-
return { ...
|
|
259
|
+
return { ...state, optimizations, optimized: true };
|
|
188
260
|
},
|
|
189
261
|
},
|
|
190
262
|
],
|
|
@@ -18,17 +18,14 @@ export const bundleModule: CLIModule = {
|
|
|
18
18
|
execute: async (context: CommandContext) => {
|
|
19
19
|
console.log('🔍 Detecting base version...');
|
|
20
20
|
|
|
21
|
-
const { baseVersion
|
|
21
|
+
const { baseVersion } = context.options;
|
|
22
22
|
|
|
23
23
|
if (baseVersion) {
|
|
24
24
|
console.log(`✅ Using specified base version: ${baseVersion}`);
|
|
25
25
|
return { baseVersion, specified: true };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
30
|
-
|
|
31
|
-
const autoDetectedVersion = `v${Math.floor(Math.random() * 3) + 1}.${Math.floor(Math.random() * 10)}.${Math.floor(Math.random() * 10)}`;
|
|
28
|
+
const autoDetectedVersion = 'latest';
|
|
32
29
|
|
|
33
30
|
console.log(
|
|
34
31
|
`✅ Auto detected base version: ${autoDetectedVersion}`,
|
|
@@ -40,8 +37,15 @@ export const bundleModule: CLIModule = {
|
|
|
40
37
|
{
|
|
41
38
|
name: 'build-current-version',
|
|
42
39
|
description: 'Build current version',
|
|
43
|
-
execute: async (
|
|
40
|
+
execute: async (
|
|
41
|
+
context: CommandContext,
|
|
42
|
+
previousResult?: unknown,
|
|
43
|
+
) => {
|
|
44
44
|
console.log('🏗️ Building current version...');
|
|
45
|
+
const state =
|
|
46
|
+
previousResult && typeof previousResult === 'object'
|
|
47
|
+
? (previousResult as Record<string, unknown>)
|
|
48
|
+
: {};
|
|
45
49
|
|
|
46
50
|
const {
|
|
47
51
|
platform,
|
|
@@ -64,7 +68,7 @@ export const bundleModule: CLIModule = {
|
|
|
64
68
|
console.log(` Source maps: ${sourcemap}`);
|
|
65
69
|
|
|
66
70
|
try {
|
|
67
|
-
const buildOptions:
|
|
71
|
+
const buildOptions: Record<string, unknown> = {
|
|
68
72
|
platform,
|
|
69
73
|
dev,
|
|
70
74
|
sourcemap,
|
|
@@ -86,11 +90,17 @@ export const bundleModule: CLIModule = {
|
|
|
86
90
|
options: buildOptions,
|
|
87
91
|
});
|
|
88
92
|
|
|
93
|
+
const bundlePath =
|
|
94
|
+
typeof output === 'string'
|
|
95
|
+
? output
|
|
96
|
+
: '${tempDir}/output/${platform}.${time}.ppk';
|
|
89
97
|
const currentBuild = {
|
|
90
|
-
version:
|
|
98
|
+
version:
|
|
99
|
+
typeof state.baseVersion === 'string'
|
|
100
|
+
? state.baseVersion
|
|
101
|
+
: 'current',
|
|
91
102
|
platform,
|
|
92
|
-
bundlePath
|
|
93
|
-
size: Math.floor(Math.random() * 15) + 10,
|
|
103
|
+
bundlePath,
|
|
94
104
|
buildTime: Date.now(),
|
|
95
105
|
};
|
|
96
106
|
|
|
@@ -98,7 +108,7 @@ export const bundleModule: CLIModule = {
|
|
|
98
108
|
`✅ Current version build completed: ${currentBuild.version}`,
|
|
99
109
|
);
|
|
100
110
|
|
|
101
|
-
return { ...
|
|
111
|
+
return { ...state, currentBuild };
|
|
102
112
|
} catch (error) {
|
|
103
113
|
console.error('❌ Current version build failed:', error);
|
|
104
114
|
throw error;
|