@dxos/cli 2.18.5-dev.5b370dc9 → 2.19.1-dev.50eb4801

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.
Files changed (68) hide show
  1. package/README.md +25 -16
  2. package/dist/dx.yml +13 -0
  3. package/dist/known-extensions.yml +51 -67
  4. package/dist/src/extensions/index.d.ts +4 -0
  5. package/dist/src/extensions/index.d.ts.map +1 -0
  6. package/dist/src/extensions/index.js +23 -0
  7. package/dist/src/extensions/index.js.map +1 -0
  8. package/dist/src/extensions/manager.d.ts +15 -0
  9. package/dist/src/extensions/manager.d.ts.map +1 -0
  10. package/dist/src/extensions/manager.js +52 -0
  11. package/dist/src/extensions/manager.js.map +1 -0
  12. package/dist/src/extensions/module.d.ts +19 -0
  13. package/dist/src/extensions/module.d.ts.map +1 -0
  14. package/dist/src/extensions/module.js +56 -0
  15. package/dist/src/extensions/module.js.map +1 -0
  16. package/dist/src/extensions/pluggable.d.ts +67 -0
  17. package/dist/src/extensions/pluggable.d.ts.map +1 -0
  18. package/dist/src/{pluggable.js → extensions/pluggable.js} +45 -89
  19. package/dist/src/extensions/pluggable.js.map +1 -0
  20. package/dist/src/extensions/utils.d.ts +9 -0
  21. package/dist/src/extensions/utils.d.ts.map +1 -0
  22. package/dist/src/extensions/utils.js +58 -0
  23. package/dist/src/extensions/utils.js.map +1 -0
  24. package/dist/src/main.js +42 -62
  25. package/dist/src/main.js.map +1 -1
  26. package/dist/src/modules/devtools.d.ts +1 -1
  27. package/dist/src/modules/devtools.d.ts.map +1 -1
  28. package/dist/src/modules/devtools.js +5 -4
  29. package/dist/src/modules/devtools.js.map +1 -1
  30. package/dist/src/modules/extension.d.ts.map +1 -1
  31. package/dist/src/modules/extension.js +18 -16
  32. package/dist/src/modules/extension.js.map +1 -1
  33. package/dist/src/modules/halo.d.ts +1 -1
  34. package/dist/src/modules/index.d.ts +9 -0
  35. package/dist/src/modules/index.d.ts.map +1 -0
  36. package/dist/src/modules/index.js +28 -0
  37. package/dist/src/modules/index.js.map +1 -0
  38. package/dist/src/modules/info.d.ts +6 -0
  39. package/dist/src/modules/info.d.ts.map +1 -0
  40. package/dist/src/modules/info.js +25 -0
  41. package/dist/src/modules/info.js.map +1 -0
  42. package/dist/src/modules/{installation.d.ts → install.d.ts} +1 -1
  43. package/dist/src/modules/install.d.ts.map +1 -0
  44. package/dist/src/modules/{installation.js → install.js} +12 -11
  45. package/dist/src/modules/install.js.map +1 -0
  46. package/dist/src/modules/profile.d.ts +2 -2
  47. package/dist/src/modules/profile.d.ts.map +1 -1
  48. package/dist/src/modules/profile.js.map +1 -1
  49. package/dist/src/modules/services.d.ts.map +1 -1
  50. package/dist/src/modules/services.js +8 -5
  51. package/dist/src/modules/services.js.map +1 -1
  52. package/dist/src/modules/storage.d.ts.map +1 -1
  53. package/dist/src/modules/storage.js.map +1 -1
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +10 -10
  56. package/dist/src/extensions.d.ts +0 -6
  57. package/dist/src/extensions.d.ts.map +0 -1
  58. package/dist/src/extensions.js +0 -47
  59. package/dist/src/extensions.js.map +0 -1
  60. package/dist/src/modules/installation.d.ts.map +0 -1
  61. package/dist/src/modules/installation.js.map +0 -1
  62. package/dist/src/modules/pluggable.d.ts +0 -14
  63. package/dist/src/modules/pluggable.d.ts.map +0 -1
  64. package/dist/src/modules/pluggable.js +0 -48
  65. package/dist/src/modules/pluggable.js.map +0 -1
  66. package/dist/src/pluggable.d.ts +0 -68
  67. package/dist/src/pluggable.d.ts.map +0 -1
  68. package/dist/src/pluggable.js.map +0 -1
