Skip to content

Commit

Permalink
Add imports after the first occurrence of aws-sdk (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Oct 20, 2023
1 parent f3b9ce9 commit 2fe3834
Show file tree
Hide file tree
Showing 58 changed files with 335 additions and 466 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-hornets-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Add imports after the first occurrence of aws-sdk
2 changes: 1 addition & 1 deletion scripts/generateNewClientTests/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const CLIENTS_TO_TEST = ["ACM", "AccessAnalyzer", "Discovery"];
export const CLIENTS_TO_TEST = ["AccessAnalyzer", "Discovery", "ACM"];

export const LOCAL_NAME_SUFFIX = "Client";
3 changes: 2 additions & 1 deletion scripts/generateNewClientTests/getServiceImportDeepOutput.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageImportsCode } from "./getV3PackageImportsCode";

export const getServiceImportDeepOutput = () => {
let content = ``;

content += getV3PackageImportsCode(CLIENTS_TO_TEST);
content += getV3PackageImportsCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST));
content += `\n`;
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNameWithLocalSuffix } from "./getClientNameWithLocalSuffix";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageImportsCode } from "./getV3PackageImportsCode";

export const getServiceImportDeepWithNameOutput = () => {
let content = ``;

content += getV3PackageImportsCode(CLIENTS_TO_TEST, { useLocalSuffix: true });
content += getV3PackageImportsCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST), {
useLocalSuffix: true,
});
content += `\n`;
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST.map(getClientNameWithLocalSuffix));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageImportEqualsCode } from "./getV3PackageImportEqualsCode";

export const getServiceImportEqualsOutput = () => {
let content = ``;

content += getV3PackageImportEqualsCode(CLIENTS_TO_TEST);
content += getV3PackageImportEqualsCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST));
content += "\n";
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNameWithLocalSuffix } from "./getClientNameWithLocalSuffix";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageImportEqualsCode } from "./getV3PackageImportEqualsCode";

export const getServiceImportEqualsWithNameOutput = () => {
let content = ``;

content += getV3PackageImportEqualsCode(CLIENTS_TO_TEST, { useLocalSuffix: true });
content += getV3PackageImportEqualsCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST), {
useLocalSuffix: true,
});
content += "\n";
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST.map(getClientNameWithLocalSuffix));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageRequiresCode } from "./getV3PackageRequiresCode";

export const getServiceRequireDeepOutput = () => {
let content = `\n\n`;

content += getV3PackageRequiresCode(CLIENTS_TO_TEST);
content += getV3PackageRequiresCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST));
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST);

return content;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { CLIENTS_TO_TEST } from "./config";
import { getClientNameWithLocalSuffix } from "./getClientNameWithLocalSuffix";
import { getClientNamesSortedByPackageName } from "./getClientNamesSortedByPackageName";
import { getV3ClientsNewExpressionCode } from "./getV3ClientsNewExpressionCode";
import { getV3PackageRequiresCode } from "./getV3PackageRequiresCode";

