Thank you for considering contributing to this project! Here are some guidelines to help you get started.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
If you find a bug or have a feature request, please open an issue here.
- Follow the existing code style.
- Write clear, concise commit messages.
- Add comments where necessary.
The project uses TypeScript. To build the project, run:
npm run build
This will compile the TypeScript files in the src
directory into JavaScript files in the dist
directory.
Please ensure that your changes pass all existing tests and add new tests for any new features.
To run the tests, use the following command:
npm test:ci
This command will:
- Clean the coverage directory
- Run Jest tests with coverage and verbose output
- Run the linter
If you want to run only the Jest tests without cleaning or linting, you can use:
npm test
or with debugging
npm test:debug
To run a specific test file, use:
npx jest path/to/your/test-file.test.ts
or
npm test -- path/to/your/test-file.test.ts
Replace path/to/your/test-file.test.ts
with the actual path to the test file you want to run.
To run a specific test file without coverage, use the --coverage=false
:
npm test -- --coverage=false path/to/your/test-file.test.ts
or
npx jest --coverage=false path/to/your/test-file.test.ts
To run a specific test or test suite within a file, use the -t
flag followed by a name pattern:
npx jest path/to/your/test-file.test.ts -t "name of your test"
This will run only the tests whose names match the provided pattern.
To run the linter separately:
npm run lint
To automatically fix linting issues:
npm run lint:fix
The dist
directory contains the compiled JavaScript files. Ensure that this directory is up-to-date before committing your changes.
Releases are managed using GitHub Actions and GitVersion for semantic versioning.
-
Tagging a Release: To create a new release, create a new tag on the
main
branch. For example:git tag v1.0.0 git push origin v1.0.0
-
Release Branch: The
create-release-branch.yml
workflow will automatically create a new branch namedreleases/v1.0.0
based on this tag. -
Building and Packaging: The
build-and-push.yml
workflow will run on the new release branch, compile the project, update thedist
folder, and create a GitHub release.
The project uses GitVersion to manage semantic versioning. The version is determined based on the commit history and branch names.
- Major Changes: Include
breaking change
orbreaking
(case-insensitive) in your commit message. - Minor Changes: Include
adds
,add
, orminor
(case-insensitive) in your commit message. - Patch Changes: Include
fix
orpatch
(case-insensitive) in your commit message. - No Version Bump: Include
+semver: none
or+semver: skip
in your commit message.
Branch naming conventions also affect versioning:
- Feature branches (
feature/...
orfeatures/...
) increment the minor version. - Hotfix branches (
fix/...
,fixes/...
,hotfix/...
, orhotfixes/...
) increment the patch version. - Release branches (
releases/...
orrelease/...
) increment the patch version.
The main branch is labeled as 'preview' in the version.
This illustrates the GitHub Actions workflows in this repository.
graph TD
A{{Push to main branch}}
D{{Pull request to main}}
E{{Push to releases/** branch}}
F{{Push tag vx.x.x}}
PathText["Trigger 1: Paths: src/**, package.json, package-lock.json
Trigger 2: On all changes"]
PathText ~~~ B
PathText ~~~ C
subgraph Workflows
direction LR
B[Tests Workflow]
C[Build, Push, and Release Workflow]
G[Create Release Branch Workflow]
end
A -->|See trigger 1| B
A -->|See trigger 1| C
D -->|See trigger 2| B
E -->|See trigger 1| B
E -->|See trigger 1| C
F --> G
B --> AA{Are there changes to dist folder?}
AA -->|Yes| Z((Workflow fails))
AA -->|No| Y[Build project]
Y --> H{Tests pass?}
H -->|Yes| I[Upload coverage to Codecov]
H -->|No| Z
I --> J[Upload test results to Codecov]
J --> K[Create and upload artifact]
K --> L[Run Relabeler]
C --> X[Build project]
X --> M{Check for dist changes}
M -->|No changes| N[Notify no changes]
M -->|Changes| O[Update package.json version]
O --> P[Create PR with changes for pushed branch]
P --> Q{On main branch?}
P --> T{On releases/** branch?}
Q -->|Yes| R[Create preview tag]
R --> S[Create GitHub Preview Release]
T -->|Yes| U[Create GitHub Release]
G --> V[Create new release branch]
V --> W[Push new release branch]
classDef subprocess stroke-width:4px,stroke-dasharray: 5 5;
class B,C,G subprocess;
classDef eventTrigger fill:#e1f5fe,stroke:#333,stroke-width:2px,color:#000;
class A,D,E,F eventTrigger;
classDef invisible fill:none,stroke:none;
class PathText invisible;
classDef failure fill:#FFA07A,stroke:#FF0000,stroke-width:2px,color:#000;
class Z failure;
By contributing, you agree that your contributions will be licensed under the MIT License.