@dxos/cli 2.4.15-alpha.0 → 2.5.1-alpha.0
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 +60 -69
- package/bin/dx.js +1 -1
- package/dist/known-extensions.yml +129 -0
- package/dist/src/extensions.d.ts +6 -0
- package/dist/src/extensions.d.ts.map +1 -0
- package/dist/src/extensions.js +45 -0
- package/dist/src/extensions.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +78 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/modules/cert.d.ts +4 -0
- package/dist/src/modules/cert.d.ts.map +1 -0
- package/dist/src/modules/cert.js +33 -0
- package/dist/src/modules/cert.js.map +1 -0
- package/dist/src/modules/extension.d.ts +4 -0
- package/dist/src/modules/extension.d.ts.map +1 -0
- package/dist/src/modules/extension.js +145 -0
- package/dist/src/modules/extension.js.map +1 -0
- package/dist/src/modules/installation.d.ts +5 -0
- package/dist/src/modules/installation.d.ts.map +1 -0
- package/dist/src/modules/installation.js +91 -0
- package/dist/src/modules/installation.js.map +1 -0
- package/dist/src/modules/pluggable.d.ts +14 -0
- package/dist/src/modules/pluggable.d.ts.map +1 -0
- package/dist/src/modules/pluggable.js +48 -0
- package/dist/src/modules/pluggable.js.map +1 -0
- package/dist/src/modules/profile.d.ts +2 -0
- package/dist/src/modules/profile.d.ts.map +1 -0
- package/dist/src/modules/profile.js +75 -0
- package/dist/src/modules/profile.js.map +1 -0
- package/dist/src/modules/services.d.ts +5 -0
- package/dist/src/modules/services.d.ts.map +1 -0
- package/dist/src/modules/services.js +260 -0
- package/dist/src/modules/services.js.map +1 -0
- package/dist/src/pluggable.d.ts +65 -0
- package/dist/src/pluggable.d.ts.map +1 -0
- package/dist/src/pluggable.js +226 -0
- package/dist/src/pluggable.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +22 -38
- package/dist/es/extensions.js +0 -100
- package/dist/es/main.js +0 -98
- package/dist/es/modules/cert.js +0 -43
- package/dist/es/modules/extension.js +0 -191
- package/dist/es/modules/installation.js +0 -144
- package/dist/es/modules/pluggable.js +0 -68
- package/dist/es/modules/profile.js +0 -100
- package/dist/es/modules/services.js +0 -408
- package/dist/es/pluggable.js +0 -312
package/README.md
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
# DXOS CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
General information about DXOS CLI can be found [here](../../README.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
$ yarn global add @dxos/cli@beta
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
or
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
$ npm install --global @dxos/cli@beta
|
|
15
|
-
```
|
|
16
|
-
*Note: You will need to be logged into your npm account in the terminal for this to work*
|
|
5
|
+
## Usage
|
|
17
6
|
|
|
18
7
|
### Profiles
|
|
19
8
|
|
|
@@ -29,7 +18,7 @@ Example:
|
|
|
29
18
|
$ dx profile init --name moon --template-url https://git.io/JuhES
|
|
30
19
|
```
|
|
31
20
|
|
|
32
|
-
Profiles are stored in the `~/.
|
|
21
|
+
Profiles are stored in the `~/.dx/profile` folder. To further customize a profile, edit the profile configuration file.
|
|
33
22
|
|
|
34
23
|
To activate/use a profile, do one of the following (highest to lowest precedence):
|
|
35
24
|
|
|
@@ -61,7 +50,7 @@ View the profile used for a command (using the `--dry-run` flag):
|
|
|
61
50
|
|
|
62
51
|
```bash
|
|
63
52
|
$ dx wns status --dry-run
|
|
64
|
-
Profile: /Users/ashwinp/.
|
|
53
|
+
Profile: /Users/ashwinp/.dx/profile/devnet.yml
|
|
65
54
|
```
|
|
66
55
|
|
|
67
56
|
Multiple templates can be created and shared with others to use different configuration values. Some [sample templates](./profiles/README.md) are included in the repo.
|
|
@@ -108,23 +97,27 @@ $ dx extension uninstall @dxos/cli-ipfs
|
|
|
108
97
|
Found Extension @dxos/cli-ipfs@1.0.1-beta.2 installed, do you wish to remove it? (Yes/No): y
|
|
109
98
|
✔ Uninstalling @dxos/cli-ipfs
|
|
110
99
|
```
|
|
111
|
-
## Commands
|
|
112
|
-
|
|
113
|
-
All the CLI modules support `help` flag that provides desired command clarification, e.g.
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
$ dx help
|
|
117
|
-
```
|
|
118
100
|
|
|
119
|
-
|
|
120
|
-
$ dx app help
|
|
121
|
-
```
|
|
101
|
+
#### Available Extensions
|
|
122
102
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
103
|
+
| Extension |
|
|
104
|
+
| :------------ |
|
|
105
|
+
| [App CLI](../cli-app/README.md) |
|
|
106
|
+
| [Bot CLI](../cli-bot/README.md) |
|
|
107
|
+
| [Chat CLI](../cli-chat/README.md) |
|
|
108
|
+
| [Console CLI](../cli-console/README.md) |
|
|
109
|
+
| [Data CLI](../cli-data/README.md) |
|
|
110
|
+
| [DXNS CLI](../cli-dxns/README.md) |
|
|
111
|
+
| [ECHO CLI](../cli-echo/README.md) |
|
|
112
|
+
| [HALO CLI](../cli-halo/README.md) |
|
|
113
|
+
| [IPFS CLI](../cli-ipfs/README.md) |
|
|
114
|
+
| [KUBE CLI](../cli-kube/README.md) |
|
|
115
|
+
| [MDNS CLI](../cli-mdns/README.md) |
|
|
116
|
+
| [Mesh CLI](../cli-mesh/README.md) |
|
|
117
|
+
| [Pad CLI](../cli-pad/README.md) |
|
|
118
|
+
| [Signal CLI](../cli-signal/README.md) |
|
|
119
|
+
| [WNS CLI](../cli-wns/README.md) |
|
|
126
120
|
|
|
127
|
-
## Setup
|
|
128
121
|
|
|
129
122
|
### Certification
|
|
130
123
|
|
|
@@ -136,38 +129,52 @@ $ dx cert import --url https://kube.local/kube.pem
|
|
|
136
129
|
|
|
137
130
|
<!--TODO(egor): Host cert on .well-known endpoint.-->
|
|
138
131
|
|
|
139
|
-
Corresponding certificate would be downloaded to `~/.
|
|
132
|
+
Corresponding certificate would be downloaded to `~/.dx/certs` and considered by CLI as "trusted".
|
|
140
133
|
|
|
141
|
-
|
|
134
|
+
## Development
|
|
142
135
|
|
|
143
|
-
|
|
136
|
+
### Dependencies
|
|
144
137
|
|
|
145
|
-
|
|
138
|
+
- [yarn](https://yarnpkg.com/)
|
|
139
|
+
- [jq](https://stedolan.github.io/jq/)
|
|
146
140
|
|
|
147
|
-
|
|
141
|
+
### Setup
|
|
148
142
|
|
|
149
|
-
|
|
143
|
+
```bash
|
|
144
|
+
# CLI is a yarn monorepo
|
|
150
145
|
|
|
146
|
+
# Install dependencies
|
|
147
|
+
yarn
|
|
148
|
+
|
|
149
|
+
# Build all packages
|
|
150
|
+
yarn build
|
|
151
151
|
```
|
|
152
|
-
$ dx version
|
|
153
|
-
v1.0.1-beta.15
|
|
154
|
-
|
|
155
|
-
$ dx upgrade --force
|
|
156
|
-
Found extensions: @dxos/cli-data, @dxos/cli-signal, @dxos/cli-bot, @dxos/cli-app
|
|
157
|
-
✔ Uninstalling @dxos/cli-data
|
|
158
|
-
✔ Uninstalling @dxos/cli-signal
|
|
159
|
-
✔ Uninstalling @dxos/cli-bot
|
|
160
|
-
✔ Uninstalling @dxos/cli-app
|
|
161
|
-
✔ Uninstalling @dxos/cli
|
|
162
|
-
✔ Installing @dxos/cli
|
|
163
|
-
✔ Installing @dxos/cli-app
|
|
164
|
-
✔ Installing @dxos/cli-bot
|
|
165
|
-
✔ Installing @dxos/cli-signal
|
|
166
|
-
✔ Installing @dxos/cli-data
|
|
167
152
|
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
### Running commands locally
|
|
154
|
+
|
|
155
|
+
During local development there is a need for testing of a newly created / modified commands. For that purpose, any cli command could be called from the repo root via `yarn dx`, e.g.:
|
|
156
|
+
|
|
170
157
|
```
|
|
158
|
+
yarn dx dxns resource list --json
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
If the command ought to be called from the specific path (e.g. during app deployent), an alias for the local dx binary coud be created by adding such to the shell profile:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
alias dx-local='node ~/path/to/cli/packages/cli/bin/dx.js'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Then, all commands could be called via `dx-local` in any directory, like:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
dx-local dxns resource list --json
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Environment Variables
|
|
174
|
+
|
|
175
|
+
While the usage of ENV variables is minimized, in some edge cases CLI still uses ENV variables for configuration. Those variables are mapped to the canonical structure: [ENV mapping](../cli-core/src/env-map.json)
|
|
176
|
+
|
|
177
|
+
ENV variables are also used to pass configuration between CLI and spawned processes, but this happens transparently for CLI user.
|
|
171
178
|
|
|
172
179
|
## Troubleshooting
|
|
173
180
|
|
|
@@ -188,7 +195,7 @@ $ dx version
|
|
|
188
195
|
If those outputs are different, make sure to remove old versions of `wire`.
|
|
189
196
|
Remove old CLI and extensions, installed globally.
|
|
190
197
|
|
|
191
|
-
|
|
198
|
+
For that purpose `dx uninstall` and `dx upgrade` commands are available.
|
|
192
199
|
|
|
193
200
|
To remove CLI and all extensions:
|
|
194
201
|
|
|
@@ -203,19 +210,3 @@ $ dx upgrade --npm-client yarn --force
|
|
|
203
210
|
```
|
|
204
211
|
|
|
205
212
|
`--version` attribute could be supplied in order to upgrade/downgrade to a specific version.
|
|
206
|
-
|
|
207
|
-
## Extensions
|
|
208
|
-
|
|
209
|
-
| Extension |
|
|
210
|
-
| :------------ |
|
|
211
|
-
| [App CLI](https://github.com/dxos/cli/blob/master/packages/cli-app/README.md) |
|
|
212
|
-
| [Bot CLI](https://github.com/dxos/cli/blob/master/packages/cli-bot/README.md) |
|
|
213
|
-
| [Chat CLI](https://github.com/dxos/cli/blob/master/packages/cli-chat/README.md) |
|
|
214
|
-
| [Dashboard CLI](https://github.com/dxos/cli/blob/master/packages/cli-dashboard/README.md) |
|
|
215
|
-
| [Data CLI](https://github.com/dxos/cli/blob/master/packages/cli-data/README.md) |
|
|
216
|
-
| [IPFS CLI](https://github.com/dxos/cli/blob/master/packages/cli-ipfs/README.md) |
|
|
217
|
-
| [Machine CLI](https://github.com/dxos/cli/blob/master/packages/cli-machine/README.md) |
|
|
218
|
-
| [MDNS CLI](https://github.com/dxos/cli/blob/master/packages/cli-mdns/README.md) |
|
|
219
|
-
| [Pad CLI](https://github.com/dxos/cli/blob/master/packages/cli-pad/README.md) |
|
|
220
|
-
| [Signal CLI](https://github.com/dxos/cli/blob/master/packages/cli-signal/README.md) |
|
|
221
|
-
| [WNS CLI](https://github.com/dxos/cli/blob/master/packages/cli-wns/README.md) |
|
package/bin/dx.js
CHANGED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# This is an autogenerated file. Do not edit this file directly.
|
|
2
|
+
---
|
|
3
|
+
-
|
|
4
|
+
moduleName: "@dxos/cli-app"
|
|
5
|
+
describe: "App proxy extension."
|
|
6
|
+
command:
|
|
7
|
+
- "app"
|
|
8
|
+
initRequired: false
|
|
9
|
+
destroyRequired: false
|
|
10
|
+
-
|
|
11
|
+
moduleName: "@dxos/cli-bot"
|
|
12
|
+
describe: "Bot extension."
|
|
13
|
+
command:
|
|
14
|
+
- "bot"
|
|
15
|
+
initRequired: false
|
|
16
|
+
destroyRequired: false
|
|
17
|
+
-
|
|
18
|
+
moduleName: "@dxos/cli-chat"
|
|
19
|
+
describe: "Chat extension."
|
|
20
|
+
command:
|
|
21
|
+
- "chat"
|
|
22
|
+
initRequired: false
|
|
23
|
+
destroyRequired: false
|
|
24
|
+
-
|
|
25
|
+
moduleName: "@dxos/cli-console"
|
|
26
|
+
describe: "KUBE console extension."
|
|
27
|
+
command:
|
|
28
|
+
- "console"
|
|
29
|
+
initRequired: false
|
|
30
|
+
destroyRequired: false
|
|
31
|
+
-
|
|
32
|
+
moduleName: "@dxos/cli-data"
|
|
33
|
+
describe: "Party and Device management."
|
|
34
|
+
command:
|
|
35
|
+
-
|
|
36
|
+
command: "party"
|
|
37
|
+
describe: "Party management."
|
|
38
|
+
-
|
|
39
|
+
command: "storage"
|
|
40
|
+
describe: "Storage management."
|
|
41
|
+
-
|
|
42
|
+
command: "device"
|
|
43
|
+
describe: "Device management."
|
|
44
|
+
initRequired: true
|
|
45
|
+
destroyRequired: true
|
|
46
|
+
-
|
|
47
|
+
moduleName: "@dxos/cli-dxns"
|
|
48
|
+
describe: "DXNS extension."
|
|
49
|
+
command:
|
|
50
|
+
- "dxns"
|
|
51
|
+
initRequired: true
|
|
52
|
+
destroyRequired: true
|
|
53
|
+
-
|
|
54
|
+
moduleName: "@dxos/cli-echo"
|
|
55
|
+
describe: "ECHO extension."
|
|
56
|
+
command:
|
|
57
|
+
- "echo"
|
|
58
|
+
initRequired: false
|
|
59
|
+
destroyRequired: false
|
|
60
|
+
-
|
|
61
|
+
moduleName: "@dxos/cli-halo"
|
|
62
|
+
describe: "HALO extension."
|
|
63
|
+
command:
|
|
64
|
+
- "halo"
|
|
65
|
+
initRequired: false
|
|
66
|
+
destroyRequired: false
|
|
67
|
+
-
|
|
68
|
+
moduleName: "@dxos/cli-ipfs"
|
|
69
|
+
describe: "IPFS extension."
|
|
70
|
+
command:
|
|
71
|
+
- "ipfs"
|
|
72
|
+
initRequired: false
|
|
73
|
+
destroyRequired: false
|
|
74
|
+
-
|
|
75
|
+
moduleName: "@dxos/cli-kube"
|
|
76
|
+
describe: "KUBE extension."
|
|
77
|
+
command:
|
|
78
|
+
- "kube"
|
|
79
|
+
initRequired: false
|
|
80
|
+
destroyRequired: false
|
|
81
|
+
-
|
|
82
|
+
moduleName: "@dxos/cli-mdns"
|
|
83
|
+
describe: "MDNS extension."
|
|
84
|
+
command:
|
|
85
|
+
- "mdns"
|
|
86
|
+
initRequired: false
|
|
87
|
+
destroyRequired: false
|
|
88
|
+
-
|
|
89
|
+
moduleName: "@dxos/cli-mesh"
|
|
90
|
+
describe: "MESH extension."
|
|
91
|
+
command:
|
|
92
|
+
- "mesh"
|
|
93
|
+
initRequired: false
|
|
94
|
+
destroyRequired: false
|
|
95
|
+
-
|
|
96
|
+
moduleName: "@dxos/cli-pad"
|
|
97
|
+
describe: "Pad extension."
|
|
98
|
+
command:
|
|
99
|
+
- "pad"
|
|
100
|
+
initRequired: false
|
|
101
|
+
destroyRequired: false
|
|
102
|
+
-
|
|
103
|
+
moduleName: "@dxos/cli-signal"
|
|
104
|
+
describe: "Signal server extension."
|
|
105
|
+
command:
|
|
106
|
+
-
|
|
107
|
+
command: "signal"
|
|
108
|
+
describe: "Signal server as process."
|
|
109
|
+
-
|
|
110
|
+
command: "container-signal"
|
|
111
|
+
describe: "Signal server as container."
|
|
112
|
+
initRequired: false
|
|
113
|
+
destroyRequired: false
|
|
114
|
+
-
|
|
115
|
+
moduleName: "@dxos/cli-wns"
|
|
116
|
+
describe: "Registry extension."
|
|
117
|
+
command:
|
|
118
|
+
-
|
|
119
|
+
command: "wns"
|
|
120
|
+
describe: "Registry operations."
|
|
121
|
+
-
|
|
122
|
+
command: "faucet"
|
|
123
|
+
describe: "Faucet management."
|
|
124
|
+
-
|
|
125
|
+
command: "keys"
|
|
126
|
+
describe: "Keys management."
|
|
127
|
+
initRequired: false
|
|
128
|
+
destroyRequired: false
|
|
129
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const EXTENSIONS_CONFIG: ".dx/extensions.yml";
|
|
2
|
+
export function getInfo(name: any): Promise<any>;
|
|
3
|
+
export function addInstalled(name: any, info: any): Promise<void>;
|
|
4
|
+
export function removeInstalled(name: any): Promise<void>;
|
|
5
|
+
export function listInstalled(): Promise<any>;
|
|
6
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/extensions.js"],"names":[],"mappings":"AASA,qDAAsD;AAI/C,iDAGN;AAEM,kEAaN;AAEM,0DAIN;AAEM,8CAIN"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2020 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.listInstalled = exports.removeInstalled = exports.addInstalled = exports.getInfo = exports.EXTENSIONS_CONFIG = void 0;
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const cli_core_1 = require("@dxos/cli-core");
|
|
13
|
+
exports.EXTENSIONS_CONFIG = '.dx/extensions.yml';
|
|
14
|
+
const filePath = path_1.default.join(os_1.default.homedir(), exports.EXTENSIONS_CONFIG);
|
|
15
|
+
const getInfo = async (name) => {
|
|
16
|
+
const { extensions = [] } = await (0, cli_core_1.readFile)(filePath, { absolute: true });
|
|
17
|
+
return extensions.find(({ moduleName }) => moduleName === name);
|
|
18
|
+
};
|
|
19
|
+
exports.getInfo = getInfo;
|
|
20
|
+
const addInstalled = async (name, info) => {
|
|
21
|
+
const { package: { version }, command, description } = info;
|
|
22
|
+
let { extensions = [] } = await (0, cli_core_1.readFile)(filePath, { absolute: true });
|
|
23
|
+
extensions = extensions.filter(({ moduleName }) => moduleName !== name);
|
|
24
|
+
extensions.push({
|
|
25
|
+
moduleName: name,
|
|
26
|
+
version,
|
|
27
|
+
describe: description,
|
|
28
|
+
command
|
|
29
|
+
});
|
|
30
|
+
return (0, cli_core_1.writeFile)({ extensions }, filePath, { absolute: true });
|
|
31
|
+
};
|
|
32
|
+
exports.addInstalled = addInstalled;
|
|
33
|
+
const removeInstalled = async (name) => {
|
|
34
|
+
let { extensions = [] } = await (0, cli_core_1.readFile)(filePath, { absolute: true });
|
|
35
|
+
extensions = extensions.filter(({ moduleName }) => moduleName !== name);
|
|
36
|
+
return (0, cli_core_1.writeFile)({ extensions }, filePath, { absolute: true });
|
|
37
|
+
};
|
|
38
|
+
exports.removeInstalled = removeInstalled;
|
|
39
|
+
const listInstalled = async () => {
|
|
40
|
+
const { extensions = [] } = await (0, cli_core_1.readFile)(filePath, { absolute: true });
|
|
41
|
+
extensions.sort(({ moduleName: a }, { moduleName: b }) => a > b ? 1 : a < b ? -1 : 0);
|
|
42
|
+
return extensions;
|
|
43
|
+
};
|
|
44
|
+
exports.listInstalled = listInstalled;
|
|
45
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/extensions.js"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4CAAoB;AACpB,gDAAwB;AAExB,6CAAqD;AAExC,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,yBAAiB,CAAC,CAAC;AAErD,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE;IACpC,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;AAClE,CAAC,CAAC;AAHW,QAAA,OAAO,WAGlB;AAEK,MAAM,YAAY,GAAG,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAC/C,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAC5D,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ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AAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAJW,QAAA,aAAa,iBAIxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":""}
|
package/dist/src/main.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2020 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
11
|
+
const lodash_uniqby_1 = __importDefault(require("lodash.uniqby"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const read_pkg_up_1 = __importDefault(require("read-pkg-up"));
|
|
14
|
+
const cli_core_1 = require("@dxos/cli-core");
|
|
15
|
+
const extensions_1 = require("./extensions");
|
|
16
|
+
const cert_1 = require("./modules/cert");
|
|
17
|
+
const extension_1 = require("./modules/extension");
|
|
18
|
+
const installation_1 = require("./modules/installation");
|
|
19
|
+
const pluggable_1 = require("./modules/pluggable");
|
|
20
|
+
const profile_1 = require("./modules/profile");
|
|
21
|
+
const services_1 = require("./modules/services");
|
|
22
|
+
const KNOWN_EXTENSIONS = (0, fs_1.readFileSync)(path_1.default.join(__dirname, '../known-extensions.yml')).toString();
|
|
23
|
+
const { logError } = (0, cli_core_1.getLoggers)();
|
|
24
|
+
const knownExtensions = js_yaml_1.default.load(KNOWN_EXTENSIONS);
|
|
25
|
+
const pkg = read_pkg_up_1.default.sync({ cwd: __dirname });
|
|
26
|
+
const CLI_BASE_COMMAND = 'dx';
|
|
27
|
+
const CLI_CONFIG = {
|
|
28
|
+
prompt: CLI_BASE_COMMAND,
|
|
29
|
+
baseCommand: '',
|
|
30
|
+
enableInteractive: true
|
|
31
|
+
};
|
|
32
|
+
const extensions = [];
|
|
33
|
+
const destroyers = [];
|
|
34
|
+
const init = async (state) => {
|
|
35
|
+
const installedExtensions = await (0, extensions_1.listInstalled)();
|
|
36
|
+
const pluggableModules = (0, lodash_uniqby_1.default)(knownExtensions.concat(installedExtensions), 'moduleName');
|
|
37
|
+
for await (const extension of pluggableModules) {
|
|
38
|
+
const version = extension.version || (pkg === null || pkg === void 0 ? void 0 : pkg.package.version);
|
|
39
|
+
const pluggableModule = new pluggable_1.PluggableModule({ ...extension, version }, state);
|
|
40
|
+
if (extension.initRequired) {
|
|
41
|
+
await pluggableModule.init();
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line
|
|
44
|
+
extensions.push(...pluggableModule.export.call(pluggableModule));
|
|
45
|
+
if (extension.destroyRequired) {
|
|
46
|
+
destroyers.push(pluggableModule.destroy.bind(pluggableModule));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const destroy = async () => {
|
|
51
|
+
for await (const destroyer of destroyers) {
|
|
52
|
+
await destroyer();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const modules = [
|
|
56
|
+
profile_1.ProfileModule,
|
|
57
|
+
cert_1.CertModule,
|
|
58
|
+
services_1.ServicesModule,
|
|
59
|
+
installation_1.UpgradeModule,
|
|
60
|
+
installation_1.UninstallModule,
|
|
61
|
+
extension_1.ExtensionModule
|
|
62
|
+
];
|
|
63
|
+
module.exports = (0, cli_core_1.createCLI)({
|
|
64
|
+
options: CLI_CONFIG,
|
|
65
|
+
dir: __dirname,
|
|
66
|
+
main: !module.parent,
|
|
67
|
+
init,
|
|
68
|
+
destroy,
|
|
69
|
+
getModules: async () => [...modules, ...extensions],
|
|
70
|
+
info: {}
|
|
71
|
+
});
|
|
72
|
+
const handleError = (err) => {
|
|
73
|
+
logError(err);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
};
|
|
76
|
+
process.on('uncaughtException', handleError);
|
|
77
|
+
process.on('unhandledRejection', handleError);
|
|
78
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;AAEF,2BAAkC;AAClC,sDAA2B;AAC3B,kEAAmC;AACnC,gDAAwB;AACxB,8DAAoC;AAEpC,6CAAkE;AAElE,6CAA6C;AAC7C,yCAA4C;AAC5C,mDAAsD;AACtD,yDAAwE;AACxE,mDAAsD;AACtD,+CAAkD;AAClD,iDAAoD;AAEpD,MAAM,gBAAgB,GAAG,IAAA,iBAAY,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAElG,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,qBAAU,GAAE,CAAC;AAElC,MAAM,eAAe,GAAG,iBAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAEpD,MAAM,GAAG,GAAG,qBAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;AAE/C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE,gBAAgB;IACxB,WAAW,EAAE,EAAE;IACf,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,MAAM,UAAU,GAAU,EAAE,CAAC;AAC7B,MAAM,UAAU,GAAU,EAAE,CAAC;AAE7B,MAAM,IAAI,GAAG,KAAK,EAAE,KAAgB,EAAE,EAAE;IACtC,MAAM,mBAAmB,GAAG,MAAM,IAAA,0BAAa,GAAE,CAA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AG,UAAU,CAAC;IACnD,IAAI,EAAE,EAAE;CACT,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC/B,QAAQ,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAC7C,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cert.d.ts","sourceRoot":"","sources":["../../../src/modules/cert.js"],"names":[],"mappings":"AAYO;;IAFM,MAAM,CAmBjB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2020 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CertModule = void 0;
|
|
10
|
+
const assert_1 = __importDefault(require("assert"));
|
|
11
|
+
const cli_core_1 = require("@dxos/cli-core");
|
|
12
|
+
/**
|
|
13
|
+
* Cert CLI module.
|
|
14
|
+
* @returns {object}
|
|
15
|
+
*/
|
|
16
|
+
const CertModule = ({ config }) => ({
|
|
17
|
+
command: ['cert'],
|
|
18
|
+
describe: 'Certificate management.',
|
|
19
|
+
builder: yargs => yargs
|
|
20
|
+
.command({
|
|
21
|
+
command: ['import'],
|
|
22
|
+
describe: 'Import certificate.',
|
|
23
|
+
builder: yargs => yargs
|
|
24
|
+
.option('url', { default: config.get('system.certEndpoint') }),
|
|
25
|
+
handler: (0, cli_core_1.asyncHandler)(async (argv) => {
|
|
26
|
+
const { url } = argv;
|
|
27
|
+
(0, assert_1.default)(url, 'Invalid Cert URL.');
|
|
28
|
+
await (0, cli_core_1.importCert)(url);
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
exports.CertModule = CertModule;
|
|
33
|
+
//# sourceMappingURL=cert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cert.js","sourceRoot":"","sources":["../../../src/modules/cert.js"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAE5B,6CAA0D;AAE1D;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,QAAQ,EAAE,yBAAyB;IAEnC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK;SACpB,OAAO,CAAC;QACP,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,QAAQ,EAAE,qBAAqB;QAC/B,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK;aACpB,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAEhE,OAAO,EAAE,IAAA,uBAAY,EAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YACjC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YACrB,IAAA,gBAAM,EAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;YACjC,MAAM,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;KACH,CAAC;CACL,CAAC,CAAC;AAjBU,QAAA,UAAU,cAiBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/modules/extension.js"],"names":[],"mappings":"AAkBO;;IAFM,MAAM,CAoJjB"}
|