@catladder/cli 0.0.0-main-03ba8cbf → 0.0.0-main-4188853e

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.
@@ -3002,7 +3002,7 @@ exports.getBuildInfoVariables = getBuildInfoVariables;
3002
3002
 
3003
3003
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3004
3004
  exports.getEnvConfig = void 0;
3005
- const utils_1 = __nccwpck_require__(2497);
3005
+ const lodash_1 = __nccwpck_require__(3255);
3006
3006
  const getEnvConfig = (config, componentName, env) => {
3007
3007
  var _a, _b;
3008
3008
  const defaultConfig = config.components[componentName];
@@ -3014,7 +3014,19 @@ const getEnvConfig = (config, componentName, env) => {
3014
3014
  // env is disabled, still return the default config
3015
3015
  return defaultConfig;
3016
3016
  }
3017
- return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
3017
+ /**
3018
+ * env config is merged with default. Arrays are not merged.
3019
+ * you can customize this by providing a function that takes the default value as argument
3020
+ */
3021
+ return (0, lodash_1.mergeWith)({}, defaultConfig, envCustomizations, (defaultValue, customValue) => {
3022
+ // check if custom value is a function (and default is not),
3023
+ // we currently don't have config options that are functions, but we might in the future
3024
+ if (typeof customValue === "function" &&
3025
+ typeof defaultValue !== "function") {
3026
+ return customValue(defaultValue);
3027
+ }
3028
+ return undefined;
3029
+ });
3018
3030
  };
3019
3031
  exports.getEnvConfig = getEnvConfig;
3020
3032
  //# sourceMappingURL=getEnvConfig.js.map
@@ -5934,7 +5934,7 @@ exports.getBuildInfoVariables = getBuildInfoVariables;
5934
5934
 
5935
5935
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5936
5936
  exports.getEnvConfig = void 0;
5937
- const utils_1 = __nccwpck_require__(32497);
5937
+ const lodash_1 = __nccwpck_require__(23255);
5938
5938
  const getEnvConfig = (config, componentName, env) => {
5939
5939
  var _a, _b;
5940
5940
  const defaultConfig = config.components[componentName];
@@ -5946,7 +5946,19 @@ const getEnvConfig = (config, componentName, env) => {
5946
5946
  // env is disabled, still return the default config
5947
5947
  return defaultConfig;
5948
5948
  }
5949
- return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
5949
+ /**
5950
+ * env config is merged with default. Arrays are not merged.
5951
+ * you can customize this by providing a function that takes the default value as argument
5952
+ */
5953
+ return (0, lodash_1.mergeWith)({}, defaultConfig, envCustomizations, (defaultValue, customValue) => {
5954
+ // check if custom value is a function (and default is not),
5955
+ // we currently don't have config options that are functions, but we might in the future
5956
+ if (typeof customValue === "function" &&
5957
+ typeof defaultValue !== "function") {
5958
+ return customValue(defaultValue);
5959
+ }
5960
+ return undefined;
5961
+ });
5950
5962
  };
5951
5963
  exports.getEnvConfig = getEnvConfig;
5952
5964
  //# sourceMappingURL=getEnvConfig.js.map
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEnvConfig = void 0;
4
- const utils_1 = require("../utils");
4
+ const lodash_1 = require("lodash");
5
5
  const getEnvConfig = (config, componentName, env) => {
6
6
  var _a, _b;
7
7
  const defaultConfig = config.components[componentName];
@@ -13,7 +13,19 @@ const getEnvConfig = (config, componentName, env) => {
13
13
  // env is disabled, still return the default config
14
14
  return defaultConfig;
15
15
  }
16
- return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
16
+ /**
17
+ * env config is merged with default. Arrays are not merged.
18
+ * you can customize this by providing a function that takes the default value as argument
19
+ */
20
+ return (0, lodash_1.mergeWith)({}, defaultConfig, envCustomizations, (defaultValue, customValue) => {
21
+ // check if custom value is a function (and default is not),
22
+ // we currently don't have config options that are functions, but we might in the future
23
+ if (typeof customValue === "function" &&
24
+ typeof defaultValue !== "function") {
25
+ return customValue(defaultValue);
26
+ }
27
+ return undefined;
28
+ });
17
29
  };
