varlock 0.0.15 → 0.1.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/README.md +1 -1
- package/dist/auto-load.js +6 -6
- package/dist/{chunk-2SPIWTVE.js → chunk-2JGPOSVQ.js} +2 -2
- package/dist/chunk-2JGPOSVQ.js.map +1 -0
- package/dist/{chunk-OLZUI45U.js → chunk-2VZORH2Y.js} +4 -4
- package/dist/{chunk-OLZUI45U.js.map → chunk-2VZORH2Y.js.map} +1 -1
- package/dist/chunk-5NNVZXCM.js +18 -0
- package/dist/{chunk-IH74UIYN.js.map → chunk-5NNVZXCM.js.map} +1 -1
- package/dist/{chunk-OM3JCP4E.js → chunk-7FI2PPMC.js} +3 -3
- package/dist/{chunk-OM3JCP4E.js.map → chunk-7FI2PPMC.js.map} +1 -1
- package/dist/{chunk-IWQ4BDSW.js → chunk-7UWLKQXP.js} +1507 -591
- package/dist/chunk-7UWLKQXP.js.map +1 -0
- package/dist/{chunk-WTAZCEL6.js → chunk-D7YI7IQX.js} +4 -4
- package/dist/{chunk-WTAZCEL6.js.map → chunk-D7YI7IQX.js.map} +1 -1
- package/dist/{chunk-UPLR6H2O.js → chunk-H3R4W3XK.js} +33 -14
- package/dist/chunk-H3R4W3XK.js.map +1 -0
- package/dist/{chunk-LYSRVOTA.js → chunk-IBAUYNXV.js} +3 -3
- package/dist/{chunk-LYSRVOTA.js.map → chunk-IBAUYNXV.js.map} +1 -1
- package/dist/{chunk-LBV2UW3I.js → chunk-QT5E2RY6.js} +3 -3
- package/dist/chunk-QT5E2RY6.js.map +1 -0
- package/dist/{chunk-XTPPJ3UK.js → chunk-R66KFGSX.js} +15 -22
- package/dist/chunk-R66KFGSX.js.map +1 -0
- package/dist/{chunk-C5BEZMSO.js → chunk-RWBSXJV6.js} +3 -3
- package/dist/{chunk-C5BEZMSO.js.map → chunk-RWBSXJV6.js.map} +1 -1
- package/dist/{chunk-WMCJKFEN.js → chunk-VYAOZFZB.js} +4 -4
- package/dist/{chunk-WMCJKFEN.js.map → chunk-VYAOZFZB.js.map} +1 -1
- package/dist/{chunk-7JMYT62X.js → chunk-WDC67GVB.js} +3 -3
- package/dist/{chunk-7JMYT62X.js.map → chunk-WDC67GVB.js.map} +1 -1
- package/dist/cli/cli-executable.js +189 -94
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/dotenv-compat.js +6 -6
- package/dist/{env-DLUhFCnC.d.ts → env-graph-eF0B8G0j.d.ts} +210 -55
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/init.command-A52ZWKL2.js +8 -0
- package/dist/{init.command-YZ23U7SF.js.map → init.command-A52ZWKL2.js.map} +1 -1
- package/dist/lib/exec-sync-varlock.js +1 -1
- package/dist/load.command-C75DTSKP.js +8 -0
- package/dist/{load.command-NVMWXLOK.js.map → load.command-C75DTSKP.js.map} +1 -1
- package/dist/plugin-lib.d.ts +9 -0
- package/dist/plugin-lib.js +3 -0
- package/dist/plugin-lib.js.map +1 -0
- package/dist/run.command-YSQDB4GE.js +8 -0
- package/dist/{run.command-CXMAPHO7.js.map → run.command-YSQDB4GE.js.map} +1 -1
- package/dist/runtime/env.d.ts +28 -1
- package/dist/runtime/env.js +1 -1
- package/dist/runtime/patch-console.js +2 -2
- package/dist/runtime/patch-response.js +2 -2
- package/dist/runtime/patch-server-response.js +2 -2
- package/dist/telemetry.command-JIHKG3ZH.js +8 -0
- package/dist/{telemetry.command-3DVW7H2K.js.map → telemetry.command-JIHKG3ZH.js.map} +1 -1
- package/package.json +18 -10
- package/dist/chunk-2SPIWTVE.js.map +0 -1
- package/dist/chunk-EPKIAPPA.js +0 -146
- package/dist/chunk-EPKIAPPA.js.map +0 -1
- package/dist/chunk-IH74UIYN.js +0 -18
- package/dist/chunk-IWQ4BDSW.js.map +0 -1
- package/dist/chunk-LBV2UW3I.js.map +0 -1
- package/dist/chunk-UPLR6H2O.js.map +0 -1
- package/dist/chunk-XTPPJ3UK.js.map +0 -1
- package/dist/init.command-YZ23U7SF.js +0 -8
- package/dist/load.command-NVMWXLOK.js +0 -8
- package/dist/login.command-W4DP7RUO.js +0 -8
- package/dist/login.command-W4DP7RUO.js.map +0 -1
- package/dist/run.command-CXMAPHO7.js +0 -8
- package/dist/telemetry.command-3DVW7H2K.js +0 -8
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { commandSpec } from '../chunk-
|
|
3
|
-
import {
|
|
4
|
-
import { commandSpec as commandSpec$
|
|
1
|
+
import { commandSpec as commandSpec$4 } from '../chunk-2VZORH2Y.js';
|
|
2
|
+
import { commandSpec } from '../chunk-D7YI7IQX.js';
|
|
3
|
+
import { CliExitError, fmt } from '../chunk-IBAUYNXV.js';
|
|
4
|
+
import { commandSpec as commandSpec$1 } from '../chunk-R66KFGSX.js';
|
|
5
|
+
import { commandSpec as commandSpec$2 } from '../chunk-VYAOZFZB.js';
|
|
5
6
|
import { commandSpec as commandSpec$3 } from '../chunk-RZT65DRA.js';
|
|
6
|
-
import { commandSpec as commandSpec$4 } from '../chunk-OLZUI45U.js';
|
|
7
|
-
import { CliExitError, fmt } from '../chunk-LYSRVOTA.js';
|
|
8
7
|
import { cli } from '../chunk-33ROL4J5.js';
|
|
9
|
-
import { InvalidEnvError } from '../chunk-
|
|
10
|
-
import { ansis_default, gracefulExit,
|
|
8
|
+
import { InvalidEnvError } from '../chunk-H3R4W3XK.js';
|
|
9
|
+
import { ansis_default, gracefulExit, asyncExitHook } from '../chunk-7UWLKQXP.js';
|
|
11
10
|
import '../chunk-FGMXIEFA.js';
|
|
12
11
|
import { __commonJS, __name, __toESM } from '../chunk-XN24GZXQ.js';
|
|
13
12
|
import os2 from 'os';
|
|
14
13
|
import crypto, { createHash } from 'crypto';
|
|
15
14
|
import { join, dirname } from 'path';
|
|
16
|
-
import fs, {
|
|
15
|
+
import fs, { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
17
16
|
import Debug from 'debug';
|
|
18
17
|
import process2 from 'process';
|
|
19
18
|
|
|
20
|
-
// ../../node_modules/.pnpm/ci-info@4.3.
|
|
19
|
+
// ../../node_modules/.pnpm/ci-info@4.3.1/node_modules/ci-info/vendors.json
|
|
21
20
|
var require_vendors = __commonJS({
|
|
22
|
-
"../../node_modules/.pnpm/ci-info@4.3.
|
|
21
|
+
"../../node_modules/.pnpm/ci-info@4.3.1/node_modules/ci-info/vendors.json"(exports, module) {
|
|
23
22
|
module.exports = [
|
|
24
23
|
{
|
|
25
24
|
name: "Agola CI",
|
|
@@ -381,9 +380,9 @@ var require_vendors = __commonJS({
|
|
|
381
380
|
}
|
|
382
381
|
});
|
|
383
382
|
|
|
384
|
-
// ../../node_modules/.pnpm/ci-info@4.3.
|
|
383
|
+
// ../../node_modules/.pnpm/ci-info@4.3.1/node_modules/ci-info/index.js
|
|
385
384
|
var require_ci_info = __commonJS({
|
|
386
|
-
"../../node_modules/.pnpm/ci-info@4.3.
|
|
385
|
+
"../../node_modules/.pnpm/ci-info@4.3.1/node_modules/ci-info/index.js"(exports) {
|
|
387
386
|
var vendors = require_vendors();
|
|
388
387
|
var env = process.env;
|
|
389
388
|
Object.defineProperty(exports, "_vendors", {
|
|
@@ -394,19 +393,21 @@ var require_ci_info = __commonJS({
|
|
|
394
393
|
exports.name = null;
|
|
395
394
|
exports.isPR = null;
|
|
396
395
|
exports.id = null;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
396
|
+
if (env.CI !== "false") {
|
|
397
|
+
vendors.forEach(function(vendor) {
|
|
398
|
+
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
399
|
+
const isCI2 = envs.every(function(obj) {
|
|
400
|
+
return checkEnv(obj);
|
|
401
|
+
});
|
|
402
|
+
exports[vendor.constant] = isCI2;
|
|
403
|
+
if (!isCI2) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
exports.name = vendor.name;
|
|
407
|
+
exports.isPR = checkPR(vendor);
|
|
408
|
+
exports.id = vendor.constant;
|
|
401
409
|
});
|
|
402
|
-
|
|
403
|
-
if (!isCI2) {
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
exports.name = vendor.name;
|
|
407
|
-
exports.isPR = checkPR(vendor);
|
|
408
|
-
exports.id = vendor.constant;
|
|
409
|
-
});
|
|
410
|
+
}
|
|
410
411
|
exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
|
|
411
412
|
(env.BUILD_ID || // Jenkins, Cloudbees
|
|
412
413
|
env.BUILD_NUMBER || // Jenkins, TeamCity
|
|
@@ -493,13 +494,46 @@ function hasDockerCGroup() {
|
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
496
|
__name(hasDockerCGroup, "hasDockerCGroup");
|
|
496
|
-
function
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
function hasDockerMountInfo() {
|
|
498
|
+
try {
|
|
499
|
+
return fs.readFileSync("/proc/self/mountinfo", "utf8").includes("/docker/containers/");
|
|
500
|
+
} catch {
|
|
501
|
+
return false;
|
|
499
502
|
}
|
|
503
|
+
}
|
|
504
|
+
__name(hasDockerMountInfo, "hasDockerMountInfo");
|
|
505
|
+
function isDocker() {
|
|
506
|
+
isDockerCached ??= hasDockerEnv() || hasDockerCGroup() || hasDockerMountInfo();
|
|
500
507
|
return isDockerCached;
|
|
501
508
|
}
|
|
502
509
|
__name(isDocker, "isDocker");
|
|
510
|
+
var isDockerCached2;
|
|
511
|
+
function hasDockerEnv2() {
|
|
512
|
+
try {
|
|
513
|
+
fs.statSync("/.dockerenv");
|
|
514
|
+
return true;
|
|
515
|
+
} catch {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
__name(hasDockerEnv2, "hasDockerEnv");
|
|
520
|
+
function hasDockerCGroup2() {
|
|
521
|
+
try {
|
|
522
|
+
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
523
|
+
} catch {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
__name(hasDockerCGroup2, "hasDockerCGroup");
|
|
528
|
+
function isDocker2() {
|
|
529
|
+
if (isDockerCached2 === void 0) {
|
|
530
|
+
isDockerCached2 = hasDockerEnv2() || hasDockerCGroup2();
|
|
531
|
+
}
|
|
532
|
+
return isDockerCached2;
|
|
533
|
+
}
|
|
534
|
+
__name(isDocker2, "isDocker");
|
|
535
|
+
|
|
536
|
+
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
503
537
|
var cachedResult;
|
|
504
538
|
var hasContainerEnv = /* @__PURE__ */ __name(() => {
|
|
505
539
|
try {
|
|
@@ -511,7 +545,7 @@ var hasContainerEnv = /* @__PURE__ */ __name(() => {
|
|
|
511
545
|
}, "hasContainerEnv");
|
|
512
546
|
function isInsideContainer() {
|
|
513
547
|
if (cachedResult === void 0) {
|
|
514
|
-
cachedResult = hasContainerEnv() ||
|
|
548
|
+
cachedResult = hasContainerEnv() || isDocker2();
|
|
515
549
|
}
|
|
516
550
|
return cachedResult;
|
|
517
551
|
}
|
|
@@ -538,58 +572,142 @@ var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
|
538
572
|
|
|
539
573
|
// package.json
|
|
540
574
|
var package_default = {
|
|
541
|
-
version: "0.
|
|
575
|
+
version: "0.1.1"};
|
|
576
|
+
|
|
577
|
+
// src/config.ts
|
|
578
|
+
var CONFIG = {
|
|
579
|
+
// varlock.dev app
|
|
580
|
+
POSTHOG_API_KEY: "phc_bfzH97VIta8yQa8HrsgmitqS6rTydjMISs0m8aqJTnq",
|
|
581
|
+
POSTHOG_HOST: "https://ph.varlock.dev"
|
|
582
|
+
};
|
|
542
583
|
|
|
543
584
|
// src/cli/helpers/telemetry.ts
|
|
544
585
|
var debug = Debug("varlock:telemetry");
|
|
545
586
|
var TRUE_ENV_VAR_VALUES = ["true", "1", "t"];
|
|
546
|
-
var
|
|
547
|
-
var
|
|
548
|
-
var
|
|
549
|
-
|
|
550
|
-
|
|
587
|
+
var userVarlockDirPath = join(os2.homedir(), ".varlock");
|
|
588
|
+
var userVarlockConfigFilePath = join(userVarlockDirPath, "config.json");
|
|
589
|
+
var userVarlockConfig;
|
|
590
|
+
var projectVarlockConfig;
|
|
591
|
+
var mergedVarlockConfigFileContents;
|
|
592
|
+
var _gitDirPath;
|
|
593
|
+
var _varlockDirPath;
|
|
594
|
+
var _projectRootDirPath;
|
|
595
|
+
var _foundProjectRoot = false;
|
|
596
|
+
function findProjectDirs() {
|
|
597
|
+
if (!_foundProjectRoot) {
|
|
598
|
+
let currentDir = process.cwd();
|
|
599
|
+
while (currentDir) {
|
|
600
|
+
const possibleGitDirPath = join(currentDir, ".git");
|
|
601
|
+
if (!_gitDirPath && existsSync(possibleGitDirPath)) {
|
|
602
|
+
_gitDirPath = possibleGitDirPath;
|
|
603
|
+
}
|
|
604
|
+
const possibleVarlockDirPath = join(currentDir, ".varlock");
|
|
605
|
+
if (!_varlockDirPath && possibleVarlockDirPath !== userVarlockDirPath && existsSync(possibleVarlockDirPath)) {
|
|
606
|
+
_varlockDirPath = possibleVarlockDirPath;
|
|
607
|
+
}
|
|
608
|
+
const parentDir = dirname(currentDir);
|
|
609
|
+
if (parentDir === currentDir) break;
|
|
610
|
+
currentDir = parentDir;
|
|
611
|
+
}
|
|
612
|
+
if (_gitDirPath) _projectRootDirPath = dirname(_gitDirPath);
|
|
613
|
+
else if (_varlockDirPath) _projectRootDirPath = dirname(_varlockDirPath);
|
|
614
|
+
else _projectRootDirPath = process.cwd();
|
|
615
|
+
_foundProjectRoot = true;
|
|
616
|
+
}
|
|
617
|
+
return {
|
|
618
|
+
gitDirPath: _gitDirPath,
|
|
619
|
+
varlockDirPath: _varlockDirPath,
|
|
620
|
+
projectRootDirPath: _projectRootDirPath
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
__name(findProjectDirs, "findProjectDirs");
|
|
624
|
+
function loadVarlockConfig() {
|
|
625
|
+
if (mergedVarlockConfigFileContents) return mergedVarlockConfigFileContents;
|
|
551
626
|
try {
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
627
|
+
const userConfigStr = readFileSync(userVarlockConfigFilePath, "utf-8");
|
|
628
|
+
userVarlockConfig = userConfigStr.trim() ? JSON.parse(userConfigStr) : void 0;
|
|
629
|
+
} catch (err) {
|
|
630
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
631
|
+
debug(`User varlock config file not found - ${userVarlockConfigFilePath}`);
|
|
632
|
+
} else if (err instanceof SyntaxError) {
|
|
633
|
+
throw new Error(`Invalid JSON in project varlock config - ${userVarlockConfigFilePath}`, { cause: err });
|
|
634
|
+
} else {
|
|
635
|
+
throw new Error(`Problem reading project varlock config - ${userVarlockConfigFilePath}`, { cause: err });
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const { varlockDirPath } = findProjectDirs();
|
|
639
|
+
if (varlockDirPath) {
|
|
640
|
+
const projectVarlockConfigPath = join(varlockDirPath, "config.json");
|
|
641
|
+
try {
|
|
642
|
+
const projectConfigStr = readFileSync(projectVarlockConfigPath, "utf-8");
|
|
643
|
+
projectVarlockConfig = projectConfigStr.trim() ? JSON.parse(projectConfigStr) : void 0;
|
|
644
|
+
} catch (err) {
|
|
645
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
646
|
+
debug(`Project varlock config file not found - ${projectVarlockConfigPath}`);
|
|
647
|
+
} else if (err instanceof SyntaxError) {
|
|
648
|
+
throw new Error(`Invalid JSON in project varlock config - ${projectVarlockConfigPath}`, { cause: err });
|
|
649
|
+
} else {
|
|
650
|
+
throw new Error(`Problem reading project varlock config - ${projectVarlockConfigPath}`, { cause: err });
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (projectVarlockConfig?.anonymousId) throw new Error("Anonymous ID should not be set in project varlock config");
|
|
558
654
|
}
|
|
655
|
+
mergedVarlockConfigFileContents = {
|
|
656
|
+
...userVarlockConfig,
|
|
657
|
+
...projectVarlockConfig
|
|
658
|
+
};
|
|
659
|
+
return mergedVarlockConfigFileContents;
|
|
559
660
|
}
|
|
560
|
-
__name(
|
|
661
|
+
__name(loadVarlockConfig, "loadVarlockConfig");
|
|
561
662
|
var cachedAnonymousId;
|
|
562
663
|
function getAnonymousId() {
|
|
563
664
|
if (cachedAnonymousId) return cachedAnonymousId;
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
cachedAnonymousId =
|
|
567
|
-
return
|
|
665
|
+
const varlockConfig = loadVarlockConfig();
|
|
666
|
+
if (varlockConfig?.anonymousId) {
|
|
667
|
+
cachedAnonymousId = varlockConfig.anonymousId;
|
|
668
|
+
return varlockConfig.anonymousId;
|
|
568
669
|
}
|
|
569
670
|
const newAnonymousId = `${import_ci_info.isCI ? "ci-" : ""}${crypto.randomUUID()}`;
|
|
570
|
-
|
|
571
|
-
|
|
671
|
+
try {
|
|
672
|
+
if (!existsSync(userVarlockDirPath)) {
|
|
673
|
+
mkdirSync(userVarlockDirPath, { recursive: true });
|
|
674
|
+
}
|
|
675
|
+
writeFileSync(
|
|
676
|
+
userVarlockConfigFilePath,
|
|
677
|
+
JSON.stringify({
|
|
678
|
+
...userVarlockConfig,
|
|
679
|
+
anonymousId: newAnonymousId
|
|
680
|
+
}, null, 2),
|
|
681
|
+
{ flag: "w" }
|
|
682
|
+
);
|
|
683
|
+
} catch (err) {
|
|
684
|
+
if (os2.homedir() === "/dev/null") {
|
|
685
|
+
console.error([
|
|
686
|
+
"Your HOME directory is not set - probably because you are running within Docker.",
|
|
687
|
+
"Please set HOME within your Dockerfile to a writable directory.",
|
|
688
|
+
"For example: `ENV HOME=/app/.home` (or whatever directory you want to use)."
|
|
689
|
+
].join("\n"));
|
|
690
|
+
} else {
|
|
691
|
+
console.error([
|
|
692
|
+
"There was a problem writing to the ~/.varlock folder",
|
|
693
|
+
err.message,
|
|
694
|
+
"Please ensure your home folder (or at least the ~/.varlock folder) is writable"
|
|
695
|
+
].join("\n"));
|
|
696
|
+
}
|
|
697
|
+
gracefulExit(1);
|
|
572
698
|
}
|
|
573
|
-
writeFileSync(
|
|
574
|
-
varlockConfigFilePath,
|
|
575
|
-
JSON.stringify({
|
|
576
|
-
...configFileContents,
|
|
577
|
-
anonymousId: newAnonymousId
|
|
578
|
-
}, null, 2),
|
|
579
|
-
{ flag: "w" }
|
|
580
|
-
);
|
|
581
699
|
cachedAnonymousId = newAnonymousId;
|
|
582
700
|
return newAnonymousId;
|
|
583
701
|
}
|
|
584
702
|
__name(getAnonymousId, "getAnonymousId");
|
|
585
703
|
function checkIsOptedOut() {
|
|
586
|
-
if (process.env.PH_OPT_OUT === "true" || TRUE_ENV_VAR_VALUES.includes(
|
|
704
|
+
if (process.env.PH_OPT_OUT === "true" || process.env.VARLOCK_TELEMETRY_DISABLED && TRUE_ENV_VAR_VALUES.includes(process.env.VARLOCK_TELEMETRY_DISABLED.toLowerCase())) {
|
|
587
705
|
debug("telemetry opted out - env var");
|
|
588
706
|
return true;
|
|
589
707
|
}
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
debug(
|
|
708
|
+
const varlockConfig = loadVarlockConfig();
|
|
709
|
+
if (varlockConfig?.analytics_opt_out || varlockConfig?.telemetryDisabled) {
|
|
710
|
+
debug(`telemetry opted out - config file (${projectVarlockConfig?.telemetryDisabled ? "project" : "user"} config)`);
|
|
593
711
|
return true;
|
|
594
712
|
}
|
|
595
713
|
return false;
|
|
@@ -605,21 +723,10 @@ function anonymizeValue(payload) {
|
|
|
605
723
|
}
|
|
606
724
|
__name(anonymizeValue, "anonymizeValue");
|
|
607
725
|
function getProjectGitRemoteUrl() {
|
|
726
|
+
findProjectDirs();
|
|
727
|
+
if (!_gitDirPath) return void 0;
|
|
608
728
|
try {
|
|
609
|
-
|
|
610
|
-
let currentDir = process.cwd();
|
|
611
|
-
while (currentDir) {
|
|
612
|
-
const possibleGitDirPath = join(currentDir, ".git");
|
|
613
|
-
if (existsSync(possibleGitDirPath)) {
|
|
614
|
-
gitDirPath = possibleGitDirPath;
|
|
615
|
-
break;
|
|
616
|
-
}
|
|
617
|
-
const parentDir = dirname(currentDir);
|
|
618
|
-
if (parentDir === currentDir) break;
|
|
619
|
-
currentDir = parentDir;
|
|
620
|
-
}
|
|
621
|
-
if (!gitDirPath) return void 0;
|
|
622
|
-
const gitConfigContents = readFileSync(join(gitDirPath, "config"), "utf-8");
|
|
729
|
+
const gitConfigContents = readFileSync(join(_gitDirPath, "config"), "utf-8");
|
|
623
730
|
const remoteUpstreamPos = gitConfigContents.indexOf('[remote "upstream"]');
|
|
624
731
|
if (remoteUpstreamPos !== -1) {
|
|
625
732
|
const remoteUpstreamUrl = gitConfigContents.slice(remoteUpstreamPos).match(/url = (.+)/)?.[1];
|
|
@@ -679,7 +786,7 @@ async function posthogCapture(event, properties) {
|
|
|
679
786
|
...telemetryMeta,
|
|
680
787
|
...properties
|
|
681
788
|
},
|
|
682
|
-
distinct_id: getAnonymousId()
|
|
789
|
+
distinct_id: isOptedOut ? "---" : getAnonymousId()
|
|
683
790
|
};
|
|
684
791
|
debug(`track${isOptedOut ? " (disabled)" : ""}`, payload);
|
|
685
792
|
if (isOptedOut) return;
|
|
@@ -712,10 +819,10 @@ __name(trackCommand, "trackCommand");
|
|
|
712
819
|
|
|
713
820
|
// src/cli/cli-executable.ts
|
|
714
821
|
var versionId = package_default.version;
|
|
715
|
-
function buildLazyCommand(
|
|
716
|
-
const commandName =
|
|
822
|
+
function buildLazyCommand(commandSpec6, loadCommandFn) {
|
|
823
|
+
const commandName = commandSpec6.name;
|
|
717
824
|
return {
|
|
718
|
-
...
|
|
825
|
+
...commandSpec6,
|
|
719
826
|
run: /* @__PURE__ */ __name(async (...args) => {
|
|
720
827
|
await trackCommand(commandName, { command: commandName });
|
|
721
828
|
const commandSpecAndFn = await loadCommandFn();
|
|
@@ -725,12 +832,11 @@ function buildLazyCommand(commandSpec7, loadCommandFn) {
|
|
|
725
832
|
}
|
|
726
833
|
__name(buildLazyCommand, "buildLazyCommand");
|
|
727
834
|
var subCommands = /* @__PURE__ */ new Map();
|
|
728
|
-
subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-
|
|
729
|
-
subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-
|
|
730
|
-
subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-
|
|
835
|
+
subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-A52ZWKL2.js')));
|
|
836
|
+
subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-C75DTSKP.js')));
|
|
837
|
+
subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-YSQDB4GE.js')));
|
|
731
838
|
subCommands.set("help", buildLazyCommand(commandSpec$3, async () => await import('../help.command-B7VWA53B.js')));
|
|
732
|
-
subCommands.set("telemetry", buildLazyCommand(commandSpec$4, async () => await import('../telemetry.command-
|
|
733
|
-
subCommands.set("login", buildLazyCommand(commandSpec$5, async () => await import('../login.command-W4DP7RUO.js')));
|
|
839
|
+
subCommands.set("telemetry", buildLazyCommand(commandSpec$4, async () => await import('../telemetry.command-JIHKG3ZH.js')));
|
|
734
840
|
(/* @__PURE__ */ __name(async function go() {
|
|
735
841
|
try {
|
|
736
842
|
let args = process.argv.slice(2);
|
|
@@ -765,17 +871,6 @@ subCommands.set("login", buildLazyCommand(commandSpec$5, async () => await impor
|
|
|
765
871
|
gracefulExit(1);
|
|
766
872
|
} else if (error instanceof CliExitError || error instanceof InvalidEnvError) {
|
|
767
873
|
console.error(error.getFormattedOutput());
|
|
768
|
-
} else if (error instanceof EnvSourceParseError) {
|
|
769
|
-
console.error(`\u{1F6A8} Error encountered while loading ${error.location.path}`);
|
|
770
|
-
console.error(error.message);
|
|
771
|
-
const errLoc = error.location;
|
|
772
|
-
const errPreview = [
|
|
773
|
-
errLoc.lineStr,
|
|
774
|
-
`${ansis_default.gray("-".repeat(errLoc.colNumber - 1))}${ansis_default.red("^")}`
|
|
775
|
-
].join("\n");
|
|
776
|
-
console.error("Error parsing .env file");
|
|
777
|
-
console.error(fmt.filePath(`${errLoc.path}:${errLoc.lineNumber}:${errLoc.colNumber}`));
|
|
778
|
-
console.error(errPreview);
|
|
779
874
|
gracefulExit(1);
|
|
780
875
|
} else {
|
|
781
876
|
throw error;
|