Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:

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

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
12,706 changes: 4,798 additions & 7,908 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
"version": "1.0.0",
"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.",
"main": "index.js",
"type": "commonjs",
"type": "module",
"scripts": {
"clean": "rm -rf ./node_modules && npm i",
"build": "./node_modules/.bin/esbuild --platform=node --minify --bundle index.js --outdir=build",
"start": "node ./build/index.js",
"demo": "./node_modules/.bin/esbuild --platform=node --bundle demo/run.js --outfile=build/demo.js && node build/demo.js",
"test": "node --experimental-vm-modules --input-type=module node_modules/jest/bin/jest.js",
"coverage": "jest --collect-coverage"
"start": "node index.js",
"demo": "node demo/run.js",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --collect-coverage"
},
"repository": {
"type": "git",
Expand All @@ -26,9 +25,14 @@
"url": "https://github.com/seigel/cyrano/issues"
},
"homepage": "https://github.com/seigel/cyrano#readme",
"jest": {
"testPathIgnorePatterns": ["/node_modules/", "/.claude/"],
"transform": {}
},
"engines": {
"node": ">=22"
},
"devDependencies": {
"@babel/preset-env": "^7.16.11",
"esbuild": "^0.25.0",
"jest": "^27.5.1"
"jest": "^30.2.0"
}
}
62 changes: 26 additions & 36 deletions src/commands/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
import * as ack from "./ack.js";
import * as boutstop from "./boutstop.js";
import * as broken from "./broken.js";
import * as deny from "./deny.js";
import * as disp from "./disp.js";
import * as getteam from "./getteam.js";
import * as hello from "./hello.js";
import * as info from "./info.js";
import * as msg from "./msg.js";
import * as nak from "./nak.js";
import * as next from "./next.js";
import * as ping from "./ping.js";
import * as prev from "./prev.js";
import * as replace from "./replace.js";
import * as standby from "./standby.js";
import * as stop from "./stop.js";
import * as team from "./team.js";
import * as updated from "./updated.js";

const dictionary = {}
const builders = {}
require("./ack").register(dictionary);
require("./ack").registerBuilder(builders);
require("./boutstop").register(dictionary);
require("./boutstop").registerBuilder(builders);
require("./broken").register(dictionary);
require("./broken").registerBuilder(builders);
require("./deny").register(dictionary);
require("./deny").registerBuilder(builders);
require("./disp").register(dictionary);
require("./disp").registerBuilder(builders);
require("./getteam").register(dictionary);
require("./getteam").registerBuilder(builders);
require("./hello").register(dictionary);
require("./hello").registerBuilder(builders);
require("./info").register(dictionary);
require("./info").registerBuilder(builders);
require("./msg").register(dictionary);
require("./msg").registerBuilder(builders);
require("./nak").register(dictionary);
require("./nak").registerBuilder(builders);
require("./next").register(dictionary);
require("./next").registerBuilder(builders);
require("./ping").register(dictionary);
require("./ping").registerBuilder(builders);
require("./prev").register(dictionary);
require("./prev").registerBuilder(builders);
require("./replace").register(dictionary);
require("./replace").registerBuilder(builders);
require("./standby").register(dictionary);
require("./standby").registerBuilder(builders);
require("./stop").register(dictionary);
require("./stop").registerBuilder(builders);
require("./team").register(dictionary);
require("./team").registerBuilder(builders);
require("./updated").register(dictionary);
require("./updated").registerBuilder(builders);

const modules = [ack, boutstop, broken, deny, disp, getteam, hello, info, msg, nak, next, ping, prev, replace, standby, stop, team, updated];
for (const mod of modules) {
mod.register(dictionary);
mod.registerBuilder(builders);
}

export default dictionary;
export { builders };
2 changes: 1 addition & 1 deletion tests/commands/ack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI"]); })
.toThrowError(`Incompatible command tokens for >${ACK_COMMAND}<. Expected 0, Got: 1`);
.toThrow(`Incompatible command tokens for >${ACK_COMMAND}<. Expected 0, Got: 1`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); }).not.toThrow();
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/boutstop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE"]);
}
).toThrowError(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 2`);
).toThrow(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 2`);
});

test('no issue with null tokens', () => {
expect(
() => {
parse(null);
}
).toThrowError(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 0`);
).toThrow(`Incompatible command tokens for >${BOUTSTOP_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/broken.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 2`);
.toThrow(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 0`);
.toThrow(`Incompatible command tokens for >${BROKEN_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/deny.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 2`);
.toThrow(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 0`);
.toThrow(`Incompatible command tokens for >${DENY_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/disp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE"]);
}
).toThrowError("Incompatible command tokens for >DISP<. Expected 18, Got: 2");
).toThrow("Incompatible command tokens for >DISP<. Expected 18, Got: 2");
});

test('no tokens provided', () => {
expect(
() => {
parse(null);
}
).toThrowError("Incompatible command tokens for >DISP<. Expected 18, Got: 0");
).toThrow("Incompatible command tokens for >DISP<. Expected 18, Got: 0");
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/getteam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI"]); })
.toThrowError(`Incompatible command tokens for >${GETTEAM_COMMAND}<. Expected 2, Got: 1`);
.toThrow(`Incompatible command tokens for >${GETTEAM_COMMAND}<. Expected 2, Got: 1`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${GETTEAM_COMMAND}<. Expected 2, Got: 0`);
.toThrow(`Incompatible command tokens for >${GETTEAM_COMMAND}<. Expected 2, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/hello.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE", "MONKEY"]);
}
).toThrowError("Incompatible command tokens for >HELLO<. Expected 0 or 1, Got: 3");
).toThrow("Incompatible command tokens for >HELLO<. Expected 0 or 1, Got: 3");
});

