bdy 1.18.4-dev → 1.18.6-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distTs/package.json +1 -1
- package/distTs/src/agent/manager.js +20 -18
- package/distTs/src/api/client.js +48 -0
- package/distTs/src/autocomplete.js +10 -5
- package/distTs/src/command/agent/debug.js +6 -6
- package/distTs/src/command/agent/disable.js +2 -2
- package/distTs/src/command/agent/enable.js +2 -2
- package/distTs/src/command/agent/install.js +31 -26
- package/distTs/src/command/agent/proxy/disable.js +2 -2
- package/distTs/src/command/agent/proxy/enable.js +2 -2
- package/distTs/src/command/agent/proxy/status.js +2 -2
- package/distTs/src/command/agent/restart.js +6 -6
- package/distTs/src/command/agent/run.js +3 -3
- package/distTs/src/command/agent/start.js +7 -7
- package/distTs/src/command/agent/stop.js +6 -6
- package/distTs/src/command/agent/tags/get.js +2 -2
- package/distTs/src/command/agent/tags/set.js +2 -2
- package/distTs/src/command/agent/target/disable.js +2 -2
- package/distTs/src/command/agent/target/enable.js +2 -2
- package/distTs/src/command/agent/target/status.js +2 -2
- package/distTs/src/command/agent/tunnel/disable.js +2 -2
- package/distTs/src/command/agent/tunnel/enable.js +2 -2
- package/distTs/src/command/agent/tunnel/http.js +7 -7
- package/distTs/src/command/agent/tunnel/list.js +2 -2
- package/distTs/src/command/agent/tunnel/remove.js +2 -2
- package/distTs/src/command/agent/tunnel/start.js +5 -5
- package/distTs/src/command/agent/tunnel/status.js +4 -4
- package/distTs/src/command/agent/tunnel/tcp.js +7 -7
- package/distTs/src/command/agent/tunnel/tls.js +7 -7
- package/distTs/src/command/agent/uninstall.js +12 -12
- package/distTs/src/command/agent/update.js +9 -9
- package/distTs/src/command/api/info.js +2 -1
- package/distTs/src/command/api/list.js +2 -1
- package/distTs/src/command/api/request.js +2 -2
- package/distTs/src/command/login.js +8 -6
- package/distTs/src/command/package/create.js +2 -2
- package/distTs/src/command/package/download.js +5 -37
- package/distTs/src/command/package/publish.js +7 -6
- package/distTs/src/command/pre.js +5 -5
- package/distTs/src/command/project/link.js +4 -3
- package/distTs/src/command/sandbox/app/list.js +35 -0
- package/distTs/src/command/sandbox/app/logs.js +43 -0
- package/distTs/src/command/sandbox/app/start.js +27 -0
- package/distTs/src/command/sandbox/app/status.js +35 -0
- package/distTs/src/command/sandbox/app/stop.js +27 -0
- package/distTs/src/command/sandbox/app.js +25 -0
- package/distTs/src/command/sandbox/cp.js +7 -39
- package/distTs/src/command/sandbox/create.js +22 -12
- package/distTs/src/command/sandbox/logs.js +26 -0
- package/distTs/src/command/sandbox/snapshot/create.js +2 -2
- package/distTs/src/command/sandbox/update.js +14 -0
- package/distTs/src/command/sandbox.js +4 -0
- package/distTs/src/command/scrape.js +15 -14
- package/distTs/src/command/tunnel/http.js +8 -8
- package/distTs/src/command/tunnel/start.js +9 -9
- package/distTs/src/command/tunnel/tcp.js +8 -8
- package/distTs/src/command/tunnel/tls.js +8 -8
- package/distTs/src/command/ut/upload.js +16 -48
- package/distTs/src/command/vt/close.js +5 -5
- package/distTs/src/command/vt/compare.js +18 -16
- package/distTs/src/command/vt/exec.js +28 -28
- package/distTs/src/command/vt/installBrowser.js +2 -2
- package/distTs/src/command/vt/storybook.js +14 -14
- package/distTs/src/input.js +8 -7
- package/distTs/src/logger.js +3 -3
- package/distTs/src/openapi.js +24 -0
- package/distTs/src/output.js +21 -16
- package/distTs/src/sshKeygen.js +9 -0
- package/distTs/src/texts.js +42 -8
- package/distTs/src/tunnel/cfg.js +17 -20
- package/distTs/src/tunnel/tunnel.js +2 -1
- package/distTs/src/utils.js +9 -28
- package/package.json +1 -1
|
@@ -7,7 +7,6 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const human_id_1 = __importDefault(require("human-id"));
|
|
11
10
|
const VALID_RESOURCES = [
|
|
12
11
|
'1x2',
|
|
13
12
|
'2x4',
|
|
@@ -31,16 +30,17 @@ commandSandboxCreate.option('-i, --identifier <identifier>', texts_1.OPTION_SAND
|
|
|
31
30
|
commandSandboxCreate.option('--os <image>', texts_1.OPTION_SANDBOX_OS);
|
|
32
31
|
commandSandboxCreate.option('--snapshot <snapshot-name>', texts_1.OPTION_SANDBOX_FROM_SNAPSHOT);
|
|
33
32
|
commandSandboxCreate.option('--resources <spec>', texts_1.OPTION_SANDBOX_RESOURCES);
|
|
34
|
-
commandSandboxCreate.option('--
|
|
35
|
-
commandSandboxCreate.option('--
|
|
33
|
+
commandSandboxCreate.option('--boot-command <commands...>', texts_1.OPTION_SANDBOX_INSTALL_COMMANDS);
|
|
34
|
+
commandSandboxCreate.option('--app-command <commands...>', texts_1.OPTION_SANDBOX_APP_COMMAND);
|
|
36
35
|
commandSandboxCreate.option('--app-dir <directory>', texts_1.OPTION_SANDBOX_APP_DIR);
|
|
37
|
-
commandSandboxCreate.option('--app-type <type>', texts_1.OPTION_SANDBOX_APP_TYPE);
|
|
38
36
|
commandSandboxCreate.option('--tag <tags...>', texts_1.OPTION_SANDBOX_TAGS);
|
|
39
37
|
commandSandboxCreate.option('--yaml <content|@path>', texts_1.OPTION_SANDBOX_YAML);
|
|
40
38
|
commandSandboxCreate.option('--wait-for-running [seconds]', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
|
|
41
39
|
commandSandboxCreate.option('--wait-for-configured [seconds]', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
|
|
40
|
+
commandSandboxCreate.option('--wait-for-apps [seconds]', texts_1.OPTION_SANDBOX_WAIT_APPS);
|
|
42
41
|
commandSandboxCreate.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CREATE);
|
|
43
42
|
commandSandboxCreate.action(async (options) => {
|
|
43
|
+
const humanId = require('human-id').default;
|
|
44
44
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
45
45
|
const project = input_1.default.restApiProject(options.project);
|
|
46
46
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -58,7 +58,7 @@ commandSandboxCreate.action(async (options) => {
|
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
const timestamp = Date.now().toString(36);
|
|
61
|
-
const baseName = (
|
|
61
|
+
const baseName = humanId({ separator: '-', capitalize: false });
|
|
62
62
|
const defaultIdentifier = `${baseName}-${timestamp}`;
|
|
63
63
|
const body = {
|
|
64
64
|
name: options.name || options.identifier || baseName,
|
|
@@ -79,21 +79,18 @@ commandSandboxCreate.action(async (options) => {
|
|
|
79
79
|
if (options.resources) {
|
|
80
80
|
body.resources = options.resources;
|
|
81
81
|
}
|
|
82
|
-
if (options.
|
|
83
|
-
body.
|
|
82
|
+
if (options.bootCommand) {
|
|
83
|
+
body.first_boot_commands = options.bootCommand.join('\n');
|
|
84
84
|
}
|
|
85
85
|
if (options.tags) {
|
|
86
86
|
body.tags = options.tags;
|
|
87
87
|
}
|
|
88
|
-
if (options.
|
|
89
|
-
body.
|
|
88
|
+
if (options.appCommand) {
|
|
89
|
+
body.apps = options.appCommand;
|
|
90
90
|
}
|
|
91
91
|
if (options.appDir) {
|
|
92
92
|
body.app_dir = options.appDir;
|
|
93
93
|
}
|
|
94
|
-
if (options.appType) {
|
|
95
|
-
body.app_type = options.app_type;
|
|
96
|
-
}
|
|
97
94
|
output_1.default.normal((0, texts_1.TXT_SANDBOX_CREATING)(body.name, body.identifier));
|
|
98
95
|
result = await client.createSandbox(workspace, project, body);
|
|
99
96
|
}
|
|
@@ -124,6 +121,19 @@ commandSandboxCreate.action(async (options) => {
|
|
|
124
121
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SETUP_TIMEOUT);
|
|
125
122
|
}
|
|
126
123
|
}
|
|
124
|
+
if (options.waitForApps) {
|
|
125
|
+
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_APPS);
|
|
126
|
+
const timeout = parseInt(options.waitForApps, 10) || 300;
|
|
127
|
+
try {
|
|
128
|
+
const status = await client.sandboxWaitForApps(workspace, sandboxId, timeout);
|
|
129
|
+
if (status !== utils_1.SANDBOX_APP_STATUS.RUNNING) {
|
|
130
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_APP_FAILED);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_APPS_TIMEOUT);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
127
137
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CREATED)(result.identifier, result.html_url));
|
|
128
138
|
});
|
|
129
139
|
exports.default = commandSandboxCreate;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const input_1 = __importDefault(require("../../input"));
|
|
9
|
+
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const commandSandboxLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_LOGS);
|
|
11
|
+
commandSandboxLogs.hideVersionUpdate = true;
|
|
12
|
+
commandSandboxLogs.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandSandboxLogs.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandSandboxLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
|
+
commandSandboxLogs.action(async (identifier, options) => {
|
|
16
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
+
const project = input_1.default.restApiProject(options.project);
|
|
18
|
+
const client = input_1.default.restApiTokenClient();
|
|
19
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
20
|
+
if (!sandbox_id) {
|
|
21
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
+
}
|
|
23
|
+
const { boot_logs } = await client.getSandbox(workspace, sandbox_id);
|
|
24
|
+
output_1.default.exitNormal((boot_logs || []).join('\n'));
|
|
25
|
+
});
|
|
26
|
+
exports.default = commandSandboxLogs;
|
|
@@ -7,7 +7,6 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const human_id_1 = __importDefault(require("human-id"));
|
|
11
10
|
const commandSandboxSnapshotCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE);
|
|
12
11
|
commandSandboxSnapshotCreate.alias('add');
|
|
13
12
|
commandSandboxSnapshotCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
@@ -17,6 +16,7 @@ commandSandboxSnapshotCreate.argument('<identifier>', texts_1.OPTION_SANDBOX_IDE
|
|
|
17
16
|
commandSandboxSnapshotCreate.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
18
17
|
commandSandboxSnapshotCreate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_CREATE}`);
|
|
19
18
|
commandSandboxSnapshotCreate.action(async (identifier, options) => {
|
|
19
|
+
const humanId = require('human-id').default;
|
|
20
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
21
|
const project = input_1.default.restApiProject(options.project);
|
|
22
22
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -24,7 +24,7 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
|
|
|
24
24
|
if (!sandbox_id) {
|
|
25
25
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
26
26
|
}
|
|
27
|
-
const defaultName = 'snapshot-' + (
|
|
27
|
+
const defaultName = 'snapshot-' + humanId({ separator: '-', capitalize: false });
|
|
28
28
|
const snapshotName = options.name || defaultName;
|
|
29
29
|
const body = {
|
|
30
30
|
name: snapshotName,
|
|
@@ -13,6 +13,7 @@ commandSandboxUpdate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_
|
|
|
13
13
|
commandSandboxUpdate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
14
|
commandSandboxUpdate.option('--wait-for-running [seconds]', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
|
|
15
15
|
commandSandboxUpdate.option('--wait-for-configured [seconds]', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
|
|
16
|
+
commandSandboxUpdate.option('--wait-for-apps [seconds]', texts_1.OPTION_SANDBOX_WAIT_APPS);
|
|
16
17
|
commandSandboxUpdate.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
17
18
|
commandSandboxUpdate.argument('<yaml|@yaml path>', texts_1.OPTION_SANDBOX_YAML);
|
|
18
19
|
commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
@@ -55,6 +56,19 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
55
56
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SETUP_TIMEOUT);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
if (options.waitForApps) {
|
|
60
|
+
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_APPS);
|
|
61
|
+
const timeout = parseInt(options.waitForApps, 10) || 300;
|
|
62
|
+
try {
|
|
63
|
+
const status = await client.sandboxWaitForApps(workspace, sandbox_id, timeout);
|
|
64
|
+
if (status !== utils_1.SANDBOX_APP_STATUS.RUNNING) {
|
|
65
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_APP_FAILED);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_APPS_TIMEOUT);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_UPDATED)(result.identifier, result.html_url));
|
|
59
73
|
});
|
|
60
74
|
exports.default = commandSandboxUpdate;
|
|
@@ -19,6 +19,8 @@ const endpoint_1 = __importDefault(require("./sandbox/endpoint"));
|
|
|
19
19
|
const exec_1 = __importDefault(require("./sandbox/exec"));
|
|
20
20
|
const update_1 = __importDefault(require("./sandbox/update"));
|
|
21
21
|
const yaml_1 = __importDefault(require("./sandbox/yaml"));
|
|
22
|
+
const logs_1 = __importDefault(require("./sandbox/logs"));
|
|
23
|
+
const app_1 = __importDefault(require("./sandbox/app"));
|
|
22
24
|
const commandSandbox = (0, utils_1.newCommand)('sandbox', texts_1.DESC_COMMAND_SANDBOX);
|
|
23
25
|
commandSandbox.alias('sb');
|
|
24
26
|
commandSandbox.addCommand(create_1.default);
|
|
@@ -31,8 +33,10 @@ commandSandbox.addCommand(start_1.default);
|
|
|
31
33
|
commandSandbox.addCommand(stop_1.default);
|
|
32
34
|
commandSandbox.addCommand(restart_1.default);
|
|
33
35
|
commandSandbox.addCommand(status_1.default);
|
|
36
|
+
commandSandbox.addCommand(logs_1.default);
|
|
34
37
|
commandSandbox.addCommand(cp_1.default);
|
|
35
38
|
commandSandbox.addCommand(exec_1.default);
|
|
39
|
+
commandSandbox.addCommand(app_1.default);
|
|
36
40
|
commandSandbox.addCommand(snapshot_1.default);
|
|
37
41
|
commandSandbox.addCommand(endpoint_1.default);
|
|
38
42
|
exports.default = commandSandbox;
|
|
@@ -6,18 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const texts_1 = require("../texts");
|
|
9
|
-
const validation_1 = require("../visualTest/validation");
|
|
10
9
|
const output_1 = __importDefault(require("../output"));
|
|
11
|
-
const requests_1 = require("../visualTest/requests");
|
|
12
10
|
const node_zlib_1 = require("node:zlib");
|
|
13
|
-
const tar_stream_1 = __importDefault(require("tar-stream"));
|
|
14
11
|
const promises_1 = require("node:stream/promises");
|
|
15
12
|
const node_fs_1 = require("node:fs");
|
|
16
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
14
|
const promises_2 = require("node:fs/promises");
|
|
18
|
-
const context_1 = require("../visualTest/context");
|
|
19
|
-
const ci_info_1 = require("@buddy-works/ci-info");
|
|
20
|
-
const validation_2 = require("./scrape/validation");
|
|
21
15
|
const commandScrape = (0, utils_1.newCommand)('scrape', texts_1.DESC_COMMAND_VT_SCRAPE);
|
|
22
16
|
commandScrape.argument('[url]', texts_1.OPTION_SCRAPE_URL);
|
|
23
17
|
commandScrape.option('--follow', texts_1.OPTION_SCRAPE_FOLLOW, false);
|
|
@@ -47,22 +41,28 @@ commandScrape.option('--localStorage <items...>', texts_1.OPTION_SCRAPE_LOCAL_ST
|
|
|
47
41
|
commandScrape.option('--delay <delay>', texts_1.OPTION_SCRAPE_DELAY, '0');
|
|
48
42
|
commandScrape.option('--outputDir <dir>', texts_1.OPTION_SCRAPE_OUTPUT_DIR, '.');
|
|
49
43
|
commandScrape.action(async (inputUrl, options) => {
|
|
50
|
-
|
|
44
|
+
const { checkToken } = require('../visualTest/validation');
|
|
45
|
+
const { downloadScrapPackage, sendScrap } = require('../visualTest/requests');
|
|
46
|
+
const { setCiAndCommitInfo } = require('../visualTest/context');
|
|
47
|
+
const { validateInputAndOptions } = require('./scrape/validation');
|
|
48
|
+
const { getCiAndGitInfo } = require('@buddy-works/ci-info');
|
|
49
|
+
const tar = require('tar-stream');
|
|
50
|
+
if (!checkToken('scrape')) {
|
|
51
51
|
output_1.default.exitError(texts_1.ERR_MISSING_SCRAPE_TOKEN);
|
|
52
52
|
}
|
|
53
|
-
const { url, follow, respectRobots, outputTypes, outputDir, fullPage, colorScheme, browsers, devices, cookies, requestHeaders, delay, waitForSelectors, localStorage, } =
|
|
53
|
+
const { url, follow, respectRobots, outputTypes, outputDir, fullPage, colorScheme, browsers, devices, cookies, requestHeaders, delay, waitForSelectors, localStorage, } = validateInputAndOptions(inputUrl, options);
|
|
54
54
|
try {
|
|
55
|
-
const ciAndGitInfo = await
|
|
56
|
-
|
|
57
|
-
const { buildId } = await
|
|
55
|
+
const ciAndGitInfo = await getCiAndGitInfo({});
|
|
56
|
+
setCiAndCommitInfo(ciAndGitInfo);
|
|
57
|
+
const { buildId } = await sendScrap(url, follow, respectRobots, outputTypes, fullPage, colorScheme, browsers, devices, cookies, requestHeaders, delay, waitForSelectors, localStorage);
|
|
58
58
|
const status = await watchSessionStatus(buildId);
|
|
59
59
|
if (!status.ok) {
|
|
60
60
|
output_1.default.exitError(`Scrape session failed: ${status.error}`);
|
|
61
61
|
}
|
|
62
62
|
output_1.default.normal('Downloading scrape package');
|
|
63
|
-
const scrapPackageStream = await
|
|
63
|
+
const scrapPackageStream = await downloadScrapPackage(buildId);
|
|
64
64
|
const brotliDecompressor = (0, node_zlib_1.createBrotliDecompress)();
|
|
65
|
-
const unpack =
|
|
65
|
+
const unpack = tar.extract();
|
|
66
66
|
unpack.on('entry', async (header, stream, next) => {
|
|
67
67
|
const currentDir = process.cwd();
|
|
68
68
|
const preparedOutputDir = outputDir.startsWith('.')
|
|
@@ -94,8 +94,9 @@ commandScrape.action(async (inputUrl, options) => {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
async function watchSessionStatus(buildId) {
|
|
97
|
+
const { connectToScrapSession } = require('../visualTest/requests');
|
|
97
98
|
return new Promise((resolve) => {
|
|
98
|
-
const eventSource =
|
|
99
|
+
const eventSource = connectToScrapSession(buildId);
|
|
99
100
|
eventSource.addEventListener('SESSION_STATUS', (event) => {
|
|
100
101
|
const data = JSON.parse(event.data);
|
|
101
102
|
if (data.status === 'STARTED') {
|
|
@@ -4,12 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
8
7
|
const output_1 = __importDefault(require("../../output"));
|
|
9
8
|
const texts_1 = require("../../texts");
|
|
10
|
-
const buddy_1 = __importDefault(require("../../tunnel/api/buddy"));
|
|
11
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
12
|
-
const input_1 = __importDefault(require("../../input"));
|
|
13
10
|
const commandHttp = (0, utils_1.getBasicCommandHttp)();
|
|
14
11
|
commandHttp.description(texts_1.DESC_COMMAND_HTTP);
|
|
15
12
|
commandHttp.option('-s, --serve <directory>', texts_1.OPTION_SERVE);
|
|
@@ -17,15 +14,18 @@ commandHttp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
|
17
14
|
commandHttp.argument('[protocol://host:port]', texts_1.OPTION_TARGET);
|
|
18
15
|
commandHttp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_HTTP)(false)}`);
|
|
19
16
|
commandHttp.action(async (target, options) => {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
17
|
+
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
18
|
+
const Input = require('../../input').default;
|
|
19
|
+
const Cfg = require('../../tunnel/cfg').default;
|
|
20
|
+
const { host, token } = await Input.tunnelToken(options.token);
|
|
21
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.HTTP, target, options, true);
|
|
22
22
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
23
|
-
const agent = await
|
|
24
|
-
|
|
23
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
24
|
+
Cfg.setRegionIfNotSet(region);
|
|
25
25
|
});
|
|
26
26
|
await agent.start();
|
|
27
27
|
agent.startRefreshingConfiguration();
|
|
28
|
-
const tunnel = await
|
|
28
|
+
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
29
29
|
agent.addTunnel(tunnel);
|
|
30
30
|
output_1.default.tunnel(tunnel);
|
|
31
31
|
});
|
|
@@ -3,29 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
7
6
|
const output_1 = __importDefault(require("../../output"));
|
|
8
7
|
const texts_1 = require("../../texts");
|
|
9
|
-
const buddy_1 = __importDefault(require("../../tunnel/api/buddy"));
|
|
10
8
|
const utils_1 = require("../../utils");
|
|
11
|
-
const input_1 = __importDefault(require("../../input"));
|
|
12
9
|
const commandStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_START);
|
|
13
10
|
commandStart.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
14
11
|
commandStart.argument('<name>', texts_1.OPTION_NAME);
|
|
15
12
|
commandStart.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_TUNNEL_START}`);
|
|
16
13
|
commandStart.action(async (name, options) => {
|
|
17
|
-
|
|
14
|
+
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
15
|
+
const Input = require('../../input').default;
|
|
16
|
+
const Cfg = require('../../tunnel/cfg').default;
|
|
17
|
+
if (!Cfg.hasTunnel(name)) {
|
|
18
18
|
output_1.default.exitError((0, texts_1.ERR_TUNNEL_NOT_FOUND)(name));
|
|
19
19
|
}
|
|
20
|
-
const { token, host } = await
|
|
21
|
-
const prepared =
|
|
20
|
+
const { token, host } = await Input.tunnelToken(options.token);
|
|
21
|
+
const prepared = Cfg.getTunnel(name);
|
|
22
22
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
23
|
-
const agent = await
|
|
24
|
-
|
|
23
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
24
|
+
Cfg.setRegionIfNotSet(region);
|
|
25
25
|
});
|
|
26
26
|
await agent.start();
|
|
27
27
|
agent.startRefreshingConfiguration();
|
|
28
|
-
const tunnel = await
|
|
28
|
+
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
29
29
|
agent.addTunnel(tunnel);
|
|
30
30
|
output_1.default.tunnel(tunnel);
|
|
31
31
|
});
|
|
@@ -4,27 +4,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
8
7
|
const output_1 = __importDefault(require("../../output"));
|
|
9
8
|
const texts_1 = require("../../texts");
|
|
10
|
-
const buddy_1 = __importDefault(require("../../tunnel/api/buddy"));
|
|
11
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
12
|
-
const input_1 = __importDefault(require("../../input"));
|
|
13
10
|
const commandTcp = (0, utils_1.getBasicCommandTcp)();
|
|
14
11
|
commandTcp.description(texts_1.DESC_COMMAND_TCP);
|
|
15
12
|
commandTcp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
16
13
|
commandTcp.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
14
|
commandTcp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TCP)(false)}`);
|
|
18
15
|
commandTcp.action(async (target, options) => {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
16
|
+
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
17
|
+
const Input = require('../../input').default;
|
|
18
|
+
const Cfg = require('../../tunnel/cfg').default;
|
|
19
|
+
const { host, token } = await Input.tunnelToken(options.token);
|
|
20
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TCP, target, options, true);
|
|
21
21
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
22
|
-
const agent = await
|
|
23
|
-
|
|
22
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
23
|
+
Cfg.setRegionIfNotSet(region);
|
|
24
24
|
});
|
|
25
25
|
await agent.start();
|
|
26
26
|
agent.startRefreshingConfiguration();
|
|
27
|
-
const tunnel = await
|
|
27
|
+
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
28
28
|
agent.addTunnel(tunnel);
|
|
29
29
|
output_1.default.tunnel(tunnel);
|
|
30
30
|
});
|
|
@@ -4,27 +4,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
8
7
|
const output_1 = __importDefault(require("../../output"));
|
|
9
8
|
const texts_1 = require("../../texts");
|
|
10
|
-
const buddy_1 = __importDefault(require("../../tunnel/api/buddy"));
|
|
11
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
12
|
-
const input_1 = __importDefault(require("../../input"));
|
|
13
10
|
const commandTls = (0, utils_1.getBasicCommandTls)();
|
|
14
11
|
commandTls.description(texts_1.DESC_COMMAND_TLS);
|
|
15
12
|
commandTls.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
16
13
|
commandTls.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
14
|
commandTls.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TLS)(false)}`);
|
|
18
15
|
commandTls.action(async (target, options) => {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
16
|
+
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
17
|
+
const Input = require('../../input').default;
|
|
18
|
+
const Cfg = require('../../tunnel/cfg').default;
|
|
19
|
+
const { token, host } = await Input.tunnelToken(options.token);
|
|
20
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TLS, target, options, true);
|
|
21
21
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
22
|
-
const agent = await
|
|
23
|
-
|
|
22
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
23
|
+
Cfg.setRegionIfNotSet(region);
|
|
24
24
|
});
|
|
25
25
|
await agent.start();
|
|
26
26
|
agent.startRefreshingConfiguration();
|
|
27
|
-
const tunnel = await
|
|
27
|
+
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
28
28
|
agent.addTunnel(tunnel);
|
|
29
29
|
output_1.default.tunnel(tunnel);
|
|
30
30
|
});
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
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;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -40,12 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
40
7
|
const texts_1 = require("../../texts");
|
|
41
8
|
const output_1 = __importDefault(require("../../output"));
|
|
42
9
|
const commander_1 = require("commander");
|
|
43
|
-
const zod_1 = __importStar(require("zod"));
|
|
44
|
-
const fdir_1 = require("fdir");
|
|
45
|
-
const picomatch_1 = __importDefault(require("picomatch"));
|
|
46
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
47
|
-
const ci_1 = require("../../unitTest/ci");
|
|
48
|
-
const requests_1 = require("../../unitTest/requests");
|
|
49
11
|
const token = process.env.BUDDY_UT_TOKEN || '';
|
|
50
12
|
const commandUtUpload = (0, utils_1.newCommand)('upload', texts_1.DESC_COMMAND_UT_UPLOAD);
|
|
51
13
|
commandUtUpload.argument('<glob>', texts_1.OPTION_UPLOAD_REPORT_GLOB);
|
|
@@ -54,11 +16,13 @@ commandUtUpload.addOption(new commander_1.Option('--format <format>', texts_1.OP
|
|
|
54
16
|
.makeOptionMandatory());
|
|
55
17
|
commandUtUpload.option('--dryRun', texts_1.OPTION_UPLOAD_DRY_RUN);
|
|
56
18
|
commandUtUpload.action(async (input, options) => {
|
|
19
|
+
const { getCiInfo } = require('../../unitTest/ci');
|
|
20
|
+
const { sendUploadRequest } = require('../../unitTest/requests');
|
|
57
21
|
if (!token) {
|
|
58
22
|
output_1.default.exitError(texts_1.ERR_MISSING_UT_TOKEN);
|
|
59
23
|
}
|
|
60
24
|
const { glob, dryRun } = validateInputAndOptions(input, options);
|
|
61
|
-
const ciInfo = await
|
|
25
|
+
const ciInfo = await getCiInfo();
|
|
62
26
|
const { absolutePattern, files } = findFilesByGlob(glob);
|
|
63
27
|
if (files.length === 0) {
|
|
64
28
|
output_1.default.exitError(`No files matched the provided glob: ${absolutePattern}`);
|
|
@@ -70,15 +34,17 @@ commandUtUpload.action(async (input, options) => {
|
|
|
70
34
|
});
|
|
71
35
|
output_1.default.exitSuccess('Dry run completed');
|
|
72
36
|
}
|
|
73
|
-
await
|
|
37
|
+
await sendUploadRequest(files, ciInfo);
|
|
74
38
|
output_1.default.exitSuccess('Upload completed');
|
|
75
39
|
});
|
|
76
40
|
exports.default = commandUtUpload;
|
|
77
41
|
function validateInputAndOptions(input, options) {
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
42
|
+
const z = require('zod').default;
|
|
43
|
+
const { ZodError } = require('zod');
|
|
44
|
+
const globSchema = z.string();
|
|
45
|
+
const optionsSchema = z.object({
|
|
46
|
+
format: z.enum(['junit-xml']),
|
|
47
|
+
dryRun: z.boolean().optional(),
|
|
82
48
|
});
|
|
83
49
|
try {
|
|
84
50
|
const glob = globSchema.parse(input);
|
|
@@ -90,7 +56,7 @@ function validateInputAndOptions(input, options) {
|
|
|
90
56
|
};
|
|
91
57
|
}
|
|
92
58
|
catch (error) {
|
|
93
|
-
if (error instanceof
|
|
59
|
+
if (error instanceof ZodError) {
|
|
94
60
|
output_1.default.exitError(error.errors.map((e) => `${e.path}: ${e.message}`).join(', '));
|
|
95
61
|
}
|
|
96
62
|
else {
|
|
@@ -99,8 +65,10 @@ function validateInputAndOptions(input, options) {
|
|
|
99
65
|
}
|
|
100
66
|
}
|
|
101
67
|
function findFilesByGlob(pattern) {
|
|
68
|
+
const { fdir } = require('fdir');
|
|
69
|
+
const picomatch = require('picomatch');
|
|
102
70
|
const cwd = process.cwd();
|
|
103
|
-
const scan =
|
|
71
|
+
const scan = picomatch.scan(pattern);
|
|
104
72
|
if (!scan.isGlob) {
|
|
105
73
|
return {
|
|
106
74
|
absolutePattern: pattern,
|
|
@@ -109,10 +77,10 @@ function findFilesByGlob(pattern) {
|
|
|
109
77
|
}
|
|
110
78
|
if (node_path_1.default.isAbsolute(pattern)) {
|
|
111
79
|
const root = scan.base;
|
|
112
|
-
const files = new
|
|
80
|
+
const files = new fdir().withFullPaths().glob(pattern).crawl(root).sync();
|
|
113
81
|
return { absolutePattern: pattern, files };
|
|
114
82
|
}
|
|
115
83
|
const preparedPattern = node_path_1.default.resolve(cwd, pattern);
|
|
116
|
-
const files = new
|
|
84
|
+
const files = new fdir().withFullPaths().glob(preparedPattern).crawl().sync();
|
|
117
85
|
return { absolutePattern: preparedPattern, files };
|
|
118
86
|
}
|
|
@@ -5,19 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const validation_1 = require("../../visualTest/validation");
|
|
9
|
-
const requests_1 = require("../../visualTest/requests");
|
|
10
8
|
const output_1 = __importDefault(require("../../output"));
|
|
11
9
|
const commandVtClose = (0, utils_1.newCommand)('close', texts_1.DESC_COMMAND_VT_CLOSE);
|
|
12
10
|
commandVtClose.action(async () => {
|
|
13
|
-
|
|
11
|
+
const { checkBuildId, checkToken } = require('../../visualTest/validation');
|
|
12
|
+
const { closeSession } = require('../../visualTest/requests');
|
|
13
|
+
if (!checkToken('vt')) {
|
|
14
14
|
output_1.default.exitError(texts_1.ERR_MISSING_VT_TOKEN);
|
|
15
15
|
}
|
|
16
|
-
if (!
|
|
16
|
+
if (!checkBuildId()) {
|
|
17
17
|
output_1.default.exitError(texts_1.ERR_MISSING_BUILD_ID);
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
|
-
const { message } = await
|
|
20
|
+
const { message } = await closeSession();
|
|
21
21
|
output_1.default.exitNormal(message);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
@@ -5,14 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const validation_1 = require("../../visualTest/validation");
|
|
9
8
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const linkUtils_1 = require("../../visualTest/linkUtils");
|
|
11
9
|
const node_fs_1 = require("node:fs");
|
|
12
|
-
const requests_1 = require("../../visualTest/requests");
|
|
13
|
-
const validation_2 = require("./compare/validation");
|
|
14
|
-
const context_1 = require("../../visualTest/context");
|
|
15
|
-
const ci_info_1 = require("@buddy-works/ci-info");
|
|
16
10
|
const commandVtCompare = (0, utils_1.newCommand)('compare', texts_1.DESC_COMMAND_VT_COMPARE);
|
|
17
11
|
commandVtCompare.option('--urls <urls>', texts_1.OPTION_COMPARE_URLS);
|
|
18
12
|
commandVtCompare.option('--sitemap <sitemap>', texts_1.OPTION_COMPARE_SITEMAP);
|
|
@@ -27,11 +21,17 @@ commandVtCompare.option('--header <headers...>', texts_1.OPTION_COMPARE_HEADER);
|
|
|
27
21
|
commandVtCompare.option('--delay <delays...>', texts_1.OPTION_COMPARE_DELAY);
|
|
28
22
|
commandVtCompare.option('--waitFor <waitFors...>', texts_1.OPTION_COMPARE_WAIT_FOR);
|
|
29
23
|
commandVtCompare.action(async (options) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
24
|
+
const { getCiAndGitInfo, formattedCiInfo } = require('@buddy-works/ci-info');
|
|
25
|
+
const { checkToken } = require('../../visualTest/validation');
|
|
26
|
+
const { addProtocolIfMissing } = require('../../visualTest/linkUtils');
|
|
27
|
+
const { sendCompareLinks } = require('../../visualTest/requests');
|
|
28
|
+
const { checkIfMinimalOptionsAreProvided, validateOptions } = require('./compare/validation');
|
|
29
|
+
const { setCiAndCommitInfo } = require('../../visualTest/context');
|
|
30
|
+
const validatedOptions = validateOptions(options);
|
|
31
|
+
if (!checkToken('vt')) {
|
|
32
32
|
output_1.default.exitError(texts_1.ERR_MISSING_VT_TOKEN);
|
|
33
33
|
}
|
|
34
|
-
if (!
|
|
34
|
+
if (!checkIfMinimalOptionsAreProvided(validatedOptions)) {
|
|
35
35
|
output_1.default.exitError(texts_1.ERR_MISSING_URLS);
|
|
36
36
|
}
|
|
37
37
|
let urls = [];
|
|
@@ -45,7 +45,7 @@ commandVtCompare.action(async (options) => {
|
|
|
45
45
|
urls = urls.concat(urlsList);
|
|
46
46
|
}
|
|
47
47
|
if (validatedOptions.sitemap) {
|
|
48
|
-
sitemapSource =
|
|
48
|
+
sitemapSource = addProtocolIfMissing(validatedOptions.sitemap);
|
|
49
49
|
}
|
|
50
50
|
const { filteredUrls, duplicates } = filterDuplicates(urls);
|
|
51
51
|
if (duplicates.length > 0) {
|
|
@@ -58,11 +58,11 @@ commandVtCompare.action(async (options) => {
|
|
|
58
58
|
else if (filteredUrls.length > 1) {
|
|
59
59
|
output_1.default.normal(`List of urls:\n${filteredUrls.join('\n')}`);
|
|
60
60
|
}
|
|
61
|
-
const ciAndGitInfo = await
|
|
62
|
-
output_1.default.normal(
|
|
63
|
-
|
|
61
|
+
const ciAndGitInfo = await getCiAndGitInfo({});
|
|
62
|
+
output_1.default.normal(formattedCiInfo(ciAndGitInfo));
|
|
63
|
+
setCiAndCommitInfo(ciAndGitInfo);
|
|
64
64
|
try {
|
|
65
|
-
const { message } = await
|
|
65
|
+
const { message } = await sendCompareLinks(filteredUrls, validatedOptions, sitemapSource);
|
|
66
66
|
output_1.default.exitSuccess(message);
|
|
67
67
|
}
|
|
68
68
|
catch (error) {
|
|
@@ -70,14 +70,16 @@ commandVtCompare.action(async (options) => {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
function getUrlsFromUrlOption(urls) {
|
|
73
|
-
|
|
73
|
+
const { addProtocolIfMissing } = require('../../visualTest/linkUtils');
|
|
74
|
+
return urls.split(',').map((url) => addProtocolIfMissing(url).trim());
|
|
74
75
|
}
|
|
75
76
|
function getUrlsFromUrlFile(urlsFile) {
|
|
77
|
+
const { addProtocolIfMissing } = require('../../visualTest/linkUtils');
|
|
76
78
|
const urlsFromFile = (0, node_fs_1.readFileSync)(urlsFile, 'utf-8');
|
|
77
79
|
return urlsFromFile
|
|
78
80
|
.split('\n')
|
|
79
81
|
.filter((url) => url.trim().length > 0)
|
|
80
|
-
.map((url) =>
|
|
82
|
+
.map((url) => addProtocolIfMissing(url).trim());
|
|
81
83
|
}
|
|
82
84
|
function filterDuplicates(urls) {
|
|
83
85
|
const seen = new Set();
|