@catladder/cli 0.0.0-fix-minor-catenv-command-fixes-78d05852 → 0.0.0-fix-cloud-run-memory-cpu-3ff798ea

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/package.json CHANGED
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ],
54
54
  "license": "MIT",
55
- "version": "0.0.0-fix-minor-catenv-command-fixes-78d05852",
55
+ "version": "0.0.0-fix-cloud-run-memory-cpu-3ff798ea",
56
56
  "scripts": {
57
57
  "lint": "eslint \"src/**/*.ts\"",
58
58
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
@@ -74,7 +74,7 @@
74
74
  "ts-node": "^10.9.1"
75
75
  },
76
76
  "devDependencies": {
77
- "@catladder/pipeline": "0.0.0-fix-minor-catenv-command-fixes-78d05852",
77
+ "@catladder/pipeline": "0.0.0-fix-cloud-run-memory-cpu-3ff798ea",
78
78
  "@gitbeaker/rest": "^39.28.0",
79
79
  "@kubernetes/client-node": "^0.16.2",
80
80
  "@tsconfig/node14": "^1.0.1",
@@ -105,7 +105,6 @@
105
105
  "node-fetch": "^2.3.0",
106
106
  "open": "^8.4.0",
107
107
  "prettier": "^2.5.1",
108
- "prettier-plugin-sh": "^0.14.0",
109
108
  "tmp-promise": "^2.0.2",
110
109
  "ts-results-es": "^4.1.0-alpha.1",
111
110
  "typescript": "^4.5.4",
@@ -14,6 +14,11 @@
14
14
  "responsibles": 1,
15
15
  "more": ""
16
16
  },
