@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
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.UpgradeModule = exports.UninstallModule = void 0;
|
|
9
|
-
|
|
10
|
-
var _assert = _interopRequireDefault(require("assert"));
|
|
11
|
-
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
|
-
var _readPkgUp = _interopRequireDefault(require("read-pkg-up"));
|
|
15
|
-
|
|
16
|
-
var _debug = require("@dxos/debug");
|
|
17
|
-
|
|
18
|
-
var _cliCore = require("@dxos/cli-core");
|
|
19
|
-
|
|
20
|
-
var _extensions = require("../extensions");
|
|
21
|
-
|
|
22
|
-
var _pluggable = require("../pluggable");
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// Copyright 2020 DXOS.org
|
|
26
|
-
//
|
|
27
|
-
const pkg = _readPkgUp.default.sync({
|
|
28
|
-
cwd: _path.default.join(__dirname, '../')
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Uninstall CLI module.
|
|
32
|
-
* @returns {object}
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const UninstallModule = () => ({
|
|
37
|
-
command: ['uninstall'],
|
|
38
|
-
describe: 'Uninstall CLI and extensions.',
|
|
39
|
-
builder: yargs => yargs.version(false).option('npm-client'),
|
|
40
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
41
|
-
const {
|
|
42
|
-
npmClient
|
|
43
|
-
} = argv;
|
|
44
|
-
const extensions = await (0, _extensions.listInstalled)(); // Remove extensions.
|
|
45
|
-
|
|
46
|
-
if (extensions.length) {
|
|
47
|
-
(0, _debug.log)(`Found extensions: ${extensions.map(({
|
|
48
|
-
moduleName
|
|
49
|
-
}) => moduleName).join(', ')}`);
|
|
50
|
-
const pluggableModules = extensions.map(module => new _pluggable.Pluggable(module));
|
|
51
|
-
|
|
52
|
-
for await (const pluggableModule of pluggableModules) {
|
|
53
|
-
const spinner = `Uninstalling ${pluggableModule.moduleName}`;
|
|
54
|
-
await pluggableModule.uninstallModule(npmClient, {
|
|
55
|
-
spinner
|
|
56
|
-
});
|
|
57
|
-
await (0, _extensions.removeInstalled)(pluggableModule.moduleName);
|
|
58
|
-
}
|
|
59
|
-
} // Remove main cli.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const cli = new _pluggable.Pluggable({
|
|
63
|
-
moduleName: pkg.package.name
|
|
64
|
-
});
|
|
65
|
-
const spinner = `Uninstalling ${cli.moduleName}`;
|
|
66
|
-
await cli.uninstallModule(npmClient, {
|
|
67
|
-
spinner
|
|
68
|
-
});
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
* Upgrade CLI module.
|
|
73
|
-
* @returns {object}
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
exports.UninstallModule = UninstallModule;
|
|
78
|
-
|
|
79
|
-
const UpgradeModule = ({
|
|
80
|
-
config
|
|
81
|
-
}) => ({
|
|
82
|
-
command: ['upgrade'],
|
|
83
|
-
describe: 'Upgrade CLI.',
|
|
84
|
-
builder: yargs => yargs.version(false).option('npm-client').option('channel', {
|
|
85
|
-
default: config.get('cli.channel')
|
|
86
|
-
}).option('force', {
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
default: false
|
|
89
|
-
}).option('version'),
|
|
90
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
91
|
-
const {
|
|
92
|
-
channel,
|
|
93
|
-
version,
|
|
94
|
-
force,
|
|
95
|
-
npmClient
|
|
96
|
-
} = argv;
|
|
97
|
-
const newVersion = version || channel;
|
|
98
|
-
(0, _assert.default)(newVersion, 'Invalid Version.');
|
|
99
|
-
const extensions = await (0, _extensions.listInstalled)();
|
|
100
|
-
let modules = [];
|
|
101
|
-
|
|
102
|
-
if (force) {
|
|
103
|
-
if (extensions.length) {
|
|
104
|
-
(0, _debug.log)(`Found extensions: ${extensions.map(({
|
|
105
|
-
moduleName
|
|
106
|
-
}) => moduleName).join(', ')}`);
|
|
107
|
-
modules = extensions.map(({
|
|
108
|
-
moduleName
|
|
109
|
-
}) => new _pluggable.Pluggable({
|
|
110
|
-
moduleName,
|
|
111
|
-
version: newVersion
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
modules.push(new _pluggable.Pluggable({
|
|
116
|
-
moduleName: pkg.package.name,
|
|
117
|
-
version: newVersion
|
|
118
|
-
}));
|
|
119
|
-
} // Remove old modules.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for await (const module of modules) {
|
|
123
|
-
const spinner = `Uninstalling ${module.moduleName}`;
|
|
124
|
-
await module.uninstallModule(npmClient, {
|
|
125
|
-
spinner
|
|
126
|
-
});
|
|
127
|
-
await (0, _extensions.removeInstalled)(module.moduleName);
|
|
128
|
-
} // Install new modules.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
for await (const module of modules.reverse()) {
|
|
132
|
-
const spinner = `Installing ${module.moduleName}`;
|
|
133
|
-
await module.installModule(npmClient, {
|
|
134
|
-
spinner
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
if (module.moduleName !== pkg.package.name) {
|
|
138
|
-
await (0, _extensions.addInstalled)(module.moduleName, module.getInfo());
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
exports.UpgradeModule = UpgradeModule;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.PluggableModule = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _cliCore = require("@dxos/cli-core");
|
|
13
|
-
|
|
14
|
-
var _pluggable = require("../pluggable");
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
// Copyright 2020 DXOS.org
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Wrapper class for CLI extension.
|
|
22
|
-
*/
|
|
23
|
-
class PluggableModule {
|
|
24
|
-
constructor(config, state) {
|
|
25
|
-
(0, _defineProperty2.default)(this, "_pluggable", null);
|
|
26
|
-
this._config = config;
|
|
27
|
-
this._state = state;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get pluggable() {
|
|
31
|
-
if (!this._pluggable) {
|
|
32
|
-
this._pluggable = _pluggable.Pluggable.create(this._config);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return this._pluggable;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async init() {
|
|
39
|
-
if (this.pluggable.installed) {
|
|
40
|
-
await this.pluggable.init(this._state);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async destroy() {
|
|
45
|
-
if (this.pluggable.installed) {
|
|
46
|
-
await this.pluggable.destroy(this._state);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export() {
|
|
51
|
-
const {
|
|
52
|
-
command,
|
|
53
|
-
describe
|
|
54
|
-
} = this._config;
|
|
55
|
-
return command.map(cmd => (() => ({
|
|
56
|
-
command: typeof cmd === 'object' ? cmd.command : cmd,
|
|
57
|
-
describe: typeof cmd === 'object' ? cmd.describe : describe,
|
|
58
|
-
builder: yargs => yargs.help(false).strict(false),
|
|
59
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
60
|
-
return this.pluggable.run(this._state, argv);
|
|
61
|
-
}) // eslint-disable-next-line
|
|
62
|
-
|
|
63
|
-
})).bind(this));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
exports.PluggableModule = PluggableModule;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ProfileModule = void 0;
|
|
9
|
-
|
|
10
|
-
var _assert = _interopRequireDefault(require("assert"));
|
|
11
|
-
|
|
12
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
13
|
-
|
|
14
|
-
var _cliCore = require("@dxos/cli-core");
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
// Copyright 2020 DXOS.org
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Profile CLI module.
|
|
22
|
-
* @returns {object}
|
|
23
|
-
*/
|
|
24
|
-
const ProfileModule = () => ({
|
|
25
|
-
command: ['profile'],
|
|
26
|
-
describe: 'CLI profile management.',
|
|
27
|
-
builder: yargs => yargs.command({
|
|
28
|
-
command: ['init'],
|
|
29
|
-
describe: 'Init profile.',
|
|
30
|
-
builder: yargs => yargs.option('name', {
|
|
31
|
-
type: 'string',
|
|
32
|
-
describe: 'Profile name'
|
|
33
|
-
}).option('template-url', {
|
|
34
|
-
type: 'string',
|
|
35
|
-
describe: 'URL to download profile template'
|
|
36
|
-
}),
|
|
37
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
38
|
-
const {
|
|
39
|
-
name,
|
|
40
|
-
templateUrl
|
|
41
|
-
} = argv;
|
|
42
|
-
(0, _assert.default)(name, 'Invalid profile name.');
|
|
43
|
-
(0, _assert.default)(templateUrl, 'Invalid template URL.');
|
|
44
|
-
return (0, _cliCore.initProfileFromTemplate)(name, templateUrl);
|
|
45
|
-
})
|
|
46
|
-
}).command({
|
|
47
|
-
command: ['set [name]'],
|
|
48
|
-
describe: 'Set profile as default.',
|
|
49
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
50
|
-
const {
|
|
51
|
-
name
|
|
52
|
-
} = argv;
|
|
53
|
-
(0, _assert.default)(name, 'Invalid profile name.');
|
|
54
|
-
const profilePath = (0, _cliCore.getProfilePath)(name);
|
|
55
|
-
|
|
56
|
-
if (!_fsExtra.default.existsSync(profilePath)) {
|
|
57
|
-
(0, _cliCore.print)(`Profile not found: ${profilePath}`);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
(0, _cliCore.setProfileAsDefault)(name);
|
|
62
|
-
})
|
|
63
|
-
}).command({
|
|
64
|
-
command: ['config [profile]'],
|
|
65
|
-
describe: 'Profile config.',
|
|
66
|
-
handler: (0, _cliCore.asyncHandler)(async argv => {
|
|
67
|
-
const {
|
|
68
|
-
profile
|
|
69
|
-
} = argv;
|
|
70
|
-
const profilePath = profile ? (0, _cliCore.getProfilePath)(profile) : (0, _cliCore.getActiveProfilePath)();
|
|
71
|
-
|
|
72
|
-
if (!_fsExtra.default.existsSync(profilePath)) {
|
|
73
|
-
(0, _cliCore.print)(`Profile not found: ${profilePath}`);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
(0, _cliCore.print)((0, _cliCore.getConfig)(profilePath).values, {
|
|
78
|
-
json: true
|
|
79
|
-
});
|
|
80
|
-
})
|
|
81
|
-
}),
|
|
82
|
-
handler: (0, _cliCore.asyncHandler)(async () => {
|
|
83
|
-
const profilePath = (0, _cliCore.getActiveProfilePath)();
|
|
84
|
-
|
|
85
|
-
if (!profilePath) {
|
|
86
|
-
(0, _cliCore.print)('No active profile. Enter the following command to set the active profile:');
|
|
87
|
-
(0, _cliCore.print)('dx profile set <NAME>');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (!_fsExtra.default.existsSync(profilePath)) {
|
|
92
|
-
(0, _cliCore.print)(`Profile not found: ${profilePath}`);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
(0, _cliCore.print)((0, _cliCore.getProfileName)(profilePath));
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
exports.ProfileModule = ProfileModule;
|