@applitools/core 4.59.4-debug.0 → 4.61.0

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.
@@ -39,23 +39,14 @@ exports.cacheKey = 'default';
39
39
  * Prefers 'origin' if it exists, otherwise uses the first available remote
40
40
  */
41
41
  exports.getPrimaryRemoteName = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
42
- const fnStart = Date.now();
43
- if (isDebugMode())
44
- logger.log(`[DEBUG] getPrimaryRemoteName: started`);
45
42
  const result = await executeWithLog('git remote show', { execOptions, logger });
46
43
  if (result.stderr) {
47
44
  logger.log(`Error during extracting remotes from git`, result.stderr);
48
- if (isDebugMode())
49
- logger.log(`[DEBUG] getPrimaryRemoteName: falling back to 'origin' after error in ${Date.now() - fnStart}ms`);
50
45
  return 'origin'; // Fallback to 'origin' if we can't determine remotes
51
46
  }
52
47
  const remotes = result.stdout.trim().split(/\s+/);
53
- if (isDebugMode())
54
- logger.log(`[DEBUG] getPrimaryRemoteName: parsed remotes: [${remotes.join(', ')}]`);
55
48
  const remote = remotes.includes('origin') ? 'origin' : remotes[0] || 'origin';
56
49
  logger.log(`Primary remote name: ${remote}`);
57
- if (isDebugMode())
58
- logger.log(`[DEBUG] getPrimaryRemoteName: completed in ${Date.now() - fnStart}ms`);
59
50
  return remote;
60
51
  }, args => {
61
52
  var _a;
@@ -64,14 +55,9 @@ exports.getPrimaryRemoteName = utils.general.cachify(async function ({ execOptio
64
55
  });
65
56
  });
