react-native-update-cli 2.10.0 → 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 (65) 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/app.d.ts +7 -6
  6. package/lib/app.js +23 -22
  7. package/lib/exports.d.ts +1 -1
  8. package/lib/index.d.ts +2 -3
  9. package/lib/index.js +14 -62
  10. package/lib/locales/en.d.ts +1 -0
  11. package/lib/locales/en.js +1 -0
  12. package/lib/locales/zh.d.ts +1 -0
  13. package/lib/locales/zh.js +1 -0
  14. package/lib/module-manager.d.ts +1 -5
  15. package/lib/module-manager.js +2 -30
  16. package/lib/modules/app-module.js +1 -249
  17. package/lib/modules/bundle-module.js +1 -173
  18. package/lib/modules/package-module.js +1 -2
  19. package/lib/modules/user-module.js +1 -399
  20. package/lib/modules/version-module.js +1 -2
  21. package/lib/package.d.ts +1 -2
  22. package/lib/package.js +6 -6
  23. package/lib/provider.d.ts +1 -4
  24. package/lib/provider.js +2 -21
  25. package/lib/types.d.ts +0 -20
  26. package/lib/user.d.ts +1 -1
  27. package/lib/user.js +1 -1
  28. package/lib/utils/app-info-parser/aab.js +1 -1
  29. package/lib/utils/app-info-parser/resource-finder.js +5 -5
  30. package/lib/utils/app-info-parser/utils.js +3 -2
  31. package/lib/utils/check-lockfile.js +1 -1
  32. package/lib/utils/dep-versions.js +2 -2
  33. package/lib/utils/http-helper.js +2 -2
  34. package/lib/utils/index.d.ts +1 -1
  35. package/lib/utils/index.js +1 -1
  36. package/lib/versions.d.ts +1 -0
  37. package/lib/versions.js +19 -14
  38. package/package.json +1 -1
  39. package/src/api.ts +1 -1
  40. package/src/app.ts +39 -40
  41. package/src/exports.ts +0 -2
  42. package/src/index.ts +16 -81
  43. package/src/locales/en.ts +1 -0
  44. package/src/locales/zh.ts +1 -0
  45. package/src/module-manager.ts +1 -41
  46. package/src/modules/app-module.ts +1 -271
  47. package/src/modules/bundle-module.ts +1 -206
  48. package/src/modules/package-module.ts +0 -3
  49. package/src/modules/user-module.ts +1 -459
  50. package/src/modules/version-module.ts +0 -1
  51. package/src/package.ts +5 -7
  52. package/src/provider.ts +4 -25
  53. package/src/types.ts +0 -32
  54. package/src/user.ts +1 -1
  55. package/src/utils/app-info-parser/aab.ts +1 -1
  56. package/src/utils/app-info-parser/resource-finder.ts +5 -5
  57. package/src/utils/app-info-parser/utils.ts +2 -2
  58. package/src/utils/check-lockfile.ts +1 -1
  59. package/src/utils/dep-versions.ts +2 -2
  60. package/src/utils/http-helper.ts +2 -2
  61. package/src/utils/index.ts +1 -1
  62. package/src/versions.ts +24 -14
  63. package/lib/workflow-runner.d.ts +0 -2
  64. package/lib/workflow-runner.js +0 -25
  65. package/src/workflow-runner.ts +0 -24
@@ -5,14 +5,12 @@ import type {
5
5
  CommandContext,
6
6
  CommandDefinition,
7
7
  CommandResult,
8
- CustomWorkflow,
9
8
  } from './types';
10
9
 
11
10
  export class ModuleManager {
12
11
  private modules: Map<string, CLIModule> = new Map();
13
12
  private provider: CLIProvider;
14
13
  private commands: Map<string, CommandDefinition> = new Map();
15
- private workflows: Map<string, CustomWorkflow> = new Map();
16
14
 
17
15
  constructor() {
18
16
  this.provider = new CLIProviderImpl();
@@ -31,12 +29,6 @@ export class ModuleManager {
31
29
  }
32
30
  }
33
31
 
34
- if (module.workflows) {
35
- for (const workflow of module.workflows) {
36
- this.registerWorkflow(workflow);
37
- }
38
- }
39
-
40
32
  if (module.init) {
41
33
  module.init(this.provider);
42
34
  }
@@ -54,12 +46,6 @@ export class ModuleManager {
54
46
  }
55
47
  }
56
48
 
57
- if (module.workflows) {
58
- for (const workflow of module.workflows) {
59
- this.workflows.delete(workflow.name);
60
- }
61
- }
62
-
63
49
  if (module.cleanup) {
64
50
  module.cleanup();
65
51
  }
@@ -75,14 +61,6 @@ export class ModuleManager {
75
61
  this.commands.set(command.name, command);
76
62
  }
77
63
 
78
- registerWorkflow(workflow: CustomWorkflow): void {
79
- if (this.workflows.has(workflow.name)) {
80
- throw new Error(`Workflow '${workflow.name}' is already registered`);
81
- }
82
- this.workflows.set(workflow.name, workflow);
83
- this.provider.registerWorkflow(workflow);
84
- }
85
-
86
64
  async executeCommand(
87
65
  commandName: string,
88
66
  context: CommandContext,
@@ -95,13 +73,6 @@ export class ModuleManager {
95
73
  return await command.handler(context);
96
74
  }
97
75
 
98
- async executeWorkflow(
99
- workflowName: string,
100
- context: CommandContext,
101
- ): Promise<CommandResult> {
102
- return await this.provider.executeWorkflow(workflowName, context);
103
- }
104
-
105
76
  getProvider(): CLIProvider {
106
77
  return this.provider;
107
78
  }
@@ -110,10 +81,6 @@ export class ModuleManager {
110
81
  return Array.from(this.commands.values());
111
82
  }
112
83
 
113
- listWorkflows(): CustomWorkflow[] {
114
- return Array.from(this.workflows.values());
115
- }
116
-
117
84
  listModules(): CLIModule[] {
118
85
  return Array.from(this.modules.values());
119
86
  }
@@ -126,17 +93,10 @@ export class ModuleManager {
126
93
  );
127
94
  }
128
95
 
129
- console.log('\n=== Registered Workflows ===');
130
- for (const workflow of this.workflows.values()) {
131
- console.log(
132
- ` ${workflow.name}: ${workflow.description || 'No description'}`,
133
- );
134
- }
135
-
136
96
  console.log('\n=== Registered Modules ===');
137
97
  for (const module of this.modules.values()) {
138
98
  console.log(
139
- ` ${module.name} (v${module.version}): ${module.commands?.length || 0} commands, ${module.workflows?.length || 0} workflows`,
99
+ ` ${module.name} (v${module.version}): ${module.commands?.length || 0} commands`,
140
100
  );
141
101
  }
142
102
  }
@@ -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
  };