Skip to content

Commit

Permalink
Add disclaimer in README and process warning (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Nov 7, 2023
1 parent 68341cc commit e0176fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-oranges-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Add disclaimer in README and process warning
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ You can provide names of the custom transforms instead of a local path or url:
v2-to-v3 Converts AWS SDK for JavaScript APIs in a Javascript/TypeScript
codebase from version 2 (v2) to version 3 (v3).

Please review the code change thoroughly for required functionality before deploying it to production.
If the transformation is not complete or is incorrect, please report the issue on GitHub.

## Prerequisites

To use aws-sdk-js-codemod, please install [Node.js][install-nodejs].
Expand Down
15 changes: 15 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ if (args[2] === "--help" || args[2] === "-h") {
process.stdout.write(getHelpParagraph(transforms));
}

const disclaimerLines = [
`╔════════════════════════════════════════════════════════╗`,
`║ Please review the code change thoroughly for required ║`,
`║ functionality before deploying it to production. ║`,
`║ ║`,
`║ If the transformation is not complete or is incorrect, ║`,
`║ please report the issue on GitHub. ║`,
`╚════════════════════════════════════════════════════════╝`,
``,
];

const parser = getJsCodeshiftParser();

let options, positionalArguments;
Expand All @@ -61,6 +72,10 @@ try {

const { transform } = options;
if (transforms.map(({ name }) => name).includes(transform)) {
const supressDisclaimer = process.env.AWS_SDK_JS_CODEMOD_SUPRESS_WARNING;
if (!supressDisclaimer || !supressDisclaimer === "1") {
console.warn(disclaimerLines.map((line) => `\n${line}`).join(""));
}
options.transform = getUpdatedTransformFile(transform);
}

Expand Down

0 comments on commit e0176fb

Please sign in to comment.