Skip to content

Commit ab382b4

Browse files
authored
feat: upgrade to node 24 + migrate to bun (#65)
1 parent ce8cdf9 commit ab382b4

File tree

16 files changed

+348
-7545
lines changed

16 files changed

+348
-7545
lines changed

.github/dependabot.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
version: 2
22
updates:
3-
- package-ecosystem: 'github-actions'
3+
- package-ecosystem: "github-actions"
44
directory: /
55
schedule:
66
interval: weekly
77
groups:
88
actions-deps:
99
patterns:
10-
- '*'
10+
- "*"
1111

12-
- package-ecosystem: npm
12+
- package-ecosystem: bun
1313
directory: /
1414
schedule:
1515
interval: monthly
1616
groups:
1717
security-updates:
1818
applies-to: security-updates
1919
patterns:
20-
- '*'
20+
- "*"
2121
major-updates:
2222
applies-to: version-updates
2323
update-types:
24-
- 'major'
24+
- "major"
2525
minor-updates:
2626
applies-to: version-updates
2727
update-types:
28-
- 'minor'
29-
- 'patch'
28+
- "minor"
29+
- "patch"

.github/workflows/build.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v6
1313

14-
- uses: actions/setup-node@v6
14+
- uses: oven-sh/setup-bun@v2
1515
with:
16-
node-version: 22
17-
cache: "npm"
16+
bun-version: 1.3.11
1817

1918
- name: Install dependencies
20-
run: npm install
19+
run: bun install
2120

2221
- name: Run all checks
23-
run: npm run all
22+
run: bun run all

.github/workflows/update-tags.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Update aggregate tags"
2+
on:
3+
push:
4+
tags:
5+
- "v*.*"
6+
7+
jobs:
8+
retag:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v6
12+
with:
13+
fetch-depth: 0
14+
- name: Calculate short tag name
15+
id: calculate_short_tag
16+
run: |
17+
TRUNC_VER=$(echo ${{ github.ref_name }} | cut -d '.' -f 1)
18+
echo "Short tag: $TRUNC_VER"
19+
echo "tag=$TRUNC_VER" >> $GITHUB_OUTPUT
20+
- uses: rickstaa/action-create-tag@v1
21+
permissions:
22+
contents: write
23+
with:
24+
force_push_tag: true
25+
tag: "${{ steps.calculate_short_tag.outputs.tag }}"
26+
message: "Points to ${{ github.ref_name }}"

.gitignore

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,13 @@
11
# Dependency directory
22
node_modules
33

4-
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5-
# Logs
6-
logs
7-
*.log
8-
npm-debug.log*
9-
yarn-debug.log*
10-
yarn-error.log*
11-
lerna-debug.log*
12-
13-
# Diagnostic reports (https://nodejs.org/api/report.html)
14-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15-
16-
# Runtime data
17-
pids
18-
*.pid
19-
*.seed
20-
*.pid.lock
21-
22-
# Directory for instrumented libs generated by jscoverage/JSCover
23-
lib-cov
24-
25-
# Coverage directory used by tools like istanbul
26-
coverage
27-
*.lcov
28-
29-
# nyc test coverage
30-
.nyc_output
31-
32-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33-
.grunt
34-
35-
# Bower dependency directory (https://bower.io/)
36-
bower_components
37-
38-
# node-waf configuration
39-
.lock-wscript
40-
41-
# Compiled binary addons (https://nodejs.org/api/addons.html)
42-
build/Release
43-
44-
# Dependency directories
45-
jspm_packages/
46-
47-
# TypeScript v1 declaration files
48-
typings/
49-
50-
# TypeScript cache
51-
*.tsbuildinfo
52-
53-
# Optional npm cache directory
54-
.npm
55-
56-
# Optional eslint cache
57-
.eslintcache
58-
59-
# Optional REPL history
60-
.node_repl_history
61-
62-
# Output of 'npm pack'
63-
*.tgz
64-
65-
# Yarn Integrity file
66-
.yarn-integrity
67-
684
# dotenv environment variables file
695
.env
706
.env.test
717

72-
# parcel-bundler cache (https://parceljs.org/)
73-
.cache
74-
75-
# next.js build output
76-
.next
77-
78-
# nuxt.js build output
79-
.nuxt
80-
81-
# vuepress build output
82-
.vuepress/dist
83-
84-
# Serverless directories
85-
.serverless/
86-
87-
# FuseBox cache
88-
.fusebox/
89-
90-
# DynamoDB Local files
91-
.dynamodb/
92-
938
# OS metadata
949
.DS_Store
9510
Thumbs.db
9611

9712
# Ignore built ts files
98-
__tests__/runner/*
9913
lib

__tests__/main.test.ts

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,34 @@ type TestFile = {
2626
};
2727
const TEST_FILES: TestFile[] = [
2828
{
29+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file2_deleted.txt%0A@@ -1,4 +1,3 @@%0A A%0A-B%0A C%0A D%0A",
2930
path: "file2_deleted.txt",
3031
tolerance: "worse",
31-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file2_deleted.txt%0A@@ -1,4 +1,3 @@%0A A%0A-B%0A C%0A D%0A",
3232
},
3333
{
34+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file3_same.txt%0A",
3435
path: "file3_same.txt",
3536
tolerance: "same",
36-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file3_same.txt%0A",
3737
},
3838
{
39+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file4_added.txt%0A@@ -1,4 +1,5 @@%0A A%0A B%0A C%0A D%0A+E%0A",
3940
path: "file4_added.txt",
4041
tolerance: "better",
41-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file4_added.txt%0A@@ -1,4 +1,5 @@%0A A%0A B%0A C%0A D%0A+E%0A",
4242
},
4343
{
44+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file5_mixed.txt%0A@@ -1,4 +1,4 @@%0A A%0A B%0A-C%0A D%0A+E%0A",
4445
path: "file5_mixed.txt",
4546
tolerance: "mixed",
46-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file5_mixed.txt%0A@@ -1,4 +1,4 @@%0A A%0A B%0A-C%0A D%0A+E%0A",
4747
},
4848
{
49+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file6_mixed_added.txt%0A@@ -1,4 +1,5 @@%0A A%0A B%0A-C%0A D%0A+E%0A+F%0A",
4950
path: "file6_mixed_added.txt",
5051
tolerance: "mixed-better",
51-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file6_mixed_added.txt%0A@@ -1,4 +1,5 @@%0A A%0A B%0A-C%0A D%0A+E%0A+F%0A",
5252
},
5353
{
54+
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file7_mixed_deleted.txt%0A@@ -1,4 +1,3 @@%0A A%0A B%0A-C%0A-D%0A+E%0A",
5455
path: "file7_mixed_deleted.txt",
5556
tolerance: "mixed-worse",
56-
diff: "===================================================================%0A--- FIXTURES/file1_basic.txt%0A+++ FIXTURES/file7_mixed_deleted.txt%0A@@ -1,4 +1,3 @@%0A A%0A B%0A-C%0A-D%0A+E%0A",
5757
},
5858
];
5959

@@ -95,8 +95,8 @@ describe("run action", () => {
9595
};
9696

9797
const parseOutput = (actionOutput: string): ActionOutputs => {
98-
let passed: boolean | undefined = undefined;
99-
let output: string | undefined = undefined;
98+
let passed: boolean | undefined;
99+
let output: string | undefined;
100100
for (const line of actionOutput.split("\n")) {
101101
if (line.startsWith("::set-output name=passed::")) {
102102
passed = line.split("::set-output name=passed::")[1] === "true";
@@ -108,7 +108,7 @@ describe("run action", () => {
108108
if (passed === undefined || output === undefined) {
109109
throw new Error("Action did not return expected output");
110110
}
111-
return { passed, output };
111+
return { output, passed };
112112
};
113113

114114
const runAction = (
@@ -122,7 +122,7 @@ describe("run action", () => {
122122
process.env.INPUT_TOLERANCE = tolerance.toString();
123123
process.env.INPUT_MODE = mode.toString();
124124
process.env.GITHUB_OUTPUT = "";
125-
const main = path.join(__dirname, "..", "lib", "main.js");
125+
const main = path.join(__dirname, "..", "dist", "index.js");
126126
const options: cp.ExecSyncOptions = {
127127
env: process.env,
128128
};
@@ -160,25 +160,25 @@ describe("run action", () => {
160160
const cases = ((): Case[] => {
161161
const cases: Case[] = [
162162
{
163+
expectError: true,
164+
mode: "strict",
163165
name: "an unknown file",
164166
newFile: "do not exist . whatever",
165-
mode: "strict",
166167
tolerance: "same",
167-
expectError: true,
168168
},
169169
{
170+
expectError: true,
171+
mode: "mixed" as unknown as Mode,
170172
name: "an unknown mode",
171173
newFile: TEST_FILES[0].path,
172-
mode: "mixed" as unknown as Mode,
173174
tolerance: "same",
174-
expectError: true,
175175
},
176176
{
177+
expectError: true,
178+
mode: "addition",
177179
name: "an unknown tolerance",
178180
newFile: TEST_FILES[0].path,
179-
mode: "addition",
180181
tolerance: "high" as unknown as Tolerance,
181-
expectError: true,
182182
},
183183
];
184184

@@ -195,13 +195,13 @@ describe("run action", () => {
195195
result = "an error";
196196
}
197197
cases.push({
198+
expectError,
199+
expectedOutput: file.diff,
200+
expectedPass,
201+
mode: mode,
198202
name: `file ${file.path}, mode ${mode}, tolerance ${tolerance} and expecting ${result}`,
199203
newFile: file.path,
200204
tolerance: tolerance,
201-
mode: mode,
202-
expectedPass,
203-
expectedOutput: file.diff,
204-
expectError,
205205
});
206206
}
207207
}
@@ -210,34 +210,31 @@ describe("run action", () => {
210210
return cases;
211211
})();
212212

213-
test.each(cases)(
214-
"with $name",
215-
({
216-
newFile,
213+
test.each(cases)("with $name", ({
214+
newFile,
215+
tolerance,
216+
mode,
217+
expectedPass,
218+
expectedOutput,
219+
expectError,
220+
}: Case) => {
221+
if (expectError) {
222+
expect(() => {
223+
runAction(BASE_FILE, newFile, tolerance, mode);
224+
}).toThrow();
225+
return;
226+
}
227+
const { passed, output } = runAction(
228+
BASE_FILE,
229+
path.join(FIXTURES_FOLDER, newFile),
217230
tolerance,
218231
mode,
219-
expectedPass,
232+
);
233+
expect(passed).toBe(expectedPass);
234+
expect(output.replace(new RegExp(FIXTURES_FOLDER, "g"), "FIXTURES")).toBe(
220235
expectedOutput,
221-
expectError,
222-
}: Case) => {
223-
if (expectError) {
224-
expect(() => {
225-
runAction(BASE_FILE, newFile, tolerance, mode);
226-
}).toThrow();
227-
return;
228-
}
229-
const { passed, output } = runAction(
230-
BASE_FILE,
231-
path.join(FIXTURES_FOLDER, newFile),
232-
tolerance,
233-
mode,
234-
);
235-
expect(passed).toBe(expectedPass);
236-
expect(output.replace(new RegExp(FIXTURES_FOLDER, "g"), "FIXTURES")).toBe(
237-
expectedOutput,
238-
);
239-
},
240-
);
236+
);
237+
});
241238
});
242239

243240
// TODO: missing tests for notifications?

0 commit comments

Comments
 (0)