Skip to content

Commit 579c364

Browse files
committed
fix(feat): redirect from stdlib to core api
1 parent 7b3b53e commit 579c364

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

scripts/stdlib/utils.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,16 @@ module.exports.TARGET_REFLECT_MODULE_DIR = TARGET_ROOT_PATH + '/kotlin-reflect';
1717
module.exports.exists = async function exists(path) {
1818
try {
1919
await access(path);
20-
return true;
2120
} catch (e) {
22-
//
21+
return false;
2322
}
24-
return false;
23+
return true;
2524
};
2625

2726
module.exports.writeRedirects = async function writeRedirects(name, urls) {
2827
const content = urls
29-
.map(([from, to]) => ({ from: '/' + from, to: '/' + to.replace(/\/index\.html$/, '/') }))
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(/\/index\.html$/, '/'), to: '/' + from }))
29+
.sort((a, b) => a.from.localeCompare(b.from));
3530

3631
console.log(`write ${urls.length} redirects...`);
3732
await writeFile(name, YAML.stringify(content), 'utf8');

0 commit comments

Comments
 (0)