Skip to content

Commit ac5e008

Browse files
authored
Fix compatibility with Bun (#24)
1 parent 919140d commit ac5e008

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,47 @@ jobs:
1717
- "ubuntu-latest"
1818
- "macos-latest"
1919
- "windows-latest"
20-
node_version:
21-
- "22"
22-
- "20"
23-
- "18"
20+
runtime:
21+
- ["Node.js", "24"]
22+
- ["Node.js", "22"]
23+
- ["Node.js", "20"]
24+
- ["Node.js", "18"]
25+
- ["Bun", "latest"]
2426
# exclude:
2527
# - os: "macos-latest"
2628
# node_version: "12"
27-
name: Node.js ${{ matrix.node_version }} on ${{ matrix.os }}
29+
name: ${{matrix.runtime[0]}} ${{ matrix.runtime[1] }} on ${{ matrix.os }}
2830
runs-on: ${{ matrix.os }}
2931
env:
3032
YARN_ENABLE_IMMUTABLE_INSTALLS: false
33+
TEST_RUNTIME: ${{matrix.runtime[0]}}
3134
steps:
3235
- name: Checkout
3336
uses: actions/checkout@v4
3437

3538
- name: Setup Node.js
3639
uses: actions/setup-node@v4
40+
if: ${{matrix.runtime[0] == 'Node.js'}}
3741
with:
38-
node-version: ${{ matrix.node_version }}
42+
node-version: ${{ matrix.runtime[1] }}
43+
44+
- name: Setup Bun
45+
uses: oven-sh/setup-bun@v2
46+
if: ${{matrix.runtime[0] == 'Bun'}}
47+
with:
48+
bun-version: ${{ matrix.runtime[1] }}
3949

4050
- name: Install Dependencies
4151
run: yarn
4252

43-
- name: Run Test
53+
- name: Run Test (${{matrix.runtime[0]}})
54+
if: ${{matrix.runtime[0] == 'Node.js'}}
4455
run: yarn test-coverage
4556

57+
- name: Run Test (${{matrix.runtime[0]}})
58+
if: ${{matrix.runtime[0] == 'Bun'}}
59+
run: bun c8 bun test ./test.js
60+
4661
- uses: codecov/codecov-action@v5
4762
with:
4863
fail_ci_if_error: true

.release-it.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
3+
"git": {
4+
"commitMessage": "chore: release v${version}"
5+
},
6+
"github": {
7+
"release": true
8+
}
9+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@
4646
"prettier": "*"
4747
},
4848
"devDependencies": {
49-
"@types/node": "22.13.13",
49+
"@types/node": "22.15.30",
5050
"c8": "10.1.3",
5151
"npm-run-all": "4.1.5",
5252
"prettier": "3.5.3",
53-
"release-it": "18.1.2"
53+
"release-it": "19.0.3"
5454
},
5555
"packageManager": "[email protected]",
5656
"publishConfig": {
5757
"access": "public",
5858
"registry": "https://registry.npmjs.org/"
5959
},
6060
"dependencies": {
61-
"make-synchronized": "^0.4.2"
61+
"make-synchronized": "^0.8.0"
6262
}
6363
}

test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import fakePrettier from "./a-fake-prettier-to-test.cjs";
88

99
const code = await fs.readFile("./index.cjs", "utf8");
1010

11+
if (process.env.TEST_RUNTIME === "Bun") {
12+
assert(typeof Bun !== "undefined");
13+
}
14+
1115
test("format", async () => {
1216
const formatOptions = { parser: "meriyah" };
1317
const formattedBySynchronizedPrettier = synchronizedPrettier.format(

0 commit comments

Comments
 (0)