terraguardian-cli 0.2.0 → 0.2.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terraguardian-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI that helps with projects that are built with terraform and helps with deployments of lambda src code",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -3,12 +3,23 @@ const FileHandler = require('../fs-utils/FileHandler');
3
3
  const exec = util.promisify(require('child_process').exec);
4
4
 
5
5
  async function executeCommand(command) {
6
- const { stdout, stderr } = await exec(command);
7
- console.log(stdout);
8
- if (stderr) {
9
- throw new Error(stderr);
10
- }
11
- return stdout;
6
+ return new Promise((resolve, reject) => {
7
+ exec(command, (error, stdout, stderr) => {
8
+ console.log(stdout);
9
+
10
+ // If stderr contains file size info or non-critical messages, ignore it
11
+ if (stderr) {
12
+ // If stderr contains the file size info pattern, just log it, don't throw
13
+ if (stderr.includes('kb') || stderr.includes('mb')) {
14
+ console.log('Build info (stderr):', stderr);
15
+ } else {
16
+ reject(new Error(stderr)); // Reject for actual errors
17
+ }
18
+ }
19
+
20
+ resolve(stdout); // Resolve with the output if everything is fine
21
+ });
22
+ });
12
23
  }
13
24
 
14
25
  function getLineOfInterest(
@@ -18,7 +18,6 @@ function getEsbuildBuildCommand(lambdaName, lambdaPath, buildOutputDir) {
18
18
  '--platform=node', // Set platform to node for AWS Lambda
19
19
  '--target=node20', // Change as needed for your Lambda runtime
20
20
  `--outfile=${buildOutputDir}/${NODE_BUILD_FILE_NAME}`, // Output file name
21
- '--sourcemap', // Optional: generate sourcemaps for debugging
22
21
  '--minify', // Optional: minify the output (you can disable if not needed)
23
22
  ];
24
23