@wocker/ws 1.0.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/LICENSE +21 -0
- package/README.md +155 -0
- package/bin/ws.js +13 -0
- package/lib/App.d.ts +13 -0
- package/lib/App.js +52 -0
- package/lib/controllers/ImageController.d.ts +8 -0
- package/lib/controllers/ImageController.js +29 -0
- package/lib/controllers/ProjectController.d.ts +64 -0
- package/lib/controllers/ProjectController.js +561 -0
- package/lib/controllers/index.d.ts +2 -0
- package/lib/controllers/index.js +27 -0
- package/lib/env.d.ts +7 -0
- package/lib/env.js +24 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +31 -0
- package/lib/makes/Controller.d.ts +5 -0
- package/lib/makes/Controller.js +12 -0
- package/lib/makes/Docker.d.ts +58 -0
- package/lib/makes/Docker.js +418 -0
- package/lib/makes/FS.d.ts +37 -0
- package/lib/makes/FS.js +317 -0
- package/lib/makes/LineConvertStream.d.ts +13 -0
- package/lib/makes/LineConvertStream.js +45 -0
- package/lib/makes/Logger.d.ts +7 -0
- package/lib/makes/Logger.js +39 -0
- package/lib/makes/Model.d.ts +5 -0
- package/lib/makes/Model.js +16 -0
- package/lib/makes/MySQL.d.ts +15 -0
- package/lib/makes/MySQL.js +31 -0
- package/lib/makes/Plugin.d.ts +13 -0
- package/lib/makes/Plugin.js +43 -0
- package/lib/makes/Repository.d.ts +11 -0
- package/lib/makes/Repository.js +25 -0
- package/lib/makes/index.d.ts +6 -0
- package/lib/makes/index.js +71 -0
- package/lib/models/Preset.d.ts +19 -0
- package/lib/models/Preset.js +60 -0
- package/lib/models/Project.d.ts +38 -0
- package/lib/models/Project.js +151 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.js +27 -0
- package/lib/plugins/LocaltunnelPlugin.d.ts +36 -0
- package/lib/plugins/LocaltunnelPlugin.js +273 -0
- package/lib/plugins/MaildevPlugin.d.ts +10 -0
- package/lib/plugins/MaildevPlugin.js +45 -0
- package/lib/plugins/MariadbPlugin.d.ts +25 -0
- package/lib/plugins/MariadbPlugin.js +297 -0
- package/lib/plugins/MongodbPlugin.d.ts +20 -0
- package/lib/plugins/MongodbPlugin.js +271 -0
- package/lib/plugins/NgrokPlugin.d.ts +37 -0
- package/lib/plugins/NgrokPlugin.js +248 -0
- package/lib/plugins/PageKitePlugin.d.ts +31 -0
- package/lib/plugins/PageKitePlugin.js +158 -0
- package/lib/plugins/PostgresPlugin.d.ts +16 -0
- package/lib/plugins/PostgresPlugin.js +94 -0
- package/lib/plugins/PresetPlugin.d.ts +19 -0
- package/lib/plugins/PresetPlugin.js +164 -0
- package/lib/plugins/ProjectPlugin.d.ts +12 -0
- package/lib/plugins/ProjectPlugin.js +54 -0
- package/lib/plugins/ProxmoxPlugin.d.ts +9 -0
- package/lib/plugins/ProxmoxPlugin.js +55 -0
- package/lib/plugins/ProxyPlugin.d.ts +33 -0
- package/lib/plugins/ProxyPlugin.js +257 -0
- package/lib/plugins/RedisPlugin.d.ts +10 -0
- package/lib/plugins/RedisPlugin.js +42 -0
- package/lib/plugins/ServeoPlugin.d.ts +36 -0
- package/lib/plugins/ServeoPlugin.js +260 -0
- package/lib/plugins/TestPlugin.d.ts +10 -0
- package/lib/plugins/TestPlugin.js +75 -0
- package/lib/plugins/index.d.ts +14 -0
- package/lib/plugins/index.js +159 -0
- package/lib/services/AppConfigService.d.ts +18 -0
- package/lib/services/AppConfigService.js +77 -0
- package/lib/services/AppEventsService.d.ts +13 -0
- package/lib/services/AppEventsService.js +29 -0
- package/lib/services/ProjectService.d.ts +13 -0
- package/lib/services/ProjectService.js +91 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.js +38 -0
- package/lib/types/Config.d.ts +11 -0
- package/lib/types/Config.js +5 -0
- package/lib/types/EnvConfig.d.ts +3 -0
- package/lib/types/EnvConfig.js +5 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +27 -0
- package/lib/utils/buildOptions.d.ts +1 -0
- package/lib/utils/buildOptions.js +12 -0
- package/lib/utils/demuxOutput.d.ts +2 -0
- package/lib/utils/demuxOutput.js +25 -0
- package/lib/utils/escapeRegExp.d.ts +2 -0
- package/lib/utils/escapeRegExp.js +10 -0
- package/lib/utils/exec.d.ts +2 -0
- package/lib/utils/exec.js +44 -0
- package/lib/utils/fetch.d.ts +5 -0
- package/lib/utils/fetch.js +37 -0
- package/lib/utils/followProgress.d.ts +6 -0
- package/lib/utils/followProgress.js +80 -0
- package/lib/utils/format-size-units.d.ts +1 -0
- package/lib/utils/format-size-units.js +19 -0
- package/lib/utils/get-config.d.ts +2 -0
- package/lib/utils/get-config.js +20 -0
- package/lib/utils/get-cursor-position.d.ts +4 -0
- package/lib/utils/get-cursor-position.js +34 -0
- package/lib/utils/image-build.d.ts +13 -0
- package/lib/utils/image-build.js +34 -0
- package/lib/utils/index.d.ts +21 -0
- package/lib/utils/index.js +236 -0
- package/lib/utils/injectVariables.d.ts +5 -0
- package/lib/utils/injectVariables.js +17 -0
- package/lib/utils/parse-table.d.ts +2 -0
- package/lib/utils/parse-table.js +27 -0
- package/lib/utils/promptConfirm.d.ts +6 -0
- package/lib/utils/promptConfirm.js +21 -0
- package/lib/utils/promptGroup.d.ts +16 -0
- package/lib/utils/promptGroup.js +39 -0
- package/lib/utils/promptSelect.d.ts +12 -0
- package/lib/utils/promptSelect.js +47 -0
- package/lib/utils/promptText.d.ts +13 -0
- package/lib/utils/promptText.js +53 -0
- package/lib/utils/set-config.d.ts +2 -0
- package/lib/utils/set-config.js +18 -0
- package/lib/utils/spawn.d.ts +2 -0
- package/lib/utils/spawn.js +24 -0
- package/lib/utils/tty.d.ts +2 -0
- package/lib/utils/tty.js +10 -0
- package/lib/utils/volumeFormat.d.ts +6 -0
- package/lib/utils/volumeFormat.js +15 -0
- package/lib/utils/volumeParse.d.ts +2 -0
- package/lib/utils/volumeParse.js +16 -0
- package/package.json +90 -0
- package/plugins/localtunnel/Dockerfile +37 -0
- package/plugins/localtunnel/Ubuntu.dockerfile +34 -0
- package/plugins/localtunnel/config.json +3 -0
- package/plugins/maildev/Dockerfile +5 -0
- package/plugins/maildev/config.json +3 -0
- package/plugins/mariadb/admin/conf/config.user.inc.php +9 -0
- package/plugins/ngrok/Dockerfile +2 -0
- package/plugins/pagekite/Dockerfile +3 -0
- package/plugins/proxmox/Dockerfile +35 -0
- package/plugins/proxy/Dockerfile +7 -0
- package/plugins/proxy/config.json +3 -0
- package/plugins/serveo/Dockerfile +17 -0
- package/presets/apache/.docker/apache2/apache2.conf +230 -0
- package/presets/apache/.docker/apache2/mods-available/mpm_prefork.conf +16 -0
- package/presets/apache/.docker/apache2/sites-available/000-default.conf.conf +21 -0
- package/presets/apache/Dockerfile +110 -0
- package/presets/apache/bin/compare-version +3 -0
- package/presets/apache/config.json +47 -0
- package/presets/go/Dockerfile +19 -0
- package/presets/go/config.json +13 -0
- package/presets/node/Dockerfile +37 -0
- package/presets/node/config.json +36 -0
- package/presets/php-apache/Dockerfile +133 -0
- package/presets/php-apache/bin/compare-version +3 -0
- package/presets/php-apache/config.json +56 -0
- package/presets/php-apache/etc/apache2/apache2.conf +230 -0
- package/presets/php-apache/etc/apache2/mods-available/mpm_prefork.conf +16 -0
- package/presets/php-apache/etc/apache2/sites-available/000-default.conf +21 -0
- package/presets/shopify/Dockerfile +160 -0
- package/presets/shopify/bin/compare-version +3 -0
- package/presets/shopify/config.json +24 -0
- package/presets/shopify/etc/apache2/apache2.conf +230 -0
- package/presets/shopify/etc/apache2/mods-available/mpm_prefork.conf +16 -0
- package/presets/shopify/etc/apache2/sites-available/000-default.conf +21 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _buildOptions = require("./buildOptions");
|
|
7
|
+
Object.keys(_buildOptions).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _buildOptions[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _buildOptions[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _demuxOutput = require("./demuxOutput");
|
|
18
|
+
Object.keys(_demuxOutput).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _demuxOutput[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _demuxOutput[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _escapeRegExp = require("./escapeRegExp");
|
|
29
|
+
Object.keys(_escapeRegExp).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _escapeRegExp[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _escapeRegExp[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _exec = require("./exec");
|
|
40
|
+
Object.keys(_exec).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _exec[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _exec[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _fetch = require("./fetch");
|
|
51
|
+
Object.keys(_fetch).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _fetch[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _fetch[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _followProgress = require("./followProgress");
|
|
62
|
+
Object.keys(_followProgress).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _followProgress[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _followProgress[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _formatSizeUnits = require("./format-size-units");
|
|
73
|
+
Object.keys(_formatSizeUnits).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _formatSizeUnits[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _formatSizeUnits[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _getConfig = require("./get-config");
|
|
84
|
+
Object.keys(_getConfig).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _getConfig[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _getConfig[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _getCursorPosition = require("./get-cursor-position");
|
|
95
|
+
Object.keys(_getCursorPosition).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _getCursorPosition[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _getCursorPosition[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _imageBuild = require("./image-build");
|
|
106
|
+
Object.keys(_imageBuild).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _imageBuild[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _imageBuild[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
var _injectVariables = require("./injectVariables");
|
|
117
|
+
Object.keys(_injectVariables).forEach(function (key) {
|
|
118
|
+
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (key in exports && exports[key] === _injectVariables[key]) return;
|
|
120
|
+
Object.defineProperty(exports, key, {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _injectVariables[key];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
var _parseTable = require("./parse-table");
|
|
128
|
+
Object.keys(_parseTable).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _parseTable[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _parseTable[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
var _promptConfirm = require("./promptConfirm");
|
|
139
|
+
Object.keys(_promptConfirm).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _promptConfirm[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _promptConfirm[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
var _promptGroup = require("./promptGroup");
|
|
150
|
+
Object.keys(_promptGroup).forEach(function (key) {
|
|
151
|
+
if (key === "default" || key === "__esModule") return;
|
|
152
|
+
if (key in exports && exports[key] === _promptGroup[key]) return;
|
|
153
|
+
Object.defineProperty(exports, key, {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return _promptGroup[key];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
var _promptSelect = require("./promptSelect");
|
|
161
|
+
Object.keys(_promptSelect).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (key in exports && exports[key] === _promptSelect[key]) return;
|
|
164
|
+
Object.defineProperty(exports, key, {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function () {
|
|
167
|
+
return _promptSelect[key];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
var _promptText = require("./promptText");
|
|
172
|
+
Object.keys(_promptText).forEach(function (key) {
|
|
173
|
+
if (key === "default" || key === "__esModule") return;
|
|
174
|
+
if (key in exports && exports[key] === _promptText[key]) return;
|
|
175
|
+
Object.defineProperty(exports, key, {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () {
|
|
178
|
+
return _promptText[key];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
var _setConfig = require("./set-config");
|
|
183
|
+
Object.keys(_setConfig).forEach(function (key) {
|
|
184
|
+
if (key === "default" || key === "__esModule") return;
|
|
185
|
+
if (key in exports && exports[key] === _setConfig[key]) return;
|
|
186
|
+
Object.defineProperty(exports, key, {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _setConfig[key];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
var _spawn = require("./spawn");
|
|
194
|
+
Object.keys(_spawn).forEach(function (key) {
|
|
195
|
+
if (key === "default" || key === "__esModule") return;
|
|
196
|
+
if (key in exports && exports[key] === _spawn[key]) return;
|
|
197
|
+
Object.defineProperty(exports, key, {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function () {
|
|
200
|
+
return _spawn[key];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
var _tty = require("./tty");
|
|
205
|
+
Object.keys(_tty).forEach(function (key) {
|
|
206
|
+
if (key === "default" || key === "__esModule") return;
|
|
207
|
+
if (key in exports && exports[key] === _tty[key]) return;
|
|
208
|
+
Object.defineProperty(exports, key, {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () {
|
|
211
|
+
return _tty[key];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
var _volumeFormat = require("./volumeFormat");
|
|
216
|
+
Object.keys(_volumeFormat).forEach(function (key) {
|
|
217
|
+
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (key in exports && exports[key] === _volumeFormat[key]) return;
|
|
219
|
+
Object.defineProperty(exports, key, {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
get: function () {
|
|
222
|
+
return _volumeFormat[key];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
var _volumeParse = require("./volumeParse");
|
|
227
|
+
Object.keys(_volumeParse).forEach(function (key) {
|
|
228
|
+
if (key === "default" || key === "__esModule") return;
|
|
229
|
+
if (key in exports && exports[key] === _volumeParse[key]) return;
|
|
230
|
+
Object.defineProperty(exports, key, {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get: function () {
|
|
233
|
+
return _volumeParse[key];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.injectVariables = void 0;
|
|
7
|
+
const injectVariables = (str, data) => {
|
|
8
|
+
let res = str;
|
|
9
|
+
Object.keys(data).forEach(key => {
|
|
10
|
+
const variableName = `\\$\\{${key}\\}`;
|
|
11
|
+
const variableValue = data[key];
|
|
12
|
+
const regex = new RegExp(variableName, 'g');
|
|
13
|
+
res = res.replace(regex, variableValue);
|
|
14
|
+
});
|
|
15
|
+
return res;
|
|
16
|
+
};
|
|
17
|
+
exports.injectVariables = injectVariables;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseTable = void 0;
|
|
7
|
+
const parseTable = (string, pos) => {
|
|
8
|
+
return string.split("\n").filter(line => {
|
|
9
|
+
return line.split(new RegExp("\\s\\s+")).filter(item => {
|
|
10
|
+
return item !== "";
|
|
11
|
+
}).length > 0;
|
|
12
|
+
}).map((line, index) => {
|
|
13
|
+
if (index === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
let data = line.split(new RegExp("\\s\\s+"));
|
|
17
|
+
let row = {};
|
|
18
|
+
for (let i in data) {
|
|
19
|
+
let name = pos[i];
|
|
20
|
+
row[name] = data[i];
|
|
21
|
+
}
|
|
22
|
+
return row;
|
|
23
|
+
}).filter(line => {
|
|
24
|
+
return !!line;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.parseTable = parseTable;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.promptConfirm = void 0;
|
|
7
|
+
var _inquirer = require("inquirer");
|
|
8
|
+
const promptConfirm = async options => {
|
|
9
|
+
const {
|
|
10
|
+
message,
|
|
11
|
+
default: defaultValue = true
|
|
12
|
+
} = options;
|
|
13
|
+
const res = await (0, _inquirer.prompt)({
|
|
14
|
+
type: "confirm",
|
|
15
|
+
name: "confirm",
|
|
16
|
+
message,
|
|
17
|
+
default: defaultValue
|
|
18
|
+
});
|
|
19
|
+
return res.confirm;
|
|
20
|
+
};
|
|
21
|
+
exports.promptConfirm = promptConfirm;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PromptConfirmOptions } from "./promptConfirm";
|
|
2
|
+
import { PromptSelectOptions } from "./promptSelect";
|
|
3
|
+
import { PromptTextOptions } from "./promptText";
|
|
4
|
+
type Values = {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
type Option = ({
|
|
8
|
+
type: "boolean";
|
|
9
|
+
} & PromptConfirmOptions) | PromptTextOptions | ({
|
|
10
|
+
type: "select";
|
|
11
|
+
} & PromptSelectOptions);
|
|
12
|
+
type Options<T = unknown> = {
|
|
13
|
+
[key: string]: Option & T;
|
|
14
|
+
};
|
|
15
|
+
export declare const promptGroup: (values: Values, options: Options) => Promise<Values>;
|
|
16
|
+
export { Options as PromptGroupOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.promptGroup = void 0;
|
|
7
|
+
var _promptConfirm = require("./promptConfirm");
|
|
8
|
+
var _promptSelect = require("./promptSelect");
|
|
9
|
+
var _promptText = require("./promptText");
|
|
10
|
+
const promptGroup = async (values, options) => {
|
|
11
|
+
for (const key in options) {
|
|
12
|
+
const value = values[key];
|
|
13
|
+
const option = options[key];
|
|
14
|
+
switch (option.type) {
|
|
15
|
+
case "boolean":
|
|
16
|
+
values[key] = await (0, _promptConfirm.promptConfirm)({
|
|
17
|
+
...option,
|
|
18
|
+
default: typeof value !== "undefined" ? value === "true" : true
|
|
19
|
+
});
|
|
20
|
+
values[key] = values[key].toString();
|
|
21
|
+
break;
|
|
22
|
+
case "string":
|
|
23
|
+
case "integer":
|
|
24
|
+
values[key] = await (0, _promptText.promptText)({
|
|
25
|
+
...option,
|
|
26
|
+
default: typeof value !== "undefined" ? value : option.default || ""
|
|
27
|
+
});
|
|
28
|
+
break;
|
|
29
|
+
case "select":
|
|
30
|
+
values[key] = await (0, _promptSelect.promptSelect)({
|
|
31
|
+
...option,
|
|
32
|
+
default: typeof value !== "undefined" ? value : option.default || ""
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return values;
|
|
38
|
+
};
|
|
39
|
+
exports.promptGroup = promptGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
message?: string;
|
|
3
|
+
options: string[] | {
|
|
4
|
+
[value: string]: string;
|
|
5
|
+
} | {
|
|
6
|
+
label?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
default?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const promptSelect: (props: Options) => Promise<any>;
|
|
12
|
+
export { promptSelect, Options as PromptSelectOptions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.promptSelect = void 0;
|
|
7
|
+
var inquirer = _interopRequireWildcard(require("inquirer"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
const promptSelect = async props => {
|
|
11
|
+
const {
|
|
12
|
+
message = "Select: ",
|
|
13
|
+
options: rawOptions,
|
|
14
|
+
default: value
|
|
15
|
+
} = props;
|
|
16
|
+
const options = Array.isArray(rawOptions) ? rawOptions.map(option => {
|
|
17
|
+
return {
|
|
18
|
+
label: typeof option === "string" ? option : option.label || option.value,
|
|
19
|
+
value: typeof option === "string" ? option : option.value
|
|
20
|
+
};
|
|
21
|
+
}) : Object.keys(rawOptions).map(value => {
|
|
22
|
+
return {
|
|
23
|
+
label: rawOptions[value],
|
|
24
|
+
value
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const defaultOption = options.find(option => {
|
|
28
|
+
return option.value === value;
|
|
29
|
+
});
|
|
30
|
+
const res = await inquirer.prompt({
|
|
31
|
+
type: "list",
|
|
32
|
+
name: "value",
|
|
33
|
+
message: `${message}: `,
|
|
34
|
+
choices: options.map(option => {
|
|
35
|
+
return option.label || option.value;
|
|
36
|
+
}),
|
|
37
|
+
default: defaultOption ? defaultOption.label || defaultOption.value : ""
|
|
38
|
+
});
|
|
39
|
+
const option = options.find(option => {
|
|
40
|
+
return (option.label || option.value) === res.value;
|
|
41
|
+
});
|
|
42
|
+
if (option) {
|
|
43
|
+
return option.value;
|
|
44
|
+
}
|
|
45
|
+
return "";
|
|
46
|
+
};
|
|
47
|
+
exports.promptSelect = promptSelect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Transformer } from "inquirer";
|
|
2
|
+
type Options = {
|
|
3
|
+
required?: boolean;
|
|
4
|
+
message?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
suffix?: string;
|
|
8
|
+
type?: "string" | "integer";
|
|
9
|
+
default?: string;
|
|
10
|
+
transformer?: Transformer;
|
|
11
|
+
};
|
|
12
|
+
export declare const promptText: (props: Options) => Promise<any>;
|
|
13
|
+
export { Options as PromptTextOptions };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.promptText = void 0;
|
|
7
|
+
var _inquirer = require("inquirer");
|
|
8
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const promptText = async props => {
|
|
11
|
+
const {
|
|
12
|
+
required,
|
|
13
|
+
message = "Prompt",
|
|
14
|
+
label = message || "Prompt",
|
|
15
|
+
prefix = "",
|
|
16
|
+
suffix = "",
|
|
17
|
+
type = "string",
|
|
18
|
+
default: defaultValue,
|
|
19
|
+
transformer
|
|
20
|
+
} = props;
|
|
21
|
+
const res = await (0, _inquirer.prompt)({
|
|
22
|
+
message: `${label}: `,
|
|
23
|
+
name: "value",
|
|
24
|
+
type: "input",
|
|
25
|
+
default: defaultValue,
|
|
26
|
+
validate(value) {
|
|
27
|
+
if (required) {
|
|
28
|
+
if (typeof value === "undefined" || value === "") {
|
|
29
|
+
return "Mandatory value";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (type === "integer") {
|
|
33
|
+
if (isNaN(parseInt(value)) || parseInt(value).toString() !== value) {
|
|
34
|
+
return "Should be integer";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
},
|
|
39
|
+
transformer: transformer || (value => {
|
|
40
|
+
if (!prefix && !suffix) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
if (suffix) {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
process.stdout.write(`\x1b[${suffix.length}D`);
|
|
46
|
+
}, 0);
|
|
47
|
+
}
|
|
48
|
+
return `${_chalk.default.gray(prefix)}${value}${_chalk.default.gray(suffix)}`;
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
return res.value;
|
|
52
|
+
};
|
|
53
|
+
exports.promptText = promptText;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setConfig = void 0;
|
|
7
|
+
var _env = require("../env");
|
|
8
|
+
var _FS = require("../makes/FS");
|
|
9
|
+
var _getConfig = require("./get-config");
|
|
10
|
+
const setConfig = async data => {
|
|
11
|
+
const config = {
|
|
12
|
+
...(await (0, _getConfig.getConfig)()),
|
|
13
|
+
...data
|
|
14
|
+
};
|
|
15
|
+
await _FS.FS.writeJSON(_env.MAP_PATH, config);
|
|
16
|
+
return config;
|
|
17
|
+
};
|
|
18
|
+
exports.setConfig = setConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.spawn = void 0;
|
|
7
|
+
var _child_process = require("child_process");
|
|
8
|
+
const spawn = async command => {
|
|
9
|
+
return new Promise(resolve => {
|
|
10
|
+
let [prog, ...options] = command.split(/\s+/);
|
|
11
|
+
let worker = (0, _child_process.spawn)(prog, options);
|
|
12
|
+
worker.stdout.on("data", data => {
|
|
13
|
+
console.log(`stdout: ${data}`);
|
|
14
|
+
});
|
|
15
|
+
worker.stderr.on("data", data => {
|
|
16
|
+
console.error(`stderr: ${data}`);
|
|
17
|
+
});
|
|
18
|
+
worker.on("close", code => {
|
|
19
|
+
console.log(`child process exited with code ${code}`);
|
|
20
|
+
resolve(undefined);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
exports.spawn = spawn;
|
package/lib/utils/tty.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.volumeFormat = void 0;
|
|
7
|
+
const volumeFormat = volume => {
|
|
8
|
+
const {
|
|
9
|
+
source,
|
|
10
|
+
destination,
|
|
11
|
+
options
|
|
12
|
+
} = volume;
|
|
13
|
+
return `${source}:${destination}` + (options ? `:${options}` : "");
|
|
14
|
+
};
|
|
15
|
+
exports.volumeFormat = volumeFormat;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.volumeParse = void 0;
|
|
7
|
+
const volumeParse = volume => {
|
|
8
|
+
const regVolume = /^([^:]+):([^:]+)(?::([^:]+))?$/;
|
|
9
|
+
const [, source, destination, options] = regVolume.exec(volume);
|
|
10
|
+
return {
|
|
11
|
+
source,
|
|
12
|
+
destination,
|
|
13
|
+
options
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.volumeParse = volumeParse;
|