Skip to content

Commit 55704d1

Browse files
vmasekmatejchalk
authored andcommitted
fix: add toSorted polyfill as hotfix for bug in github actions runner
1 parent f5f226e commit 55704d1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/cli/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#! /usr/bin/env node
22
import { hideBin } from 'yargs/helpers';
33
import { cli } from './lib/cli.js';
4+
// FIXME: this is a hot fix for github action running in node 18 instead of node 20
5+
// eslint-disable-next-line import/no-unassigned-import
6+
import './lib/polyfills.js';
47

58
// bootstrap Yargs, parse arguments and execute command
69
await cli(hideBin(process.argv)).argv;

packages/cli/src/lib/polyfills.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if (!Array.prototype.toSorted) {
2+
// eslint-disable-next-line functional/immutable-data
3+
Array.prototype.toSorted = function <T>(
4+
this: T[],
5+
compareFn?: (a: T, b: T) => number,
6+
): T[] {
7+
return [...this].sort(compareFn);
8+
};
9+
}

0 commit comments

Comments
 (0)