@unisphere/cli 1.13.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -0
- package/bundler/context/rollup.js +199 -0
- package/bundler/package/bundled-dependencies.js +15 -0
- package/bundler/package/fix-package-json-dependencies.js +104 -0
- package/bundler/package/rollup.js +116 -0
- package/package.json +49 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +12 -0
- package/src/index.js.map +1 -0
- package/src/lib/commands/context/activate/check-availability.d.ts +7 -0
- package/src/lib/commands/context/activate/check-availability.js +29 -0
- package/src/lib/commands/context/activate/check-availability.js.map +1 -0
- package/src/lib/commands/context/activate/command.d.ts +2 -0
- package/src/lib/commands/context/activate/command.js +16 -0
- package/src/lib/commands/context/activate/command.js.map +1 -0
- package/src/lib/commands/context/activate/element/command.d.ts +2 -0
- package/src/lib/commands/context/activate/element/command.js +73 -0
- package/src/lib/commands/context/activate/element/command.js.map +1 -0
- package/src/lib/commands/context/activate/loader/command.d.ts +2 -0
- package/src/lib/commands/context/activate/loader/command.js +55 -0
- package/src/lib/commands/context/activate/loader/command.js.map +1 -0
- package/src/lib/commands/context/activate/runtime-file-utils.d.ts +20 -0
- package/src/lib/commands/context/activate/runtime-file-utils.js +39 -0
- package/src/lib/commands/context/activate/runtime-file-utils.js.map +1 -0
- package/src/lib/commands/context/activate/update-runtime-version.d.ts +23 -0
- package/src/lib/commands/context/activate/update-runtime-version.js +78 -0
- package/src/lib/commands/context/activate/update-runtime-version.js.map +1 -0
- package/src/lib/commands/context/activate/verify-env-readiness.d.ts +8 -0
- package/src/lib/commands/context/activate/verify-env-readiness.js +54 -0
- package/src/lib/commands/context/activate/verify-env-readiness.js.map +1 -0
- package/src/lib/commands/context/activate/workspace/command.d.ts +2 -0
- package/src/lib/commands/context/activate/workspace/command.js +60 -0
- package/src/lib/commands/context/activate/workspace/command.js.map +1 -0
- package/src/lib/commands/context/build-command.d.ts +2 -0
- package/src/lib/commands/context/build-command.js +74 -0
- package/src/lib/commands/context/build-command.js.map +1 -0
- package/src/lib/commands/context/context-command.d.ts +2 -0
- package/src/lib/commands/context/context-command.js +19 -0
- package/src/lib/commands/context/context-command.js.map +1 -0
- package/src/lib/commands/context/publish/command.d.ts +2 -0
- package/src/lib/commands/context/publish/command.js +82 -0
- package/src/lib/commands/context/publish/command.js.map +1 -0
- package/src/lib/commands/context/publish/execute/execute.d.ts +2 -0
- package/src/lib/commands/context/publish/execute/execute.js +118 -0
- package/src/lib/commands/context/publish/execute/execute.js.map +1 -0
- package/src/lib/commands/context/publish/execute/sync-element.d.ts +8 -0
- package/src/lib/commands/context/publish/execute/sync-element.js +58 -0
- package/src/lib/commands/context/publish/execute/sync-element.js.map +1 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.d.ts +11 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.js +112 -0
- package/src/lib/commands/context/publish/prepare/build-nx-runtimes.js.map +1 -0
- package/src/lib/commands/context/publish/prepare/prepare.d.ts +2 -0
- package/src/lib/commands/context/publish/prepare/prepare.js +122 -0
- package/src/lib/commands/context/publish/prepare/prepare.js.map +1 -0
- package/src/lib/commands/context/publish/types.d.ts +15 -0
- package/src/lib/commands/context/publish/types.js +3 -0
- package/src/lib/commands/context/publish/types.js.map +1 -0
- package/src/lib/commands/context/serve-command.d.ts +2 -0
- package/src/lib/commands/context/serve-command.js +76 -0
- package/src/lib/commands/context/serve-command.js.map +1 -0
- package/src/lib/commands/info/command.d.ts +2 -0
- package/src/lib/commands/info/command.js +51 -0
- package/src/lib/commands/info/command.js.map +1 -0
- package/src/lib/commands/init/command.d.ts +2 -0
- package/src/lib/commands/init/command.js +46 -0
- package/src/lib/commands/init/command.js.map +1 -0
- package/src/lib/commands/package/build-command.d.ts +2 -0
- package/src/lib/commands/package/build-command.js +70 -0
- package/src/lib/commands/package/build-command.js.map +1 -0
- package/src/lib/commands/package/link/command.d.ts +2 -0
- package/src/lib/commands/package/link/command.js +110 -0
- package/src/lib/commands/package/link/command.js.map +1 -0
- package/src/lib/commands/package/package-command.d.ts +2 -0
- package/src/lib/commands/package/package-command.js +15 -0
- package/src/lib/commands/package/package-command.js.map +1 -0
- package/src/lib/commands/package/publish/command.d.ts +2 -0
- package/src/lib/commands/package/publish/command.js +37 -0
- package/src/lib/commands/package/publish/command.js.map +1 -0
- package/src/lib/commands/package/publish/deploy-to-github.d.ts +13 -0
- package/src/lib/commands/package/publish/deploy-to-github.js +151 -0
- package/src/lib/commands/package/publish/deploy-to-github.js.map +1 -0
- package/src/lib/commands/package/publish/deploy-to-npm.d.ts +13 -0
- package/src/lib/commands/package/publish/deploy-to-npm.js +151 -0
- package/src/lib/commands/package/publish/deploy-to-npm.js.map +1 -0
- package/src/lib/commands/package/publish/publish.d.ts +2 -0
- package/src/lib/commands/package/publish/publish.js +133 -0
- package/src/lib/commands/package/publish/publish.js.map +1 -0
- package/src/lib/commands/package/publish/types.d.ts +7 -0
- package/src/lib/commands/package/publish/types.js +3 -0
- package/src/lib/commands/package/publish/types.js.map +1 -0
- package/src/lib/unisphere.d.ts +2 -0
- package/src/lib/unisphere.js +19 -0
- package/src/lib/unisphere.js.map +1 -0
- package/src/lib/utils/artifacts.d.ts +6 -0
- package/src/lib/utils/artifacts.js +44 -0
- package/src/lib/utils/artifacts.js.map +1 -0
- package/src/lib/utils/aws/copy-s3-folder.d.ts +7 -0
- package/src/lib/utils/aws/copy-s3-folder.js +43 -0
- package/src/lib/utils/aws/copy-s3-folder.js.map +1 -0
- package/src/lib/utils/aws/download-json-from-bucket.d.ts +8 -0
- package/src/lib/utils/aws/download-json-from-bucket.js +42 -0
- package/src/lib/utils/aws/download-json-from-bucket.js.map +1 -0
- package/src/lib/utils/aws/get-s3-client.d.ts +2 -0
- package/src/lib/utils/aws/get-s3-client.js +39 -0
- package/src/lib/utils/aws/get-s3-client.js.map +1 -0
- package/src/lib/utils/aws/is-s3-file-exists.d.ts +6 -0
- package/src/lib/utils/aws/is-s3-file-exists.js +36 -0
- package/src/lib/utils/aws/is-s3-file-exists.js.map +1 -0
- package/src/lib/utils/aws/is-s3-folder-exists.d.ts +8 -0
- package/src/lib/utils/aws/is-s3-folder-exists.js +33 -0
- package/src/lib/utils/aws/is-s3-folder-exists.js.map +1 -0
- package/src/lib/utils/aws/list-s3-folders.d.ts +8 -0
- package/src/lib/utils/aws/list-s3-folders.js +32 -0
- package/src/lib/utils/aws/list-s3-folders.js.map +1 -0
- package/src/lib/utils/aws/mime-type-mapping.d.ts +2 -0
- package/src/lib/utils/aws/mime-type-mapping.js +8624 -0
- package/src/lib/utils/aws/mime-type-mapping.js.map +1 -0
- package/src/lib/utils/aws/upload-json-to-bucket.d.ts +9 -0
- package/src/lib/utils/aws/upload-json-to-bucket.js +31 -0
- package/src/lib/utils/aws/upload-json-to-bucket.js.map +1 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.d.ts +9 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.js +60 -0
- package/src/lib/utils/aws/upload-to-aws-bucket.js.map +1 -0
- package/src/lib/utils/github/tags.d.ts +10 -0
- package/src/lib/utils/github/tags.js +71 -0
- package/src/lib/utils/github/tags.js.map +1 -0
- package/src/lib/utils/listr2/create-exec-task.d.ts +8 -0
- package/src/lib/utils/listr2/create-exec-task.js +38 -0
- package/src/lib/utils/listr2/create-exec-task.js.map +1 -0
- package/src/lib/utils/listr2/defaults.d.ts +4 -0
- package/src/lib/utils/listr2/defaults.js +25 -0
- package/src/lib/utils/listr2/defaults.js.map +1 -0
- package/src/lib/utils/prompts/prompts.d.ts +24 -0
- package/src/lib/utils/prompts/prompts.js +184 -0
- package/src/lib/utils/prompts/prompts.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.d.ts +19 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.js +75 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/confirm.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.d.ts +4 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.js +12 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.d.ts +12 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.js +55 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/prompt.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.d.ts +30 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.js +106 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/select.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.d.ts +35 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.js +130 -0
- package/src/lib/utils/prompts/vendor/prompts/elements/text.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/index.d.ts +9 -0
- package/src/lib/utils/prompts/vendor/prompts/index.js +66 -0
- package/src/lib/utils/prompts/vendor/prompts/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.d.ts +27 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.js +52 -0
- package/src/lib/utils/prompts/vendor/prompts/prompts.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.js +39 -0
- package/src/lib/utils/prompts/vendor/prompts/util/action.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.js +17 -0
- package/src/lib/utils/prompts/vendor/prompts/util/clear.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.d.ts +9 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.js +21 -0
- package/src/lib/utils/prompts/vendor/prompts/util/figures.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.d.ts +6 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.js +14 -0
- package/src/lib/utils/prompts/vendor/prompts/util/index.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.d.ts +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.js +12 -0
- package/src/lib/utils/prompts/vendor/prompts/util/strip.js.map +1 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.d.ts +27 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.js +30 -0
- package/src/lib/utils/prompts/vendor/prompts/util/style.js.map +1 -0
- package/src/lib/utils/read-json-file.d.ts +6 -0
- package/src/lib/utils/read-json-file.js +19 -0
- package/src/lib/utils/read-json-file.js.map +1 -0
- package/src/lib/utils/unisphere/augment-workspace-config.d.ts +2 -0
- package/src/lib/utils/unisphere/augment-workspace-config.js +212 -0
- package/src/lib/utils/unisphere/augment-workspace-config.js.map +1 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.d.ts +16 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.js +67 -0
- package/src/lib/utils/unisphere/build-unisphere-elements.js.map +1 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.d.ts +2 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.js +35 -0
- package/src/lib/utils/unisphere/find-unisphere-workspace-file.js.map +1 -0
- package/src/lib/utils/unisphere/get-global-file.d.ts +2 -0
- package/src/lib/utils/unisphere/get-global-file.js +27 -0
- package/src/lib/utils/unisphere/get-global-file.js.map +1 -0
- package/src/lib/utils/unisphere/types.d.ts +88 -0
- package/src/lib/utils/unisphere/types.js +97 -0
- package/src/lib/utils/unisphere/types.js.map +1 -0
- package/src/lib/utils/unisphere/workspace.d.ts +5 -0
- package/src/lib/utils/unisphere/workspace.js +50 -0
- package/src/lib/utils/unisphere/workspace.js.map +1 -0
- package/src/lib/utils/unisphere-utils.d.ts +7 -0
- package/src/lib/utils/unisphere-utils.js +33 -0
- package/src/lib/utils/unisphere-utils.js.map +1 -0
- package/src/lib/utils/utils.d.ts +9 -0
- package/src/lib/utils/utils.js +33 -0
- package/src/lib/utils/utils.js.map +1 -0
- package/src/lib/utils/validator.d.ts +33 -0
- package/src/lib/utils/validator.js +109 -0
- package/src/lib/utils/validator.js.map +1 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextPrompt = void 0;
|
|
4
|
+
const colorette_1 = require("colorette");
|
|
5
|
+
const prompt_1 = require("./prompt");
|
|
6
|
+
const sisteransi_1 = require("sisteransi");
|
|
7
|
+
const util_1 = require("../util");
|
|
8
|
+
/**
|
|
9
|
+
* TextPrompt Base Element
|
|
10
|
+
* @param {Object} opts Options
|
|
11
|
+
* @param {String} opts.message Message
|
|
12
|
+
* @param {String} [opts.style='default'] Render style
|
|
13
|
+
* @param {String} [opts.initial] Default value
|
|
14
|
+
*/
|
|
15
|
+
class TextPrompt extends prompt_1.Prompt {
|
|
16
|
+
constructor(opts = {}) {
|
|
17
|
+
super(opts);
|
|
18
|
+
this.transform = util_1.style.render(opts.style);
|
|
19
|
+
this.scale = this.transform.scale;
|
|
20
|
+
this.msg = opts.message;
|
|
21
|
+
this.initial = opts.initial || '';
|
|
22
|
+
this.value = '';
|
|
23
|
+
this.cursor = Number(!!this.initial);
|
|
24
|
+
this.clear = (0, util_1.clear)('');
|
|
25
|
+
this.render();
|
|
26
|
+
}
|
|
27
|
+
set value(v) {
|
|
28
|
+
if (!v && this.initial) {
|
|
29
|
+
this.placeholder = true;
|
|
30
|
+
this.rendered = (0, colorette_1.gray)(this.transform.render(this.initial));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.placeholder = false;
|
|
34
|
+
this.rendered = this.transform.render(v);
|
|
35
|
+
}
|
|
36
|
+
this._value = v;
|
|
37
|
+
this.fire();
|
|
38
|
+
}
|
|
39
|
+
get value() {
|
|
40
|
+
return this._value;
|
|
41
|
+
}
|
|
42
|
+
reset() {
|
|
43
|
+
this.value = '';
|
|
44
|
+
this.fire();
|
|
45
|
+
this.render();
|
|
46
|
+
}
|
|
47
|
+
abort() {
|
|
48
|
+
this.value = this.value || this.initial;
|
|
49
|
+
this.done = this.aborted = true;
|
|
50
|
+
this.fire();
|
|
51
|
+
this.render();
|
|
52
|
+
this.out.write('\n');
|
|
53
|
+
this.close();
|
|
54
|
+
}
|
|
55
|
+
submit() {
|
|
56
|
+
this.value = this.value || this.initial;
|
|
57
|
+
this.done = true;
|
|
58
|
+
this.aborted = false;
|
|
59
|
+
this.fire();
|
|
60
|
+
this.render();
|
|
61
|
+
this.out.write('\n');
|
|
62
|
+
this.close();
|
|
63
|
+
}
|
|
64
|
+
next() {
|
|
65
|
+
if (!this.placeholder)
|
|
66
|
+
return this.bell();
|
|
67
|
+
this.value = this.initial;
|
|
68
|
+
this.cursor = this.rendered.length;
|
|
69
|
+
this.fire();
|
|
70
|
+
this.render();
|
|
71
|
+
}
|
|
72
|
+
moveCursor(n) {
|
|
73
|
+
if (this.placeholder)
|
|
74
|
+
return;
|
|
75
|
+
this.cursor = this.cursor + n;
|
|
76
|
+
}
|
|
77
|
+
_(c, key) {
|
|
78
|
+
let s1 = this.value.slice(0, this.cursor);
|
|
79
|
+
let s2 = this.value.slice(this.cursor);
|
|
80
|
+
this.moveCursor(1);
|
|
81
|
+
this.value = `${s1}${c}${s2}`;
|
|
82
|
+
if (this.placeholder)
|
|
83
|
+
this.cursor = 0;
|
|
84
|
+
this.render();
|
|
85
|
+
}
|
|
86
|
+
delete() {
|
|
87
|
+
if (this.value.length === 0)
|
|
88
|
+
return this.bell();
|
|
89
|
+
let s1 = this.value.slice(0, this.cursor - 1);
|
|
90
|
+
let s2 = this.value.slice(this.cursor);
|
|
91
|
+
this.value = `${s1}${s2}`;
|
|
92
|
+
this.moveCursor(-1);
|
|
93
|
+
this.render();
|
|
94
|
+
}
|
|
95
|
+
first() {
|
|
96
|
+
this.cursor = 0;
|
|
97
|
+
this.render();
|
|
98
|
+
}
|
|
99
|
+
last() {
|
|
100
|
+
this.cursor = this.value.length;
|
|
101
|
+
this.render();
|
|
102
|
+
}
|
|
103
|
+
left() {
|
|
104
|
+
if (this.cursor <= 0 || this.placeholder)
|
|
105
|
+
return this.bell();
|
|
106
|
+
this.moveCursor(-1);
|
|
107
|
+
this.render();
|
|
108
|
+
}
|
|
109
|
+
right() {
|
|
110
|
+
if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
|
|
111
|
+
return this.bell();
|
|
112
|
+
this.moveCursor(1);
|
|
113
|
+
this.render();
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
const prompt = [
|
|
117
|
+
util_1.style.symbol(this.done, this.aborted),
|
|
118
|
+
(0, colorette_1.bold)(this.msg),
|
|
119
|
+
util_1.style.delimiter(false),
|
|
120
|
+
this.done ? (0, colorette_1.green)(this.rendered) : this.rendered,
|
|
121
|
+
].join(' ');
|
|
122
|
+
this.out.write(this.clear + prompt);
|
|
123
|
+
this.out.write(sisteransi_1.cursor.move(this.placeholder
|
|
124
|
+
? -this.initial.length * this.scale
|
|
125
|
+
: -this.rendered.length + this.cursor * this.scale));
|
|
126
|
+
this.clear = (0, util_1.clear)(prompt);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.TextPrompt = TextPrompt;
|
|
130
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/elements/text.js"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,qCAAkC;AAClC,2CAAoC;AACpC,kCAAuC;AAEvC;;;;;;GAMG;AACH,MAAa,UAAW,SAAQ,eAAM;IACpC,YAAY,IAAI,GAAG,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,SAAS,GAAG,YAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC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AAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QAC7F,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,MAAM,MAAM,GAAG;YACb,YAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC;YACrC,IAAA,gBAAI,EAAC,IAAI,CAAC,GAAG,CAAC;YACd,YAAK,CAAC,SAAS,CAAC,KAAK,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ;SACjD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEZ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,mBAAM,CAAC,IAAI,CACT,IAAI,CAAC,WAAW;YACd,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK;YACnC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CACrD,CACF,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,IAAA,YAAK,EAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF;AA9HD,gCA8HC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt for a series of questions
|
|
3
|
+
* @param {Array|Object} questions Single question object or Array of question objects
|
|
4
|
+
* @returns {Object} Object with values from user input
|
|
5
|
+
*/
|
|
6
|
+
export function prompt(questions?: any[] | any, { onSubmit, onCancel }?: {
|
|
7
|
+
onSubmit?: () => void;
|
|
8
|
+
onCancel?: () => void;
|
|
9
|
+
}): any;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prompt = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const prompts = require("./prompts");
|
|
6
|
+
const ignore = ['suggest', 'format', 'onState'];
|
|
7
|
+
const noop = () => { };
|
|
8
|
+
/**
|
|
9
|
+
* Prompt for a series of questions
|
|
10
|
+
* @param {Array|Object} questions Single question object or Array of question objects
|
|
11
|
+
* @returns {Object} Object with values from user input
|
|
12
|
+
*/
|
|
13
|
+
function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const answers = {};
|
|
16
|
+
questions = [].concat(questions);
|
|
17
|
+
let answer, question, quit, name, type;
|
|
18
|
+
let MAP = prompt._map || {};
|
|
19
|
+
for (question of questions) {
|
|
20
|
+
({ name, type } = question);
|
|
21
|
+
if (MAP[name] !== void 0) {
|
|
22
|
+
answers[name] = MAP[name];
|
|
23
|
+
delete MAP[name];
|
|
24
|
+
continue; // take val & run
|
|
25
|
+
}
|
|
26
|
+
// if property is a function, invoke it unless it's ignored
|
|
27
|
+
for (let key in question) {
|
|
28
|
+
if (ignore.includes(key))
|
|
29
|
+
continue;
|
|
30
|
+
let value = question[key];
|
|
31
|
+
question[key] =
|
|
32
|
+
typeof value === 'function' ? yield value(answer, Object.assign({}, answers), question) : value;
|
|
33
|
+
}
|
|
34
|
+
if (typeof question.message !== 'string') {
|
|
35
|
+
throw new Error('prompt message is required');
|
|
36
|
+
}
|
|
37
|
+
// update vars in case they changed
|
|
38
|
+
({ name, type } = question);
|
|
39
|
+
// skip if type is a falsy value
|
|
40
|
+
if (!type)
|
|
41
|
+
continue;
|
|
42
|
+
if (prompts[type] === void 0) {
|
|
43
|
+
throw new Error(`prompt type (${type}) is not defined`);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
answer = yield prompts[type](question);
|
|
47
|
+
answers[name] = answer = question.format ? yield question.format(answer, answers) : answer;
|
|
48
|
+
quit = onSubmit(question, answer);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
quit = !onCancel(question);
|
|
52
|
+
}
|
|
53
|
+
if (quit)
|
|
54
|
+
return answers;
|
|
55
|
+
}
|
|
56
|
+
return answers;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.prompt = prompt;
|
|
60
|
+
function inject(obj) {
|
|
61
|
+
prompt._map = prompt._map || {};
|
|
62
|
+
for (let k in obj) {
|
|
63
|
+
prompt._map[k] = obj[k];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/index.js"],"names":[],"mappings":";;;;AAAA,qCAAqC;AACrC,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB;;;;GAIG;AACH,SAAsB,MAAM,CAAC,SAAS,GAAG,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,EAAE;;QACpF,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACvC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QAE5B,KAAK,QAAQ,IAAI,SAAS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,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC3F,IAAI,GAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;aACnC;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;aAC5B;YAED,IAAI,IAAI;gBAAE,OAAO,OAAO,CAAC;SAC1B;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAjDD,wBAiDC;AAED,SAAS,MAAM,CAAC,GAAG;IACjB,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAChC,KAAK,IAAI,CAAC,IAAI,GAAG,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;KACzB;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text prompt
|
|
3
|
+
* @param {string} args.message Prompt message to display
|
|
4
|
+
* @param {string} [args.initial] Default string value
|
|
5
|
+
* @param {string} [args.style="default"] Render style ('default', 'password', 'invisible')
|
|
6
|
+
* @param {function} [args.onState] On state change callback
|
|
7
|
+
* @returns {Promise} Promise with user input
|
|
8
|
+
*/
|
|
9
|
+
export function text(args: any): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Classic yes/no prompt
|
|
12
|
+
* @param {string} args.message Prompt message to display
|
|
13
|
+
* @param {boolean} [args.initial=false] Default value
|
|
14
|
+
* @param {function} [args.onState] On state change callback
|
|
15
|
+
* @returns {Promise} Promise with user input
|
|
16
|
+
*/
|
|
17
|
+
export function confirm(args: any): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Interactive select prompt
|
|
20
|
+
* @param {string} args.message Prompt message to display
|
|
21
|
+
* @param {Array} args.choices Array of choices objects `[{ title, value }, ...]`
|
|
22
|
+
* @param {number} [args.initial] Index of default value
|
|
23
|
+
* @param {String} [args.hint] Hint to display
|
|
24
|
+
* @param {function} [args.onState] On state change callback
|
|
25
|
+
* @returns {Promise} Promise with user input
|
|
26
|
+
*/
|
|
27
|
+
export function select(args: any): Promise<any>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.select = exports.confirm = exports.text = void 0;
|
|
4
|
+
const el = require("./elements");
|
|
5
|
+
const noop = v => v;
|
|
6
|
+
function toPrompt(type, args, opts = {}) {
|
|
7
|
+
return new Promise((res, rej) => {
|
|
8
|
+
const p = new el[type](args);
|
|
9
|
+
const onAbort = opts.onAbort || noop;
|
|
10
|
+
const onSubmit = opts.onSubmit || noop;
|
|
11
|
+
p.on('state', args.onState || noop);
|
|
12
|
+
p.on('submit', x => res(onSubmit(x)));
|
|
13
|
+
p.on('abort', x => rej(onAbort(x)));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Text prompt
|
|
18
|
+
* @param {string} args.message Prompt message to display
|
|
19
|
+
* @param {string} [args.initial] Default string value
|
|
20
|
+
* @param {string} [args.style="default"] Render style ('default', 'password', 'invisible')
|
|
21
|
+
* @param {function} [args.onState] On state change callback
|
|
22
|
+
* @returns {Promise} Promise with user input
|
|
23
|
+
*/
|
|
24
|
+
function text(args) {
|
|
25
|
+
return toPrompt('TextPrompt', args);
|
|
26
|
+
}
|
|
27
|
+
exports.text = text;
|
|
28
|
+
/**
|
|
29
|
+
* Classic yes/no prompt
|
|
30
|
+
* @param {string} args.message Prompt message to display
|
|
31
|
+
* @param {boolean} [args.initial=false] Default value
|
|
32
|
+
* @param {function} [args.onState] On state change callback
|
|
33
|
+
* @returns {Promise} Promise with user input
|
|
34
|
+
*/
|
|
35
|
+
function confirm(args) {
|
|
36
|
+
return toPrompt('ConfirmPrompt', args);
|
|
37
|
+
}
|
|
38
|
+
exports.confirm = confirm;
|
|
39
|
+
/**
|
|
40
|
+
* Interactive select prompt
|
|
41
|
+
* @param {string} args.message Prompt message to display
|
|
42
|
+
* @param {Array} args.choices Array of choices objects `[{ title, value }, ...]`
|
|
43
|
+
* @param {number} [args.initial] Index of default value
|
|
44
|
+
* @param {String} [args.hint] Hint to display
|
|
45
|
+
* @param {function} [args.onState] On state change callback
|
|
46
|
+
* @returns {Promise} Promise with user input
|
|
47
|
+
*/
|
|
48
|
+
function select(args) {
|
|
49
|
+
return toPrompt('SelectPrompt', args);
|
|
50
|
+
}
|
|
51
|
+
exports.select = select;
|
|
52
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/prompts.js"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpB,SAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC9B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,IAAI,CAAC,IAAI;IACvB,OAAO,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAC,IAAI;IAC1B,OAAO,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAFD,0BAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAC,IAAI;IACzB,OAAO,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function _default(key: any): false | "first" | "abort" | "last" | "reset" | "submit" | "delete" | "next" | "up" | "down" | "right" | "left";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function default_1(key) {
|
|
4
|
+
if (key.ctrl) {
|
|
5
|
+
if (key.name === 'a')
|
|
6
|
+
return 'first';
|
|
7
|
+
if (key.name === 'c')
|
|
8
|
+
return 'abort';
|
|
9
|
+
if (key.name === 'd')
|
|
10
|
+
return 'abort';
|
|
11
|
+
if (key.name === 'e')
|
|
12
|
+
return 'last';
|
|
13
|
+
if (key.name === 'g')
|
|
14
|
+
return 'reset';
|
|
15
|
+
}
|
|
16
|
+
if (key.name === 'return')
|
|
17
|
+
return 'submit';
|
|
18
|
+
if (key.name === 'enter')
|
|
19
|
+
return 'submit'; // ctrl + J
|
|
20
|
+
if (key.name === 'backspace')
|
|
21
|
+
return 'delete';
|
|
22
|
+
if (key.name === 'abort')
|
|
23
|
+
return 'abort';
|
|
24
|
+
if (key.name === 'escape')
|
|
25
|
+
return 'abort';
|
|
26
|
+
if (key.name === 'tab')
|
|
27
|
+
return 'next';
|
|
28
|
+
if (key.name === 'up')
|
|
29
|
+
return 'up';
|
|
30
|
+
if (key.name === 'down')
|
|
31
|
+
return 'down';
|
|
32
|
+
if (key.name === 'right')
|
|
33
|
+
return 'right';
|
|
34
|
+
if (key.name === 'left')
|
|
35
|
+
return 'left';
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
exports.default = default_1;
|
|
39
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/action.js"],"names":[],"mappings":";;AAAA,mBAAyB,GAAG;IAC1B,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;QACrC,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;QACrC,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;QACrC,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;YAAE,OAAO,MAAM,CAAC;QACpC,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;KACtC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC3C,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC,CAAC,WAAW;IACtD,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,QAAQ,CAAC;IAC9C,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACzC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC1C,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC;IAEtC,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvC,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACzC,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IAEvC,OAAO,KAAK,CAAC;AACf,CAAC;AArBD,4BAqBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function _default(prompt: any, perLine?: number): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const strip_1 = require("./strip");
|
|
4
|
+
const sisteransi_1 = require("sisteransi");
|
|
5
|
+
const width = str => [...(0, strip_1.default)(str)].length;
|
|
6
|
+
function default_1(prompt, perLine = process.stdout.columns) {
|
|
7
|
+
if (!perLine)
|
|
8
|
+
return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
|
|
9
|
+
let rows = 0;
|
|
10
|
+
const lines = prompt.split(/\r?\n/);
|
|
11
|
+
for (let line of lines) {
|
|
12
|
+
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
|
|
13
|
+
}
|
|
14
|
+
return (sisteransi_1.erase.line + sisteransi_1.cursor.prevLine()).repeat(rows - 1) + sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
|
|
15
|
+
}
|
|
16
|
+
exports.default = default_1;
|
|
17
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/clear.js"],"names":[],"mappings":";;AAAA,mCAA4B;AAC5B,2CAA2C;AAE3C,MAAM,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AAE5C,mBAAyB,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO,kBAAK,CAAC,IAAI,GAAG,mBAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE/C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;KAChE;IAED,OAAO,CAAC,kBAAK,CAAC,IAAI,GAAG,mBAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,kBAAK,CAAC,IAAI,GAAG,mBAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAVD,4BAUC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const main = {
|
|
4
|
+
tick: '✔',
|
|
5
|
+
cross: '✖',
|
|
6
|
+
ellipsis: '…',
|
|
7
|
+
pointerSmall: '›',
|
|
8
|
+
line: '─',
|
|
9
|
+
pointer: '❯',
|
|
10
|
+
};
|
|
11
|
+
const win = {
|
|
12
|
+
tick: '√',
|
|
13
|
+
cross: '×',
|
|
14
|
+
ellipsis: '...',
|
|
15
|
+
pointerSmall: '»',
|
|
16
|
+
line: '─',
|
|
17
|
+
pointer: '>',
|
|
18
|
+
};
|
|
19
|
+
const figures = process.platform === 'win32' ? win : main;
|
|
20
|
+
exports.default = figures;
|
|
21
|
+
//# sourceMappingURL=figures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figures.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/figures.js"],"names":[],"mappings":";;AAAA,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,GAAG;CACb,CAAC;AACF,MAAM,GAAG,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,GAAG;CACb,CAAC;AACF,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAE1D,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.figures = exports.strip = exports.style = exports.clear = exports.action = void 0;
|
|
4
|
+
const action_1 = require("./action");
|
|
5
|
+
exports.action = action_1.default;
|
|
6
|
+
const clear_1 = require("./clear");
|
|
7
|
+
exports.clear = clear_1.default;
|
|
8
|
+
const style = require("./style");
|
|
9
|
+
exports.style = style;
|
|
10
|
+
const strip_1 = require("./strip");
|
|
11
|
+
exports.strip = strip_1.default;
|
|
12
|
+
const figures_1 = require("./figures");
|
|
13
|
+
exports.figures = figures_1.default;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/index.js"],"names":[],"mappings":";;;AAAA,qCAA8B;AAMrB,iBANF,gBAAM,CAME;AALf,mCAA4B;AAKX,gBALV,eAAK,CAKU;AAJtB,iCAAiC;AAIT,sBAAK;AAH7B,mCAA4B;AAGG,gBAHxB,eAAK,CAGwB;AAFpC,uCAAgC;AAEM,kBAF/B,iBAAO,CAE+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function _default(str: any): any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function default_1(str) {
|
|
4
|
+
const pattern = [
|
|
5
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
|
|
6
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))',
|
|
7
|
+
].join('|');
|
|
8
|
+
const RGX = new RegExp(pattern, 'g');
|
|
9
|
+
return typeof str === 'string' ? str.replace(RGX, '') : str;
|
|
10
|
+
}
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
//# sourceMappingURL=strip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/strip.js"],"names":[],"mappings":";;AAAA,mBAAyB,GAAG;IAC1B,MAAM,OAAO,GAAG;QACd,+EAA+E;QAC/E,wDAAwD;KACzD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEZ,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC;AARD,4BAQC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const styles: Readonly<{
|
|
2
|
+
password: {
|
|
3
|
+
scale: number;
|
|
4
|
+
render: (input: any) => string;
|
|
5
|
+
};
|
|
6
|
+
emoji: {
|
|
7
|
+
scale: number;
|
|
8
|
+
render: (input: any) => string;
|
|
9
|
+
};
|
|
10
|
+
invisible: {
|
|
11
|
+
scale: number;
|
|
12
|
+
render: (input: any) => "";
|
|
13
|
+
};
|
|
14
|
+
default: {
|
|
15
|
+
scale: number;
|
|
16
|
+
render: (input: any) => string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export function render(type: any): any;
|
|
20
|
+
export const symbols: Readonly<{
|
|
21
|
+
aborted: string;
|
|
22
|
+
done: string;
|
|
23
|
+
default: string;
|
|
24
|
+
}>;
|
|
25
|
+
export function symbol(done: any, aborted: any): string;
|
|
26
|
+
export function delimiter(completing: any): string;
|
|
27
|
+
export function item(expandable: any, expanded: any): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.item = exports.delimiter = exports.symbol = exports.symbols = exports.render = exports.styles = void 0;
|
|
4
|
+
const colorette_1 = require("colorette");
|
|
5
|
+
const figures_1 = require("./figures");
|
|
6
|
+
// rendering user input.
|
|
7
|
+
const styles = Object.freeze({
|
|
8
|
+
password: { scale: 1, render: input => '*'.repeat(input.length) },
|
|
9
|
+
emoji: { scale: 2, render: input => '😃'.repeat(input.length) },
|
|
10
|
+
invisible: { scale: 0, render: input => '' },
|
|
11
|
+
default: { scale: 1, render: input => `${input}` },
|
|
12
|
+
});
|
|
13
|
+
exports.styles = styles;
|
|
14
|
+
const render = type => styles[type] || styles.default;
|
|
15
|
+
exports.render = render;
|
|
16
|
+
// icon to signalize a prompt.
|
|
17
|
+
const symbols = Object.freeze({
|
|
18
|
+
aborted: (0, colorette_1.red)(figures_1.default.cross),
|
|
19
|
+
done: (0, colorette_1.green)(figures_1.default.tick),
|
|
20
|
+
default: (0, colorette_1.cyan)('?'),
|
|
21
|
+
});
|
|
22
|
+
exports.symbols = symbols;
|
|
23
|
+
const symbol = (done, aborted) => aborted ? symbols.aborted : done ? symbols.done : symbols.default;
|
|
24
|
+
exports.symbol = symbol;
|
|
25
|
+
// between the question and the user's input.
|
|
26
|
+
const delimiter = completing => (0, colorette_1.gray)(completing ? figures_1.default.ellipsis : figures_1.default.pointerSmall);
|
|
27
|
+
exports.delimiter = delimiter;
|
|
28
|
+
const item = (expandable, expanded) => (0, colorette_1.gray)(expandable ? (expanded ? figures_1.default.pointerSmall : '+') : figures_1.default.line);
|
|
29
|
+
exports.item = item;
|
|
30
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../../../../../../../../packages/unisphere-cli/src/lib/utils/prompts/vendor/prompts/util/style.js"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,uCAAgC;AAEhC,wBAAwB;AACxB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IACjE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IAC/D,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE;IAC5C,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE;CACnD,CAAC,CAAC;AAmBM,wBAAM;AAlBf,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;AAkBrC,wBAAM;AAhBvB,8BAA8B;AAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,IAAA,eAAG,EAAC,iBAAO,CAAC,KAAK,CAAC;IAC3B,IAAI,EAAE,IAAA,iBAAK,EAAC,iBAAO,CAAC,IAAI,CAAC;IACzB,OAAO,EAAE,IAAA,gBAAI,EAAC,GAAG,CAAC;CACnB,CAAC,CAAC;AAWsB,0BAAO;AAThC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAC/B,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AAQlC,wBAAM;AANxC,6CAA6C;AAC7C,MAAM,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC,IAAA,gBAAI,EAAC,UAAU,CAAC,CAAC,CAAC,iBAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAO,CAAC,YAAY,CAAC,CAAC;AAKjD,8BAAS;AAHnD,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CACpC,IAAA,gBAAI,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,oBAAI"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to read a JSON file
|
|
4
|
+
* @param {string} filePath - The path to the JSON file
|
|
5
|
+
* @returns {Object|null} - Parsed JSON object or null if file cannot be read
|
|
6
|
+
*/
|
|
7
|
+
function readJsonFile(filePath) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
console.warn(`Failed to read ${filePath}: ${err.message}`);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
module.exports = {
|
|
17
|
+
readJsonFile
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=read-json-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-json-file.js","sourceRoot":"","sources":["../../../../../../packages/unisphere-cli/src/lib/utils/read-json-file.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB;;;;GAIG;AACH,SAAS,YAAY,CAAC,QAAQ;IAC5B,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;KACtD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,kBAAkB,QAAQ,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG;IACf,YAAY;CACb,CAAA"}
|