17
+ {
18
+ "description": "No sensitive information (passwords, keys, user data, ...) is logged or traced",
19
+ "responsibles": 1,
20
+ "more": "[Logging guide](https://www.notion.so/panterch/Long-story-logging-022722bb878f4724ae5b49e17667b630?pvs=4#9e5a36b7158a4953b73ec6a345bd8989), [Tracing guide](https://www.notion.so/panterch/Long-story-tracing-d8a9ec1ac2ff4fa78cefa8991233224e?pvs=4#535121b5bf9741fbaf8654b4b64d879d)"
21
+ },
17
22
  {
18
23
  "description":
19
24
  "Passwords are stored hashed with salt and salt is not stored in the repository",
@@ -1,17 +1,15 @@
1
- import { getProjectConfig } from '../../config/getProjectConfig';
2
- import { parseChoiceArgument } from '../../config/parseChoiceArgument';
3
- import { printVariables } from './printVariables';
4
- import { writeDotEnvFiles } from './writeDotEnvFiles';
5
- import { writeDTsFiles } from './writeEnvDTs';
1
+ import { getProjectConfig } from "../../config/getProjectConfig";
2
+ import { printVariables } from "./printVariables";
3
+ import type { Choice } from "./types";
4
+ import { writeDotEnvFiles } from "./writeDotEnvFiles";
5
+ import { writeDTsFiles } from "./writeEnvDTs";
6
6
 
7
- export default async () => {
7
+ export default async (choice?: Choice) => {
8
8
  const config = await getProjectConfig();
9
9
  if (!config) {
10
10
  return;
11
11
  }
12
12
 
13
- const choice = parseChoiceArgument(config);
14
-
15
13
  await printVariables(config, choice);
16
14
 
17
15
  await writeDotEnvFiles(config, choice);
@@ -18,7 +18,7 @@ export const writeDotEnvFiles = async (config: Config, choice?: Choice) => {
18
18
  );
19
19
 
20
20
  const componentsWithEnabledDotEnvWrite = Object.entries(config.components)
21
- .filter(([, component]) => component?.dotEnv)
21
+ .filter(([, component]) => component?.dotEnv) // when set to true or "local"
22
22
  .map(([componentName]) => componentName);
23
23
 
24
24
  const componentsToActuallyWriteDotEnvNow = currentComponent
package/src/catenv.ts CHANGED
@@ -1,6 +1,10 @@
1
- import catenv from './apps/catenv/catenv';
1
+ import catenv from "./apps/catenv/catenv";
2
2
 
3
- catenv().then(() => {
3
+ import { parseChoice } from "./config/parseChoice";
4
+
5
+ const choice = process.argv[2] ? parseChoice(process.argv[2]) : null;
6
+
7
+ catenv(choice).then(() => {
4
8
  // we have to exit manually, because we have some file watches
5
9
  process.exit();
6
10
  });
@@ -1,13 +0,0 @@
1
- import type { Config, EnvType } from '@catladder/pipeline';
2
- import type { Choice } from '../apps/catenv/types';
3
- export declare const getEnvComponentArgument: () => {
4
- env: EnvType;
5
- componentName?: string | undefined;
6
- };
7
- /**
8
- * Parses the environment component argument and returns a Choice object.
9
- * @param envComponent - The environment component argument to parse.
10
- * @returns The parsed Choice object.
11
- * @throws Error if the env type is invalid.
12
- */
13
- export declare const parseChoiceArgument: ({ components }: Config) => Choice;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.parseChoiceArgument = exports.getEnvComponentArgument = void 0;
4
- var pipeline_1 = require("@catladder/pipeline");
5
- var envTypes = Object.keys(pipeline_1.ENV_TYPES);
6
- var getEnvComponentArgument = function () {
7
- var _a;
8
- var componentMatch = "([a-zA-Z0-9_-]+)";
9
- var argRegexp = new RegExp("^((".concat(envTypes.join('|'), "):").concat(componentMatch, "|").concat(componentMatch, ")$"));
10
- var envComponent = (_a = process.argv[2]) !== null && _a !== void 0 ? _a : '';
11
- var _b = argRegexp.exec(envComponent), _c = _b[2], env = _c === void 0 ? 'local' : _c, componentNameWithEnv = _b[3], onlyComponentName = _b[4];
12
- if (!(0, pipeline_1.isKnowEnvType)(env)) {
13
- throw new Error("invalid env type! ".concat(env, ".\nEnv must be one of: ").concat(envTypes.join(', ')));
14
- }
15
- if (componentNameWithEnv === null || componentNameWithEnv === void 0 ? void 0 : componentNameWithEnv.length) {
16
- return { env: env, componentName: componentNameWithEnv };
17
- }
18
- if (onlyComponentName === null || onlyComponentName === void 0 ? void 0 : onlyComponentName.length) {
19
- return { env: env, componentName: onlyComponentName };
20
- }
21
- return { env: env };
22
- };
23
- exports.getEnvComponentArgument = getEnvComponentArgument;
24
- /**
25
- * Parses the environment component argument and returns a Choice object.
26
- * @param envComponent - The environment component argument to parse.
27
- * @returns The parsed Choice object.
28
- * @throws Error if the env type is invalid.
29
- */
30
- var parseChoiceArgument = function (_a) {
31
- var components = _a.components;
32
- var _b = (0, exports.getEnvComponentArgument)(), env = _b.env, componentName = _b.componentName;
33
- var componentNames = Object.keys(components);
34
- if ((componentName === null || componentName === void 0 ? void 0 : componentName.length) && !componentNames.includes(componentName)) {
35
- throw new Error("invalid component name! Component must be one of: ".concat(componentNames.join(', ')));
36
- }
37
- if (componentName === null || componentName === void 0 ? void 0 : componentName.length) {
38
- return { env: env, componentName: componentName };
39
- }
40
- return { env: env };
41
- };
42
- exports.parseChoiceArgument = parseChoiceArgument;
43
- //# sourceMappingURL=parseChoiceArgument.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseChoiceArgument.js","sourceRoot":"","sources":["../../src/config/parseChoiceArgument.ts"],"names":[],"mappings":";;;AACA,gDAA+D;AAG/D,IAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,oBAAS,CAAC,CAAC;AAEjC,IAAM,uBAAuB,GAAG;;IAIrC,IAAM,cAAc,GAAG,kBAAkB,CAAC;IAC1C,IAAM,SAAS,GAAG,IAAI,MAAM,CAC1B,aAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,eAAK,cAAc,cAAI,cAAc,OAAI,CAClE,CAAC;IACF,IAAM,YAAY,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;IACrC,IAAA,KACJ,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,EADnB,UAAa,EAAb,GAAG,mBAAG,OAAO,KAAA,EAAE,oBAAoB,QAAA,EAAE,iBAAiB,QACnC,CAAC;IAC/B,IAAI,CAAC,IAAA,wBAAa,EAAC,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CACb,4BAAqB,GAAG,oCAA0B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CACxE,CAAC;KACH;IACD,IAAI,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,MAAM,EAAE;QAChC,OAAO,EAAE,GAAG,KAAA,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;KACrD;IACD,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,EAAE;QAC7B,OAAO,EAAE,GAAG,KAAA,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;KAClD;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,CAAC;AACjB,CAAC,CAAC;AAvBW,QAAA,uBAAuB,2BAuBlC;AAEF;;;;;GAKG;AACI,IAAM,mBAAmB,GAAG,UAAC,EAAsB;QAApB,UAAU,gBAAA;IACxC,IAAA,KAAyB,IAAA,+BAAuB,GAAE,EAAhD,GAAG,SAAA,EAAE,aAAa,mBAA8B,CAAC;IACzD,IAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,KAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QACpE,MAAM,IAAI,KAAK,CACb,4DAAqD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CACjF,CAAC;KACH;IACD,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,EAAE;QACzB,OAAO,EAAE,GAAG,KAAA,EAAE,aAAa,eAAA,EAAE,CAAC;KAC/B;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,CAAC;AACjB,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B"}
@@ -1,50 +0,0 @@
1
- import type { Config, EnvType } from '@catladder/pipeline';
2
- import { ENV_TYPES, isKnowEnvType } from '@catladder/pipeline';
3
- import type { Choice } from '../apps/catenv/types';
4
-
5
- const envTypes = Object.keys(ENV_TYPES);
6
-
7
- export const getEnvComponentArgument = (): {
8
- env: EnvType;
9
- componentName?: string | undefined;
10
- } => {
11
- const componentMatch = `([a-zA-Z0-9_-]+)`;
12
- const argRegexp = new RegExp(
13
- `^((${envTypes.join('|')}):${componentMatch}|${componentMatch})$`
14
- );
15
- const envComponent = process.argv[2] ?? '';
16
- const [, , env = 'local', componentNameWithEnv, onlyComponentName] =
17
- argRegexp.exec(envComponent);
18
- if (!isKnowEnvType(env)) {
19
- throw new Error(
20
- `invalid env type! ${env}.\nEnv must be one of: ${envTypes.join(', ')}`
21
- );
22
- }
23
- if (componentNameWithEnv?.length) {
24
- return { env, componentName: componentNameWithEnv };
25
- }
26
- if (onlyComponentName?.length) {
27
- return { env, componentName: onlyComponentName };
28
- }
29
- return { env };
30
- };
31
-
32
- /**
33
- * Parses the environment component argument and returns a Choice object.
34
- * @param envComponent - The environment component argument to parse.
35
- * @returns The parsed Choice object.
36
- * @throws Error if the env type is invalid.
37
- */
38
- export const parseChoiceArgument = ({ components }: Config): Choice => {
39
- const { env, componentName } = getEnvComponentArgument();
40
- const componentNames = Object.keys(components);
41
- if (componentName?.length && !componentNames.includes(componentName)) {
42
- throw new Error(
43
- `invalid component name! Component must be one of: ${componentNames.join(', ')}`
44
- );
45
- }
46
- if (componentName?.length) {
47
- return { env, componentName };
48
- }
49
- return { env };
50
- };