Skip to content

Commit

Permalink
build: Add commit-lint
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.
  • Loading branch information
MikeRatcliffe committed Sep 17, 2024
1 parent 8ecad7c commit 8795013
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 1 deletion.
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}
145 changes: 145 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# 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)
- [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 switch -c your-feature-branch-name
```

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

### Commit Guidelines

Committing your code is simple, 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").

```bash
# Commit your code
# Be sure to follow the format for commits: `type: description`
# e.g. `fix: correct issue with fetch request`
git commit -ma "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.
65 changes: 65 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* 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
*
*/
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"],
},
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@
"web-auto-extractor": "1.0.17"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@destination/prettier-plugin-twig": "^1.5.0",
"electron": "32.0.2",
"electron-builder": "25.0.5",
"husky": "^9.1.5",
"inquirer": "^9.3.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"stylelint": "^16.9.0",
"stylelint-config-standard": "^36.0.1"
},
"scripts": {
"commitlint": "commitlint --edit",
"start": "electron ./ --dev",
"pack": "electron-builder --dir",
"dist": "electron-builder -mwl",
Expand Down
10 changes: 9 additions & 1 deletion 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

0 comments on commit 8795013

Please sign in to comment.