File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 2
2
import camelCase from 'camelcase' ;
3
3
import glob from 'glob' ;
4
4
import set from 'lodash.set' ;
5
- import { resolve } from 'path' ;
5
+ import { resolve , sep } from 'path' ;
6
6
7
7
function getDirnameFromFilename ( __filename : string ) {
8
- return __filename . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
8
+ return __filename . split ( sep ) . slice ( 0 , - 1 ) . join ( sep ) ;
9
9
}
10
10
11
11
export function funcNameFromRelPathDefault ( relPath : string ) : string {
12
- const relPathArray = relPath . split ( '/' ) ; /* ? */
12
+ const relPathArray = relPath . split ( sep ) ; /* ? */
13
13
const fileName = relPathArray . pop ( ) ; /* ? */
14
- const relDirPathFunctionNameChunk = relPathArray . map ( ( pathFragment ) => camelCase ( pathFragment ) ) . join ( '/' ) ;
14
+ const relDirPathFunctionNameChunk = relPathArray . map ( ( pathFragment ) => camelCase ( pathFragment ) ) . join ( sep ) ;
15
15
const fileNameFunctionNameChunk = camelCase ( fileName ! . split ( '.' ) [ 0 ] ) ;
16
16
const funcName = relDirPathFunctionNameChunk
17
- ? `${ relDirPathFunctionNameChunk } / ${ fileNameFunctionNameChunk } `
17
+ ? `${ relDirPathFunctionNameChunk } ${ sep } ${ fileNameFunctionNameChunk } `
18
18
: fileNameFunctionNameChunk ;
19
- return funcName . replace ( / \/ / g , '-' ) ;
19
+ return funcName . replace ( sep , '-' ) ;
20
20
}
21
21
22
22
/**
You can’t perform that action at this time.
0 commit comments