This repository holds the official Topsort javascript client library. This project is built with TypeScript and uses Bun for package management and testing.
We'd love to accept your patches and contributions to this project. Bellow, you can find the guidelines on how to setup the project locally, test and code standards for top-notch contributions.
- Reporting Issues
- Local Installation
- Running Locally
- Building the SDK
- Tests
- Code Standards
- Submitting contributions
- Configuration
- License
Bugs, feature requests, and development-related questions should be directed to our GitHub issue tracker. If reporting a bug, please try and provide as much context as possible such as your operating system, Bun version, and anything else that might be relevant to the bug. For feature requests, please explain what you're trying to do, and how the requested feature would help you do that.
Security related bugs can either be reported in the issue tracker, or if they are more sensitive, emailed to [email protected].
To modify or interact with the source code, you need to install Bun (the runtime). Follow the instructions on the Bun website to install it.
You will additionally need typos for validating documentation and actionlint for validating actions. Install it through your package manager of choice (on MacOS: brew install typos-cli actionlint
).
Clone the repository and install the dependencies:
git clone [email protected]:Topsort/topsort.js.git
cd topsort.js
bun install
In order to run a local application and test it against the local Topsort.js you need to do the following (after having the SDK all set up on local machine):
On Topsort.js:
bun run build
bun link
This will set up a local @topsort/sdk
library to be used on another local project.
On the secondary project, if using bun, run:
bun link @topsort/sdk
Or add it in dependencies in the package.json file:
"@topsort/sdk": "link:@topsort/sdk"
To build the SDK, run the following command:
bun run build
This command compiles Typescript into Javascript, suitable for use in more runtimes and browsers.
To run the unit tests, use the following command:
bun run test
By default, the application is set to serve a web browser in the port 8080
for Playwright. If this port is already being used on your local machine, make sure you change the port in your .env
.SERVER_PORT
.
First, make sure you have all the dependencies installed:
bun install
To run the end-to-end tests, make sure you have installed the browsers supported by playwright by running this command:
bunx playwright install
Please refer to Playwright Documentation for details.
Then, use the following command to run a build and generate the bundled files and run the tests:
bun run test:e2e
We follow the coding standards set by Biome. Ensure your code follows these guidelines before submitting a pull request. You can run the formatter with the following command:
bun run format
To automatically fix issues:
bun run format:fix
We do conventional commits, so it will fail on checker with capital case after commit prefix. Refer to Conventional Commits spec or to Amannn's Github Action for Semantic Pull Request for details.
- Fork the repository.
- Create a new branch (git checkout -b feat/branch).
- Make your changes and commit them (git commit -m 'feat: adding new feature').
- Push to the branch (git push origin feat/branch).
- Open a pull request.
The SDK uses following configuration files:
tsconfig.json
: TypeScript configuration.tsup.config.ts
: Configuration for the TSUP bundler.playwright.config.ts
: Configuration for E2E tests runner
We also have the following variables as part of the .env
file:
PLAYWRIGHT_PORT
: Port used to run the local web browser to run Playwright E2E tests.
This project is licensed under the MIT License. See the LICENSE file for more details.