package/README.md CHANGED
@@ -53,7 +53,8 @@ dx extension list --dry-run
53
53
  Profile: /Users/ashwinp/.dx/profile/devnet.yml
54
54
  ```
55
55
 
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.
56
+ Multiple templates can be created and shared with others to use different configuration values.
57
+ Some [sample templates](./profiles/README.md) are included in the repo.
57
58
 
58
59
  ### Extensions
59
60
 
@@ -104,7 +105,7 @@ Found Extension @dxos/cli-ipfs@1.0.1-beta.2 installed, do you wish to remove it?
104
105
  | [Bot CLI](../cli-bot/README.md) |
105
106
  | [Chat CLI](../cli-chat/README.md) |
106
107
  | [Console CLI](../cli-console/README.md) |
107
- | [Data CLI](../cli-data/README.md) |
108
+ | [Party CLI](../cli-party/README.md) |
108
109
  | [DXNS CLI](../cli-dxns/README.md) |
109
110
  | [ECHO CLI](../cli-echo/README.md) |
110
111
  | [HALO CLI](../cli-halo/README.md) |
@@ -116,7 +117,8 @@ Found Extension @dxos/cli-ipfs@1.0.1-beta.2 installed, do you wish to remove it?
116
117
 
117
118
  #### Developing CLI extensions
118
119
 
119
- In order to create a new CLI extension, existing CLI extension could be used as a boilerplate. While developing a new extension out of CLI Monorepo, make sure you add `@dxos/cli` as devDependency (and `@dxos/cli-data` as well if you are planning on using DXOS SDK Client).
120
+ In order to create a new CLI extension, existing CLI extension could be used as a boilerplate.
121
+ While developing a new extension out of CLI Monorepo, make sure you add `@dxos/cli` as devDependency (and `@dxos/cli-party` as well if you are planning on using DXOS SDK Client).
120
122
 
121
123
  ### Certification
122
124
 
@@ -154,29 +156,36 @@ While developing a specific cli extension as a package in the monorepo, `rushx b
154
156
 
155
157
  ### Running commands locally
156
158
 
157
- 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 `pnpm run dx`, e.g.:
159
+ During local development there is a need for testing of a newly created/modified commands.
160
+ For that purpose, any cli command could be called from the repo root via `pnpm run dx`, e.g.:
158
161
 
159
162
  > **Note:** Command arguments should be separated from the command via `--` for `pnpm` to pass it to executable.
160
163
 
161
- ```
164
+ ```bash
162
165
  pnpm run dx dxns resource list -- --json
163
166
  ```
164
167
 
165
- 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:
168
+ If the command ought to be called from the specific path (e.g. during app deployent),
169
+ an alias for the local dx binary coud be created by adding such to the shell profile:
166
170
 
167
- ```
168
- alias dx-local='node ~/path/to/cli/packages/cli/bin/dx.js'
171
+ ```bash
172
+ `eval $(./scripts/dev.sh)`
169
173
  ```
170
174
 
171
- Then, all commands could be called via `dx-local` in any directory, like:
175
+ Then run `rushx build:watch` in for all packages that are being edited.
172
176
 
173
- ```
174
- dx-local dxns resource list --json
175
- ```
177
+ Run `dx info` to check if the local version is being run.
178
+
179
+ Set the `DEBUG` environment variable to `true` to see full exception traces on error.
180
+
181
+ ```bash
182
+ DEBUG=dxos:cli dx
183
+ ````
176
184
 
177
185
  ### Environment Variables
178
186
 
179
- 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)
187
+ While the usage of ENV variables is minimized, in some edge cases CLI still uses ENV variables for configuration.
188
+ Those variables are mapped to the canonical structure: [ENV mapping](../cli-core/src/env-map.json)
180
189
 
181
190
  ENV variables are also used to pass configuration between CLI and spawned processes, but this happens transparently for CLI user.
182
191
 
@@ -196,20 +205,20 @@ Check installed version:
196
205
  dx version
197
206
  ```
