@beesolve/aws-accounts 1.0.1 → 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.
package/README.md CHANGED
@@ -19,6 +19,7 @@ Requires Node.js 24+ and valid AWS credentials (via environment, profile, or SSO
19
19
  # 1. Create a project directory
20
20
  mkdir my-org && cd my-org
21
21
  npm init -y
22
+ npm pkg set type=module
22
23
  npm install @beesolve/aws-accounts
23
24
 
24
25
  # 2. Deploy remote infrastructure (S3 bucket, IAM role, Lambda)
package/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/cli.js";
package/dist/cli.js CHANGED
File without changes
@@ -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,12 +1,13 @@
1
1
  {
2
2
  "name": "@beesolve/aws-accounts",
3
- "version": "1.0.1",
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": {
7
- "aws-accounts": "dist/cli.js"
7
+ "aws-accounts": "bin/cli.js"
8
8
  },
9
9
  "files": [
10
+ "bin",
10
11
  "dist",
11
12
  "!dist/**/*.test.js",
12
13
  "dist-lambda"
@@ -21,7 +22,7 @@
21
22
  },
22
23
  "scripts": {
23
24
  "clean": "rm -rf dist",
24
- "build": "npm run clean && esbuild $(find src -name '*.ts' ! -name '*.test.ts') --platform=node --target=node24 --format=esm --outdir=dist --outbase=src && chmod +x dist/cli.js",
25
+ "build": "npm run clean && esbuild $(find src -name '*.ts' ! -name '*.test.ts') --platform=node --target=node24 --format=esm --outdir=dist --outbase=src",
25
26
  "build:lambda": "node scripts/buildLambda.ts",
26
27
  "build:tests": "find dist -name '*.test.js' -delete && esbuild \"src/**/*.test.ts\" --platform=node --target=node24 --format=esm --outdir=dist --outbase=src",
27
28
  "cli": "npm run build && node dist/cli.js",