Skip to content

Commit e172c79

Browse files
cinderblockclaude
andcommitted
Switch to bun, add unit + integration tests
Replaces ts-node / ts-node-dev with bun for both running and watching. Bun runs the existing TypeScript directly with no transpile step, and its built-in test runner is what the new tests use. - npm scripts rewritten in terms of `bun run` / `bun --watch run` - Removed unused `node`, `@types/node`, `ts-node`, `ts-node-dev` deps - Added `@types/bun` for `bun:test` types - Dropped `package-lock.json` in favor of `bun.lock` - `engines` now asks for bun >= 1.0 Tests live alongside source under `src/*.test.ts`: - `encode.test.ts` covers `headerFor` and `inferOutFile` helpers (those are now exported from `encode.ts` so they're testable in isolation). - `roundtrip.test.ts` writes a fixture XML to a temp dir, encodes it, decodes the result, and asserts byte-identical recovery — for both `.ewprj` and `.ms14` headers, for a payload large enough to span more than one PKWare section, and for an empty payload. `bun test` runs all 11 tests; README documents `bun install` / `bun run ewd` / `bun run ewe` / `bun test`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0e8b20c commit e172c79

7 files changed

Lines changed: 846 additions & 8639 deletions

File tree

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ big files into 900 000-decompressed-byte sections; `ewe` mirrors that.
1313

1414
## Install
1515

16+
Requires [bun](https://bun.sh) (≥ 1.0).
17+
1618
```bash
17-
npm i
19+
bun install
1820
```
1921

2022
## Decode
2123

2224
```bash
23-
npm run ewd -- --verbose ./samples/Temp.ewprj ./samples/Design1.ms14
25+
bun run ewd --verbose ./samples/Temp.ewprj ./samples/Design1.ms14
2426
```
2527

2628
For each input, writes `<filename>.xml` next to it.
@@ -34,9 +36,9 @@ Options:
3436
## Encode
3537

3638
```bash
37-
npm run ewe -- --verbose ./samples/Temp.ewprj.xml
39+
bun run ewe --verbose ./samples/Temp.ewprj.xml
3840
# or with explicit output:
39-
npm run ewe -- --output ./out.ewprj ./samples/Temp.ewprj.xml
41+
bun run ewe --output ./out.ewprj ./samples/Temp.ewprj.xml
4042
```
4143

4244
By default, strips a trailing `.xml` from each input to derive the output
@@ -59,11 +61,21 @@ still valid: a decode/encode/decode round-trip on every sample tested
5961
produces byte-identical XML, and the resulting files are accepted by
6062
`ewd`. Improving compression density is a `node-pkware` problem.
6163

64+
## Tests
65+
66+
```bash
67+
bun test
68+
```
69+
70+
Covers unit tests for the encoder's filename helpers and round-trip
71+
integration tests (tiny `.ewprj`, tiny `.ms14`, multi-block payload that
72+
spans more than one PKWare section, and an empty payload).
73+
6274
## Development
6375

6476
```bash
65-
npm run dev:ewd -- --verbose ./samples/Temp.ewprj
66-
npm run dev:ewe -- --verbose ./samples/Temp.ewprj.xml
77+
bun run dev:ewd --verbose ./samples/Temp.ewprj
78+
bun run dev:ewe --verbose ./samples/Temp.ewprj.xml
6779
```
6880

69-
Both use `ts-node-dev` for fast reload.
81+
Both use `bun --watch` for fast reload on source changes.

bun.lock

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

0 commit comments

Comments
 (0)