Skip to content

Commit

Permalink
fix(feat): redirect from stdlib to core api
Browse files Browse the repository at this point in the history
  • Loading branch information
zoobestik committed Oct 31, 2024
1 parent 7b3b53e commit 579c364
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions scripts/stdlib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@ module.exports.TARGET_REFLECT_MODULE_DIR = TARGET_ROOT_PATH + '/kotlin-reflect';
module.exports.exists = async function exists(path) {
try {
await access(path);
return true;
} catch (e) {
//
return false;
}
return false;
return true;
};

module.exports.writeRedirects = async function writeRedirects(name, urls) {
const content = urls
.map(([from, to]) => ({ from: '/' + from, to: '/' + to.replace(/\/index\.html$/, '/') }))
.sort(function(a, b) {
if (a.from < b.from) return -1;
if (a.from > b.from) return 1;
return 0;
});
.map(([from, to]) => ({ from: '/' + to.replace(/\/index\.html$/, '/'), to: '/' + from }))
.sort((a, b) => a.from.localeCompare(b.from));

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

0 comments on commit 579c364

Please sign in to comment.