Skip to content

Commit a2585ea

Browse files
authored
Merge pull request #21 from seigel/chore/node22-modernize
chore: modernize to Node 22, Jest 30, native ESM
2 parents 8087bd1 + 5bbbe4f commit a2585ea

24 files changed

Lines changed: 4876 additions & 7997 deletions

.babelrc

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

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [ 12.x, 14.x, 16.x ]
19+
node-version: [ 22.x ]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828
cache: 'npm'

package-lock.json

Lines changed: 4798 additions & 7908 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
"version": "1.0.0",
44
"description": "Freeing the information contained in networked fencing scoring machines by providing an ecosystem of services that allows everyone to set up events with more automation.",
55
"main": "index.js",
6-
"type": "commonjs",
6+
"type": "module",
77
"scripts": {
88
"clean": "rm -rf ./node_modules && npm i",
9-
"build": "./node_modules/.bin/esbuild --platform=node --minify --bundle index.js --outdir=build",
10-
"start": "node ./build/index.js",
11-
"demo": "./node_modules/.bin/esbuild --platform=node --bundle demo/run.js --outfile=build/demo.js && node build/demo.js",
12-
"test": "node --experimental-vm-modules --input-type=module node_modules/jest/bin/jest.js",
13-
"coverage": "jest --collect-coverage"
9+
"start": "node index.js",
10+
"demo": "node demo/run.js",
11+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12+
"coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --collect-coverage"
1413
},
1514
"repository": {
1615
"type": "git",
@@ -26,9 +25,14 @@
2625
"url": "https://github.com/seigel/cyrano/issues"
2726
},
2827
"homepage": "https://github.com/seigel/cyrano#readme",
28+
"jest": {
29+
"testPathIgnorePatterns": ["/node_modules/", "/.claude/"],
30+
"transform": {}
31+
},
32+
"engines": {
33+
"node": ">=22"
34+
},
2935
"devDependencies": {
30-
"@babel/preset-env": "^7.16.11",
31-
"esbuild": "^0.25.0",
32-
"jest": "^27.5.1"
36+
"jest": "^30.2.0"
3337
}
3438
}

src/commands/index.js

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
1+
import * as ack from "./ack.js";
2+
import * as boutstop from "./boutstop.js";
3+
import * as broken from "./broken.js";
4+
import * as deny from "./deny.js";
5+
import * as disp from "./disp.js";
6+
import * as getteam from "./getteam.js";
7+
import * as hello from "./hello.js";
8+
import * as info from "./info.js";
9+
import * as msg from "./msg.js";
10+
import * as nak from "./nak.js";
11+
import * as next from "./next.js";
12+
import * as ping from "./ping.js";
13+
import * as prev from "./prev.js";
14+
import * as replace from "./replace.js";
15+
import * as standby from "./standby.js";
16+
import * as stop from "./stop.js";
17+
import * as team from "./team.js";
18+
import * as updated from "./updated.js";
19+
120
const dictionary = {}
221
const builders = {}
3-
require("./ack").register(dictionary);
4-
require("./ack").registerBuilder(builders);
5-
require("./boutstop").register(dictionary);
6-
require("./boutstop").registerBuilder(builders);
7-
require("./broken").register(dictionary);
8-
require("./broken").registerBuilder(builders);
9-
require("./deny").register(dictionary);
10-
require("./deny").registerBuilder(builders);
11-
require("./disp").register(dictionary);
12-
require("./disp").registerBuilder(builders);
13-
require("./getteam").register(dictionary);
14-
require("./getteam").registerBuilder(builders);
15-
require("./hello").register(dictionary);
16-
require("./hello").registerBuilder(builders);
17-
require("./info").register(dictionary);
18-
require("./info").registerBuilder(builders);
19-
require("./msg").register(dictionary);
20-
require("./msg").registerBuilder(builders);
21-
require("./nak").register(dictionary);
22-
require("./nak").registerBuilder(builders);
23-
require("./next").register(dictionary);
24-
require("./next").registerBuilder(builders);
25-
require("./ping").register(dictionary);
26-
require("./ping").registerBuilder(builders);
27-
require("./prev").register(dictionary);
28-
require("./prev").registerBuilder(builders);
29-
require("./replace").register(dictionary);
30-
require("./replace").registerBuilder(builders);
31-
require("./standby").register(dictionary);
32-
require("./standby").registerBuilder(builders);
33-
require("./stop").register(dictionary);
34-
require("./stop").registerBuilder(builders);
35-
require("./team").register(dictionary);
36-
require("./team").registerBuilder(builders);
37-
require("./updated").register(dictionary);
38-
require("./updated").registerBuilder(builders);
22+
23+
const modules = [ack, boutstop, broken, deny, disp, getteam, hello, info, msg, nak, next, ping, prev, replace, standby, stop, team, updated];
24+
for (const mod of modules) {
25+
mod.register(dictionary);
26+
mod.registerBuilder(builders);
27+
}
28+
3929
export default dictionary;
4030
export { builders };

