Skip to content

Contributing

React Simple Chatbot is open source, and contributions are welcome: bug reports, feature ideas, code and documentation. The code lives at github.com/LucasBassetti/react-simple-chatbot. Please follow the code of conduct in every interaction.

Open an issue to report a bug or propose a feature.

  • Bugs: describe the steps to reproduce the problem, what happened and what you expected. Include the versions of react-simple-chatbot, React, styled-components and your browser.
  • Features: explain what the feature does, why it is useful and how you would use it. Parts you are unsure about are fine to leave open for discussion.

The library is written in TypeScript with React function components and hooks. For big changes, open an issue first so the approach can be discussed before you spend time on it.

  1. Fork the repository on GitHub, clone your fork and create a branch for your change. Avoid working on master directly.

    Terminal window
    git clone https://github.com/YOUR_USERNAME/react-simple-chatbot.git
    cd react-simple-chatbot
    git checkout -b fix/my-change
  2. Install the dependencies:

    Terminal window
    npm install
  3. Run the example app while you work. npm start serves the app in example/ with Vite at http://localhost:5173:

    Terminal window
    npm start
  4. Make your change and add tests that cover it. Before pushing, check that everything passes:

    Terminal window
    npm test
    npm run lint
    npm run typecheck
    npm run build
  5. Push your branch to your fork and open a pull request against the master branch of the main repository.

Command What it does
npm start Runs the example app (example/) with Vite.
npm test Runs the tests with Vitest and Testing Library.
npm run test:watch Runs the tests in watch mode.
npm run test:coverage Runs the tests with a coverage report.
npm run lint Checks the code with ESLint and Prettier.
npm run typecheck Checks the types with TypeScript.
npm run build Builds dist/: the ES module and UMD builds and the type declarations.

The pull request title must follow Conventional Commits:

<type>(<optional scope>)!: <short summary in the imperative mood>

The type is one of:

Type Use it for
feat A new feature
fix A bug fix
docs Documentation only
style Formatting, no code change
refactor A code change that neither fixes a bug nor adds a feature
perf A performance improvement
test Adding or fixing tests
build The build system or dependencies
ci The CI configuration
chore Other changes that don’t modify the source or the tests
revert Reverting a previous commit

Add ! after the type or scope for a breaking change. For example:

feat: add a typing indicator to custom steps
fix(cache): restore options without value
feat!: drop React 17 support

Fill in the pull request template. It asks for:

  • a description of what the change does and why,
  • the related issue, if there is one,
  • the type of change,
  • how you tested it (tests, browsers, React versions, the example app),
  • for breaking changes, what breaks and how to migrate.

Every page has an Edit page link at the bottom that opens its source on GitHub. For small fixes, that is the fastest way to propose a change.

The site is built with Astro Starlight and lives in the website/ folder of the gh-pages branch. The pages are MDX files in website/src/content/docs/, and the live examples are in website/src/examples/.

  1. Check out the gh-pages branch of your fork and start the development server:

    Terminal window
    git checkout gh-pages
    cd website
    npm install
    npm run dev
  2. Edit the pages and check them in the browser.

  3. Type-check and build the site. The build also validates the internal links:

    Terminal window
    npm run check
    npm run build
  4. Commit the changes in website/ and open a pull request against gh-pages. After the merge, the Site workflow rebuilds the published site in the root of the branch, which GitHub Pages serves.