This document describes the process for setting up and running this package on your local computer.
This package is for Node.js. You can install Node.js here.
This package runs on MacOS, Linux, and Windows environments, and runs on Node.js versions tested back to version 14.
- Clone the repository
git clone https://github.com/samhuk/verba.git && cd verba - Install NPM dependencies:
npm i
ESLint is used for Typescript linting. To lint the Typescript code, run npm run lint. To only lint for errors (excluding warnings), run npm run lint:errors.
To build all of the Typescript code, run npm run build.
To only build the Typescript code that is published to npm, run npm run build:dist.
Jest is used for unit testing. To build and run the unit tests, run npm run test:unit.
The unit tests can be debugged with Visual Studio Code by running the Unit test current file debug task.
An example app that fully demonstrates the usage of Verba is at ./examples/app.
To run the example:
- Clone repository:
git clone https://github.com/samhuk/verba.git && cd verba
- Install NPM dependencies:
npm i
- Run:
npm run example
- Alternatively, run the example app that errors to demonstrate error emission and handling:
npm run example:error
npm run check - Useful to run before committing in order to check the full validity of a change. This runs linting, Typescript build, and unit tests.
Pull requests automatically run a CI pipeline that checks various criteria:
- Linting
- Typescript build
- Unit tests
These must pass for a pull request to be approved and merged.
Typical flow for publishing a new version:
- Ensure that
package.jsonhas a bumpedversion. - Run
npm run check-and-distin order to check the validity of the code and then build the Typescript that is published to NPM. - Run
npm publishto publish to npm.
This package is, as of writing, compatible with Bun. The following table shows how Bun can be used for this repository.
| Task | Node.js command | Bun equivalent | Uses Bun engine? [0] |
|---|---|---|---|
| Install deps | npm install | bun install | ✅ |
| Lint | npm run lint | bun lint | ❌ |
| Test | npm run test | bun run test | ❌ |
| Build | npm run build | bun run build | ❌ |
| Run example app | npm run example | bun run example | ❌ |
| Test (with Bun) | N/A | bun test | ✅ |
| Run example app (with Bun) | N/A | bun ./examples/app.ts | ✅ |
[0] The Uses Bun engine? column refers to whether the command ends up just using NPM and Node, or if it runs completely with Bun (and therefore will have greatly improved performance). For example, bun test is ~8x faster than npm run test and bun run test.