react-native-update-cli 2.10.1 → 2.10.2

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 (62) hide show
  1. package/README.md +47 -497
  2. package/README.zh-CN.md +52 -500
  3. package/cli.json +2 -16
  4. package/lib/api.js +1 -1
  5. package/lib/exports.d.ts +1 -1
  6. package/lib/index.d.ts +2 -3
  7. package/lib/index.js +14 -62
  8. package/lib/locales/en.d.ts +1 -0
  9. package/lib/locales/en.js +1 -0
  10. package/lib/locales/zh.d.ts +1 -0
  11. package/lib/locales/zh.js +1 -0
  12. package/lib/module-manager.d.ts +1 -5
  13. package/lib/module-manager.js +2 -30
  14. package/lib/modules/app-module.js +1 -249
  15. package/lib/modules/bundle-module.js +1 -173
  16. package/lib/modules/package-module.js +1 -2
  17. package/lib/modules/user-module.js +1 -399
  18. package/lib/modules/version-module.js +1 -2
  19. package/lib/package.d.ts +1 -2
  20. package/lib/package.js +6 -6
  21. package/lib/provider.d.ts +1 -4
  22. package/lib/provider.js +2 -21
  23. package/lib/types.d.ts +0 -20
  24. package/lib/user.d.ts +1 -1
  25. package/lib/user.js +1 -1
  26. package/lib/utils/app-info-parser/aab.js +1 -1
  27. package/lib/utils/app-info-parser/resource-finder.js +5 -5
  28. package/lib/utils/app-info-parser/utils.js +3 -2
  29. package/lib/utils/check-lockfile.js +1 -1
  30. package/lib/utils/dep-versions.js +2 -2
  31. package/lib/utils/http-helper.js +2 -2
  32. package/lib/utils/index.d.ts +1 -1
  33. package/lib/utils/index.js +1 -1
  34. package/lib/versions.d.ts +1 -0
  35. package/lib/versions.js +19 -14
  36. package/package.json +1 -1
  37. package/src/api.ts +1 -1
  38. package/src/exports.ts +0 -2
  39. package/src/index.ts +16 -81
  40. package/src/locales/en.ts +1 -0
  41. package/src/locales/zh.ts +1 -0
  42. package/src/module-manager.ts +1 -41
  43. package/src/modules/app-module.ts +1 -271
  44. package/src/modules/bundle-module.ts +1 -206
  45. package/src/modules/package-module.ts +0 -3
  46. package/src/modules/user-module.ts +1 -459
  47. package/src/modules/version-module.ts +0 -1
  48. package/src/package.ts +5 -7
  49. package/src/provider.ts +4 -25
  50. package/src/types.ts +0 -32
  51. package/src/user.ts +1 -1
  52. package/src/utils/app-info-parser/aab.ts +1 -1
  53. package/src/utils/app-info-parser/resource-finder.ts +5 -5
  54. package/src/utils/app-info-parser/utils.ts +2 -2
  55. package/src/utils/check-lockfile.ts +1 -1
  56. package/src/utils/dep-versions.ts +2 -2
  57. package/src/utils/http-helper.ts +2 -2
  58. package/src/utils/index.ts +1 -1
  59. package/src/versions.ts +24 -14
  60. package/lib/workflow-runner.d.ts +0 -2
  61. package/lib/workflow-runner.js +0 -25
  62. package/src/workflow-runner.ts +0 -24
@@ -1,277 +1,7 @@
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
- }
1
+ import type { CLIModule } from '../types';
37
2
 