66
57
  exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)(), }) {
67
- const fnStart = Date.now();
68
- if (isDebugMode())
69
- logger.log(`[DEBUG] extractLatestCommitInfo: started`);
70
58
  let result;
71
59
  try {
72
60
  const githubPullRequestLastCommitSha = await extractGithubPullRequestLastCommitSha();
73
- if (isDebugMode())
74
- logger.log(`[DEBUG] extractLatestCommitInfo: githubPullRequestLastCommitSha = ${githubPullRequestLastCommitSha !== null && githubPullRequestLastCommitSha !== void 0 ? githubPullRequestLastCommitSha : '(none)'}`);
75
61
  result = await executeWithLog(`git log ${githubPullRequestLastCommitSha !== null && githubPullRequestLastCommitSha !== void 0 ? githubPullRequestLastCommitSha : ''} -1 --format="%aI %H"`, {
76
62
  execOptions,
77
63
  logger,
@@ -81,11 +67,7 @@ exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOp
81
67
  }
82
68
  else {
83
69
  const [timestamp, sha] = result.stdout.trim().split(' ');
84
- if (isDebugMode())
85
- logger.log(`[DEBUG] extractLatestCommitInfo: parsed timestamp=${timestamp}, sha=${sha}`);
86
70
  if (isISODate(timestamp)) {
87
- if (isDebugMode())
88
- logger.log(`[DEBUG] extractLatestCommitInfo: completed in ${Date.now() - fnStart}ms`);
89
71
  return { sha, timestamp };
90
72
  }
91
73
  else {
@@ -96,8 +78,6 @@ exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOp
96
78
  catch (err) {
97
79
  logger.log(`Error during parsing commit hash from git`, err, result === null || result === void 0 ? void 0 : result.stdout);
98
80
  }
99
- if (isDebugMode())
100
- logger.log(`[DEBUG] extractLatestCommitInfo: returning undefined after ${Date.now() - fnStart}ms`);
101
81
  async function extractGithubPullRequestLastCommitSha() {
102
82
  var _a, _b, _c;
103
83
  if (((_a = process.env.GITHUB_EVENT_NAME) === null || _a === void 0 ? void 0 : _a.startsWith('pull_request')) && process.env.GITHUB_EVENT_PATH) {
@@ -109,19 +89,12 @@ exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOp
109
89
  }
110
90
  }, () => exports.cacheKey);
111
91
  exports.extractGitBranch = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
112
- const fnStart = Date.now();
113
- if (isDebugMode())
114
- logger.log(`[DEBUG] extractGitBranch: started`);
115
92
  // 1. Try CI environment variables first (fast, no subprocess, handles detached HEAD in CI)
116
93
  const ciBranch = extractCIBranchName();
117
94
  if (ciBranch) {
118
95
  logger.log(`Extracted branch name from CI environment: "${ciBranch}"`);
119
- if (isDebugMode())
120
- logger.log(`[DEBUG] extractGitBranch: completed via CI env in ${Date.now() - fnStart}ms`);
121
96
  return ciBranch;
122
97
  }
123
- if (isDebugMode())
124
- logger.log(`[DEBUG] extractGitBranch: no CI branch env found, falling back to git command`);
125
98
  // 2. Fall back to git command (works when on an actual branch locally)
126
99
  const result = await executeWithLog('git branch --show-current', { execOptions, logger });
127
100
  if (result.stderr) {
@@ -129,42 +102,26 @@ exports.extractGitBranch = utils.general.cachify(async function ({ execOptions,
129
102
  }
130
103
  else {
131
104
  const branch = result.stdout.trim();
132
- if (isDebugMode())
133
- logger.log(`[DEBUG] extractGitBranch: git branch --show-current returned: "${branch}"`);
134
105
  if (branch) {
135
106
  logger.log(`Extracted current git branch: "${branch}"`);
136
- if (isDebugMode())
137
- logger.log(`[DEBUG] extractGitBranch: completed via git in ${Date.now() - fnStart}ms`);
138
107
  return branch;
139
108
  }
140
109
  logger.log('git branch --show-current returned empty (detached HEAD), no branch name available');
141
110
  }
142
- if (isDebugMode())
143
- logger.log(`[DEBUG] extractGitBranch: returning undefined after ${Date.now() - fnStart}ms`);
144
111
  }, args => { var _a, _b, _c; return ({ cwd: (_b = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.execOptions) === null || _b === void 0 ? void 0 : _b.cwd, ignoreGitBranching: (_c = args[0]) === null || _c === void 0 ? void 0 : _c.ignoreGitBranching }); });
145
112
  exports.extractGitRepo = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
146
- const fnStart = Date.now();
147
- if (isDebugMode())
148
- logger.log(`[DEBUG] extractGitRepo: started`);
149
113
  const remotes = await extractRemotes();
150
114
  logger.log(`Extracted remotes from git: ${remotes}`);
151
115
  const remote = remotes.includes('origin') ? 'origin' : remotes[0];
152
- if (isDebugMode())
153
- logger.log(`[DEBUG] extractGitRepo: selected remote: "${remote}"`);
154
116
  const result = await executeWithLog(`git remote get-url ${remote}`, { execOptions, logger });
155
117
  if (result.stderr) {
156
118
  logger.log(`Error during extracting remote url from git`, result.stderr);
157
- if (isDebugMode())
158
- logger.log(`[DEBUG] extractGitRepo: returning {} after error in ${Date.now() - fnStart}ms`);
159
119
  return {};
160
120
  }
161
121
  else {
162
122
  const remoteUrl = result.stdout.trim();
163
123
  logger.log(`Extracted url for git remote ${remote}: ${remoteUrl}`);
164
- const parsed = extractRepoFromRemoteUrl(remoteUrl);
165
- if (isDebugMode())
166
- logger.log(`[DEBUG] extractGitRepo: parsed repo: owner="${parsed.owner}", name="${parsed.name}" in ${Date.now() - fnStart}ms`);
167
- return parsed;
124
+ return extractRepoFromRemoteUrl(remoteUrl);
168
125
  }
169
126
  async function extractRemotes() {
170
127
  const result = await executeWithLog('git remote show', { execOptions, logger });
@@ -205,10 +162,7 @@ async function extractBuildIdFromCI() {
205
162
  exports.extractBuildIdFromCI = extractBuildIdFromCI;
206
163
  exports.extractBranchingTimestamp = utils.general.cachify(async function ({ branchName, parentBranchName, execOptions, logger = (0, logger_1.makeLogger)(), }) {
207
164
  var _a;
208
- const fnStart = Date.now();
209
165
  logger = logger.extend({ tags: [`extract-branching-timestamp-${utils.general.shortid()}`] });
210
- if (isDebugMode())
211
- logger.log(`[DEBUG] extractBranchingTimestamp: started (branch=${branchName}, parent=${parentBranchName})`);
212
166
  // Get the primary remote name (cached)
213
167
  const remoteName = await (0, exports.getPrimaryRemoteName)({ execOptions, logger });
214
168
  const shallowCheckResult = await executeWithLog('git rev-parse --is-shallow-repository', {
@@ -216,8 +170,6 @@ exports.extractBranchingTimestamp = utils.general.cachify(async function ({ bran
216
170
  logger,
217
171
  });
218
172
  const isShallow = shallowCheckResult.stdout.trim() === 'true';
219
- if (isDebugMode())
220
- logger.log(`[DEBUG] extractBranchingTimestamp: isShallow=${isShallow}`);
221
173
  if (isShallow) {
222
174
  logger.log('extractBranchingTimestamp - Repository is a shallow clone, attempting to unshallow');
223
175
  await executeFetchStrategy(isShallow, execOptions, logger);
@@ -225,14 +177,10 @@ exports.extractBranchingTimestamp = utils.general.cachify(async function ({ bran
225
177
  // Step 1: Try with remote refs first (fast path - uses already-fetched remote data)
226
178
  const command = `HASH=$(git merge-base ${branchName} ${parentBranchName}) && git show -q --format=%aI $HASH`;
227
179
  let result = await executeWithLog(command, { execOptions, logger });
228
- if (isDebugMode())
229
- logger.log(`[DEBUG] extractBranchingTimestamp: step 1 (local refs) stderr=${!!result.stderr}`);
230
180
  // Step 2: If remote refs failed, try local refs
231
181
  if (result.stderr) {
232
182
  const commandWithRemoteRefs = `HASH=$(git merge-base ${remoteName}/${branchName} ${remoteName}/${parentBranchName}) && git show -q --format=%aI $HASH`;
233
183
  result = await executeWithLog(commandWithRemoteRefs, { execOptions, logger });
234
- if (isDebugMode())
235
- logger.log(`[DEBUG] extractBranchingTimestamp: step 2 (remote refs) stderr=${!!result.stderr}`);
236
184
  }
237
185
  // Step 3: Handle missing branches with smart fetch (check remote existence first)
238
186
  // Fetch remote branches list once if there's an error (cached call - virtually free)
@@ -269,14 +217,10 @@ exports.extractBranchingTimestamp = utils.general.cachify(async function ({ bran
269
217
  const timestamp = result.stdout.replace(/\s/g, '');
270
218
  if (isISODate(timestamp)) {
271
219
  logger.log('git branching timestamp successfully extracted', timestamp);
272
- if (isDebugMode())
273
- logger.log(`[DEBUG] extractBranchingTimestamp: completed in ${Date.now() - fnStart}ms`);
274
220
  return timestamp;
275
221
  }
276
222
  else {
277
223
  logger.log(`Error during extracting merge timestamp: git branching timestamp is an invalid ISO date string: ${timestamp}. stderr: ${result.stderr}, stdout: ${result.stdout}`);
278
- if (isDebugMode())
279
- logger.log(`[DEBUG] extractBranchingTimestamp: returning undefined after ${Date.now() - fnStart}ms`);
280
224
  }
281
225
  }, args => {
282
226
  var _a;
@@ -290,15 +234,8 @@ async function executeWithLog(command, { execOptions, logger = (0, logger_1.make
290
234
  execOptions: {},
291
235
  logger: (0, logger_1.makeLogger)(),
292
236
  }) {
293
- var _a;
294
237
  logger.log(`executing command: ${command}`);
295
- const cmdStart = Date.now();
296
238
  const result = await utils.process.execute(command, execOptions);
297
- if (isDebugMode()) {
298
- const duration = Date.now() - cmdStart;
299
- const preview = ((_a = result.stdout) === null || _a === void 0 ? void 0 : _a.trim().slice(0, 300)) || '(empty)';
300
- logger.log(`[DEBUG] command took ${duration}ms | code: ${result.code} | stdout: ${preview}`);
301
- }
302
239
  if (result.stderr && result.code) {
303
240
  logger.log(`exit code: ${result.code}, stderr: ${result.stderr}`);
304
241
  }
@@ -398,9 +335,6 @@ args => { var _a; return ({ cwd: (_a = args[0].execOptions) === null || _a === v
398
335
  * Determine fetch strategy and execute appropriate fetch operation
399
336
  */
400
337
  async function executeFetchStrategy(isShallow, execOptions, logger) {
401
- const fnStart = Date.now();
402
- if (isDebugMode())
403
- logger.log(`[DEBUG] executeFetchStrategy: started (isShallow=${isShallow})`);
404
338
  const remoteName = await (0, exports.getPrimaryRemoteName)({ execOptions, logger });
405
339
  if (isShallow) {
406
340
  // Shallow clone needs full unshallow for initial topology discovery
@@ -420,8 +354,6 @@ async function executeFetchStrategy(isShallow, execOptions, logger) {
420
354
  });
421
355
  logger.log(`All remote branches fetched successfully`);
422
356
  }
423
- if (isDebugMode())
424
- logger.log(`[DEBUG] executeFetchStrategy: completed in ${Date.now() - fnStart}ms`);
425
357
  }
426
358
  /**
427
359
  * Helper function to check if we're dealing with a remote branch scenario
@@ -434,9 +366,6 @@ async function executeFetchStrategy(isShallow, execOptions, logger) {
434
366
  * @param logger - Logger instance
435
367
  */
436
368
  async function ensureRemoteBranchesAvailable(branchName, isShallow, execOptions, logger) {
437
- const fnStart = Date.now();
438
- if (isDebugMode())
439
- logger.log(`[DEBUG] ensureRemoteBranchesAvailable: started (branch=${branchName}, isShallow=${isShallow})`);
440
369
  try {
441
370
  // Get the primary remote name (cached)
442
371
  const remoteName = await (0, exports.getPrimaryRemoteName)({ execOptions, logger });
@@ -445,13 +374,8 @@ async function ensureRemoteBranchesAvailable(branchName, isShallow, execOptions,
445
374
  execOptions,
446
375
  logger,
447
376
  });
448
- const upstream = symbolicResult.stdout.trim();
449
- const isRemoteBranch = upstream.startsWith(`${remoteName}/`);
450
- if (isDebugMode())
451
- logger.log(`[DEBUG] ensureRemoteBranchesAvailable: upstream="${upstream}", isRemoteBranch=${isRemoteBranch}`);
377
+ const isRemoteBranch = symbolicResult.stdout.trim().startsWith(`${remoteName}/`);
452
378
  if (!isRemoteBranch) {
453
- if (isDebugMode())
454
- logger.log(`[DEBUG] ensureRemoteBranchesAvailable: not a remote branch, skipping fetch in ${Date.now() - fnStart}ms`);
455
379
  return;
456
380
  }
457
381
  logger.log(`Detected remote branch scenario, fetching ancestor branches...`);
@@ -463,8 +387,6 @@ async function ensureRemoteBranchesAvailable(branchName, isShallow, execOptions,
463
387
  // Execute appropriate fetch strategy
464
388
  await executeFetchStrategy(isShallow, execOptions, logger);
465
389
  logger.log(`Remote branches fetched successfully for complete ancestor check`);
466
- if (isDebugMode())
467
- logger.log(`[DEBUG] ensureRemoteBranchesAvailable: completed in ${Date.now() - fnStart}ms`);
468
390
  }
469
391
  catch (err) {
470
392
  logger.log('Note: Could not determine if branch is remote, continuing with topology discovery', err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.59.4-debug.0",
3
+ "version": "4.61.0",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -60,19 +60,19 @@
60
60
  "setup:standalone": "sh -c 'yarn chromedriver --port=4444 --verbose &'"
61
61
  },
62
62
  "dependencies": {
63
- "@applitools/core-base": "workspace:*",
64
- "@applitools/dom-capture": "workspace:*",
65
- "@applitools/dom-snapshot": "workspace:*",
66
- "@applitools/driver": "workspace:*",
67
- "@applitools/ec-client": "workspace:*",
68
- "@applitools/logger": "workspace:*",
69
- "@applitools/nml-client": "workspace:*",
70
- "@applitools/req": "workspace:*",
71
- "@applitools/screenshoter": "workspace:*",
72
- "@applitools/snippets": "workspace:*",
73
- "@applitools/socket": "workspace:*",
74
- "@applitools/ufg-client": "workspace:*",
75
- "@applitools/utils": "workspace:*",
63
+ "@applitools/core-base": "1.33.0",
64
+ "@applitools/dom-capture": "11.7.1",
65
+ "@applitools/dom-snapshot": "4.16.4",
66
+ "@applitools/driver": "1.25.5",
67
+ "@applitools/ec-client": "1.12.26",
68
+ "@applitools/logger": "2.2.11",
69
+ "@applitools/nml-client": "1.11.25",
70
+ "@applitools/req": "1.10.0",
71
+ "@applitools/screenshoter": "3.12.18",
72
+ "@applitools/snippets": "2.8.2",
73
+ "@applitools/socket": "1.3.12",
74
+ "@applitools/ufg-client": "1.22.0",
75
+ "@applitools/utils": "1.14.4",
76
76
  "abort-controller": "3.0.0",
77
77
  "chalk": "4.1.2",
78
78
  "node-fetch": "2.6.7",
@@ -80,12 +80,12 @@
80
80
  "throat": "6.0.2"
81
81
  },
82
82
  "devDependencies": {
83
- "@applitools/bongo": "workspace:^",
84
- "@applitools/spec-driver-puppeteer": "workspace:^",
85
- "@applitools/spec-driver-selenium": "workspace:^",
86
- "@applitools/test-server": "workspace:^",
87
- "@applitools/test-utils": "workspace:^",
88
- "@applitools/tunnel-client": "workspace:^",
83
+ "@applitools/bongo": "^5.10.0",
84
+ "@applitools/spec-driver-puppeteer": "^1.7.5",
85
+ "@applitools/spec-driver-selenium": "^1.7.16",
86
+ "@applitools/test-server": "^1.4.3",
87
+ "@applitools/test-utils": "^1.5.17",
88
+ "@applitools/tunnel-client": "^1.11.11",
89
89
  "@types/mocha": "^10.0.7",
90
90
  "@types/node": "^12.20.55",
91
91
  "@types/selenium-webdriver": "^4.1.2",
@@ -114,4 +114,4 @@
114
114
  "selenium-webdriver>ws>utf-8-validate": false
115
115
  }
116
116
  }
117
- }
117
+ }
package/dist/cli/cli.js DELETED
@@ -1,160 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- /* eslint no-console: off */
31
- const core_server_1 = require("../universal/core-server");
32
- const core_server_process_1 = require("../universal/core-server-process");
33
- const logs_1 = require("../troubleshoot/logs");
34
- const check_network_1 = require("../troubleshoot/check-network");
35
- const yargs_1 = __importDefault(require("yargs"));
36
- const utils = __importStar(require("@applitools/utils"));
37
- const fs_1 = __importDefault(require("fs"));
38
- void yargs_1.default
39
- .example([
40
- ['eyes universal', 'Run Eyes Universal server on default port (21077)'],
41
- ['eyes universal --fork', 'Run Eyes Universal server in a forked process'],
42
- ['eyes universal --port 8080', 'Run Eyes Universal server on port 8080'],
43
- ['eyes universal --no-singleton', 'Run Eyes Universal server on a non-singleton mode'],
44
- ['eyes universal --shutdown-mode stdin', 'Run Eyes Universal server which will close once stdin stream will end'],
45
- ['eyes check-network', ''],
46
- ])
47
- .version(JSON.parse(fs_1.default.readFileSync(require.resolve('../../package.json'), 'utf-8')).version)
48
- .command({
49
- command: 'universal',
50
- builder: yargs => yargs.options({
51
- port: {
52
- description: 'run server on a specific port.',
53
- type: 'number',
54
- default: 21077,
55
- },
56
- singleton: {
57
- description: 'runs server on a singleton mode. It will prevent the server to start in case the same server is already started.',
58
- type: 'boolean',
59
- default: true,
60
- },
61
- fork: {
62
- description: 'runs server in a forked process.',
63
- type: 'boolean',
64
- default: false,
65
- },
66
- debug: {
67
- description: 'runs server in a debug mode.',
68
- type: 'boolean',
69
- default: false,
70
- },
71
- 'port-resolution-mode': {
72
- describe: 'preferred algorithm to solve port collisions.\n"lazy" mode will not try find free port.\n"random" mode will run on a random port.\n"next" mode will run on next free port after the given one.',
73
- alias: 'port-resolution',
74
- type: 'string',
75
- default: 'next',
76
- },
77
- 'shutdown-mode': {
78
- describe: 'preferred algorithm to automatically kill the process.\n"lazy" mode will end the process once the idle timeout ran out after the last client is disconnected from the server.\n"stdin" mode will end the process once its stdin stream got to its end.',
79
- alias: 'shutdown',
80
- type: 'string',
81
- default: 'lazy',
82
- },
83
- 'idle-timeout': {
84
- description: 'time in minutes for server to stay responsible in case of idle.',
85
- type: 'number',
86
- default: 15,
87
- coerce: value => value * 60 * 1000,
88
- },
89
- cert: {
90
- description: 'path to the certificate file.',
91
- alias: 'cert-path',
92
- type: 'string',
93
- implies: 'key',
94
- },
95
- key: {
96
- description: 'path to the key file.',
97
- alias: 'key-path',
98
- type: 'string',
99
- implies: 'cert',
100
- },
101
- config: {
102
- description: 'json string to use instead of cli arguments',
103
- type: 'string',
104
- coerce: JSON.parse,
105
- },
106
- maskLog: {
107
- description: 'mask sensitive information in the log',
108
- type: 'boolean',
109
- default: false,
110
- },
111
- }),
112
- handler: async (args) => {
113
- if (args.fork) {
114
- const { port } = await (0, core_server_process_1.makeCoreServerProcess)({ ...args, fork: false, isProcess: true });
115
- // eslint-disable-next-line no-console
116
- console.log(port); // NOTE: this is a part of the generic protocol
117
- }
118
- else {
119
- void (0, core_server_1.makeCoreServer)({ ...args, ...args.config, isProcess: true });
120
- }
121
- },
122
- })
123
- .command({
124
- command: 'logs [input]',
125
- builder: yargs => yargs.options({
126
- input: {
127
- description: 'log input to process',
128
- type: 'string',
129
- },
130
- structure: {
131
- description: 'group logs by tag names',
132
- type: 'boolean',
133
- },
134
- analyze: {
135
- description: 'group logs by tag names',
136
- type: 'boolean',
137
- },
138
- }),
139
- handler: async (args) => {
140
- var _a;
141
- const input = (_a = args.input) !== null && _a !== void 0 ? _a : (await utils.streams.toBuffer(process.stdin)).toString('utf8');
142
- const logs = (0, logs_1.parseLogs)(input);
143
- if (args.analyze) {
144
- console.log(JSON.stringify((0, logs_1.analyzeLogs)((0, logs_1.structureLogs)(logs)), null, 2));
145
- }
146
- else if (args.structure) {
147
- console.log(JSON.stringify((0, logs_1.structureLogs)(logs), null, 2));
148
- }
149
- else {
150
- console.log(JSON.stringify(logs, null, 2));
151
- }
152
- },
153
- })
154
- .command({
155
- command: 'check-network',
156
- handler: async () => {
157
- await (0, check_network_1.checkNetwork)();
158
- },
159
- })
160
- .wrap(yargs_1.default.terminalWidth()).argv;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.makeCoreServerProcess = void 0;
7
- const child_process_1 = require("child_process");
8
- const path_1 = __importDefault(require("path"));
9
- function makeCoreServerProcess(options) {
10
- return new Promise((resolve, reject) => {
11
- const server = (0, child_process_1.fork)(path_1.default.resolve(__dirname, '../../dist/cli/cli.js'), ['universal', `--config=${JSON.stringify(options)}`], {
12
- stdio: [options.shutdownMode === 'stdin' ? 'inherit' : 'ignore', 'ignore', 'ignore', 'ipc'],
13
- ...options.forkOptions,
14
- });
15
- const timeout = setTimeout(() => {
16
- reject(new Error(`Server didn't respond for 10s after being started`));
17
- server.kill();
18
- }, 60000);
19
- server.on('error', reject);
20
- server.once('message', ({ name, payload }) => {
21
- var _a;
22
- if (name === 'port') {
23
- resolve({ port: payload.port, close: () => server.kill() });
24
- clearTimeout(timeout);
25
- (_a = server.channel) === null || _a === void 0 ? void 0 : _a.unref();
26
- }
27
- });
28
- server.unref();
29
- });
30
- }
31
- exports.makeCoreServerProcess = makeCoreServerProcess;