Thank you for your interest in contributing to Contentstack Utils JavaScript. This document provides guidelines and instructions for contributing.
All pull requests must be raised against the development branch.
Feature/fix PRs should merge into development. Release PRs are raised by maintainers directly from development to master.
- Node.js 10 or later
- npm (comes with Node.js)
- Git
-
Fork the repository on GitHub and clone your fork locally:
git clone https://github.com/YOUR_USERNAME/contentstack-utils-javascript.git cd contentstack-utils-javascript -
Add the upstream remote (optional, for syncing with the main repo):
git remote add upstream https://github.com/contentstack/contentstack-utils-javascript.git
-
Create a branch from
developmentfor your work:git fetch upstream git checkout development git pull upstream development git checkout -b your-feature-or-fix-name
-
Install dependencies:
npm install
-
Build the project:
npm run build
- Run the full test suite:
npm test - Run tests in watch mode (for development):
npm run test:debug
All tests must pass before submitting a PR. New features and bug fixes should include or update tests as appropriate.
- ESLint: The project uses ESLint. Fix auto-fixable issues with your editor or by running the linter.
- Prettier: Code is formatted with Prettier. Use
npm run formatto formatsrc/**/*.ts.
Ensure your code adheres to the existing style so that CI and pre-commit checks pass.
This project uses Conventional Commits enforced by Commitlint.
- Use a type and a short subject (e.g.
feat: add jsonToHTML option,fix: handle empty nodes). - Allowed types include:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert,sample. - Subject should be lowercase, imperative, and not end with a period.
- Add a blank line and a longer body when the change needs more explanation.
Husky runs a commit-msg hook to validate commit messages. Invalid messages will be rejected.
Husky is used for Git hooks. Before each commit, the pre-commit hook runs. Ensure your working tree is clean and that tests and lint pass locally to avoid failed commits.
-
Keep your branch up to date with
development:git fetch upstream git rebase upstream/development
-
Open a Pull Request against the
developmentbranch for feature/fix work. Maintainers handle release PRs fromdevelopmenttomaster. -
Fill out the PR template (if one exists) and provide:
- A clear title and description of the change
- Link to any related issue
- Summary of testing done
-
Address review feedback promptly. Maintainers may request changes before merging.
-
Do not force-push after review has started unless the maintainer asks you to; use new commits for updates when possible so review history is preserved.
- Use the GitHub issue tracker for bugs and feature requests.
- Search existing issues first to avoid duplicates.
- Include steps to reproduce for bugs, and your environment (Node version, OS).
- For security issues, see SECURITY.md.
- README – Project overview and usage
- CHANGELOG – Version history and changes
- SECURITY – Security and vulnerability reporting
- CODEOWNERS – Code ownership and review expectations
Thank you for contributing.