mirror of
				https://gitcode.com/github-mirrors/react-native-update-cli.git
				synced 2025-10-31 14:53:11 +08:00 
			
		
		
		
	cli modular refactor (#16)
* add logic to support SENTRY_PROPERTIES parameter * remove update.json and meta.json files in ppk * udpapte * refactor modles * update * add package-module file * update * update readme file * modifu cli.json file * fix command issues * improve version workflow logic * udpate * update * update * update * udpate * udpate * add example * update readme file * udpate version * change logic to use pushy command uniformly
This commit is contained in:
		
							
								
								
									
										125
									
								
								src/types.ts
									
									
									
									
									
								
							
							
						
						
									
										125
									
								
								src/types.ts
									
									
									
									
									
								
							| @@ -12,6 +12,12 @@ export type Platform = 'ios' | 'android' | 'harmony'; | ||||
| export interface Package { | ||||
|   id: string; | ||||
|   name: string; | ||||
|   version?: string; | ||||
|   status?: string; | ||||
|   appId?: string; | ||||
|   appKey?: string; | ||||
|   versionName?: any; | ||||
|   buildTime?: any; | ||||
| } | ||||
|  | ||||
| export interface Version { | ||||
| @@ -20,3 +26,122 @@ export interface Version { | ||||
|   name: string; | ||||
|   packages?: Package[]; | ||||
| } | ||||
|  | ||||
| export interface CommandContext { | ||||
|   args: string[]; | ||||
|   options: Record<string, any>; | ||||
|   platform?: Platform; | ||||
|   appId?: string; | ||||
|   session?: Session; | ||||
| } | ||||
|  | ||||
| export interface CommandResult { | ||||
|   success: boolean; | ||||
|   data?: any; | ||||
|   error?: string; | ||||
| } | ||||
|  | ||||
| export interface CommandDefinition { | ||||
|   name: string; | ||||
|   description?: string; | ||||
|   handler: (context: CommandContext) => Promise<CommandResult>; | ||||
|   options?: Record< | ||||
|     string, | ||||
|     { | ||||
|       hasValue?: boolean; | ||||
|       default?: any; | ||||
|       description?: string; | ||||
|     } | ||||
|   >; | ||||
| } | ||||
|  | ||||
| export interface BundleOptions { | ||||
|   dev?: boolean; | ||||
|   platform?: Platform; | ||||
|   bundleName?: string; | ||||
|   entryFile?: string; | ||||
|   output?: string; | ||||
|   sourcemap?: boolean; | ||||
|   taro?: boolean; | ||||
|   expo?: boolean; | ||||
|   rncli?: boolean; | ||||
|   disableHermes?: boolean; | ||||
| } | ||||
|  | ||||
| export interface PublishOptions { | ||||
|   name?: string; | ||||
|   description?: string; | ||||
|   metaInfo?: string; | ||||
|   packageId?: string; | ||||
|   packageVersion?: string; | ||||
|   minPackageVersion?: string; | ||||
|   maxPackageVersion?: string; | ||||
|   packageVersionRange?: string; | ||||
|   rollout?: number; | ||||
|   dryRun?: boolean; | ||||
| } | ||||
|  | ||||
| export interface UploadOptions { | ||||
|   platform?: Platform; | ||||
|   filePath: string; | ||||
|   appId?: string; | ||||
| } | ||||
|  | ||||
| export interface WorkflowStep { | ||||
|   name: string; | ||||
|   description?: string; | ||||
|   execute: (context: CommandContext, previousResult?: any) => Promise<any>; | ||||
|   condition?: (context: CommandContext) => boolean; | ||||
| } | ||||
|  | ||||
| export interface CustomWorkflow { | ||||
|   name: string; | ||||
|   description?: string; | ||||
|   steps: WorkflowStep[]; | ||||
|   validate?: (context: CommandContext) => boolean; | ||||
|   options?: Record< | ||||
|     string, | ||||
|     { | ||||
|       hasValue?: boolean; | ||||
|       default?: any; | ||||
|       description?: string; | ||||
|     } | ||||
|   >; | ||||
| } | ||||
|  | ||||
| export interface CLIProvider { | ||||
|   bundle: (options: BundleOptions) => Promise<CommandResult>; | ||||
|   publish: (options: PublishOptions) => Promise<CommandResult>; | ||||
|   upload: (options: UploadOptions) => Promise<CommandResult>; | ||||
|  | ||||
|   createApp: (name: string, platform: Platform) => Promise<CommandResult>; | ||||
|   listApps: (platform?: Platform) => Promise<CommandResult>; | ||||
|   getSelectedApp: ( | ||||
|     platform?: Platform, | ||||
|   ) => Promise<{ appId: string; platform: Platform }>; | ||||
|  | ||||
|   listVersions: (appId: string) => Promise<CommandResult>; | ||||
|   updateVersion: ( | ||||
|     appId: string, | ||||
|     versionId: string, | ||||
|     updates: Partial<Version>, | ||||
|   ) => Promise<CommandResult>; | ||||
|  | ||||
|   getPlatform: (platform?: Platform) => Promise<Platform>; | ||||
|   loadSession: () => Promise<Session>; | ||||
|  | ||||
|   registerWorkflow: (workflow: CustomWorkflow) => void; | ||||
|   executeWorkflow: ( | ||||
|     workflowName: string, | ||||
|     context: CommandContext, | ||||
|   ) => Promise<CommandResult>; | ||||
| } | ||||
|  | ||||
| export interface CLIModule { | ||||
|   name: string; | ||||
|   version: string; | ||||
|   commands?: CommandDefinition[]; | ||||
|   workflows?: CustomWorkflow[]; | ||||
|   init?: (provider: CLIProvider) => void; | ||||
|   cleanup?: () => void; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 波仔糕
					波仔糕