tests/commands/ack.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('#parse', () => {
1515
describe('invalid length of tokens', function () {
1616
test('problem with token length for this parser', () => {
1717
expect(() => { parse(["HI"]); })
18-
.toThrowError(`Incompatible command tokens for >${ACK_COMMAND}<. Expected 0, Got: 1`);
18+
.toThrow(`Incompatible command tokens for >${ACK_COMMAND}<. Expected 0, Got: 1`);
1919
});
2020
test('no issue with null tokens', () => {
2121
expect(() => { parse(null); }).not.toThrow();

tests/commands/boutstop.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ describe('#parse', () => {
2828
() => {
2929
parse(["HI", "THERE"]);
3030
}
31-
).toThrowError(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 2`);
31+
).toThrow(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 2`);
3232
});
3333

3434
test('no issue with null tokens', () => {
3535
expect(
3636
() => {
3737
parse(null);
3838
}
39-
).toThrowError(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 0`);
39+
).toThrow(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 0`);
4040
});
4141
});
4242

tests/commands/broken.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ describe('#parse', () => {
1515
describe('invalid length of tokens', function () {
1616
test('problem with token length for this parser', () => {
1717
expect(() => { parse(["HI", "THERE"]); })
18-
.toThrowError(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 2`);
18+
.toThrow(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 2`);
1919
});
2020
test('no issue with null tokens', () => {
2121
expect(() => { parse(null); })
22-
.toThrowError(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 0`);
22+
.toThrow(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 0`);
2323
});
2424
});
2525

tests/commands/deny.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ describe('#parse', () => {
1515
describe('invalid length of tokens', function () {
1616
test('problem with token length for this parser', () => {
1717
expect(() => { parse(["HI", "THERE"]); })
18-
.toThrowError(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 2`);
18+
.toThrow(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 2`);
1919
});
2020
test('no issue with null tokens', () => {
2121
expect(() => { parse(null); })
22-
.toThrowError(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 0`);
22+
.toThrow(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 0`);
2323
});
2424
});
2525

tests/commands/disp.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ describe('#parse', () => {
3030
() => {
3131
parse(["HI", "THERE"]);
3232
}
33-
).toThrowError("Incompatible command tokens for >DISP<. Expected 18, Got: 2");
33+
).toThrow("Incompatible command tokens for >DISP<. Expected 18, Got: 2");
3434
});
3535

3636
test('no tokens provided', () => {
3737
expect(
3838
() => {
3939
parse(null);
4040
}
41-
).toThrowError("Incompatible command tokens for >DISP<. Expected 18, Got: 0");
41+
).toThrow("Incompatible command tokens for >DISP<. Expected 18, Got: 0");
4242
});
4343
});
4444

0 commit comments

Comments
 (0)