Skip to content

Commit

Permalink
build: Add commit-lint and Commitizen
Browse files Browse the repository at this point in the history
In order for the automatic release process VRPirates#32 to work we need to ensure that we always use conventional commits in order for the changelog to be generated correctly. This patch ensures that this is the case

fix VRPirates#36
  • Loading branch information
MikeRatcliffe committed Sep 15, 2024
1 parent beea4c3 commit 5ca0f2c
Show file tree
Hide file tree
Showing 6 changed files with 2,034 additions and 16 deletions.
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run commitlint ${1}
167 changes: 167 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Contributing to Sidenoder

Thank you for your interest in contributing to **Sidenoder**! We appreciate your help in improving the project. Please follow the guidelines below to get started.

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
- [Setting Up Your Environment](#setting-up-your-environment)
- [Running the Project](#running-the-project)
- [Making Changes](#making-changes)
- [Commit Guidelines](#commit-guidelines)
- [Using Commitizen (Preferred Method)](#using-commitizen-preferred-method)
- [Manually](#manually)
- [Submitting Your Contribution](#submitting-your-contribution)
- [Pull Request Checklist](#pull-request-checklist)
- [Code Style Guidelines](#code-style-guidelines)
- [Reporting Issues](#reporting-issues)

## Getting Started

To contribute to Sidenoder, you’ll need to:

1. Fork the repository from [Sidenoder GitHub](https://github.com/VRPirates/sidenoder).
2. Clone your forked repository to your local machine.

```bash
git clone https://github.com/YOUR_USERNAME/sidenoder.git
```

3. Navigate to the project directory:

```bash
cd sidenoder
```

## Setting Up Your Environment

Sidenoder is an Electron app, and you will need to have **Node.js** and **npm** installed. You can download and install Node.js from [nodejs.org](https://nodejs.org).

After installing Node.js, run the following command to install the project dependencies:

```bash
npm install
```

## Running the Project

Once the dependencies are installed, you can run the project locally in development mode. Use the following command:

```bash
npm start
```

This will start the Electron app, and any changes you make will be reflected in real time.

## Making Changes

Before making any changes, ensure that your local repository is up to date with the latest changes from the main repository:

```bash
git checkout main
git pull upstream main
```

Now, create a new branch for your feature or bug fix:

```bash
git checkout -b your-feature-branch-name
```

Make sure to keep your changes isolated to one specific task or issue.

### Commit Guidelines

There are two ways you can commit your code, manually or using Commitizen.
Whichever method you choose, please stick to these rules:

- Write clear, concise commit messages.
- Use one commit per feature or bug fix.
- Use present tense ("add feature" instead of "added feature").

#### Using Commitizen (Preferred Method)

```bash
# Stage your changes ready for commiting.
git add .

# Run Commitized
npm run cz
```

Commitizen will guide you in creating a commit message describing your changes.

#### Manually

- Follow the format for commits: `type: description` e.g. `fix: correct issue with fetch request`

```bash
# Stage your changes ready for commiting.
git add .

# Commit your code
# Be sure to follow the format for commits: `type: description`
# e.g. `fix: correct issue with fetch request`
git commit -m "fix: correct issue with fetch request"
```

The following types are valid:

| **Type** | **Description** |
| ---------- | ----------------------------------------------------------------------------------------------------------- |
| `build` | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
| `chore` | Other changes that don't modify `src` or test files |
| `ci` | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) |
| `docs` | Documentation only changes |
| `feat` | A new feature |
| `fix` | A bug fix |
| `perf` | Performance improvements |
| `refactor` | A code change that neither fixes a bug nor adds a feature |
| `revert` | Reverts a previous commit |
| `style` | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
| `test` | Adding missing tests or correcting existing tests |

## Submitting Your Contribution

Once you're done with your changes:

1. Push your branch to your forked repository:

```bash
git push origin your-feature-branch-name
```

2. Go to the original repository at [Sidenoder GitHub](https://github.com/VRPirates/sidenoder).
3. Click on the `[Pull Request]` button.
4. Ensure your pull request has a clear description of what you’ve done and reference any relevant issues (if applicable).

### Pull Request Checklist

**NOTE: Always Ensure that the code works by running the app locally.**

After submitting, a project maintainer will review your pull request. You may be asked to make changes, so please respond to feedback promptly.

## Code Style Guidelines

To maintain consistency, ensure that your code follows the project's coding standards. We use the following tools:

- **ESLint**: Helps catch common errors and enforces code consistency.
- **Prettier**: Formats code.
- **StyleLint**: Helps catch common CSS errors and enforces code consistency.

These tools will automatically run when you attempt to commit your code and warn you of any issues.

## Reporting Issues

If you encounter any issues or have suggestions for improvements, please open an issue on the [Issues page](https://github.com/VRPirates/sidenoder/issues). Be sure to include:

- A clear and descriptive title.
- Steps to reproduce the issue, if applicable.
- Screenshots or logs if relevant.

You can also browse existing issues and contribute by helping to resolve them.

---

Thank you for contributing to Sidenoder! Your support is highly appreciated, and we look forward to seeing your pull requests.
10 changes: 9 additions & 1 deletion readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

**SideNoder** - A **cross platform sideloader** for Quest(1&2&3) standalone vr headset.

# Quest 3 compatibility fix added in v 0.8.0
Expand Down Expand Up @@ -55,12 +57,18 @@ Other version of rclone will not work.
Also android tools and scrcpy is required:

```bash
brew install scrcpy
brew install scrcpy
brew install android-platform-tools
```

---

## Contributing to Sidenoder

To contribute to Sidenoder, please reqd our [Contributors Guide](./CONTRIBUTING.md).

---

Please report any issues here :

https://github.com/VRPirates/sidenoder/issues
170 changes: 170 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/**
* This commitlint config file extends the conventional configuration
* and adds the following customizations:
*
* - Ignores commit messages that start with "Merge"
* - Allows the following commit types:
* - build
* - chore
* - ci
* - docs
* - feat
* - fix
* - perf
* - refactor
* - revert
* - style
* - test
* - Merge
*
* Please see the commitlint documentation for more information on how to use
* this configuration file:
* https://commitlint.js.org/reference/rules.html
*
* You can optionally use Commitizen to help write a commit message:
*
* 1. Stage your files.
* 2. Run npm run cz.
* 3. Follow the prompts to enter your commit message.
*
*/
const RuleConfigSeverity = {
Disabled: 0,
Warning: 1,
Error: 2,
};

module.exports = {
ignores: [(message) => message.startsWith("Merge")],
rules: {
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
],
],
"body-case": [RuleConfigSeverity.Disabled, "always"],
"body-leading-blank": [RuleConfigSeverity.Warning, "always"],
"body-max-line-length": [RuleConfigSeverity.Disabled, "always"],
"footer-leading-blank": [RuleConfigSeverity.Warning, "always"],
"footer-max-line-length": [RuleConfigSeverity.Disabled, "always"],
"header-max-length": [RuleConfigSeverity.Disabled, "always"],
"header-trim": [RuleConfigSeverity.Error, "always"],
"scope-case": [RuleConfigSeverity.Error, "always", "lower-case"],
"subject-case": [RuleConfigSeverity.Disabled, "always"],
"subject-empty": [RuleConfigSeverity.Error, "never"],
"subject-full-stop": [RuleConfigSeverity.Error, "never", "."],
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"],
"type-empty": [RuleConfigSeverity.Error, "never"],
},
prompt: {
questions: {
type: {
description: "Select the type of change that you're committing",
enum: {
build: {
description:
"Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
title: "Builds",
emoji: "🛠",
},
chore: {
description: "Other changes that don't modify src or test files",
title: "Chores",
emoji: "♻️",
},
ci: {
description:
"Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)",
title: "Continuous Integrations",
emoji: "⚙️",
},
docs: {
description: "Documentation only changes",
title: "Documentation",
emoji: "📚",
},
feat: {
description: "A new feature",
title: "Features",
emoji: "✨",
},
fix: {
description: "A bug fix",
title: "Bug Fixes",
emoji: "🐛",
},
perf: {
description: "A code change that improves performance",
title: "Performance Improvements",
emoji: "🚀",
},
refactor: {
description:
"A code change that neither fixes a bug nor adds a feature",
title: "Code Refactoring",
emoji: "📦",
},
revert: {
description: "Reverts a previous commit",
title: "Reverts",
emoji: "🗑",
},
style: {
description:
"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
title: "Styles",
emoji: "💎",
},
test: {
description: "Adding missing tests or correcting existing tests",
title: "Tests",
emoji: "🚨",
},
},
},
scope: {
description:
"What is the scope of this change (e.g. component or file name)",
},
subject: {
description:
"Write a short, imperative tense description of the change",
},
body: {
description: "Provide a longer description of the change",
},
isBreaking: {
description: "Are there any breaking changes?",
},
breakingBody: {
description:
"A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
},
breaking: {
description: "Describe the breaking changes",
},
isIssueAffected: {
description: "Does this change affect any open issues?",
},
issuesBody: {
description:
"If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
};
Loading

0 comments on commit 5ca0f2c

Please sign in to comment.