38
3
  export const appModule: CLIModule = {
39
4
  name: 'app',
40
5
  version: '1.0.0',
41
-
42
6
  commands: [],
43
-
44
- workflows: [
45
- {
46
- name: 'setup-app',
47
- description: 'Setup a new app with initial configuration',
48
- steps: [
49
- {
50
- name: 'create',
51
- description: 'Create the app',
52
- execute: async (context: CommandContext) => {
53
- console.log('Creating app in workflow');
54
- const name = getStringOption(context.options, 'name');
55
- const downloadUrl = getStringOption(context.options, 'downloadUrl');
56
- const platform = normalizePlatformOption(context.options.platform);
57
- await appCommands.createApp({
58
- options: {
59
- name,
60
- downloadUrl,
61
- platform,
62
- },
63
- });
64
- return { appCreated: true };
65
- },
66
- },
67
- {
68
- name: 'select',
69
- description: 'Select the created app',
70
- execute: async (
71
- context: CommandContext,
72
- previousResult?: unknown,
73
- ) => {
74
- console.log('Selecting app in workflow');
75
- const state = toObjectState<AppWorkflowState>(previousResult, {});
76
- const platform = normalizePlatformOption(context.options.platform);
77
- await appCommands.selectApp({
78
- args: [],
79
- options: { platform },
80
- });
81
- return { ...state, appSelected: true };
82
- },
83
- },
84
- ],
85
- },
86
- {
87
- name: 'manage-apps',
88
- description: 'Manage multiple apps',
89
- steps: [
90
- {
91
- name: 'list-apps',
92
- description: 'List all apps',
93
- execute: async (context: CommandContext) => {
94
- console.log('Listing all apps');
95
- const platform = normalizePlatformOption(context.options.platform);
96
- await appCommands.apps({
97
- options: { platform },
98
- });
99
- return { appsListed: true };
100
- },
101
- },
102
- {
103
- name: 'select-target-app',
104
- description: 'Select target app for operations',
105
- execute: async (
106
- context: CommandContext,
107
- previousResult?: unknown,
108
- ) => {
109
- console.log('Selecting target app');
110
- const state = toObjectState<AppWorkflowState>(previousResult, {});
111
- const platform = normalizePlatformOption(context.options.platform);
112
- await appCommands.selectApp({
113
- args: [],
114
- options: { platform },
115
- });
116
- return { ...state, targetAppSelected: true };
117
- },
118
- },
119
- ],
120
- },
121
- {
122
- name: 'multi-platform-app-management',
123
- description: 'Multi-platform app unified management workflow',
124
- steps: [
125
- {
126
- name: 'scan-platforms',
127
- description: 'Scan apps on all platforms',
128
- execute: async (context: CommandContext) => {
129
- console.log('🔍 Scanning apps on all platforms...');
130
-
131
- const appsData: Record<Platform, WorkflowApp[]> = {
132
- ios: [],
133
- android: [],
134
- harmony: [],
135
- };
136
-
137
- for (const platform of allPlatforms) {
138
- console.log(` Scanning ${platform} platform...`);
139
-
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
- }
161
- }
162
-
163
- console.log('✅ Platform scanning completed');
164
-
165
- return { platforms: allPlatforms, appsData, scanned: true };
166
- },
167
- },
168
- {
169
- name: 'analyze-apps',
170
- description: 'Analyze app status',
171
- execute: async (
172
- context: CommandContext,
173
- previousResult?: unknown,
174
- ) => {
175
- console.log('📊 Analyzing app status...');
176
-
177
- const state = toObjectState<AppWorkflowState>(previousResult, {});
178
- const appsData =
179
- (state.appsData as Record<Platform, WorkflowApp[]> | undefined) ??
180
- emptyAppsData;
181
- const analysis: AppAnalysis = {
182
- totalApps: 0,
183
- activeApps: 0,
184
- inactiveApps: 0,
185
- platformDistribution: {
186
- ios: 0,
187
- android: 0,
188
- harmony: 0,
189
- },
190
- issues: [],
191
- };
192
-
193
- for (const platform of allPlatforms) {
194
- const platformApps = appsData[platform] ?? [];
195
- analysis.totalApps += platformApps.length;
196
- analysis.platformDistribution[platform] = platformApps.length;
197
-
198
- for (const app of platformApps) {
199
- if (app.status === 'active') {
200
- analysis.activeApps++;
201
- } else {
202
- analysis.inactiveApps++;
203
- analysis.issues.push(
204
- `${platform}/${app.name}: App is inactive`,
205
- );
206
- }
207
- }
208
- }
209
-
210
- console.log('📈 Analysis results:');
211
- console.log(` Total apps: ${analysis.totalApps}`);
212
- console.log(` Active apps: ${analysis.activeApps}`);
213
- console.log(` Inactive apps: ${analysis.inactiveApps}`);
214
-
215
- if (analysis.issues.length > 0) {
216
- console.log('⚠️ Issues found:');
217
- for (const issue of analysis.issues) {
218
- console.log(` - ${issue}`);
219
- }
220
- }
221
-
222
- return { ...state, analysis };
223
- },
224
- },
225
- {
226
- name: 'optimize-apps',
227
- description: 'Optimize app configuration',
228
- execute: async (
229
- context: CommandContext,
230
- previousResult?: unknown,
231
- ) => {
232
- console.log('⚡ Optimizing app configuration...');
233
-
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[] = [];
241
-
242
- if (analysis.inactiveApps > 0) {
243
- console.log(' Handling inactive apps...');
244
- optimizations.push('Reactivate inactive apps');
245
- }
246
-
247
- if (analysis.totalApps > 10) {
248
- console.log(' Many apps detected, suggest grouping...');
249
- optimizations.push('Create app groups');
250
- }
251
-
252
- for (const optimization of optimizations) {
253
- console.log(` Executing: ${optimization}...`);
254
- console.log(` ✅ ${optimization} completed`);
255
- }
256
-
257
- console.log('✅ App optimization completed');
258
-
259
- return { ...state, optimizations, optimized: true };
260
- },
261
- },
262
- ],
263
- options: {
264
- includeInactive: {
265
- hasValue: false,
266
- default: true,
267
- description: 'Include inactive apps',
268
- },
269
- autoOptimize: {
270
- hasValue: false,
271
- default: true,
272
- description: 'Auto optimize configuration',
273
- },
274
- },
275
- },
276
- ],
277
7
  };