198
207
 
199
- If those outputs are different, make sure to remove old versions of `wire`.
208
+ If those outputs are different, make sure to remove old versions of `dx`.
200
209
  Remove old CLI and extensions, installed globally.
201
210
 
202
211
  For that purpose `dx uninstall` and `dx upgrade` commands are available.
203
212
 
204
213
  To remove CLI and all extensions:
205
214
 
206
- ```
215
+ ```bash
207
216
  dx uninstall --npm-client yarn
208
217
  ```
209
218
 
210
219
  To force upgrade CLI and all installed extensions to the latest:
211
220
 
212
- ```
221
+ ```bash
213
222
  dx upgrade --npm-client yarn --force
214
223
  ```
215
224
 
package/dist/dx.yml ADDED
@@ -0,0 +1,13 @@
1
+ moduleName: "@dxos/cli"
2
+ displayName: cli
3
+ description: DXOS CLI
4
+ modules:
5
+ - command: "devtools"
6
+ - command: "extension"
7
+ - command: "service"
8
+ - command: "uninstall"
9
+ - command: "upgrade"
10
+ - command: "halo"
11
+ - command: "info"
12
+ - command: "profile"
13
+ - command: "storage"
@@ -2,96 +2,80 @@
2
2
  ---
3
3
  -
4
4
  moduleName: "@dxos/cli-app"
5
- describe: "App proxy extension."
6
- command:
7
- - "app"
8
- initRequired: false
9
- destroyRequired: false
5
+ description: "App proxy extension."
6
+ modules:
7
+ -
8
+ command: "app"
10
9
  -
11
10
  moduleName: "@dxos/cli-bot"
12
- describe: "Bot extension."
13
- command:
14
- - "bot"
15
- initRequired: false
16
- destroyRequired: false
11
+ description: "Bot extension."
12
+ modules:
13
+ -
14
+ command: "bot"
17
15
  -
18
16
  moduleName: "@dxos/cli-chat"
19
- describe: "Chat extension."
20
- command:
21
- - "chat"
22
- initRequired: false
23
- destroyRequired: false
17
+ description: "Chat extension."
18
+ modules:
19
+ -
20
+ command: "chat"
24
21
  -
25
22
  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:
23
+ description: "KUBE console extension."
24
+ modules:
35
25
  -
36
- command: "party"
37
- describe: "Party management."
38
- -
39
- command: "device"
40
- describe: "Device management."
41
- initRequired: true
42
- destroyRequired: true
26
+ command: "console"
43
27
  -
44
28
  moduleName: "@dxos/cli-dxns"
45
- describe: "DXNS extension."
46
- command:
29
+ description: "DXNS extension."
30
+ modules:
47
31
  -
48
32
  command: "dxns"
49
- describe: "DXNS extension."
50
33
  -
51
34
  command: "ns"
52
- describe: "DXNS extension alias."
53
- initRequired: true
54
- destroyRequired: true
55
35
  -
56
36
  moduleName: "@dxos/cli-echo"
57
- describe: "ECHO extension."
58
- command:
59
- - "echo"
60
- initRequired: false
61
- destroyRequired: false
37
+ description: "ECHO extension."
38
+ modules:
39
+ -
40
+ command: "echo"
62
41
  -
63
42
  moduleName: "@dxos/cli-ipfs"
64
- describe: "IPFS extension."
65
- command:
66
- - "ipfs"
67
- initRequired: false
68
- destroyRequired: false
43
+ description: "IPFS extension."
44
+ modules:
45
+ -
46
+ command: "ipfs"
69
47
  -
70
48
  moduleName: "@dxos/cli-kube"
71
- describe: "KUBE extension."
72
- command:
73
- - "kube"
74
- initRequired: false
75
- destroyRequired: false
49
+ description: "KUBE extension."
50
+ modules:
51
+ -
52
+ command: "kube"
76
53
  -
77
54
  moduleName: "@dxos/cli-mdns"
78
- describe: "MDNS extension."
79
- command:
80
- - "mdns"
81
- initRequired: false
82
- destroyRequired: false
55
+ description: "MDNS extension."
56
+ modules:
57
+ -
58
+ command: "mdns"
83
59
  -