export const getServiceRequireDeepWithNameOutput = () => {
let content = `\n\n`;

content += getV3PackageRequiresCode(CLIENTS_TO_TEST, { useLocalSuffix: true });
content += getV3PackageRequiresCode(getClientNamesSortedByPackageName(CLIENTS_TO_TEST), {
useLocalSuffix: true,
});
content += getV3ClientsNewExpressionCode(CLIENTS_TO_TEST.map(getClientNameWithLocalSuffix));

return content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import AWS = require("aws-sdk");

new AWS.ACM();
new AWS.AccessAnalyzer();
new AWS.Discovery();
new AWS.ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import ACM = AWS_client_acm.ACM;
import AWS_client_application_discovery_service = require("@aws-sdk/client-application-discovery-service");
import ApplicationDiscoveryService = AWS_client_application_discovery_service.ApplicationDiscoveryService;

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import * as AWS from "aws-sdk";

new AWS.ACM();
new AWS.AccessAnalyzer();
new AWS.Discovery();
new AWS.ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { AccessAnalyzer } from "@aws-sdk/client-accessanalyzer";
import { ACM } from "@aws-sdk/client-acm";
import { ApplicationDiscoveryService } from "@aws-sdk/client-application-discovery-service";

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
const ACMClient = require("aws-sdk").ACM;
const AccessAnalyzerClient = require("aws-sdk").AccessAnalyzer;
const DiscoveryClient = require("aws-sdk").Discovery;
const ACMClient = require("aws-sdk").ACM;

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


const {
ACM: ACMClient
} = require("@aws-sdk/client-acm");

const {
AccessAnalyzer: AccessAnalyzerClient
} = require("@aws-sdk/client-accessanalyzer");

const {
ACM: ACMClient
} = require("@aws-sdk/client-acm");

const {
ApplicationDiscoveryService: DiscoveryClient
} = require("@aws-sdk/client-application-discovery-service");

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
const ACM = require("aws-sdk").ACM;
const AccessAnalyzer = require("aws-sdk").AccessAnalyzer;
const Discovery = require("aws-sdk").Discovery;
const ACM = require("aws-sdk").ACM;

new ACM();
new AccessAnalyzer();
new Discovery();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


const {
ACM
} = require("@aws-sdk/client-acm");

const {
AccessAnalyzer
} = require("@aws-sdk/client-accessanalyzer");

const {
ACM
} = require("@aws-sdk/client-acm");

const {
ApplicationDiscoveryService
} = require("@aws-sdk/client-application-discovery-service");

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
const AWS = require("aws-sdk");

new AWS.ACM();
new AWS.AccessAnalyzer();
new AWS.Discovery();
new AWS.ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ const {
ApplicationDiscoveryService
} = require("@aws-sdk/client-application-discovery-service");

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import * as ACMClient from "aws-sdk/clients/acm";
import * as AccessAnalyzerClient from "aws-sdk/clients/accessanalyzer";
import * as DiscoveryClient from "aws-sdk/clients/discovery";
import * as ACMClient from "aws-sdk/clients/acm";

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import { ACM as ACMClient } from "@aws-sdk/client-acm";
import { AccessAnalyzer as AccessAnalyzerClient } from "@aws-sdk/client-accessanalyzer";
import { ACM as ACMClient } from "@aws-sdk/client-acm";
import { ApplicationDiscoveryService as DiscoveryClient } from "@aws-sdk/client-application-discovery-service";

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import * as ACM from "aws-sdk/clients/acm";
import * as AccessAnalyzer from "aws-sdk/clients/accessanalyzer";
import * as Discovery from "aws-sdk/clients/discovery";
import * as ACM from "aws-sdk/clients/acm";

new ACM();
new AccessAnalyzer();
new Discovery();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import { ACM } from "@aws-sdk/client-acm";
import { AccessAnalyzer } from "@aws-sdk/client-accessanalyzer";
import { ACM } from "@aws-sdk/client-acm";
import { ApplicationDiscoveryService } from "@aws-sdk/client-application-discovery-service";

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import ACMClient from "aws-sdk/clients/acm";
import AccessAnalyzerClient from "aws-sdk/clients/accessanalyzer";
import DiscoveryClient from "aws-sdk/clients/discovery";
import ACMClient from "aws-sdk/clients/acm";

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import { ACM as ACMClient } from "@aws-sdk/client-acm";
import { AccessAnalyzer as AccessAnalyzerClient } from "@aws-sdk/client-accessanalyzer";
import { ACM as ACMClient } from "@aws-sdk/client-acm";
import { ApplicationDiscoveryService as DiscoveryClient } from "@aws-sdk/client-application-discovery-service";

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import ACM from "aws-sdk/clients/acm";
import AccessAnalyzer from "aws-sdk/clients/accessanalyzer";
import Discovery from "aws-sdk/clients/discovery";
import ACM from "aws-sdk/clients/acm";

new ACM();
new AccessAnalyzer();
new Discovery();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import { ACM } from "@aws-sdk/client-acm";
import { AccessAnalyzer } from "@aws-sdk/client-accessanalyzer";
import { ACM } from "@aws-sdk/client-acm";
import { ApplicationDiscoveryService } from "@aws-sdk/client-application-discovery-service";

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import ACMClient = require("aws-sdk/clients/acm");
import AccessAnalyzerClient = require("aws-sdk/clients/accessanalyzer");
import DiscoveryClient = require("aws-sdk/clients/discovery");
import ACMClient = require("aws-sdk/clients/acm");

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import AWS_client_acm = require("@aws-sdk/client-acm");
import ACMClient = AWS_client_acm.ACM;
import AWS_client_accessanalyzer = require("@aws-sdk/client-accessanalyzer");
import AccessAnalyzerClient = AWS_client_accessanalyzer.AccessAnalyzer;
import AWS_client_acm = require("@aws-sdk/client-acm");
import ACMClient = AWS_client_acm.ACM;
import AWS_client_application_discovery_service = require("@aws-sdk/client-application-discovery-service");
import DiscoveryClient = AWS_client_application_discovery_service.ApplicationDiscoveryService;

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import ACM = require("aws-sdk/clients/acm");
import AccessAnalyzer = require("aws-sdk/clients/accessanalyzer");
import Discovery = require("aws-sdk/clients/discovery");
import ACM = require("aws-sdk/clients/acm");

new ACM();
new AccessAnalyzer();
new Discovery();
new ACM();
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.


import AWS_client_acm = require("@aws-sdk/client-acm");
import ACM = AWS_client_acm.ACM;
import AWS_client_accessanalyzer = require("@aws-sdk/client-accessanalyzer");
import AccessAnalyzer = AWS_client_accessanalyzer.AccessAnalyzer;
import AWS_client_acm = require("@aws-sdk/client-acm");
import ACM = AWS_client_acm.ACM;
import AWS_client_application_discovery_service = require("@aws-sdk/client-application-discovery-service");
import ApplicationDiscoveryService = AWS_client_application_discovery_service.ApplicationDiscoveryService;

new ACM();
new AccessAnalyzer();
new ApplicationDiscoveryService();
new ACM();
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This file is generated by scripts/generateNewClientTests/index.ts
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
import {
ACM as ACMClient,
AccessAnalyzer as AccessAnalyzerClient,
Discovery as DiscoveryClient
Discovery as DiscoveryClient,
ACM as ACMClient
} from "aws-sdk";

new ACMClient();
new AccessAnalyzerClient();
new DiscoveryClient();
new ACMClient();
Loading

0 comments on commit 2fe3834

Please sign in to comment.