@wocker/ws 1.0.2 → 1.0.3
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 +1 -1
- package/lib/App.d.ts +4 -3
- package/lib/App.js +98 -77
- package/lib/controllers/ImageController.d.ts +2 -2
- package/lib/controllers/ImageController.js +27 -27
- package/lib/controllers/PluginController.d.ts +2 -2
- package/lib/controllers/PluginController.js +78 -56
- package/lib/controllers/PresetController.d.ts +3 -1
- package/lib/controllers/PresetController.js +155 -136
- package/lib/controllers/ProjectController.d.ts +5 -5
- package/lib/controllers/ProjectController.js +653 -603
- package/lib/controllers/ProxyController.d.ts +4 -1
- package/lib/controllers/ProxyController.js +269 -245
- package/lib/controllers/index.js +19 -58
- package/lib/env.js +33 -15
- package/lib/index.d.ts +2 -0
- package/lib/index.js +30 -16
- package/lib/makes/Controller.js +4 -8
- package/lib/makes/DI.d.ts +7 -0
- package/lib/makes/DI.js +27 -0
- package/lib/makes/Docker.js +298 -382
- package/lib/makes/FS.js +328 -304
- package/lib/makes/LineConvertStream.js +37 -40
- package/lib/makes/Logger.d.ts +9 -1
- package/lib/makes/Logger.js +22 -11
- package/lib/makes/Model.js +8 -12
- package/lib/makes/MySQL.js +6 -27
- package/lib/makes/Plugin.d.ts +1 -1
- package/lib/makes/Plugin.js +55 -37
- package/lib/makes/Preset.d.ts +46 -0
- package/lib/makes/Preset.js +33 -0
- package/lib/makes/Project.d.ts +45 -0
- package/lib/makes/Project.js +127 -0
- package/lib/makes/Repository.js +18 -21
- package/lib/makes/index.d.ts +3 -0
- package/lib/makes/index.js +23 -69
- package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
- package/lib/plugins/ElasticSearchPlugin.js +66 -66
- package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
- package/lib/plugins/LocaltunnelPlugin.js +256 -257
- package/lib/plugins/MaildevPlugin.d.ts +2 -2
- package/lib/plugins/MaildevPlugin.js +45 -44
- package/lib/plugins/MongodbPlugin.d.ts +2 -2
- package/lib/plugins/MongodbPlugin.js +303 -248
- package/lib/plugins/NgrokPlugin.d.ts +2 -2
- package/lib/plugins/NgrokPlugin.js +221 -231
- package/lib/plugins/PageKitePlugin.d.ts +2 -2
- package/lib/plugins/PageKitePlugin.js +150 -149
- package/lib/plugins/PostgresPlugin.d.ts +1 -1
- package/lib/plugins/PostgresPlugin.js +115 -89
- package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
- package/lib/plugins/ProxmoxPlugin.js +50 -38
- package/lib/plugins/RedisPlugin.d.ts +3 -1
- package/lib/plugins/RedisPlugin.js +73 -72
- package/lib/plugins/index.js +25 -103
- package/lib/services/AppConfigService.d.ts +3 -3
- package/lib/services/AppConfigService.js +162 -157
- package/lib/services/AppEventsService.js +26 -24
- package/lib/services/DockerService.d.ts +37 -2
- package/lib/services/DockerService.js +185 -205
- package/lib/services/LogService.d.ts +3 -2
- package/lib/services/LogService.js +33 -34
- package/lib/services/PluginService.d.ts +2 -1
- package/lib/services/PluginService.js +11 -14
- package/lib/services/PresetService.d.ts +8 -3
- package/lib/services/PresetService.js +60 -59
- package/lib/services/ProjectService.d.ts +11 -4
- package/lib/services/ProjectService.js +140 -129
- package/lib/services/index.js +21 -80
- package/lib/types/Config.d.ts +4 -3
- package/lib/types/Config.js +1 -4
- package/lib/types/EnvConfig.js +1 -4
- package/lib/types/index.js +16 -25
- package/lib/utils/buildOptions.js +5 -8
- package/lib/utils/demuxOutput.js +16 -20
- package/lib/utils/escapeRegExp.js +4 -7
- package/lib/utils/exec.js +38 -39
- package/lib/utils/fetch.js +46 -30
- package/lib/utils/followProgress.js +66 -77
- package/lib/utils/format-size-units.js +16 -16
- package/lib/utils/get-config.d.ts +1 -1
- package/lib/utils/get-config.js +13 -16
- package/lib/utils/get-cursor-position.js +22 -29
- package/lib/utils/image-build.js +35 -23
- package/lib/utils/index.js +32 -191
- package/lib/utils/injectVariables.js +10 -13
- package/lib/utils/parse-table.js +20 -23
- package/lib/utils/set-config.d.ts +1 -1
- package/lib/utils/set-config.js +12 -15
- package/lib/utils/spawn.js +17 -20
- package/lib/utils/tty.js +2 -6
- package/lib/utils/volumeFormat.js +5 -12
- package/lib/utils/volumeParse.js +10 -13
- package/package.json +13 -39
- package/presets/bun/Dockerfile +11 -0
- package/presets/bun/config.json +3 -0
- package/presets/node/Dockerfile +4 -2
- package/presets/php-apache/Dockerfile +3 -2
- package/.github/workflows/publish.yml +0 -31
- package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
package/lib/utils/demuxOutput.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.demuxOutput = void 0;
|
|
7
|
-
const demuxOutput = buffer => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return output;
|
|
4
|
+
const demuxOutput = (buffer) => {
|
|
5
|
+
let nextDataLength = null, output = Buffer.from([]);
|
|
6
|
+
while (buffer.length > 0) {
|
|
7
|
+
const header = bufferSlice(8);
|
|
8
|
+
nextDataLength = header.readUInt32BE(4);
|
|
9
|
+
const content = bufferSlice(nextDataLength);
|
|
10
|
+
output = Buffer.concat([output, content]);
|
|
11
|
+
}
|
|
12
|
+
function bufferSlice(end) {
|
|
13
|
+
const out = buffer.slice(0, end);
|
|
14
|
+
buffer = Buffer.from(buffer.slice(end, buffer.length));
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
return output;
|
|
22
18
|
};
|
|
23
|
-
exports.demuxOutput = demuxOutput;
|
|
19
|
+
exports.demuxOutput = demuxOutput;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.escapeRegExp = void 0;
|
|
7
|
-
const escapeRegExp = string => {
|
|
8
|
-
|
|
4
|
+
const escapeRegExp = (string) => {
|
|
5
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9
6
|
};
|
|
10
|
-
exports.escapeRegExp = escapeRegExp;
|
|
7
|
+
exports.escapeRegExp = escapeRegExp;
|
package/lib/utils/exec.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
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
6
|
exports.exec = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
7
|
+
const core_1 = require("@wocker/core");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const exec = async (command) => {
|
|
11
|
+
core_1.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const worker = (0, child_process_1.exec)(command, {
|
|
14
|
+
maxBuffer: Infinity
|
|
15
|
+
}, (err, stdout, stderr) => {
|
|
16
|
+
if (err) {
|
|
17
|
+
return reject(err);
|
|
18
|
+
}
|
|
19
|
+
return resolve({
|
|
20
|
+
stdout,
|
|
21
|
+
stderr
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
if (worker.stdout) {
|
|
25
|
+
worker.stdout.on("data", (data) => {
|
|
26
|
+
process.stdout.write(data);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (worker.stderr) {
|
|
30
|
+
worker.stderr.on("data", (data) => {
|
|
31
|
+
process.stderr.write(data);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
worker.on("close", (code) => {
|
|
35
|
+
core_1.Logger.info("close", chalk_1.default.red(code));
|
|
36
|
+
});
|
|
37
|
+
worker.on("exit", (code) => {
|
|
38
|
+
core_1.Logger.info("exit", chalk_1.default.red(code));
|
|
39
|
+
});
|
|
40
40
|
});
|
|
41
|
-
});
|
|
42
41
|
};
|
|
43
|
-
exports.exec = exec;
|
|
42
|
+
exports.exec = exec;
|
package/lib/utils/fetch.js
CHANGED
|
@@ -1,36 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.fetch = void 0;
|
|
7
|
-
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
|
+
const https = __importStar(require("https"));
|
|
10
28
|
const fetch = async (url, options) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const { method = "GET" } = options || {};
|
|
30
|
+
const target = new URL(url);
|
|
31
|
+
const params = {
|
|
32
|
+
method,
|
|
33
|
+
protocol: target.protocol,
|
|
34
|
+
hostname: target.hostname,
|
|
35
|
+
port: target.port,
|
|
36
|
+
path: target.pathname
|
|
37
|
+
};
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const req = https.request(params, (res) => {
|
|
40
|
+
let body = "";
|
|
41
|
+
res.on("data", (data) => {
|
|
42
|
+
body += data;
|
|
43
|
+
});
|
|
44
|
+
res.on("end", () => {
|
|
45
|
+
resolve(body);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
req.on("error", reject);
|
|
49
|
+
req.end();
|
|
31
50
|
});
|
|
32
|
-
req.on("error", reject);
|
|
33
|
-
req.end();
|
|
34
|
-
});
|
|
35
51
|
};
|
|
36
|
-
exports.fetch = fetch;
|
|
52
|
+
exports.fetch = fetch;
|
|
@@ -1,80 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.followProgress = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const followProgress = async stream => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
resolve(null);
|
|
72
|
-
}
|
|
73
|
-
isEnded = true;
|
|
74
|
-
};
|
|
75
|
-
lineStream.on("end", handleEnd);
|
|
76
|
-
lineStream.on("close", handleEnd);
|
|
77
|
-
lineStream.on("error", reject);
|
|
78
|
-
});
|
|
4
|
+
const LineConvertStream_1 = require("../makes/LineConvertStream");
|
|
5
|
+
const format_size_units_1 = require("./format-size-units");
|
|
6
|
+
const makes_1 = require("../makes");
|
|
7
|
+
const followProgress = async (stream) => {
|
|
8
|
+
const lineStream = new LineConvertStream_1.LineConvertStream(stream);
|
|
9
|
+
let line = 0;
|
|
10
|
+
const mapLines = {};
|
|
11
|
+
lineStream.on("data", (chunk) => {
|
|
12
|
+
const data = JSON.parse(chunk.toString());
|
|
13
|
+
const { stream, id, status, progressDetail: { current, total } = {}, aux } = data;
|
|
14
|
+
if (stream) {
|
|
15
|
+
process.stdout.write(`${stream}`);
|
|
16
|
+
line += stream.split("\n").length - 1;
|
|
17
|
+
}
|
|
18
|
+
else if (id) {
|
|
19
|
+
if (typeof mapLines[id] === "undefined") {
|
|
20
|
+
mapLines[id] = line;
|
|
21
|
+
}
|
|
22
|
+
const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
|
|
23
|
+
const dy = line - targetLine;
|
|
24
|
+
if (dy > 0) {
|
|
25
|
+
process.stdout.write("\x1b[s");
|
|
26
|
+
process.stdout.write(`\x1b[${dy}A`);
|
|
27
|
+
}
|
|
28
|
+
process.stdout.write("\x1b[2K");
|
|
29
|
+
let str = `${id}: ${status}\n`;
|
|
30
|
+
if (status === "Downloading") {
|
|
31
|
+
const width = process.stdout.columns;
|
|
32
|
+
const sizeWidth = 19, totalWidth = width - id.length - status.length - sizeWidth - 7, currentWidth = Math.floor(totalWidth * (current / total)), formatSize = `${(0, format_size_units_1.formatSizeUnits)(current)}/${(0, format_size_units_1.formatSizeUnits)(total)}`;
|
|
33
|
+
str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
|
|
34
|
+
}
|
|
35
|
+
process.stdout.write(str);
|
|
36
|
+
if (dy > 0) {
|
|
37
|
+
process.stdout.write("\x1b[u");
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
line++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (status) {
|
|
44
|
+
process.stdout.write(`${status}\n`);
|
|
45
|
+
line += Math.ceil(status.length / process.stdout.columns);
|
|
46
|
+
}
|
|
47
|
+
else if (aux) {
|
|
48
|
+
const str = `auxID: ${aux.ID}`;
|
|
49
|
+
process.stdout.write(`${str}\n`);
|
|
50
|
+
line += Math.ceil(str.length / process.stdout.columns);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
makes_1.Logger.warn("followProgress: unexpected data", data);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
let isEnded = false;
|
|
58
|
+
const handleEnd = () => {
|
|
59
|
+
if (!isEnded) {
|
|
60
|
+
resolve(null);
|
|
61
|
+
}
|
|
62
|
+
isEnded = true;
|
|
63
|
+
};
|
|
64
|
+
lineStream.on("end", handleEnd);
|
|
65
|
+
lineStream.on("close", handleEnd);
|
|
66
|
+
lineStream.on("error", reject);
|
|
67
|
+
});
|
|
79
68
|
};
|
|
80
|
-
exports.followProgress = followProgress;
|
|
69
|
+
exports.followProgress = followProgress;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.formatSizeUnits = void 0;
|
|
7
|
-
const formatSizeUnits = bytes => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const formatSizeUnits = (bytes) => {
|
|
5
|
+
if (bytes >= 1073741824) {
|
|
6
|
+
return (bytes / 1073741824).toFixed(2) + "GB";
|
|
7
|
+
}
|
|
8
|
+
else if (bytes >= 1048576) {
|
|
9
|
+
return (bytes / 1048576).toFixed(2) + "MB";
|
|
10
|
+
}
|
|
11
|
+
else if (bytes >= 1024) {
|
|
12
|
+
return (bytes / 1024).toFixed(2) + "kB";
|
|
13
|
+
}
|
|
14
|
+
else if (bytes >= 1) {
|
|
15
|
+
return bytes + "b";
|
|
16
|
+
}
|
|
17
|
+
return "0b";
|
|
18
18
|
};
|
|
19
|
-
exports.formatSizeUnits = formatSizeUnits;
|
|
19
|
+
exports.formatSizeUnits = formatSizeUnits;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Config } from "
|
|
1
|
+
import { Config } from "../types";
|
|
2
2
|
export declare const getConfig: () => Promise<Config>;
|
package/lib/utils/get-config.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getConfig = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const env_1 = require("../env");
|
|
5
|
+
const FS_1 = require("../makes/FS");
|
|
9
6
|
const getConfig = async () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
return FS_1.FS.readJSON(env_1.MAP_PATH).catch((err) => {
|
|
8
|
+
if (err.code === "ENOENT") {
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
env: {},
|
|
11
|
+
projects: []
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
throw err;
|
|
15
|
+
});
|
|
19
16
|
};
|
|
20
|
-
exports.getConfig = getConfig;
|
|
17
|
+
exports.getConfig = getConfig;
|
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getCursorPosition = void 0;
|
|
7
|
-
// import {} from "tty";
|
|
8
|
-
|
|
9
4
|
const code = '\x1b[6n';
|
|
10
5
|
const getCursorPosition = async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
return position;
|
|
6
|
+
process.stdin.resume();
|
|
7
|
+
process.stdin.setRawMode(true);
|
|
8
|
+
const position = {};
|
|
9
|
+
await new Promise((resolve, reject) => {
|
|
10
|
+
const handleData = (data) => {
|
|
11
|
+
const match = /\[(\d+);(\d+)R$/.exec(data.toString());
|
|
12
|
+
if (match) {
|
|
13
|
+
const [, col, row] = match.slice(1, 3).reverse().map(Number);
|
|
14
|
+
position.row = row;
|
|
15
|
+
position.col = col;
|
|
16
|
+
resolve(undefined);
|
|
17
|
+
}
|
|
18
|
+
process.stdin.off("data", handleData);
|
|
19
|
+
process.stdin.pause();
|
|
20
|
+
};
|
|
21
|
+
process.stdin.once("data", handleData);
|
|
22
|
+
process.stdout.write(code);
|
|
23
|
+
process.stdout.emit("data", code);
|
|
24
|
+
});
|
|
25
|
+
return position;
|
|
33
26
|
};
|
|
34
|
-
exports.getCursorPosition = getCursorPosition;
|
|
27
|
+
exports.getCursorPosition = getCursorPosition;
|
package/lib/utils/image-build.js
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.imageBuild = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = options;
|
|
19
|
-
const buildArgsString = Object.keys(buildArgs).map(key => {
|
|
20
|
-
return `--build-arg ${key}=${buildArgs[key]}`;
|
|
21
|
-
}).join(" ");
|
|
22
|
-
const labelsString = Object.keys(labels).map(key => {
|
|
23
|
-
return `--label ${key}=${labels[key]}`;
|
|
24
|
-
}).join(" ");
|
|
25
|
-
await (0, _exec.exec)(`
|
|
27
|
+
const Path = __importStar(require("path"));
|
|
28
|
+
const exec_1 = require("./exec");
|
|
29
|
+
const imageBuild = async (options) => {
|
|
30
|
+
const { tag, buildArgs = {}, labels = {}, context, src } = options;
|
|
31
|
+
const buildArgsString = Object.keys(buildArgs).map((key) => {
|
|
32
|
+
return `--build-arg ${key}=${buildArgs[key]}`;
|
|
33
|
+
}).join(" ");
|
|
34
|
+
const labelsString = Object.keys(labels).map((key) => {
|
|
35
|
+
return `--label ${key}=${labels[key]}`;
|
|
36
|
+
}).join(" ");
|
|
37
|
+
await (0, exec_1.exec)(`
|
|
26
38
|
docker build \
|
|
27
39
|
--tag "${tag}" \
|
|
28
40
|
${buildArgsString} \
|
|
@@ -31,4 +43,4 @@ const imageBuild = async options => {
|
|
|
31
43
|
${context}
|
|
32
44
|
`);
|
|
33
45
|
};
|
|
34
|
-
exports.imageBuild = imageBuild;
|
|
46
|
+
exports.imageBuild = imageBuild;
|