Contentful Personalization & Analytics
    Preparing search index...

    Contentful Logo

    Contentful Personalization & Analytics

    Contributing

    Readme · Reference · Contributing

    We appreciate any community contributions to this project, whether in the form of issues or pull requests.

    This document outlines what we'd like you to follow in terms of commit messages and code style.

    It also explains what to do in case you want to set up the project locally and run tests.

    Working on your first Pull Request? You can learn how from this extensive list of resources for people who are new to contributing to Open Source.

    Table of Contents

    The following software is required for testing and maintaining Optimization SDK Suite packages:

    Note

    Docker is currently only used to run E2E tests, specifically for the Web Vanilla reference implementation

    Code formatting:

    pnpm format:check
    pnpm format:fix

    Code linting:

    pnpm lint:check
    pnpm link:fix

    Check types:

    pnpm typecheck
    

    Build all packages:

    pnpm build
    

    Run unit tests:

    pnpm test:unit
    

    Run E2E tests:

    pnpm test:e2e
    

    Manage processes (useful when running reference implementations and their E2E tests):

    pnpm pm2:list
    pnpm pm2:logs
    pnpm pm2:stop:all
    pnpm pm2:delete:all

    Clean up all build artifacts:

    pnpm clean
    

    Run any command for a specific package (example):

    pnpm --filter @contentful/optimization-web dev
    

    This project uses ESLint and Prettier to enforce coding and formatting conventions. It may be useful to enable related editor plugins to have a smoother experience when working on Optimization SDKs.

    Please review the following files to familiarize yourself with current configurations:

    Code is documented using TSDoc, and reference documentation is generated using TypeDoc and published automatically with each new version.

    • pnpm docs:generate generates documentation from TSDoc code comments, as well as README and other linked markdown files
    • pnpm docs:watch watches for file updates and rebuilds documentation output; useful while writing and updating documentation

    Run licence-check locally:

    pnpx license-check --summary
    pnpx license-check > licenses.txt

    If the license for a package merely has a spelling or formatting difference from an existing entry in the license-check GitHub workflow allow list, update the list and submit the change via pull request. Otherwise, create an issue to receive further guidance from the maintainers.