84
60
  moduleName: "@dxos/cli-mesh"
85
- describe: "MESH extension."
86
- command:
87
- - "mesh"
88
- initRequired: false
89
- destroyRequired: false
61
+ description: "MESH extension."
62
+ modules:
63
+ -
64
+ command: "mesh"
65
+ -
66
+ moduleName: "@dxos/cli-party"
67
+ description: "Party and Device management."
68
+ modules:
69
+ -
70
+ command: "party"
71
+ description: "Party management."
72
+ -
73
+ command: "device"
74
+ description: "Device management."
90
75
  -
91
76
  moduleName: "@dxos/cli-signal"
92
- describe: "Signal server extension."
93
- command:
94
- - "signal"
95
- initRequired: false
96
- destroyRequired: false
77
+ description: "Signal server extension."
78
+ modules:
79
+ -
80
+ command: "signal"
97
81
 
@@ -0,0 +1,4 @@
1
+ export * from './manager';
2
+ export * from './module';
3
+ export * from './pluggable';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2022 DXOS.org
4
+ //
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./manager"), exports);
21
+ __exportStar(require("./module"), exports);
22
+ __exportStar(require("./pluggable"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,4CAA0B;AAC1B,2CAAyB;AACzB,8CAA4B"}
@@ -0,0 +1,15 @@
1
+ import { Extension } from '@dxos/cli-core';
2
+ export declare const EXTENSIONS_CONFIG = ".dx/extensions.yml";
3
+ /**
4
+ * Manages saved extension info.
5
+ */
6
+ export declare class ExtensionManager {
7
+ _extensions: Extension[];
8
+ load(): Promise<void>;
9
+ save(extensions: any[]): Promise<void>;
10
+ list(): Promise<Extension[]>;
11
+ get(name: string): Promise<Extension | undefined>;
12
+ add(name: string, extension: Extension): Promise<void>;
13
+ remove(name: string): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/extensions/manager.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,WAAW,EAAE,SAAS,EAAE,CAAM;IAIxB,IAAI;IAKJ,IAAI,CAAE,UAAU,EAAE,GAAG,EAAE;IAIvB,IAAI;IAMJ,GAAG,CAAE,IAAI,EAAE,MAAM;IAKjB,GAAG,CAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;IASvC,MAAM,CAAE,IAAI,EAAE,MAAM;CAK3B"}
@@ -0,0 +1,52 @@
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.ExtensionManager = 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
+ /**
16
+ * Manages saved extension info.
17
+ */
18
+ class ExtensionManager {
19
+ constructor() {
20
+ this._extensions = [];
21
+ }
22
+ // TODO(burdon): Change to sync read/write.
23
+ async load() {
24
+ const { extensions = [] } = await (0, cli_core_1.readFile)(filePath, { absolute: true });
25
+ this._extensions = extensions;
26
+ }
27
+ async save(extensions) {
28
+ return (0, cli_core_1.writeFile)({ extensions }, filePath, { absolute: true });
29
+ }
30
+ async list() {
31
+ await this.load();
32
+ this._extensions.sort(({ moduleName: a }, { moduleName: b }) => a > b ? 1 : a < b ? -1 : 0);
33
+ return this._extensions;
34
+ }
35
+ async get(name) {
36
+ await this.load();
37
+ return this._extensions.find(({ moduleName }) => moduleName === name);
38
+ }
39
+ async add(name, extension) {
40
+ await this.load();
41
+ const extensions = this._extensions.filter(({ moduleName }) => moduleName !== name);
42
+ extensions.push(extension);
43
+ await this.save(extensions);
44
+ }
45
+ async remove(name) {
46
+ await this.load();
47
+ const extensions = this._extensions.filter(({ moduleName }) => moduleName !== name);
48
+ await this.save(extensions);
49
+ }
50
+ }
51
+ exports.ExtensionManager = ExtensionManager;
52
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/extensions/manager.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4CAAoB;AACpB,gDAAwB;AAExB,6CAAgE;AAEnD,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,yBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAa,gBAAgB;IAA7B;QACE,gBAAW,GAAgB,EAAE,CAAC;IAsChC,CAAC;IApCC,2CAA2C;IAE3C,KAAK,CAAC,IAAI;QACR,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CAAE,UAAiB;QAC3B,OAAO,IAAA,oBAAS,EAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,IAAY;QACrB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,IAAY,EAAE,SAAoB;QAC3C,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAElB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;QACpF,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,MAAM,CAAE,IAAY;QACxB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;QACpF,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;CACF;AAvCD,4CAuCC"}
@@ -0,0 +1,19 @@
1
+ import { CoreState, Extension } from '@dxos/cli-core';
2
+ import { Pluggable } from './pluggable';
3
+ /**
4
+ * Wrapper class for CLI extension.
5
+ */
6
+ export declare class PluggableModule {
7
+ private readonly _extension;
8
+ private readonly _state;
9
+ _pluggable?: Pluggable;
10
+ constructor(_extension: Extension, _state: CoreState);
11
+ get pluggable(): Pluggable;
12
+ init(): Promise<void>;
13
+ destroy(): Promise<void>;
14
+ /**
15
+ * Export the Yargs module.
16
+ */
17
+ export(): any[];
18
+ }
19
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/extensions/module.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,SAAS,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;GAEG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,UAAU,CAAC,EAAE,SAAS,CAAC;gBAGJ,UAAU,EAAE,SAAS,EACrB,MAAM,EAAE,SAAS;IAGpC,IAAI,SAAS,cAMZ;IAEK,IAAI;IAMJ,OAAO;IAMb;;OAEG;IAEH,MAAM,IAAK,GAAG,EAAE;CAiBjB"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2020 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PluggableModule = void 0;
7
+ const cli_core_1 = require("@dxos/cli-core");
8
+ const pluggable_1 = require("./pluggable");
9
+ // const { debugLog } = getLoggers();
10
+ /**
11
+ * Wrapper class for CLI extension.
12
+ */
13
+ class PluggableModule {
14
+ constructor(_extension, _state) {
15
+ this._extension = _extension;
16
+ this._state = _state;
17
+ }
18
+ get pluggable() {
19
+ if (!this._pluggable) {
20
+ this._pluggable = pluggable_1.Pluggable.create(this._extension);
21
+ }
22
+ return this._pluggable;
23
+ }
24
+ async init() {
25
+ if (this.pluggable.installed) {
26
+ await this.pluggable.init(this._state);
27
+ }
28
+ }
29
+ async destroy() {
30
+ if (this.pluggable.installed && this.pluggable.destroy) {
31
+ await this.pluggable.destroy(this._state);
32
+ }
33
+ }
34
+ /**
35
+ * Export the Yargs module.
36
+ */
37
+ // TODO(burdon): Type.
38
+ export() {
39
+ const { /* moduleName, */ modules, description: mainDescription } = this._extension;
40
+ return modules.map(({ command, description }) => {
41
+ return (() => {
42
+ // debugLog(`Export ${moduleName}:${command}`);
43
+ return {
44
+ command,
45
+ describe: description !== null && description !== void 0 ? description : mainDescription,
46
+ builder: (yargs) => yargs.help(false).strict(false),
47
+ handler: (0, cli_core_1.asyncHandler)(async (argv) => {
48
+ return this.pluggable.run(this._state, argv);
49
+ })
50
+ };
51
+ });
52
+ });
53
+ }
54
+ }
55
+ exports.PluggableModule = PluggableModule;
56
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/extensions/module.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,6CAAsF;AAEtF,2CAAwC;AAExC,qCAAqC;AAErC;;GAEG;AACH,MAAa,eAAe;IAG1B,YACmB,UAAqB,EACrB,MAAiB;QADjB,eAAU,GAAV,UAAU,CAAW;QACrB,WAAM,GAAN,MAAM,CAAW;IACjC,CAAC;IAEJ,IAAI,SAAS;QACX,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,IAAI,CAAC,UAAU,GAAG,qBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACrD;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC5B,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACxC;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YACtD,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC3C;IACH,CAAC;IAED;;OAEG;IACH,sBAAsB;IACtB,MAAM;QACJ,MAAM,EAAE,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QACpF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;YAC9C,OAAO,CAAC,GAAG,EAAE;gBACX,+CAA+C;gBAE/C,OAAO;oBACL,OAAO;oBACP,QAAQ,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,eAAe;oBACxC,OAAO,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;oBACxD,OAAO,EAAE,IAAA,uBAAY,EAAC,KAAK,EAAE,IAAS,EAAE,EAAE;wBACxC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;oBAC/C,CAAC,CAAC;iBACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjDD,0CAiDC"}
@@ -0,0 +1,67 @@
1
+ import { CoreState, Extension, CLIObject } from '@dxos/cli-core';
2
+ /**
3
+ * Pluggable CLI module.
4
+ */
5
+ export declare class Pluggable {
6
+ _modulePath?: string;
7
+ _moduleName: string;
8
+ _version: string;
9
+ _workspaceRoot: string;
10
+ _workspacePackages: {
11
+ packageName: string;
12
+ projectFolder: string;
13
+ }[];
14
+ _workspaceInfo?: {
15
+ projectFolder: string;
16
+ };
17
+ _isInWorkspace?: boolean;
18
+ _isInCWD: boolean;
19
+ _installed: boolean;
20
+ /**
21
+ * Pluggable factory.
22
+ */
23
+ static create(extension: Extension): Pluggable;
24
+ constructor({ moduleName, version }: Extension);
25
+ /**
26
+ * Returns the exported info.
27
+ */
28
+ get module(): CLIObject;
29
+ get modulePath(): string;
30
+ get moduleName(): string;
31
+ get version(): string;
32
+ get workspaceRoot(): string;
33
+ get installed(): boolean;
34
+ get isInWorkspace(): boolean | undefined;
35
+ /**
36
+ * Checks if workspace is defined.
37
+ */
38
+ isWorkspace(): boolean;
39
+ /**
40
+ * Checks if extension is installed.
41
+ */
42
+ isInstalled(): boolean;
43
+ /**
44
+ * Install CLI extension.
45
+ */
46
+ installModule(npmClient?: string, options?: {}): Promise<unknown>;
47
+ /**
48
+ * Uninstall CLI extension.
49
+ */
50
+ uninstallModule(npmClient: string, options?: {}): Promise<unknown>;
51
+ /**
52
+ * Init extension in a scope of main CLI.
53
+ */
54
+ init(state: CoreState): Promise<any>;
55
+ /**
56
+ * Destroy extension in a scope of main CLI.
57
+ */
58
+ destroy(state: CoreState): Promise<any>;
59
+ /**
60
+ * Runs command of an CLI extension.
61
+ */
62
+ run(state: CoreState, argv: any): Promise<void>;
63
+ getInfo(): Extension;
64
+ getDockerCompose(): any;
65
+ _cleanCache(): void;
66
+ }
67
+ //# sourceMappingURL=pluggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluggable.d.ts","sourceRoot":"","sources":["../../../src/extensions/pluggable.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO/E;;GAEG;AACH,qBAAa,SAAS;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IAEvB,kBAAkB,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrE,cAAc,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAE,SAAS,EAAE,SAAS;gBAItB,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS;IAqB/C;;OAEG;IACH,IAAI,MAAM,IAAK,SAAS,CAIvB;IAED,IAAI,UAAU,WAgBb;IAED,IAAI,UAAU,WAEb;IAED,IAAI,OAAO,WAEV;IAED,IAAI,aAAa,WAEhB;IAED,IAAI,SAAS,YAEZ;IAED,IAAI,aAAa,wBAEhB;IAED;;OAEG;IACH,WAAW;IAIX;;OAEG;IACH,WAAW;IAiBX;;OAEG;IACG,aAAa,CAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK;IAkBrD;;OAEG;IACG,eAAe,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,KAAK;IAiBtD;;OAEG;IACG,IAAI,CAAE,KAAK,EAAE,SAAS;IAI5B;;OAEG;IACG,OAAO,CAAE,KAAK,EAAE,SAAS;IAI/B;;OAEG;IACG,GAAG,CAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG;IAwBtC,OAAO,IAAK,SAAS;IAKrB,gBAAgB;IAKhB,WAAW;CAGZ"}