@beesolve/aws-accounts 1.0.2 → 1.0.3

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,6 +1,7 @@
1
1
  import { readFile, writeFile } from "node:fs/promises";
2
2
  import { createInterface } from "node:readline/promises";
3
- import { resolve } from "node:path";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import * as v from "valibot";
5
6
  import {
6
7
  CreateBucketCommand,
@@ -66,7 +67,6 @@ const contextFilePath = "aws.context.json";
66
67
  const configFilePath = "aws.config.ts";
67
68
  const typesFilePath = "aws.config.types.ts";
68
69
  const cachePath = ".remote-state-cache.json";
69
- const lambdaZipPath = "dist-lambda/lambda.zip";
70
70
  const lambdaRoleName = "beesolve-aws-accounts-lambda-role";
71
71
  const lambdaFunctionName = "beesolve-aws-accounts";
72
72
  async function runRemoteBootstrap(input) {
@@ -909,10 +909,15 @@ async function createNewPermissionSet(props) {
909
909
  return permissionSetArn;
910
910
  }
911
911
  async function readLambdaZip() {
912
+ const thisFile = fileURLToPath(import.meta.url);
913
+ const packageDir = dirname(dirname(dirname(thisFile)));
914
+ const zipPath = join(packageDir, "dist-lambda", "lambda.zip");
912
915
  try {
913
- return await readFile(resolve(lambdaZipPath));
916
+ return await readFile(zipPath);
914
917
  } catch {
915
- throw new Error("dist-lambda/lambda.zip not found. Run `npm run build:lambda` first.");
918
+ throw new Error(
919
+ `Lambda zip not found at ${zipPath}. The package may be corrupted \u2014 try reinstalling @beesolve/aws-accounts.`
920
+ );
916
921
  }
917
922
  }
918
923
  export {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beesolve/aws-accounts",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "AWS Organizations and IAM Identity Center management CLI",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {