Skip to content

Commit 612e9dd

Browse files
committed
chore(bun): use Bun as runner
1 parent 6598eaa commit 612e9dd

File tree

12 files changed

+58
-5250
lines changed

12 files changed

+58
-5250
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
8-
- name: Install modules
9-
run: yarn
10-
- name: Run tests
11-
run: yarn test
7+
- uses: actions/checkout@v3
8+
- uses: oven-sh/setup-bun@v1
9+
- run: bun install
10+
- run: bun run test

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# advent-of-code
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run index.js
13+
```
14+
15+
This project was created using `bun init` in bun v1.0.2. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

babel.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

bun.lockb

18.2 KB
Binary file not shown.

package.json

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,12 @@
44
"main": "index.js",
55
"license": "MIT",
66
"scripts": {
7-
"test": "jest"
7+
"test": "bun test",
8+
"lint": "eslint"
89
},
910
"devDependencies": {
10-
"@babel/core": "^7.12.10",
11-
"@babel/preset-env": "^7.12.10",
12-
"@babel/preset-typescript": "^7.12.7",
13-
"@types/chai": "^4.2.14",
14-
"@types/jest": "^26.0.19",
15-
"@types/mocha": "^8.2.0",
16-
"@types/node": "^14.14.12",
17-
"@typescript-eslint/eslint-plugin": "^4.9.1",
18-
"@typescript-eslint/parser": "^4.9.1",
19-
"babel-jest": "^26.6.3",
20-
"eslint": "^7.15.0",
21-
"jest": "^26.6.3",
22-
"mocha": "^8.2.1",
23-
"ts-node": "^9.1.1",
24-
"typescript": "^4.1.3"
25-
},
26-
"jest": {
27-
"verbose": true
11+
"@typescript-eslint/eslint-plugin": "^6.13.2",
12+
"@typescript-eslint/parser": "^6.13.2",
13+
"bun-types": "^1.0.15"
2814
}
2915
}

src/2021/day00/test.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {expect, describe, beforeAll, it} from 'bun:test';
12
import {readInput} from '../../utils';
23

34
import {part1} from './part1';

src/2023/day00/input.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

src/2023/day00/part1.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function part1(input: string): string {
2+
return 'test';
3+
}

src/2023/day00/test.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {part1} from './part1';
2+
import input from './input.txt';
3+
4+
describe('Advent of Code 2023 - Day x', () => {
5+
describe('part 1', () => {
6+
test('should output test', () => {
7+
expect(part1(input)).toBe('test');
8+
});
9+
});
10+
});

src/utils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {promises} from 'fs';
2-
3-
export const readInput = async (file: string) => {
4-
return await promises.readFile(file).then((res) => String(res));
5-
};
1+
export async function readInput(file: string): Promise<string> {
2+
return Bun.file(file).text();
3+
}

0 commit comments

Comments
 (0)