Skip to content

feat!: Port to TypeScript, closes #762#763

Merged
broofa merged 34 commits intomainfrom
ts_port
Jul 16, 2024
Merged

feat!: Port to TypeScript, closes #762#763
broofa merged 34 commits intomainfrom
ts_port

Conversation

@broofa
Copy link
Copy Markdown
Member

@broofa broofa commented Jun 10, 2024

Switching the codebase to Typescript.

  • Move src/.js -> src/.ts
  • add type annotations throughout
  • Prefer Uint8Array for binary uuids throughout (BREAKING CHANGE)
  • Port unit tests to TS
  • Switch test runner from jest to node:test
  • Switch to tsc for generating buidls
  • Get all checks passing

Other notes:

  • Changes to src/*.js files should be limited to...
    • Adding type annotations
    • Switching to Uint8Array for binary UUIDs
  • The examples/node-jest test passes, but I don't see it being run as part of CI or npm test anywhere. I'm tempted to remove it. 🤔
  • Updated to eslint@latest, and switched config to ESM.
  • Updated to @wdio/*@latest
  • Switched prettier config to ESM
  • Added VSCode configuration. @ctavan, iirc you've objected to this in the past, but these are very helpful to me and to other vscode users that may want to contribute to this codebase. Specifically:
    • tasks.json starts the build:watch and test:watch scripts automatically when you open the project
    • extensions.json identifies the plugins that devs should use to apply our eslint and prettier settings while editing code
  • Sorted package.json#scripts alphabetically
    • Added build:watch and test:watch scripts, which I'm using in vscode
  • Unit tests have been ported to TS, but should be functionally identical.
  • Tests and CI are run using the dist/esm directory (unless they're explicitely testing other dist/* builds.
  • build.sh now builds ESM and CJS versions of code using tsc rather than babel.
    • The top-level dist/*.js files can now be found in dist/esm, alongside the other builds (esm-browser, cjs, and cjs-browser)
  • Switched to using Uint8Array for binary (byte) UUID data structures throughout. The one exception is the return type for md5 and sha1 on node, which is still Buffer (but that's a subclass of Uint8Array these days anyways so... 🤷)

@broofa broofa linked an issue Jun 10, 2024 that may be closed by this pull request
@uuidjs uuidjs deleted a comment from Young8881 Jun 28, 2024
@broofa broofa deleted the ts_port branch July 17, 2024 13:14
molaeiali added a commit to molaeiali/uuid that referenced this pull request Aug 5, 2024
broofa pushed a commit that referenced this pull request Aug 7, 2024
…D from being used (#786)

* fix: remove options default assignment introduced during porting to ts, pull #763 preventing native.randomUUID being used

* test: add unit test to check if native randomUUID should be used or not
@veksa veksa mentioned this pull request Oct 29, 2024
2 tasks
marmitar added a commit to marmitar/thelounge that referenced this pull request Nov 17, 2025
Update dependencies still compatible with Node 18 and CommonJS, without
any code changes required.

Major version upgrades:
- [bcryptjs v3](https://github.com/dcodeIO/bcrypt.js/releases/tag/v3.0.0)
- [commander v13](https://github.com/tj/commander.js/releases/tag/v13.0.0)
- [mime-types v3](https://github.com/jshttp/mime-types/releases/tag/v3.0.0)
- [package-json v9](https://github.com/sindresorhus/package-json/releases/tag/v9.0.0)
- [uuid v11](https://github.com/uuidjs/uuid/releases/tag/v11.0.0)

Included type definitions:
- bcryptjs>=3.0.0 (dcodeIO/bcrypt.js@2f45985)
- uuid>=11.0.0 (uuidjs/uuid#763)
- sqlite3>=5.1.0 (TryGhost/node-sqlite3#1527)
marmitar added a commit to marmitar/thelounge that referenced this pull request Jan 31, 2026
Update dependencies still compatible with Node 18 and CommonJS, without
any code changes required.

Major version upgrades:
- [bcryptjs v3](https://github.com/dcodeIO/bcrypt.js/releases/tag/v3.0.0)
- [commander v13](https://github.com/tj/commander.js/releases/tag/v13.0.0)
- [mime-types v3](https://github.com/jshttp/mime-types/releases/tag/v3.0.0)
- [package-json v9](https://github.com/sindresorhus/package-json/releases/tag/v9.0.0)
- [uuid v11](https://github.com/uuidjs/uuid/releases/tag/v11.0.0)

Included type definitions:
- bcryptjs>=3.0.0 (dcodeIO/bcrypt.js@2f45985)
- uuid>=11.0.0 (uuidjs/uuid#763)
- sqlite3>=5.1.0 (TryGhost/node-sqlite3#1527)

Minor regression:
- socket.io-parser@4.2.5 not resolved correctly by Webpack
marmitar added a commit to marmitar/thelounge that referenced this pull request Feb 11, 2026
Update dependencies still compatible with Node 18 and CommonJS, without
any code changes required.

Major version upgrades:
- [bcryptjs v3](https://github.com/dcodeIO/bcrypt.js/releases/tag/v3.0.0)
- [commander v13](https://github.com/tj/commander.js/releases/tag/v13.0.0)
- [mime-types v3](https://github.com/jshttp/mime-types/releases/tag/v3.0.0)
- [package-json v9](https://github.com/sindresorhus/package-json/releases/tag/v9.0.0)
- [uuid v11](https://github.com/uuidjs/uuid/releases/tag/v11.0.0)

Included type definitions:
- bcryptjs>=3.0.0 (dcodeIO/bcrypt.js@2f45985)
- uuid>=11.0.0 (uuidjs/uuid#763)
- sqlite3>=5.1.0 (TryGhost/node-sqlite3#1527)

Minor regression:
- socket.io-parser@4.2.5 not resolved correctly by Webpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port codebase to TypeScript Make Uint8Array the one and only type used for binary (byte) uuid values

2 participants