@@ -102,34 +102,36 @@ export function initDirectory(
102
102
targetPath : string = './' ,
103
103
isReduced : boolean = false ,
104
104
) {
105
-
106
105
const basePath = `${ targetPath } /${ packageName . replace ( '/' , '__' ) } ` ;
107
106
const configPath = `${ basePath } ${
108
107
! isReduced ? '/src' : ''
109
108
} /codeshift.config.js`;
110
109
111
110
fs . copySync ( `${ __dirname } /../template${ isReduced ? '/src' : '' } ` , basePath , {
112
- filter : ( src ) => ! src . includes ( 'src/codemod' )
111
+ filter : src => ! src . includes ( 'src/codemod' ) ,
113
112
} ) ;
114
113
115
114
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
+ ) ;
117
119
}
118
120
119
121
if ( ! fs . existsSync ( configPath ) ) {
120
122
fs . writeFileSync ( configPath , getConfig ( packageName ) ) ;
121
123
}
122
124
}
123
125
124
- export function initTransform ( packageName : string ,
126
+ export function initTransform (
127
+ packageName : string ,
125
128
id : string ,
126
129
type : 'version' | 'preset' ,
127
130
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` ) ;
133
135
}
134
136
135
137
const basePath = `${ targetPath } /${ packageName . replace ( '/' , '__' ) } ` ;
@@ -158,7 +160,10 @@ if (type === 'version' && !semver.valid(id)) {
158
160
fs . writeFileSync ( testFilePath , testFile ) ;
159
161
160
162
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
+ ) ;
162
167
}
163
168
164
169
fs . writeFileSync (
0 commit comments