File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,16 @@ module.exports.TARGET_REFLECT_MODULE_DIR = TARGET_ROOT_PATH + '/kotlin-reflect';
17
17
module . exports . exists = async function exists ( path ) {
18
18
try {
19
19
await access ( path ) ;
20
- return true ;
21
20
} catch ( e ) {
22
- //
21
+ return false ;
23
22
}
24
- return false ;
23
+ return true ;
25
24
} ;
26
25
27
26
module . exports . writeRedirects = async function writeRedirects ( name , urls ) {
28
27
const content = urls
29
- . map ( ( [ from , to ] ) => ( { from : '/' + from , to : '/' + to . replace ( / \/ i n d e x \. h t m l $ / , '/' ) } ) )
30
- . sort ( function ( a , b ) {
31
- if ( a . from < b . from ) return - 1 ;
32
- if ( a . from > b . from ) return 1 ;
33
- return 0 ;
34
- } ) ;
28
+ . map ( ( [ from , to ] ) => ( { from : '/' + to . replace ( / \/ i n d e x \. h t m l $ / , '/' ) , to : '/' + from } ) )
29
+ . sort ( ( a , b ) => a . from . localeCompare ( b . from ) ) ;
35
30
36
31
console . log ( `write ${ urls . length } redirects...` ) ;
37
32
await writeFile ( name , YAML . stringify ( content ) , 'utf8' ) ;
You can’t perform that action at this time.
0 commit comments