@@ -5,7 +5,13 @@ import { spawn } from "child_process";
55// eslint-disable-next-line @typescript-eslint/ban-ts-comment
66// @ts -ignore: package.json will be imported from dist folders
77import { version } from "../package.json" ; // eslint-disable-line
8- import { getHelpParagraph , getTransforms } from "./utils" ;
8+ import {
9+ getArgsWithUpdatedTransformFile ,
10+ getHelpParagraph ,
11+ getTransformFileFromArgs ,
12+ getTransforms ,
13+ getUpdatedTransformFile ,
14+ } from "./utils" ;
915
1016export const run = async ( args : string [ ] ) : Promise < void > => {
1117 const transforms = getTransforms ( ) ;
@@ -14,6 +20,12 @@ export const run = async (args: string[]): Promise<void> => {
1420 process . stdout . write ( `aws-sdk-js-codemod: ${ version } \n\n` ) ;
1521 } else if ( args [ 0 ] === "--help" || args [ 0 ] === "-h" ) {
1622 process . stdout . write ( getHelpParagraph ( transforms ) ) ;
23+ } else if ( args . includes ( "-t" ) || args . some ( ( arg ) => arg . startsWith ( "--transform=" ) ) ) {
24+ const transformFile = getTransformFileFromArgs ( args ) ;
25+ if ( transforms . map ( ( { name } ) => name ) . includes ( transformFile ) ) {
26+ const updatedTransformFile = getUpdatedTransformFile ( transformFile ) ;
27+ args = getArgsWithUpdatedTransformFile ( args , updatedTransformFile ) ;
28+ }
1729 }
1830 spawn ( "npm" , [ "exec" , "jscodeshift" , "--" , ...args ] , {
1931 stdio : "inherit" ,
0 commit comments