@@ -102,34 +102,36 @@ export function initDirectory(
102102 targetPath : string = './' ,
103103 isReduced : boolean = false ,
104104) {
105-
106105 const basePath = `${ targetPath } /${ packageName . replace ( '/' , '__' ) } ` ;
107106 const configPath = `${ basePath } ${
108107 ! isReduced ? '/src' : ''
109108 } /codeshift.config.js`;
110109
111110 fs . copySync ( `${ __dirname } /../template${ isReduced ? '/src' : '' } ` , basePath , {
112- filter : ( src ) => ! src . includes ( 'src/codemod' )
111+ filter : src => ! src . includes ( 'src/codemod' ) ,
113112 } ) ;
114113
115114 if ( ! isReduced ) {
116- fs . writeFileSync ( path . join ( basePath , 'package.json' ) , getPackageJson ( packageName ) ) ;
115+ fs . writeFileSync (
116+ path . join ( basePath , 'package.json' ) ,
117+ getPackageJson ( packageName ) ,
118+ ) ;
117119 }
118120
119121 if ( ! fs . existsSync ( configPath ) ) {
120122 fs . writeFileSync ( configPath , getConfig ( packageName ) ) ;
121123 }
122124}
123125
124- export function initTransform ( packageName : string ,
126+ export function initTransform (
127+ packageName : string ,
125128 id : string ,
126129 type : 'version' | 'preset' ,
127130 targetPath : string = './' ,
128- isReduced : boolean = false ) {
129- if ( type === 'version' && ! semver . valid ( id ) ) {
130- throw new Error (
131- `Provided version ${ id } is not a valid semver version` ,
132- ) ;
131+ isReduced : boolean = false ,
132+ ) {
133+ if ( type === 'version' && ! semver . valid ( id ) ) {
134+ throw new Error ( `Provided version ${ id } is not a valid semver version` ) ;
133135 }
134136
135137 const basePath = `${ targetPath } /${ packageName . replace ( '/' , '__' ) } ` ;
@@ -158,7 +160,10 @@ if (type === 'version' && !semver.valid(id)) {
158160 fs . writeFileSync ( testFilePath , testFile ) ;
159161
160162 if ( ! isReduced ) {
161- fs . writeFileSync ( path . join ( basePath , 'package.json' ) , getPackageJson ( packageName ) ) ;
163+ fs . writeFileSync (
164+ path . join ( basePath , 'package.json' ) ,
165+ getPackageJson ( packageName ) ,
166+ ) ;
162167 }
163168
164169 fs . writeFileSync (
0 commit comments