@@ -1,212 +1,7 @@
1
- import { bundleCommands } from '../bundle';
2
- import type { CLIModule, CommandContext } from '../types';
1
+ import type { CLIModule } from '../types';
3
2
 
4
3
  export const bundleModule: CLIModule = {
5
4
  name: 'bundle',
6
5
  version: '1.0.0',
7
-
8
6
  commands: [],
9
-
10
- workflows: [
11
- {
12
- name: 'incremental-build',
13
- description: 'Incremental build workflow - generate diff packages',
14
- steps: [
15
- {
16
- name: 'detect-base-version',
17
- description: 'Detect base version',
18
- execute: async (context: CommandContext) => {
19
- console.log('🔍 Detecting base version...');
20
-
21
- const { baseVersion } = context.options;
22
-
23
- if (baseVersion) {
24
- console.log(`✅ Using specified base version: ${baseVersion}`);
25
- return { baseVersion, specified: true };
26
- }
27
-
28
- const autoDetectedVersion = 'latest';
29
-
30
- console.log(
31
- `✅ Auto detected base version: ${autoDetectedVersion}`,
32
- );
33
-
34
- return { baseVersion: autoDetectedVersion, specified: false };
35
- },
36
- },
37
- {
38
- name: 'build-current-version',
39
- description: 'Build current version',
40
- execute: async (
41
- context: CommandContext,
42
- previousResult?: unknown,
43
- ) => {
44
- console.log('🏗️ Building current version...');
45
- const state =
46
- previousResult && typeof previousResult === 'object'
47
- ? (previousResult as Record<string, unknown>)
48
- : {};
49
-
50
- const {
51
- platform,
52
- dev = false,
53
- sourcemap = false,
54
- bundleName = 'index.bundlejs',
55
- entryFile = 'index.js',
56
- intermediaDir,
57
- taro = false,
58
- expo = false,
59
- rncli = false,
60
- hermes = false,
61
- output,
62
- } = context.options;
63
-
64
- console.log(`Building ${platform} platform...`);
65
- console.log(` Entry file: ${entryFile}`);
66
- console.log(` Bundle name: ${bundleName}`);
67
- console.log(` Development mode: ${dev}`);
68
- console.log(` Source maps: ${sourcemap}`);
69
-
70
- try {
71
- const buildOptions: Record<string, unknown> = {
72
- platform,
73
- dev,
74
- sourcemap,
75
- bundleName,
76
- entryFile,
77
- taro,
78
- expo,
79
- rncli,
80
- hermes,
81
- intermediaDir: '${tempDir}/intermedia/${platform}',
82
- output: '${tempDir}/output/${platform}.${time}.ppk',
83
- };
84
- if (intermediaDir) {
85
- buildOptions.intermediaDir = intermediaDir;
86
- }
87
-
88
- await bundleCommands.bundle({
89
- args: [],
90
- options: buildOptions,
91
- });
92
-
93
- const bundlePath =
94
- typeof output === 'string'
95
- ? output
96
- : '${tempDir}/output/${platform}.${time}.ppk';
97
- const currentBuild = {
98
- version:
99
- typeof state.baseVersion === 'string'
100
- ? state.baseVersion
101
- : 'current',
102
- platform,
103
- bundlePath,
104
- buildTime: Date.now(),
105
- };
106
-
107
- console.log(
108
- `✅ Current version build completed: ${currentBuild.version}`,
109
- );
110
-
111
- return { ...state, currentBuild };
112
- } catch (error) {
113
- console.error('❌ Current version build failed:', error);
114
- throw error;
115
- }
116
- },
117
- },
118
- ],
119
- validate: (context: CommandContext) => {
120
- if (!context.options.platform) {
121
- console.error('❌ Incremental build requires platform specification');
122
- return false;
123
- }
124
- return true;
125
- },
126
- options: {
127
- platform: {
128
- hasValue: true,
129
- description: 'Target platform (required)',
130
- },
131
- baseVersion: {
132
- hasValue: true,
133
- description: 'Base version (auto detect if not specified)',
134
- },
135
- skipValidation: {
136
- hasValue: false,
137
- default: false,
138
- description: 'Skip diff package validation',
139
- },
140
- dev: {
141
- hasValue: false,
142
- default: false,
143
- description: 'Development mode build',
144
- },
145
- bundleName: {
146
- hasValue: true,
147
- default: 'index.bundlejs',
148
- description: 'Bundle file name',
149
- },
150
- entryFile: {
151
- hasValue: true,
152
- default: 'index.js',
153
- description: 'Entry file',
154
- },
155
- sourcemap: {
156
- hasValue: false,
157
- default: false,
158
- description: 'Generate source maps',
159
- },
160
- output: {
161
- hasValue: true,
162
- description: 'Custom output path for diff package',
163
- },
164
- intermediaDir: {
165
- hasValue: true,
166
- description: 'Intermediate directory',
167
- },
168
- taro: {
169
- hasValue: false,
170
- default: false,
171
- description: 'Use Taro CLI',
172
- },
173
- expo: {
174
- hasValue: false,
175
- default: false,
176
- description: 'Use Expo CLI',
177
- },
178
- rncli: {
179
- hasValue: false,
180
- default: false,
181
- description: 'Use React Native CLI',
182
- },
183
- hermes: {
184
- hasValue: false,
185
- default: false,
186
- description: 'Force enable Hermes',
187
- },
188
- name: {
189
- hasValue: true,
190
- description: 'Version name for publishing',
191
- },
192
- description: {
193
- hasValue: true,
194
- description: 'Version description for publishing',
195
- },
196
- metaInfo: {
197
- hasValue: true,
198
- description: 'Meta information for publishing',
199
- },
200
- rollout: {
201
- hasValue: true,
202
- description: 'Rollout percentage',
203
- },
204
- dryRun: {
205
- hasValue: false,
206
- default: false,
207
- description: 'Dry run mode',
208
- },
209
- },
210
- },
211
- ],
212
7
  };
@@ -3,8 +3,5 @@ import type { CLIModule } from '../types';
3
3
  export const packageModule: CLIModule = {
4
4
  name: 'package',
5
5
  version: '1.0.0',
6
-
7
6
  commands: [],
8
-
9
- workflows: [],
10
7
  };