@catladder/cli 0.0.0-main-8ec1b61a → 0.0.0-main-bcd7ed75
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/dist/bundles/catenv/index.js +32 -11
- package/dist/bundles/cli/index.js +33 -12
- package/dist/cli/src/utils/preferences.js +56 -0
- package/dist/cli/src/utils/preferences.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/utils/preferences.ts +56 -0
- package/dist/cli/src/utils/preferences/index.js +0 -35
- package/dist/cli/src/utils/preferences/index.js.map +0 -1
- package/src/utils/preferences/index.ts +0 -36
- /package/dist/cli/src/utils/{preferences/index.d.ts → preferences.d.ts} +0 -0
|
@@ -508,7 +508,7 @@ const lodash_1 = __nccwpck_require__(3255);
|
|
|
508
508
|
const memoizee_1 = __importDefault(__nccwpck_require__(5839));
|
|
509
509
|
const node_fetch_1 = __importDefault(__nccwpck_require__(6372));
|
|
510
510
|
const open_1 = __importDefault(__nccwpck_require__(4247));
|
|
511
|
-
const preferences_1 = __nccwpck_require__(
|
|
511
|
+
const preferences_1 = __nccwpck_require__(3511);
|
|
512
512
|
const gitProjectInformation_1 = __nccwpck_require__(8329);
|
|
513
513
|
const TOKEN_KEY = "gitlab-personal-access-token";
|
|
514
514
|
const hasGitlabToken = async () => await (0, preferences_1.hasPreference)(TOKEN_KEY);
|
|
@@ -711,24 +711,42 @@ exports.upsertAllVariables = upsertAllVariables;
|
|
|
711
711
|
|
|
712
712
|
/***/ }),
|
|
713
713
|
|
|
714
|
-
/***/
|
|
714
|
+
/***/ 3511:
|
|
715
715
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
716
716
|
|
|
717
717
|
"use strict";
|
|
718
718
|
|
|
719
719
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
720
720
|
exports.setPreference = exports.getPreference = exports.hasPreference = void 0;
|
|
721
|
-
const
|
|
721
|
+
const promises_1 = __nccwpck_require__(3292);
|
|
722
|
+
const fs_1 = __nccwpck_require__(7147);
|
|
723
|
+
const path_1 = __nccwpck_require__(1017);
|
|
722
724
|
const os_1 = __nccwpck_require__(2037);
|
|
723
725
|
const yaml_1 = __nccwpck_require__(8033);
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
+
const legacyPreferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".catladder/preferences.yml");
|
|
727
|
+
const preferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".config/catladder/preferences.yml");
|
|
728
|
+
const ensurePreferencesFile = async () => {
|
|
729
|
+
if ((0, fs_1.existsSync)(preferencesPath)) {
|
|
730
|
+
return preferencesPath;
|
|
731
|
+
}
|
|
732
|
+
await (0, promises_1.mkdir)((0, path_1.dirname)(preferencesPath), { recursive: true, mode: 0o700 });
|
|
733
|
+
await (0, promises_1.writeFile)(preferencesPath, "---\n{}", {
|
|
734
|
+
encoding: "utf-8",
|
|
735
|
+
mode: 0o600,
|
|
736
|
+
});
|
|
737
|
+
if ((0, fs_1.existsSync)(legacyPreferencesPath)) {
|
|
738
|
+
return legacyPreferencesPath;
|
|
739
|
+
}
|
|
740
|
+
return preferencesPath;
|
|
741
|
+
};
|
|
742
|
+
const loadPreferences = async () => {
|
|
743
|
+
const currentLoadPath = await ensurePreferencesFile();
|
|
744
|
+
return (0, promises_1.readFile)(currentLoadPath, { encoding: "utf-8" });
|
|
745
|
+
};
|
|
726
746
|
const getPreferences = async () => {
|
|
727
747
|
var _a;
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
return ((_a = (0, yaml_1.parse)(await (0, fs_extra_1.readFile)(file, { encoding: "utf-8" }))) !== null && _a !== void 0 ? _a : {});
|
|
748
|
+
const yamlContent = await loadPreferences();
|
|
749
|
+
return ((_a = (0, yaml_1.parse)(yamlContent)) !== null && _a !== void 0 ? _a : {});
|
|
732
750
|
};
|
|
733
751
|
const hasPreference = async (key) => {
|
|
734
752
|
const preferences = await getPreferences();
|
|
@@ -746,10 +764,13 @@ const setPreference = async (key, value) => {
|
|
|
746
764
|
...preferences,
|
|
747
765
|
[key]: value,
|
|
748
766
|
};
|
|
749
|
-
await (0,
|
|
767
|
+
await (0, promises_1.writeFile)(preferencesPath, (0, yaml_1.stringify)(newPreferences), {
|
|
768
|
+
encoding: "utf-8",
|
|
769
|
+
mode: 0o600,
|
|
770
|
+
});
|
|
750
771
|
};
|
|
751
772
|
exports.setPreference = setPreference;
|
|
752
|
-
//# sourceMappingURL=
|
|
773
|
+
//# sourceMappingURL=preferences.js.map
|
|
753
774
|
|
|
754
775
|
/***/ }),
|
|
755
776
|
|
|
@@ -2458,7 +2458,7 @@ exports["default"] = async (vorpal) => {
|
|
|
2458
2458
|
|
|
2459
2459
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2460
2460
|
exports.getGoogleAuthUserNumber = void 0;
|
|
2461
|
-
const preferences_1 = __nccwpck_require__(
|
|
2461
|
+
const preferences_1 = __nccwpck_require__(13511);
|
|
2462
2462
|
const KEY = "googleAuthUserNumber";
|
|
2463
2463
|
const getGoogleAuthUserNumber = async function () {
|
|
2464
2464
|
if (!(await (0, preferences_1.hasPreference)(KEY))) {
|
|
@@ -3319,7 +3319,7 @@ const lodash_1 = __nccwpck_require__(23255);
|
|
|
3319
3319
|
const memoizee_1 = __importDefault(__nccwpck_require__(85839));
|
|
3320
3320
|
const node_fetch_1 = __importDefault(__nccwpck_require__(26372));
|
|
3321
3321
|
const open_1 = __importDefault(__nccwpck_require__(14247));
|
|
3322
|
-
const preferences_1 = __nccwpck_require__(
|
|
3322
|
+
const preferences_1 = __nccwpck_require__(13511);
|
|
3323
3323
|
const gitProjectInformation_1 = __nccwpck_require__(78329);
|
|
3324
3324
|
const TOKEN_KEY = "gitlab-personal-access-token";
|
|
3325
3325
|
const hasGitlabToken = async () => await (0, preferences_1.hasPreference)(TOKEN_KEY);
|
|
@@ -3598,24 +3598,42 @@ exports.stopAllPortForwards = stopAllPortForwards;
|
|
|
3598
3598
|
|
|
3599
3599
|
/***/ }),
|
|
3600
3600
|
|
|
3601
|
-
/***/
|
|
3601
|
+
/***/ 13511:
|
|
3602
3602
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3603
3603
|
|
|
3604
3604
|
"use strict";
|
|
3605
3605
|
|
|
3606
3606
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3607
3607
|
exports.setPreference = exports.getPreference = exports.hasPreference = void 0;
|
|
3608
|
-
const
|
|
3608
|
+
const promises_1 = __nccwpck_require__(73292);
|
|
3609
|
+
const fs_1 = __nccwpck_require__(57147);
|
|
3610
|
+
const path_1 = __nccwpck_require__(71017);
|
|
3609
3611
|
const os_1 = __nccwpck_require__(22037);
|
|
3610
3612
|
const yaml_1 = __nccwpck_require__(68033);
|
|
3611
|
-
const
|
|
3612
|
-
const
|
|
3613
|
+
const legacyPreferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".catladder/preferences.yml");
|
|
3614
|
+
const preferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".config/catladder/preferences.yml");
|
|
3615
|
+
const ensurePreferencesFile = async () => {
|
|
3616
|
+
if ((0, fs_1.existsSync)(preferencesPath)) {
|
|
3617
|
+
return preferencesPath;
|
|
3618
|
+
}
|
|
3619
|
+
await (0, promises_1.mkdir)((0, path_1.dirname)(preferencesPath), { recursive: true, mode: 0o700 });
|
|
3620
|
+
await (0, promises_1.writeFile)(preferencesPath, "---\n{}", {
|
|
3621
|
+
encoding: "utf-8",
|
|
3622
|
+
mode: 0o600,
|
|
3623
|
+
});
|
|
3624
|
+
if ((0, fs_1.existsSync)(legacyPreferencesPath)) {
|
|
3625
|
+
return legacyPreferencesPath;
|
|
3626
|
+
}
|
|
3627
|
+
return preferencesPath;
|
|
3628
|
+
};
|
|
3629
|
+
const loadPreferences = async () => {
|
|
3630
|
+
const currentLoadPath = await ensurePreferencesFile();
|
|
3631
|
+
return (0, promises_1.readFile)(currentLoadPath, { encoding: "utf-8" });
|
|
3632
|
+
};
|
|
3613
3633
|
const getPreferences = async () => {
|
|
3614
3634
|
var _a;
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
}
|
|
3618
|
-
return ((_a = (0, yaml_1.parse)(await (0, fs_extra_1.readFile)(file, { encoding: "utf-8" }))) !== null && _a !== void 0 ? _a : {});
|
|
3635
|
+
const yamlContent = await loadPreferences();
|
|
3636
|
+
return ((_a = (0, yaml_1.parse)(yamlContent)) !== null && _a !== void 0 ? _a : {});
|
|
3619
3637
|
};
|
|
3620
3638
|
const hasPreference = async (key) => {
|
|
3621
3639
|
const preferences = await getPreferences();
|
|
@@ -3633,10 +3651,13 @@ const setPreference = async (key, value) => {
|
|
|
3633
3651
|
...preferences,
|
|
3634
3652
|
[key]: value,
|
|
3635
3653
|
};
|
|
3636
|
-
await (0,
|
|
3654
|
+
await (0, promises_1.writeFile)(preferencesPath, (0, yaml_1.stringify)(newPreferences), {
|
|
3655
|
+
encoding: "utf-8",
|
|
3656
|
+
mode: 0o600,
|
|
3657
|
+
});
|
|
3637
3658
|
};
|
|
3638
3659
|
exports.setPreference = setPreference;
|
|
3639
|
-
//# sourceMappingURL=
|
|
3660
|
+
//# sourceMappingURL=preferences.js.map
|
|
3640
3661
|
|
|
3641
3662
|
/***/ }),
|
|
3642
3663
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setPreference = exports.getPreference = exports.hasPreference = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const os_1 = require("os");
|
|
8
|
+
const yaml_1 = require("yaml");
|
|
9
|
+
const legacyPreferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".catladder/preferences.yml");
|
|
10
|
+
const preferencesPath = (0, path_1.join)((0, os_1.homedir)(), ".config/catladder/preferences.yml");
|
|
11
|
+
const ensurePreferencesFile = async () => {
|
|
12
|
+
if ((0, fs_1.existsSync)(preferencesPath)) {
|
|
13
|
+
return preferencesPath;
|
|
14
|
+
}
|
|
15
|
+
await (0, promises_1.mkdir)((0, path_1.dirname)(preferencesPath), { recursive: true, mode: 0o700 });
|
|
16
|
+
await (0, promises_1.writeFile)(preferencesPath, "---\n{}", {
|
|
17
|
+
encoding: "utf-8",
|
|
18
|
+
mode: 0o600,
|
|
19
|
+
});
|
|
20
|
+
if ((0, fs_1.existsSync)(legacyPreferencesPath)) {
|
|
21
|
+
return legacyPreferencesPath;
|
|
22
|
+
}
|
|
23
|
+
return preferencesPath;
|
|
24
|
+
};
|
|
25
|
+
const loadPreferences = async () => {
|
|
26
|
+
const currentLoadPath = await ensurePreferencesFile();
|
|
27
|
+
return (0, promises_1.readFile)(currentLoadPath, { encoding: "utf-8" });
|
|
28
|
+
};
|
|
29
|
+
const getPreferences = async () => {
|
|
30
|
+
var _a;
|
|
31
|
+
const yamlContent = await loadPreferences();
|
|
32
|
+
return ((_a = (0, yaml_1.parse)(yamlContent)) !== null && _a !== void 0 ? _a : {});
|
|
33
|
+
};
|
|
34
|
+
const hasPreference = async (key) => {
|
|
35
|
+
const preferences = await getPreferences();
|
|
36
|
+
return key in preferences;
|
|
37
|
+
};
|
|
38
|
+
exports.hasPreference = hasPreference;
|
|
39
|
+
const getPreference = async (key) => {
|
|
40
|
+
const preferences = await getPreferences();
|
|
41
|
+
return preferences[key];
|
|
42
|
+
};
|
|
43
|
+
exports.getPreference = getPreference;
|
|
44
|
+
const setPreference = async (key, value) => {
|
|
45
|
+
const preferences = await getPreferences();
|
|
46
|
+
const newPreferences = {
|
|
47
|
+
...preferences,
|
|
48
|
+
[key]: value,
|
|
49
|
+
};
|
|
50
|
+
await (0, promises_1.writeFile)(preferencesPath, (0, yaml_1.stringify)(newPreferences), {
|
|
51
|
+
encoding: "utf-8",
|
|
52
|
+
mode: 0o600,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
exports.setPreference = setPreference;
|
|
56
|
+
//# sourceMappingURL=preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../../../src/utils/preferences.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AACzD,2BAAgC;AAChC,+BAAqC;AACrC,2BAA6B;AAC7B,+BAAwC;AAExC,MAAM,qBAAqB,GAAG,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,4BAA4B,CAAC,CAAC;AAC5E,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,mCAAmC,CAAC,CAAC;AAE7E,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;IACvC,IAAI,IAAA,eAAU,EAAC,eAAe,CAAC,EAAE,CAAC;QAChC,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAA,gBAAK,EAAC,IAAA,cAAO,EAAC,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,MAAM,IAAA,oBAAS,EAAC,eAAe,EAAE,SAAS,EAAE;QAC1C,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;IACH,IAAI,IAAA,eAAU,EAAC,qBAAqB,CAAC,EAAE,CAAC;QACtC,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE;IACjC,MAAM,eAAe,GAAG,MAAM,qBAAqB,EAAE,CAAC;IACtD,OAAO,IAAA,mBAAQ,EAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;;IAChC,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;IAC5C,OAAO,CAAC,MAAA,IAAA,YAAK,EAAC,WAAW,CAAC,mCAAI,EAAE,CAA2B,CAAC;AAC9D,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACjD,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,OAAO,GAAG,IAAI,WAAW,CAAC;AAC5B,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB;AACK,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACjD,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,KAAsB,EAAE,EAAE;IACzE,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAE3C,MAAM,cAAc,GAAG;QACrB,GAAG,WAAW;QACd,CAAC,GAAG,CAAC,EAAE,KAAK;KACb,CAAC;IAEF,MAAM,IAAA,oBAAS,EAAC,eAAe,EAAE,IAAA,gBAAS,EAAC,cAAc,CAAC,EAAE;QAC1D,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB"}
|