File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,21 @@ 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 ;
20
21
} catch ( e ) {
21
- return false ;
22
+ //
22
23
}
23
- return true ;
24
+ return false ;
24
25
} ;
25
26
26
27
module . exports . writeRedirects = async function writeRedirects ( name , urls ) {
27
28
const content = urls
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 ) ) ;
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
+ } ) ;
30
35
31
36
console . log ( `write ${ urls . length } redirects...` ) ;
32
37
await writeFile ( name , YAML . stringify ( content ) , 'utf8' ) ;
You can’t perform that action at this time.
0 commit comments