Skip to content

Contributing to DSA Toolbox

Héla Ben Khalfallah edited this page Nov 10, 2024 · 1 revision

We welcome contributions to DSA Toolbox! Here's a guide to help you get started:

1. Fork the repository 🍴

Start by forking the repository and cloning it to your local machine. This will allow you to make changes and contribute back.

2. Set up the development environment 🛠️

Once you've cloned the repo, install the necessary dependencies by running:

pnpm install

3. Available Scripts 🔨

Below are some important npm scripts you can use during development:

  • update-docs: Cleans up the docs folder and regenerates documentation using Typedoc.

    pnpm update-docs
  • build: Compiles the TypeScript files and outputs them in the dist folder.

    pnpm build
  • bench-ds: Benchmarks data structures and watches changes.

    pnpm bench-ds
  • bench-algo: Benchmarks algorithms and watches changes.

    pnpm bench-algo
  • lint: Runs the linter to check your code for style and consistency.

    pnpm lint
  • lint:fix: Automatically fixes linting issues in the code.

    pnpm lint:fix
  • format: Formats the codebase using Prettier.

    pnpm format
  • test: Runs tests with coverage using Vitest.

    pnpm test
  • test:watch: Watches and runs tests continuously while developing.

    pnpm test:watch
  • test:ui: Opens the Vitest UI to interactively run and debug tests.

    pnpm test:ui
  • prepare: Runs Husky to set up git hooks for pre-commit and pre-push.

    pnpm prepare

4. Building and Deploying Documentation 📚

We use GitHub Actions to automate the process of building and deploying the documentation.

  • The documentation is built using Typedoc and automatically deployed to GitHub Pages on the gh-pages branch.
  • You can view the documentation here: DSA Toolbox Docs.

The workflow files .github/workflows/npm-publish.yml and .github/workflows/static.yml takes care of:

  • Building the documentation with the update-docs script.
  • Deploying the docs folder to GitHub Pages.

5. Submitting Changes ✍️

Once you've made your changes, follow these steps to contribute:

  • Commit your changes: Write clear, concise commit messages explaining what you've changed.
  • Create a Pull Request (PR): Push your changes to your fork and open a PR against the main branch.
  • Check CI status: Ensure that all tests pass and the CI workflows (build, lint, test) are successful before merging.