bdy 1.25.2-dev → 1.25.2-stage
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/distTs/package.json +1 -1
- package/package.json +1 -1
- package/distTs/README.md +0 -181
- package/distTs/src/autocomplete.js +0 -90
- package/distTs/src/command/autocomplete/install.js +0 -16
- package/distTs/src/command/autocomplete/uninstall.js +0 -16
- package/distTs/src/command/autocomplete.js +0 -14
- package/distTs/src/command/environment/resolve.js +0 -47
- package/distTs/src/command/package/create.js +0 -64
- package/distTs/src/command/package/delete.js +0 -38
- package/distTs/src/command/package/docker/login.js +0 -26
- package/distTs/src/command/package/docker.js +0 -11
- package/distTs/src/command/package/download.js +0 -138
- package/distTs/src/command/package/get.js +0 -36
- package/distTs/src/command/package/list.js +0 -31
- package/distTs/src/command/package/publish.js +0 -241
- package/distTs/src/command/package/version/delete.js +0 -39
- package/distTs/src/command/package/version/get.js +0 -45
- package/distTs/src/command/package/version/list.js +0 -47
- package/distTs/src/command/package/version.js +0 -16
- package/distTs/src/command/package.js +0 -26
- package/distTs/src/command/project/get.js +0 -18
- package/distTs/src/command/project/set.js +0 -31
- package/distTs/src/command/sandbox/get/yaml.js +0 -30
- package/distTs/src/command/scrape/validation.js +0 -154
- package/distTs/src/command/scrape.js +0 -144
- package/distTs/src/command/ut/upload.js +0 -86
- package/distTs/src/command/ut.js +0 -12
- package/distTs/src/command/vt/close.js +0 -27
- package/distTs/src/command/vt/compare/validation.js +0 -46
- package/distTs/src/command/vt/compare.js +0 -100
- package/distTs/src/command/vt/exec.js +0 -82
- package/distTs/src/command/vt/installBrowser.js +0 -20
- package/distTs/src/command/vt/scrape.js +0 -193
- package/distTs/src/command/vt/shared/validation.js +0 -145
- package/distTs/src/command/vt/storybook.js +0 -138
- package/distTs/src/command/vt.js +0 -20
- package/distTs/src/main.js +0 -190
- package/distTs/src/types/options.js +0 -2
- package/distTs/src/types/scrape.js +0 -2
package/distTs/src/main.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const output_1 = __importDefault(require("./output"));
|
|
7
|
-
const selectCommand = async (parentCommand) => {
|
|
8
|
-
let items = [];
|
|
9
|
-
const map = {};
|
|
10
|
-
parentCommand.commands.filter((c) => !c._hidden).forEach((c) => {
|
|
11
|
-
const name = c.name();
|
|
12
|
-
map[name] = c;
|
|
13
|
-
items.push({
|
|
14
|
-
name,
|
|
15
|
-
description: c.description(),
|
|
16
|
-
value: name,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
items = items.sort((a, b) => a.name.localeCompare(b.name));
|
|
20
|
-
const goBack = 'go back';
|
|
21
|
-
items.push({
|
|
22
|
-
name: 'help',
|
|
23
|
-
description: 'Display help for current command',
|
|
24
|
-
value: 'help',
|
|
25
|
-
});
|
|
26
|
-
if (parentCommand.parent) {
|
|
27
|
-
items.unshift({
|
|
28
|
-
name: goBack,
|
|
29
|
-
description: 'Go back to parent command',
|
|
30
|
-
value: goBack
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
output_1.default.clearPreviousLine();
|
|
34
|
-
const name = await output_1.default.inputMenuAdv(getFinalCommand(parentCommand, {}, []), items);
|
|
35
|
-
if (name === 'help') {
|
|
36
|
-
parentCommand.help();
|
|
37
|
-
output_1.default.exitNormal();
|
|
38
|
-
}
|
|
39
|
-
else if (name === goBack && parentCommand.parent) {
|
|
40
|
-
return await selectCommand(parentCommand.parent);
|
|
41
|
-
}
|
|
42
|
-
const cmd = map[name];
|
|
43
|
-
if (cmd.commands.length > 0) {
|
|
44
|
-
return await selectCommand(cmd);
|
|
45
|
-
}
|
|
46
|
-
return cmd;
|
|
47
|
-
};
|
|
48
|
-
const setOptionValue = async (opt) => {
|
|
49
|
-
output_1.default.clearPreviousLine();
|
|
50
|
-
let name = opt.name();
|
|
51
|
-
const desc = opt.description;
|
|
52
|
-
if (desc)
|
|
53
|
-
name += ` (${desc})`;
|
|
54
|
-
if (opt.isBoolean()) {
|
|
55
|
-
const val = await output_1.default.inputMenu(`--${name}`, ['true', 'false']);
|
|
56
|
-
return val === 0;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return await output_1.default.inputString(`--${name}:`, opt.defaultValue);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const nameToCamelCase = (name) => {
|
|
63
|
-
const s = name.split('-');
|
|
64
|
-
if (s.length <= 1)
|
|
65
|
-
return name;
|
|
66
|
-
return s
|
|
67
|
-
.map((txt, i) => {
|
|
68
|
-
if (!txt || !txt.length || !i)
|
|
69
|
-
return txt;
|
|
70
|
-
return `${txt[0].toUpperCase()}${txt.substring(1)}`;
|
|
71
|
-
})
|
|
72
|
-
.join('');
|
|
73
|
-
};
|
|
74
|
-
const camelCaseToName = (cc) => {
|
|
75
|
-
return cc.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
76
|
-
};
|
|
77
|
-
const selectOptions = async (cmd) => {
|
|
78
|
-
const options = {};
|
|
79
|
-
if (cmd.options.length > 0) {
|
|
80
|
-
const map = {};
|
|
81
|
-
let items = [];
|
|
82
|
-
cmd.options.forEach((opt) => {
|
|
83
|
-
const name = opt.name();
|
|
84
|
-
map[name] = opt;
|
|
85
|
-
items.push({
|
|
86
|
-
name: `--${name}`,
|
|
87
|
-
description: opt.description,
|
|
88
|
-
value: name,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
items = items.sort((a, b) => a.name.localeCompare(b.name));
|
|
92
|
-
items.unshift({
|
|
93
|
-
name: 'Skip options',
|
|
94
|
-
value: '',
|
|
95
|
-
});
|
|
96
|
-
while (true) {
|
|
97
|
-
output_1.default.clearPreviousLine();
|
|
98
|
-
const name = await output_1.default.inputMenuAdv(getFinalCommand(cmd, options, []), items);
|
|
99
|
-
if (map[name]) {
|
|
100
|
-
const opt = map[name];
|
|
101
|
-
const value = await setOptionValue(opt);
|
|
102
|
-
const cc = nameToCamelCase(name);
|
|
103
|
-
if (opt.variadic) {
|
|
104
|
-
if (!options[cc])
|
|
105
|
-
options[cc] = [];
|
|
106
|
-
const o = options[cc];
|
|
107
|
-
o.push(value);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
options[cc] = value;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return options;
|
|
119
|
-
};
|
|
120
|
-
const selectArguments = async (cmd) => {
|
|
121
|
-
const args = [];
|
|
122
|
-
if (cmd.registeredArguments.length > 0) {
|
|
123
|
-
for (let i = 0; i < cmd.registeredArguments.length; i += 1) {
|
|
124
|
-
const arg = cmd.registeredArguments[i];
|
|
125
|
-
let desc = arg.name();
|
|
126
|
-
if (arg.description)
|
|
127
|
-
desc += ` - ${arg.description}`;
|
|
128
|
-
desc += ':';
|
|
129
|
-
output_1.default.clearPreviousLine();
|
|
130
|
-
const value = await output_1.default.inputString(`${desc[0].toUpperCase()}${desc.substring(1)}`, arg.defaultValue, arg.required);
|
|
131
|
-
if (arg.variadic) {
|
|
132
|
-
args.push(value.split(' '));
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
args.push(value);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return args;
|
|
140
|
-
};
|
|
141
|
-
const getFinalCommand = (cmd, options, args) => {
|
|
142
|
-
let txt = '';
|
|
143
|
-
let c = cmd;
|
|
144
|
-
while (c !== null) {
|
|
145
|
-
txt = c.name() + ' ' + txt;
|
|
146
|
-
c = c.parent;
|
|
147
|
-
}
|
|
148
|
-
txt = txt.trim();
|
|
149
|
-
Object.entries(options).forEach(([name, val]) => {
|
|
150
|
-
const n = camelCaseToName(name);
|
|
151
|
-
if (val === true) {
|
|
152
|
-
txt += ` --${n}`;
|
|
153
|
-
}
|
|
154
|
-
else if (val === false) {
|
|
155
|
-
txt += ` --${n}=false`;
|
|
156
|
-
}
|
|
157
|
-
else if (Array.isArray(val)) {
|
|
158
|
-
val.forEach((v) => {
|
|
159
|
-
txt += ` --${n}="${v}"`;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
txt += ` --${n}="${val}"`;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
args.forEach((arg) => {
|
|
167
|
-
if (Array.isArray(arg)) {
|
|
168
|
-
txt += ` ${arg.map(a => `"${a}"`).join(' ')}`;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
txt += ` "${arg}"`;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
return txt;
|
|
175
|
-
};
|
|
176
|
-
const main = async (program) => {
|
|
177
|
-
if (!output_1.default.isTTY()) {
|
|
178
|
-
program.help();
|
|
179
|
-
output_1.default.exitNormal();
|
|
180
|
-
}
|
|
181
|
-
const cmd = await selectCommand(program);
|
|
182
|
-
const options = await selectOptions(cmd);
|
|
183
|
-
const args = await selectArguments(cmd);
|
|
184
|
-
Object.entries(options).forEach(([k, v]) => cmd.setOptionValue(camelCaseToName(k), v));
|
|
185
|
-
output_1.default.clearPreviousLine();
|
|
186
|
-
output_1.default.cyan('❯ ', false);
|
|
187
|
-
output_1.default.normal(getFinalCommand(cmd, options, args));
|
|
188
|
-
await cmd._actionHandler([...args, options, cmd]);
|
|
189
|
-
};
|
|
190
|
-
exports.default = main;
|