Skip to content

Commit ebd5a45

Browse files
committed
remove unused module command system
1 parent 41c0035 commit ebd5a45

23 files changed

Lines changed: 112 additions & 879 deletions

example/README.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,32 @@
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
1010
example/
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
2320
npm 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

4931
const 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`.

example/README.zh-CN.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
1-
# 自定义模块示例
1+
# React Native Update CLI 示例
22

3-
这个目录包含 React Native Update CLI 自定义模块和命令扩展示例
3+
这个目录包含 React Native Update CLI 编程式 Provider API 和命令参数示例
44

55
## 目录结构
66

77
```text
88
example/
9-
├── modules/
10-
│ ├── custom-deploy-module.ts
11-
│ └── analytics-module.ts
129
├── scripts/
13-
│ ├── register-modules.ts
1410
│ └── provider-api-example.ts
11+
├── USAGE_CUSTOM_VERSION.md
1512
└── README.md
1613
```
1714

1815
## 快速开始
1916

2017
```bash
2118
npm run build
22-
npx ts-node example/scripts/register-modules.ts
23-
npx ts-node example/scripts/provider-api-example.ts
24-
```
25-
26-
## 自定义模块示例
27-
28-
```typescript
29-
import { moduleManager } from 'react-native-update-cli';
30-
import { customDeployModule } from './modules/custom-deploy-module';
31-
32-
moduleManager.registerModule(customDeployModule);
33-
34-
await moduleManager.executeCommand('deploy-dev', {
35-
args: [],
36-
options: { platform: 'ios', force: true },
37-
});
19+
npm run provider-demo
3820
```
3921

4022
## Provider API 示例
4123

4224
```typescript
43-
import { moduleManager } from 'react-native-update-cli';
25+
import { CLIProviderImpl } from 'react-native-update-cli';
4426

45-
const provider = moduleManager.getProvider();
27+
const provider = new CLIProviderImpl();
4628

4729
const bundleResult = await provider.bundle({
4830
platform: 'ios',
@@ -59,6 +41,4 @@ const publishResult = await provider.publish({
5941

6042
## 注意事项
6143

62-
- 每个模块都应该有唯一的 `name`
63-
- 通过模块注册的每个命令都应该有唯一的 `name`
64-
- 命令处理函数返回 `CommandResult`;调用方应先检查 `success` 再消费 `data`
44+
Provider 方法返回 `CommandResult`;调用方应先检查 `success` 再消费 `data`

example/modules/analytics-module.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

example/modules/custom-deploy-module.ts

Lines changed: 0 additions & 121 deletions
This file was deleted.

example/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"name": "react-native-update-cli-examples",
33
"version": "1.0.0",
4-
"description": "React Native Update CLI 自定义模块示例",
4+
"description": "React Native Update CLI provider examples",
55
"private": true,
66
"scripts": {
77
"build": "tsc --noEmit --skipLibCheck",
8-
"register-modules": "ts-node scripts/register-modules.ts",
98
"provider-demo": "ts-node scripts/provider-api-example.ts",
10-
"demo:all": "npm run register-modules && npm run provider-demo"
9+
"demo:all": "npm run provider-demo"
1110
},
1211
"dependencies": {
1312
"react-native-update-cli": "file:../"
@@ -21,9 +20,8 @@
2120
"react-native",
2221
"update",
2322
"cli",
24-
"module",
2523
"example",
26-
"custom"
24+
"provider"
2725
],
2826
"author": "reactnativecn",
2927
"license": "BSD-3-Clause"

example/scripts/provider-api-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env ts-node
22

3-
import { moduleManager } from '../../src/module-manager';
3+
import { CLIProviderImpl } from '../../src/provider';
44
import type { CLIProvider, Platform } from '../../src/types';
55

66
class DeploymentService {
77
private provider: CLIProvider;
88

99
constructor() {
10-
this.provider = moduleManager.getProvider();
10+
this.provider = new CLIProviderImpl();
1111
}
1212

1313
async buildAndPublish(platform: Platform, version: string) {

0 commit comments

Comments
 (0)