test('problem with token length for this parser', () => {
expect(
() => {
parse(null);
}
).not.toThrowError("Incompatible command tokens for >HELLO<. Expected 0 or 1, Got: 3");
).not.toThrow("Incompatible command tokens for >HELLO<. Expected 0 or 1, Got: 3");
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${INFO_COMMAND}<. Expected 42, Got: 2`);
.toThrow(`Incompatible command tokens for >${INFO_COMMAND}<. Expected 42, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${INFO_COMMAND}<. Expected 42, Got: 0`);
.toThrow(`Incompatible command tokens for >${INFO_COMMAND}<. Expected 42, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/msg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE", "MONKEY", "Honey", "BUNCH"]);
}
).toThrowError(`Incompatible command tokens for >${MSG_COMMAND}<. Expected 2, Got: 5`);
).toThrow(`Incompatible command tokens for >${MSG_COMMAND}<. Expected 2, Got: 5`);
});

test('no issue with token length for this parser', () => {
expect(
() => {
parse(null);
}
).not.toThrowError("Anything");
).not.toThrow("Anything");
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/commands/nak.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI"]); })
.toThrowError(`Incompatible command tokens for >${NAK_COMMAND}<. Expected 0, Got: 1`);
.toThrow(`Incompatible command tokens for >${NAK_COMMAND}<. Expected 0, Got: 1`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); }).not.toThrow();
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/next.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${NEXT_COMMAND}<. Expected 1, Got: 2`);
.toThrow(`Incompatible command tokens for >${NEXT_COMMAND}<. Expected 1, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${NEXT_COMMAND}<. Expected 1, Got: 0`);
.toThrow(`Incompatible command tokens for >${NEXT_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/ping.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE", "MONKEY"]); })
.toThrowError(`Incompatible command tokens for >${PING_COMMAND}<. Expected 0, Got: 3`);
.toThrow(`Incompatible command tokens for >${PING_COMMAND}<. Expected 0, Got: 3`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); }).not.toThrowError("Anything");
expect(() => { parse(null); }).not.toThrow("Anything");
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/prev.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${PREV_COMMAND}<. Expected 1, Got: 2`);
.toThrow(`Incompatible command tokens for >${PREV_COMMAND}<. Expected 1, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${PREV_COMMAND}<. Expected 1, Got: 0`);
.toThrow(`Incompatible command tokens for >${PREV_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/replace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE"]);
}
).toThrowError(`Incompatible command tokens for >${REPLACE_COMMAND}<. Expected 3, Got: 2`);
).toThrow(`Incompatible command tokens for >${REPLACE_COMMAND}<. Expected 3, Got: 2`);
});

test('no issue with null tokens', () => {
expect(
() => {
parse(null);
}
).toThrowError(`Incompatible command tokens for >${REPLACE_COMMAND}<. Expected 3, Got: 0`);
).toThrow(`Incompatible command tokens for >${REPLACE_COMMAND}<. Expected 3, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/standby.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE"]); })
.toThrowError(`Incompatible command tokens for >${STANDBY_COMMAND}<. Expected 1, Got: 2`);
.toThrow(`Incompatible command tokens for >${STANDBY_COMMAND}<. Expected 1, Got: 2`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${STANDBY_COMMAND}<. Expected 1, Got: 0`);
.toThrow(`Incompatible command tokens for >${STANDBY_COMMAND}<. Expected 1, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/stop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI", "THERE", "MONKEY"]); })
.toThrowError(`Incompatible command tokens for >${STOP_COMMAND}<. Expected 0, Got: 3`);
.toThrow(`Incompatible command tokens for >${STOP_COMMAND}<. Expected 0, Got: 3`);
});
test('no issue with token length for this parser', () => {
expect(() => { parse(null); }).not.toThrowError("Anything");
expect(() => { parse(null); }).not.toThrow("Anything");
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/team.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ describe('#parse', () => {
() => {
parse(["HI", "THERE"]);
}
).toThrowError(`Incompatible command tokens for >${TEAM_COMMAND}<. Expected 20, Got: 2`);
).toThrow(`Incompatible command tokens for >${TEAM_COMMAND}<. Expected 20, Got: 2`);
});

test('no issue with null tokens', () => {
expect(
() => {
parse(null);
}
).toThrowError(`Incompatible command tokens for >${TEAM_COMMAND}<. Expected 20, Got: 0`);
).toThrow(`Incompatible command tokens for >${TEAM_COMMAND}<. Expected 20, Got: 0`);
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/commands/updated.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('#parse', () => {
describe('invalid length of tokens', function () {
test('problem with token length for this parser', () => {
expect(() => { parse(["HI"]); })
.toThrowError(`Incompatible command tokens for >${UPDATED_COMMAND}<. Expected 2, Got: 1`);
.toThrow(`Incompatible command tokens for >${UPDATED_COMMAND}<. Expected 2, Got: 1`);
});
test('no issue with null tokens', () => {
expect(() => { parse(null); })
.toThrowError(`Incompatible command tokens for >${UPDATED_COMMAND}<. Expected 2, Got: 0`);
.toThrow(`Incompatible command tokens for >${UPDATED_COMMAND}<. Expected 2, Got: 0`);
});
});

Expand Down
Loading