18
30
  exports.getEnvConfig = getEnvConfig;
19
31
  //# sourceMappingURL=getEnvConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEnvConfig.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/getEnvConfig.ts"],"names":[],"mappings":";;;AAEA,oCAAkD;AAE3C,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,aAAqB,EACrB,GAAW,EACa,EAAE;;IAC1B,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,aAAa,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAA,MAAA,aAAa,CAAC,GAAG,0CAAG,GAAG,CAAC,mCAAI,EAAE,CAAC;IACzD,IAAI,iBAAiB,KAAK,KAAK,EAAE,CAAC;QAChC,mDAAmD;QACnD,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,OAAO,IAAA,8BAAsB,EAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;AAClE,CAAC,CAAC;AAhBW,QAAA,YAAY,gBAgBvB"}
1
+ {"version":3,"file":"getEnvConfig.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/getEnvConfig.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAG5B,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,aAAqB,EACrB,GAAW,EACa,EAAE;;IAC1B,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,aAAa,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAA,MAAA,aAAa,CAAC,GAAG,0CAAG,GAAG,CAAC,mCAAI,EAAE,CAAC;IACzD,IAAI,iBAAiB,KAAK,KAAK,EAAE,CAAC;QAChC,mDAAmD;QACnD,OAAO,aAAa,CAAC;IACvB,CAAC;IACD;;;OAGG;IACH,OAAO,IAAA,kBAAS,EACd,EAAE,EACF,aAAa,EACb,iBAAiB,EACjB,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE;QAC5B,4DAA4D;QAC5D,wFAAwF;QACxF,IACE,OAAO,WAAW,KAAK,UAAU;YACjC,OAAO,YAAY,KAAK,UAAU,EAClC,CAAC;YACD,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,YAAY,gBAoCvB"}
@@ -73,6 +73,10 @@ export type DevLocalEnvConfig = {
73
73
  vars?: EnvVars;
74
74
  port?: number;
75
75
  };
76
+ type AddOverrideFunction<T> = {
77
+ [K in keyof T]: T[K] | ((defaultValue: T[K]) => T[K]) | (T[K] extends Record<string, unknown> | undefined ? AddOverrideFunction<T[K]> : never);
78
+ };
79
+ type EnvConfigWithOverride<E extends EnvType = EnvType> = AddOverrideFunction<EnvConfig<E>>;
76
80
  export type EnvConfig<E extends EnvType = EnvType> = {
77
81
  /**
78
82
  * type of the env (stage, prod, review, dev)
@@ -84,18 +88,18 @@ export type EnvConfig<E extends EnvType = EnvType> = {
84
88
  host?: string;
85
89
  } & PartialDeep<DefaultEnvConfig>;
86
90
  export type EnvConfigWithComponent = EnvConfig<EnvType> & ComponentConfig;
87
- export type CustomEnv = EnvConfig & {
91
+ export type CustomEnv = EnvConfigWithOverride & {
88
92
  type: EnvType;
89
93
  };
90
94
  export type Env<C extends ConfigProps = never> = {
91
95
  /**
92
96
  * local is a special env that is only used in local development
93
97
  */
94
- local?: DevLocalEnvConfig;
95
- dev?: EnvConfig<"dev"> | false;
96
- stage?: EnvConfig<"stage"> | false;
97
- review?: EnvConfig<"review"> | false;
98
- prod?: EnvConfig<"prod"> | false;
98
+ local?: AddOverrideFunction<DevLocalEnvConfig>;
99
+ dev?: EnvConfigWithOverride<"dev"> | false;
100
+ stage?: EnvConfigWithOverride<"stage"> | false;
101
+ review?: EnvConfigWithOverride<"review"> | false;
102
+ prod?: EnvConfigWithOverride<"prod"> | false;
99
103
  } & Record<C["CustomEnvs"], CustomEnv> & Record<string, any>;
100
104
  export type ComponentConfig<C extends ConfigProps = never> = {
101
105
  /**
@@ -178,3 +182,4 @@ export type Config<C extends ConfigProps = never> = {
178
182
  */
179
183
  runnerVariables?: Record<string, string>;
180
184
  };
185
+ export {};