@nocobase/ctl 0.1.5 → 0.1.6
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.
- package/README.md +25 -25
- package/bin/dev.js +1 -1
- package/bin/run.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ node ./bin/run.js --help
|
|
|
36
36
|
After packaging or linking, the executable name is:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
|
|
39
|
+
nbctl
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Quick Start
|
|
@@ -44,40 +44,40 @@ nocobase
|
|
|
44
44
|
Add an environment:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
|
|
47
|
+
nbctl env add --name local --base-url http://localhost:13000/api --token <token>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Show the current environment:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
53
|
+
nbctl env
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
List configured environments:
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
|
|
59
|
+
nbctl env list
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Switch the current environment:
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
|
|
65
|
+
nbctl env use local
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
Update the runtime command cache from `swagger:get`:
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
nbctl env update
|
|
72
|
+
nbctl env update -e local
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
Use the generic resource commands:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
nbctl resource list --resource users
|
|
79
|
+
nbctl resource get --resource users --filter-by-tk 1
|
|
80
|
+
nbctl resource create --resource users --values '{"nickname":"Ada"}'
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
## Runtime Commands
|
|
@@ -96,34 +96,34 @@ If the `API documentation plugin` is disabled, the CLI will prompt to enable it.
|
|
|
96
96
|
Use `-e, --env` to temporarily select an environment:
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
nbctl env update -e prod
|
|
100
|
+
nbctl resource list --resource users -e prod
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
This does not change the current environment unless you explicitly run:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
|
|
106
|
+
nbctl env use <name>
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
## Config Scope
|
|
110
110
|
|
|
111
111
|
The `env` command supports two config scopes:
|
|
112
112
|
|
|
113
|
-
- `project`: use `./.nocobase-
|
|
114
|
-
- `global`: use the global `.nocobase-
|
|
113
|
+
- `project`: use `./.nocobase-ctl` in the current working directory
|
|
114
|
+
- `global`: use the global `.nocobase-ctl` directory
|
|
115
115
|
|
|
116
116
|
Use `-s, --scope` to select one explicitly:
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
nbctl env list -s project
|
|
120
|
+
nbctl env add -s global --name prod --base-url http://example.com/api --token <token>
|
|
121
|
+
nbctl env use local -s project
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
If you do not pass `--scope`, the CLI uses automatic resolution:
|
|
125
125
|
|
|
126
|
-
1. current working directory if `./.nocobase-
|
|
126
|
+
1. current working directory if `./.nocobase-ctl` exists
|
|
127
127
|
2. `NOCOBASE_HOME_CLI`
|
|
128
128
|
3. your home directory
|
|
129
129
|
|
|
@@ -137,9 +137,9 @@ Current built-in topics:
|
|
|
137
137
|
Check available commands at any time:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
nbctl --help
|
|
141
|
+
nbctl env --help
|
|
142
|
+
nbctl resource --help
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## Common Flags
|
|
@@ -152,13 +152,13 @@ nocobase resource --help
|
|
|
152
152
|
Example:
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
nbctl env update -e prod -s global
|
|
156
|
+
nbctl resource list --resource users -e prod -j
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
## Local Data
|
|
160
160
|
|
|
161
|
-
The CLI stores its local state in `.nocobase-
|
|
161
|
+
The CLI stores its local state in `.nocobase-ctl`, including:
|
|
162
162
|
|
|
163
163
|
- `config.json`: environment definitions and current selection
|
|
164
164
|
- `versions/<version>/commands.json`: cached runtime commands for a generated version
|
package/bin/dev.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
|
|
10
10
|
await ensureRuntimeFromArgv(process.argv.slice(2), {
|
|
11
|
-
configFile: path.join(path.dirname(__dirname), 'nocobase-
|
|
11
|
+
configFile: path.join(path.dirname(__dirname), 'nocobase-ctl.config.json'),
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
await execute({ development: true, dir: import.meta.url });
|
package/bin/run.js
CHANGED
|
@@ -9,7 +9,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
11
|
await ensureRuntimeFromArgv(process.argv.slice(2), {
|
|
12
|
-
configFile: path.join(path.dirname(__dirname), 'nocobase-
|
|
12
|
+
configFile: path.join(path.dirname(__dirname), 'nocobase-ctl.config.json'),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
await execute({ dir: import.meta.url });
|