@aws-sdk/find-v2 0.0.3 → 0.1.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/README.md CHANGED
@@ -39,7 +39,7 @@ Note about output:
39
39
  - [N] means "aws-sdk" is not found in Lambda function.
40
40
  - [?] means script was not able to proceed, and it emits reason.
41
41
 
42
- Reading 4 functions.
42
+ Reading 4 functions from "us-east-2" region.
43
43
  [N] fn-without-aws-sdk-in-bundle
44
44
  [Y] fn-with-aws-sdk-in-bundle
45
45
  [Y] fn-with-aws-sdk-in-package-json-deps
package/dist/cli.js CHANGED
@@ -16,8 +16,9 @@ export const createProgram = () => {
16
16
  program
17
17
  .command("lambda")
18
18
  .description("Scans Lambda Node.js Functions for JavaScript SDK v2.")
19
- .action(async () => {
20
- await scanLambdaFunctions();
19
+ .option("-r, --region <region>", "AWS region to scan")
20
+ .action(async (options) => {
21
+ await scanLambdaFunctions(options.region);
21
22
  });
22
23
  return program;
23
24
  };
@@ -31,6 +31,7 @@ export const scanLambdaFunction = async (client, functionName) => {
31
31
  console.log(`${JS_SDK_V2_MARKER.Y} ${functionName}`);
32
32
  return;
33
33
  }
34
+ // oxlint-disable-next-line no-unused-vars
34
35
  }
35
36
  catch (error) {
36
37
  // Parsing failure for package.json which is rare, continue.
@@ -1,12 +1,12 @@
1
1
  import { Lambda, paginateListFunctions } from "@aws-sdk/client-lambda";
2
2
  import { JS_SDK_V2_MARKER } from "./constants.js";
3
3
  import { scanLambdaFunction } from "./scanLambdaFunction.js";
4
- const client = new Lambda();
5
4
  const getNodeJsFunctionNames = (functions) => (functions ?? [])
6
5
  .filter((fn) => fn.Runtime?.startsWith("nodejs"))
7
6
  .map((fn) => fn.FunctionName)
8
7
  .filter((fnName) => fnName !== undefined);
9
- export const scanLambdaFunctions = async () => {
8
+ export const scanLambdaFunctions = async (region) => {
9
+ const client = new Lambda({ region });
10
10
  const functions = [];
11
11
  const paginator = paginateListFunctions({ client }, {});
12
12
  for await (const page of paginator) {
@@ -21,7 +21,8 @@ export const scanLambdaFunctions = async () => {
21
21
  console.log(`- ${JS_SDK_V2_MARKER.Y} means "aws-sdk" is found in Lambda function, and migration is recommended.`);
22
22
  console.log(`- ${JS_SDK_V2_MARKER.N} means "aws-sdk" is not found in Lambda function.`);
23
23
  console.log(`- ${JS_SDK_V2_MARKER.UNKNOWN} means script was not able to proceed, and it emits reason.\n`);
24
- console.log(`Reading ${functionsLength} function${functionsLength > 1 ? "s" : ""}.`);
24
+ const clientRegion = await client.config.region();
25
+ console.log(`Reading ${functionsLength} function${functionsLength > 1 ? "s" : ""} from "${clientRegion}" region.`);
25
26
  for (const functionName of functions) {
26
27
  await scanLambdaFunction(client, functionName);
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/find-v2",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "description": "CLI to find resources which call AWS using JavaScript SDK v2",
5
5
  "main": "dist/cli.js",
6
6
  "types": "dist/cli.d.ts",
@@ -24,6 +24,7 @@
24
24
  "aws-sdk": "^2.1692.0",
25
25
  "esbuild": "~0.27.1",
26
26
  "oxfmt": "^0.18.0",
27
+ "oxlint": "^1.33.0",
27
28
  "rolldown": "1.0.0-beta.54",
28
29
  "rollup": "^4.53.3",
29
30
  "typescript": "^5.9.3",
@@ -33,6 +34,7 @@
33
34
  },
34
35
  "scripts": {
35
36
  "build": "tsc",
37
+ "lint": "oxlint src/**/*.ts",
36
38
  "format": "oxfmt",
37
39
  "test": "vitest",
38
40
  "test:generate:bundles": "node scripts/generateBundles.ts",