1- # Custom Module Examples
1+ # React Native Update CLI Examples
22
33[ 中文文档] ( ./README.zh-CN.md )
44
5- This directory contains examples for extending React Native Update CLI with custom modules and commands .
5+ This directory contains examples for using the React Native Update CLI programmatic Provider API and command options .
66
77## Directory Structure
88
99``` text
1010example/
11- ├── modules/
12- │ ├── custom-deploy-module.ts
13- │ └── analytics-module.ts
1411├── scripts/
15- │ ├── register-modules.ts
1612│ └── provider-api-example.ts
13+ ├── USAGE_CUSTOM_VERSION.md
1714└── README.md
1815```
1916
2017## Quick Start
2118
2219``` bash
2320npm run build
24- npx ts-node example/scripts/register-modules.ts
25- npx ts-node example/scripts/provider-api-example.ts
26- ```
27-
28- ## Custom Module Example
29-
30- ``` typescript
31- import { moduleManager } from ' react-native-update-cli' ;
32- import { customDeployModule } from ' ./modules/custom-deploy-module' ;
33-
34- moduleManager .registerModule (customDeployModule );
35-
36- await moduleManager .executeCommand (' deploy-dev' , {
37- args: [],
38- options: { platform: ' ios' , force: true },
39- });
21+ npm run provider-demo
4022```
4123
4224## Provider API Example
4325
4426``` typescript
45- import { moduleManager } from ' react-native-update-cli' ;
27+ import { CLIProviderImpl } from ' react-native-update-cli' ;
4628
47- const provider = moduleManager . getProvider ();
29+ const provider = new CLIProviderImpl ();
4830
4931const bundleResult = await provider .bundle ({
5032 platform: ' ios' ,
@@ -61,6 +43,4 @@ const publishResult = await provider.publish({
6143
6244## Notes
6345
64- - Each module should have a unique ` name ` .
65- - Each command registered through a module should have a unique ` name ` .
66- - Command handlers return ` CommandResult ` ; callers should check ` success ` before consuming ` data ` .
46+ Provider methods return ` CommandResult ` ; callers should check ` success ` before consuming ` data ` .
0 commit comments