carlin 1.31.17 → 1.31.18

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.
Files changed (2) hide show
  1. package/dist/index.js +48 -48
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1,11 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
1
  // src/config.ts
10
2
  var NAME = "carlin";
11
3
  var AWS_DEFAULT_REGION = "us-east-1";
@@ -33,7 +25,7 @@ var waitCodeBuildFinish = async ({
33
25
  let result;
34
26
  const checkIfBuildIsFinished = async () => {
35
27
  const { builds } = await codeBuild2.batchGetBuilds({ ids: [buildId] }).promise();
36
- return new Promise((resolve5, reject) => {
28
+ return new Promise((resolve6, reject) => {
37
29
  setTimeout(() => {
38
30
  const executedBuild = builds?.find(({ id }) => {
39
31
  return id === buildId;
@@ -44,12 +36,12 @@ var waitCodeBuildFinish = async ({
44
36
  );
45
37
  if (executedBuild && executedBuild.currentPhase === "COMPLETED") {
46
38
  if (executedBuild.buildStatus === "SUCCEEDED") {
47
- resolve5(executedBuild);
39
+ resolve6(executedBuild);
48
40
  } else if (["FAILED", "FAILURE"].includes(executedBuild.buildStatus || "")) {
49
41
  reject(new Error(`Cannot execute build ${buildId}.`));
50
42
  }
51
43
  }
52
- resolve5(void 0);
44
+ resolve6(void 0);
53
45
  }, WAIT_TIME);
54
46
  });
55
47
  };
@@ -170,7 +162,7 @@ import childProcess from "child_process";
170
162
  import log3 from "npmlog";
171
163
  log3.heading = "exec";
172
164
  var spawn = (cmd) => {
173
- return new Promise((resolve5, reject) => {
165
+ return new Promise((resolve6, reject) => {
174
166
  const [cmdName, ...cmdArgs] = cmd.split(" ");
175
167
  const child = childProcess.spawn(cmdName, cmdArgs);
176
168
  child.stdout.on("data", (data) => {
@@ -184,7 +176,7 @@ var spawn = (cmd) => {
184
176
  });
185
177
  child.on("close", (code) => {
186
178
  if (code === 0) {
187
- resolve5({});
179
+ resolve6({});
188
180
  } else {
189
181
  reject(code);
190
182
  }
@@ -193,7 +185,7 @@ var spawn = (cmd) => {
193
185
  };
194
186
 
195
187
  // src/cli.ts
196
- import { constantCase, paramCase as paramCase2 } from "change-case";
188
+ import { constantCase, kebabCase as kebabCase2 } from "change-case";
197
189
 
198
190
  // src/deploy/baseStack/config.ts
199
191
  import { pascalCase as pascalCase2 } from "change-case";
@@ -1373,7 +1365,7 @@ var getVpcTemplate = () => {
1373
1365
  };
1374
1366
 
1375
1367
  // src/deploy/stackName.ts
1376
- import { paramCase, pascalCase as pascalCase4 } from "change-case";
1368
+ import { kebabCase, pascalCase as pascalCase4 } from "change-case";
1377
1369
  var setPreDefinedStackName = (stackName) => {
1378
1370
  setEnvVar("STACK_NAME", stackName);
1379
1371
  };
@@ -1396,7 +1388,7 @@ var getStackName = async () => {
1396
1388
  return environment;
1397
1389
  }
1398
1390
  if (currentBranch) {
1399
- return paramCase(currentBranch);
1391
+ return kebabCase(currentBranch);
1400
1392
  }
1401
1393
  return void 0;
1402
1394
  })();
@@ -1468,7 +1460,7 @@ var deployBaseStackCommand = {
1468
1460
  };
1469
1461
 
1470
1462
  // src/deploy/cicd/deployCicd.ts
1471
- import * as fs6 from "fs";
1463
+ import * as fs7 from "fs";
1472
1464
  import * as path6 from "path";
1473
1465
 
1474
1466
  // src/deploy/cicd/command.options.ts
@@ -2502,6 +2494,10 @@ var buildLambdaSingleFile = async ({
2502
2494
  }
2503
2495
  };
2504
2496
 
2497
+ // src/deploy/lambda/deployLambdaLayers.ts
2498
+ import * as fs4 from "fs";
2499
+ import * as path4 from "path";
2500
+
2505
2501
  // src/deploy/lambdaLayer/getPackageLambdaLayerStackName.ts
2506
2502
  import { pascalCase as pascalCase6 } from "change-case";
2507
2503
  var lambdaLayerStackNamePrefix = `LambdaLayer`;
@@ -2647,7 +2643,6 @@ var deployLambdaLayer = async ({
2647
2643
 
2648
2644
  // src/deploy/lambda/deployLambdaLayers.ts
2649
2645
  import log9 from "npmlog";
2650
- import path4 from "path";
2651
2646
  var logPrefix7 = "lambda";
2652
2647
  var deployLambdaLayers = async ({
2653
2648
  lambdaExternals = []
@@ -2663,7 +2658,9 @@ var deployLambdaLayers = async ({
2663
2658
  );
2664
2659
  const { dependencies = {} } = (() => {
2665
2660
  try {
2666
- return __require(path4.resolve(process.cwd(), "package.json")) || {};
2661
+ return JSON.parse(
2662
+ fs4.readFileSync(path4.resolve(process.cwd(), "package.json"), "utf8")
2663
+ );
2667
2664
  } catch (err) {
2668
2665
  log9.error(
2669
2666
  logPrefix7,
@@ -2741,7 +2738,7 @@ var uploadCodeToECR = async ({
2741
2738
 
2742
2739
  // src/deploy/lambda/uploadCodeToS3.ts
2743
2740
  import AdmZip from "adm-zip";
2744
- import fs4 from "fs";
2741
+ import fs5 from "fs";
2745
2742
  import log10 from "npmlog";
2746
2743
  import path5 from "path";
2747
2744
  var logPrefix8 = "lambda";
@@ -2750,10 +2747,10 @@ var outFile2 = "index.js";
2750
2747
  var uploadCodeToS3 = async ({ stackName }) => {
2751
2748
  log10.info(logPrefix8, `Uploading code to S3...`);
2752
2749
  const zip = new AdmZip();
2753
- const code = fs4.readFileSync(path5.join(process.cwd(), outFolder2, outFile2));
2750
+ const code = fs5.readFileSync(path5.join(process.cwd(), outFolder2, outFile2));
2754
2751
  zip.addFile("index.js", code);
2755
- if (!fs4.existsSync("dist")) {
2756
- fs4.mkdirSync("dist");
2752
+ if (!fs5.existsSync("dist")) {
2753
+ fs5.mkdirSync("dist");
2757
2754
  }
2758
2755
  zip.writeZip("dist/lambda.zip");
2759
2756
  const bucketName = await getBaseStackResource(
@@ -2768,7 +2765,7 @@ var uploadCodeToS3 = async ({ stackName }) => {
2768
2765
  };
2769
2766
 
2770
2767
  // src/deploy/lambda/deployLambdaCode.ts
2771
- import fs5 from "fs";
2768
+ import fs6 from "fs";
2772
2769
  import log11 from "npmlog";
2773
2770
  var logPrefix9 = "lambda";
2774
2771
  var deployLambdaCode = async ({
@@ -2778,7 +2775,7 @@ var deployLambdaCode = async ({
2778
2775
  lambdaInput,
2779
2776
  stackName
2780
2777
  }) => {
2781
- if (!fs5.existsSync(lambdaInput)) {
2778
+ if (!fs6.existsSync(lambdaInput)) {
2782
2779
  return void 0;
2783
2780
  }
2784
2781
  log11.info(logPrefix9, "Deploying Lambda code...");
@@ -2813,10 +2810,10 @@ var getLambdaInput = (extension) => {
2813
2810
  };
2814
2811
  var deployCicdLambdas = async ({ stackName }) => {
2815
2812
  const lambdaInput = (() => {
2816
- if (fs6.existsSync(getLambdaInput("js"))) {
2813
+ if (fs7.existsSync(getLambdaInput("js"))) {
2817
2814
  return getLambdaInput("js");
2818
2815
  }
2819
- if (fs6.existsSync(getLambdaInput("ts"))) {
2816
+ if (fs7.existsSync(getLambdaInput("ts"))) {
2820
2817
  return getLambdaInput("ts");
2821
2818
  }
2822
2819
  throw new Error("Cannot read CICD lambdas file.");
@@ -2894,9 +2891,9 @@ var deployCicd = async ({
2894
2891
  };
2895
2892
 
2896
2893
  // src/deploy/cicd/readSSHKey.ts
2897
- import * as fs7 from "fs";
2894
+ import * as fs8 from "fs";
2898
2895
  var readSSHKey = (dir) => {
2899
- return fs7.readFileSync(dir, "utf-8");
2896
+ return fs8.readFileSync(dir, "utf-8");
2900
2897
  };
2901
2898
 
2902
2899
  // src/deploy/cicd/command.ts
@@ -2921,11 +2918,11 @@ var deployCicdCommand = {
2921
2918
  };
2922
2919
 
2923
2920
  // ../cloudformation/src/findAndReadCloudFormationTemplate.ts
2924
- import * as fs10 from "fs";
2921
+ import * as fs11 from "fs";
2925
2922
  import * as path8 from "path";
2926
2923
 
2927
2924
  // ../cloudformation/src/readCloudFormationYamlTemplate.ts
2928
- import * as fs8 from "fs";
2925
+ import * as fs9 from "fs";
2929
2926
  import * as path7 from "path";
2930
2927
 
2931
2928
  // ../cloudformation/src/cloudFormationYamlTemplate.ts
@@ -3053,7 +3050,7 @@ var getTypes = () => {
3053
3050
  options: {
3054
3051
  kind: "scalar",
3055
3052
  construct: (filePath) => {
3056
- return fs8.readFileSync(path7.resolve(process.cwd(), filePath)).toString();
3053
+ return fs9.readFileSync(path7.resolve(process.cwd(), filePath)).toString();
3057
3054
  }
3058
3055
  }
3059
3056
  }
@@ -3062,7 +3059,7 @@ var getTypes = () => {
3062
3059
  var readCloudFormationYamlTemplate = ({
3063
3060
  templatePath
3064
3061
  }) => {
3065
- const template = fs8.readFileSync(templatePath).toString();
3062
+ const template = fs9.readFileSync(templatePath).toString();
3066
3063
  const parsed = loadCloudFormationTemplate(template, getTypes());
3067
3064
  if (!parsed || typeof parsed === "string") {
3068
3065
  throw new Error("Cannot parse CloudFormation template.");
@@ -3071,35 +3068,38 @@ var readCloudFormationYamlTemplate = ({
3071
3068
  };
3072
3069
 
3073
3070
  // ../cloudformation/src/readObjectFile.ts
3074
- import fs9 from "fs";
3071
+ import { createRequire } from "node:module";
3072
+ import { register } from "ts-node";
3073
+ import fs10 from "fs";
3075
3074
  import yaml5 from "js-yaml";
3076
3075
  var readYaml = ({ path: path12 }) => {
3077
- const template = fs9.readFileSync(path12, "utf8") || JSON.stringify({});
3076
+ const template = fs10.readFileSync(path12, "utf8") || JSON.stringify({});
3078
3077
  return yaml5.load(template);
3079
3078
  };
3080
3079
  var readObjectFile = ({ path: path12 }) => {
3081
- if (!fs9.existsSync(path12)) {
3080
+ if (!fs10.existsSync(path12)) {
3082
3081
  return {};
3083
3082
  }
3083
+ const require2 = createRequire(import.meta.url);
3084
3084
  const extension = path12.split(".").pop();
3085
3085
  if (extension === "ts") {
3086
- __require("ts-node").register({
3086
+ register({
3087
3087
  compilerOptions: { moduleResolution: "node", module: "commonjs" },
3088
3088
  moduleTypes: {
3089
3089
  "carlin.*": "cjs"
3090
3090
  },
3091
3091
  transpileOnly: true
3092
3092
  });
3093
- const tsObj = __require(path12);
3093
+ const tsObj = require2(path12);
3094
3094
  const obj = tsObj.default || tsObj;
3095
3095
  return typeof obj === "function" ? obj() : obj;
3096
3096
  }
3097
3097
  if (extension === "js") {
3098
- const obj = __require(path12);
3098
+ const obj = require2(path12);
3099
3099
  return typeof obj === "function" ? obj() : obj;
3100
3100
  }
3101
3101
  if (extension === "json") {
3102
- return __require(path12);
3102
+ return require2(path12);
3103
3103
  }
3104
3104
  if (extension === "yml" || extension === "yaml") {
3105
3105
  return readYaml({ path: path12 });
@@ -3120,7 +3120,7 @@ var findAndReadCloudFormationTemplate = ({
3120
3120
  if (acc) {
3121
3121
  return acc;
3122
3122
  }
3123
- return fs10.existsSync(path8.resolve(process.cwd(), cur)) ? cur : acc;
3123
+ return fs11.existsSync(path8.resolve(process.cwd(), cur)) ? cur : acc;
3124
3124
  }, "");
3125
3125
  if (!templatePath) {
3126
3126
  throw new Error("Cannot find a CloudFormation template.");
@@ -4069,11 +4069,11 @@ var deployVercelCommand = {
4069
4069
  };
4070
4070
 
4071
4071
  // src/deploy/readDockerfile.ts
4072
- import * as fs11 from "fs";
4072
+ import * as fs12 from "fs";
4073
4073
  import * as path9 from "path";
4074
4074
  var readDockerfile = (dockerfilePath) => {
4075
4075
  try {
4076
- return fs11.readFileSync(path9.join(process.cwd(), dockerfilePath), "utf8");
4076
+ return fs12.readFileSync(path9.join(process.cwd(), dockerfilePath), "utf8");
4077
4077
  } catch {
4078
4078
  return "";
4079
4079
  }
@@ -4300,7 +4300,7 @@ var ecsTaskReportCommand = {
4300
4300
  };
4301
4301
 
4302
4302
  // src/generateEnv/generateEnv.ts
4303
- import * as fs12 from "fs";
4303
+ import * as fs13 from "fs";
4304
4304
  import * as path10 from "path";
4305
4305
  import log22 from "npmlog";
4306
4306
  var logPrefix21 = "generate-env";
@@ -4309,7 +4309,7 @@ var readEnvFile = async ({
4309
4309
  envsPath
4310
4310
  }) => {
4311
4311
  try {
4312
- const content = await fs12.promises.readFile(
4312
+ const content = await fs13.promises.readFile(
4313
4313
  path10.resolve(process.cwd(), envsPath, envFileName),
4314
4314
  "utf8"
4315
4315
  );
@@ -4322,7 +4322,7 @@ var writeEnvFile = async ({
4322
4322
  envFileName,
4323
4323
  content
4324
4324
  }) => {
4325
- return fs12.promises.writeFile(
4325
+ return fs13.promises.writeFile(
4326
4326
  path10.resolve(process.cwd(), envFileName),
4327
4327
  content
4328
4328
  );
@@ -4456,8 +4456,8 @@ var cli = () => {
4456
4456
  if (environment && environments && environments[environment]) {
4457
4457
  Object.entries(environments[environment]).forEach(([key, value]) => {
4458
4458
  const isKeyFromCli = (() => {
4459
- const paramCaseKey = paramCase2(key);
4460
- if (parsed?.defaulted?.[paramCaseKey]) {
4459
+ const kebabCaseKey = kebabCase2(key);
4460
+ if (parsed?.defaulted?.[kebabCaseKey]) {
4461
4461
  return false;
4462
4462
  }
4463
4463
  if (deepEqual(argv[key], finalConfig[key])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carlin",
3
- "version": "1.31.17",
3
+ "version": "1.31.18",
4
4
  "description": "",
5
5
  "license": "GPL-3.0",
6
6
  "author": "Pedro Arantes <arantespp@gmail.com> (https://twitter.com/arantespp)",
@@ -22,13 +22,13 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@aws-sdk/client-cloudformation": "^3.556.0",
25
+ "@aws-sdk/client-cloudformation": "^3.564.0",
26
26
  "@octokit/webhooks": "^12.0.0",
27
27
  "@slack/webhook": "^7.0.2",
28
28
  "adm-zip": "^0.5.12",
29
- "aws-sdk": "^2.1600.0",
29
+ "aws-sdk": "^2.1608.0",
30
30
  "builtin-modules": "^3.3.0",
31
- "change-case": "^4.1.2",
31
+ "change-case": "^5.4.4",
32
32
  "deep-equal": "^2.2.3",
33
33
  "deepmerge": "^4.3.1",
34
34
  "dotenv": "^16.4.5",
@@ -43,7 +43,7 @@
43
43
  "simple-git": "^3.24.0",
44
44
  "ts-node": "^10.9.2",
45
45
  "uglify-js": "^3.17.4",
46
- "vercel": "^34.0.0",
46
+ "vercel": "^34.1.3",
47
47
  "yargs": "^17.7.2"
48
48
  },
49
49
  "devDependencies": {
@@ -63,8 +63,8 @@
63
63
  "jest": "^29.7.0",
64
64
  "tsup": "^8.0.2",
65
65
  "typescript": "~5.4.5",
66
- "@ttoss/test-utils": "^2.1.4",
67
- "@ttoss/cloudformation": "^0.9.4"
66
+ "@ttoss/cloudformation": "^0.9.5",
67
+ "@ttoss/test-utils": "^2.1.5"
68
68
  },
69
69
  "keywords": [],
70
70
  "publishConfig": {