File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -156,18 +156,21 @@ const createFiles = (
156
156
params
157
157
)
158
158
159
- fs . readdirSync ( input , { withFileTypes : true } ) . forEach (
160
- d =>
161
- d . isDirectory ( ) &&
162
- createFiles (
163
- appDir ,
164
- path . posix . join ( dirPath , d . name ) ,
165
- d . name . startsWith ( '_' )
166
- ? [ ...params , [ d . name . slice ( 1 ) . split ( '@' ) [ 0 ] , d . name . split ( '@' ) [ 1 ] ?? 'string' ] ]
167
- : params ,
168
- appText ,
169
- additionalReqs
170
- )
159
+ const dirs = fs . readdirSync ( input , { withFileTypes : true } ) . filter ( d => d . isDirectory ( ) )
160
+ if ( dirs . filter ( d => d . name . startsWith ( '_' ) ) . length >= 2 ) {
161
+ throw new Error ( 'There are two ore more path param folders.' )
162
+ }
163
+
164
+ dirs . forEach ( d =>
165
+ createFiles (
166
+ appDir ,
167
+ path . posix . join ( dirPath , d . name ) ,
168
+ d . name . startsWith ( '_' )
169
+ ? [ ...params , [ d . name . slice ( 1 ) . split ( '@' ) [ 0 ] , d . name . split ( '@' ) [ 1 ] ?? 'string' ] ]
170
+ : params ,
171
+ appText ,
172
+ additionalReqs
173
+ )
171
174
)
172
175
}
173
176
You can’t perform that action at this time.
0 commit comments