1
1
import { writeFileSync } from 'fs' ;
2
- import { basename , relative , dirname } from 'path' ;
2
+ import { basename } from 'path' ;
3
3
import { parseArgs } from './parseArgs' ;
4
4
import parse from './parse' ;
5
5
import {
@@ -20,11 +20,7 @@ export {
20
20
export default function run ( args ?: string [ ] ) {
21
21
const { files, options} = parseArgs ( args ) ;
22
22
const tsConfig = loadTsConfig ( ) ;
23
- const parsed = parse (
24
- files . map ( f => f . fileName ) ,
25
- tsConfig ,
26
- options . schema ,
27
- ) ;
23
+ const parsed = parse ( files . map ( f => f . fileName ) , tsConfig , options . schema ) ;
28
24
29
25
files . forEach ( ( { fileName, typeName} ) => {
30
26
const outputFileName = fileName . replace ( / \. t s x ? $ / , '.validator.ts' ) ;
@@ -37,12 +33,7 @@ export default function run(args?: string[]) {
37
33
normalizeSchema ( schema ) ,
38
34
`./${ basename ( fileName , / \. t s $ / . test ( fileName ) ? '.ts' : '.tsx' ) } ` ,
39
35
options . customKeywordFnName ,
40
- options . customKeywordPath
41
- ? relative (
42
- dirname ( outputFileName ) ,
43
- options . customKeywordPath ,
44
- ) . replace ( / .t s / , '' )
45
- : '' ,
36
+ options . customKeywordPath ,
46
37
tsConfig ,
47
38
options . ajv ,
48
39
) ;
0 commit comments