@catladder/cli 0.0.0-main-ccd87a98 → 0.0.0-main-840038cf

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.
@@ -1,14 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logError = void 0;
4
- const logError = (cmd, message, additionalMessage) => {
5
- cmd.log("");
6
- cmd.log(`[ERROR] 🙀 :${message}`);
7
- cmd.log("");
8
- if (additionalMessage) {
9
- cmd.log(additionalMessage);
10
- cmd.log("");
3
+ exports.logWarning = exports.logError = exports.logLines = void 0;
4
+ /**
5
+ * Logs multiple lines using the log method of the provided {@link LoggerCmdInstance}.
6
+ *
7
+ * Line items that are `null` or `undefined` are logged as empty lines.
8
+ *
9
+ * @param cmd - The logger instance to use. If `null` or `undefined`, `console` will be used.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * logLines(cmd, "line 1", "line 2", null, "line 3");
14
+ * logLines(cmd, ...linesArray); // arrays can be spread into the function
15
+ * logLines(cmd, linesArray); // but it will flatten the plain array for convenience
16
+ * ```
17
+ */
18
+ function logLines(cmd = console, ...lines) {
19
+ for (const line of lines.flat()) {
20
+ (cmd !== null && cmd !== void 0 ? cmd : console).log(`${line !== null && line !== void 0 ? line : ""}`);
11
21
  }
22
+ }
23
+ exports.logLines = logLines;
24
+ /**
25
+ * Logs an error message using the log method of the provided {@link LoggerCmdInstance}.
26
+ *
27
+ * Line items that are `null` or `undefined` are logged as empty lines.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * logError(cmd, "Message");
32
+ * logError(cmd, "Message", "Additional message");
33
+ * logError(cmd, "Message", "Additional message", "Another additional message line");
34
+ * logError(cmd, "Message", ...additionalMessages); // arrays can be spread into the function
35
+ * logError(cmd, "Message", additionalMessages); // but it will flatten the plain array for convenience
36
+ * ```
37
+ */
38
+ const logError = (cmd = console, message, ...additionalMessages) => {
39
+ logLines(cmd, "", `[ERROR] 🙀 :${message}`);
40
+ if (additionalMessages === null || additionalMessages === void 0 ? void 0 : additionalMessages.length) {
41
+ logLines(cmd, ...additionalMessages.flat());
42
+ }
43
+ logLines(cmd, "");
12
44
  };
13
45
  exports.logError = logError;
46
+ /**
47
+ * Logs a warning message using the log method of the provided {@link LoggerCmdInstance}.
48
+ *
49
+ * Line items that are `null` or `undefined` are logged as empty lines.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * logWarning(cmd, "Message");
54
+ * logWarning(cmd, "Message", "Additional message");
55
+ * logWarning(cmd, "Message", "Additional message", "Another additional message line");
56
+ * logWarning(cmd, "Message", ...additionalMessages); // arrays can be spread into the function
57
+ * logWarning(cmd, "Message", additionalMessages); // but it will flatten the plain array for convenience
58
+ * ```
59
+ */
60
+ const logWarning = (cmd = console, message, ...additionalMessages) => {
61
+ logLines(cmd, "", `[WARNING] ⚠️ : ${message}`);
62
+ if (additionalMessages === null || additionalMessages === void 0 ? void 0 : additionalMessages.length) {
63
+ logLines(cmd, ...additionalMessages.flat());
64
+ }
65
+ logLines(cmd, "");
66
+ };
67
+ exports.logWarning = logWarning;
14
68
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/utils/log.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CACtB,GAAQ,EACR,OAAe,EACf,iBAAuB,EACvB,EAAE;IACF,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACZ,GAAG,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;IAClC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACZ,IAAI,iBAAiB,EAAE,CAAC;QACtB,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,QAAQ,YAYnB"}
1
+ {"version":3,"file":"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CAAC;AACpB,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB"}
@@ -20,3 +20,4 @@ export declare const isOfDeployType: <T extends ("custom" | "kubernetes" | "dock
20
20
  }> | Extract<DeployConfigKubernetes, {
21
21
  type: T[number];
22
22
  }>;
23
+ export declare const getDeployConfigType: (t: DeployConfig | false | null | undefined) => "custom" | "kubernetes" | "dockerTag" | "google-cloudrun";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.isOfDeployType = void 0;
17
+ exports.getDeployConfigType = exports.isOfDeployType = void 0;
18
18
  __exportStar(require("./custom"), exports);
19
19
  __exportStar(require("./googleCloudRun"), exports);
20
20
  __exportStar(require("./kubernetes"), exports);
@@ -23,4 +23,10 @@ const isOfDeployType = (t, ...types) => {
23
23
  return t && types.includes(t.type) ? true : false;
24
24
  };
25
25
  exports.isOfDeployType = isOfDeployType;
26
+ const getDeployConfigType = (t) => {
27
+ if (!t)
28
+ return undefined;
29
+ return t.type;
30
+ };
31
+ exports.getDeployConfigType = getDeployConfigType;
26
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAKA,2CAAyB;AACzB,mDAAiC;AACjC,+CAA6B;AAC7B,8CAA4B;AAcrB,MAAM,cAAc,GAAG,CAC5B,CAA0C,EAC1C,GAAG,KAAQ,EACsC,EAAE;IACnD,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAKA,2CAAyB;AACzB,mDAAiC;AACjC,+CAA6B;AAC7B,8CAA4B;AAcrB,MAAM,cAAc,GAAG,CAC5B,CAA0C,EAC1C,GAAG,KAAQ,EACsC,EAAE;IACnD,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEK,MAAM,mBAAmB,GAAG,CACjC,CAA0C,EAC1C,EAAE;IACF,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACzB,OAAO,CAAC,CAAC,IAAI,CAAC;AAChB,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}