Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "./cz-config.js"
}
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ jobs:
- name: Build Project
run: |
npm run build
- name: Commitlint Check
if: github.event_name == 'push'
run: npm run commit:lint
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run commit:edit
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ ignore:
- public
- reports
- storybook-static
- .cz.json
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,22 @@ See the [Greenwood Storybook docs](/guides/ecosystem/storybook/#content-as-data)
This project is hosted on Netlify and automatically deploys on each merge into main. Release branches will be curated over the course of a Greenwood release cycle and then merged at the time the new Greenwood release is published to NPM.

For links to `/discord/`, a redirect is configured in _netlify.toml_ to redirect these requests to the project's Discord server.

## Pull Requests

To best help facilitate contributions to the project, we have Conventional Commits configured for the project to walk you through preparing commits in the format of `<type>: #<issue> <summary-of-change>`, e.g. _bug: #123 fixed bug with the thing_.

Make sure you have run `npm run lint`, `npm run format` and `npm run test` to prepare your commit. Then, after staging your files with `git add`, you can initiate the commit "wizard" by running:

```sh
$ npm run commit
```

The following will be required:

- **type**
- **issue reference** (can technically be empty)

## Continuous Integration

To test the CI build scripts locally, run the yarn commands mentioned in the _Workflows_ section of the README. (basically just make sure linting, formatting, and test tasks are all passing).
15 changes: 15 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://commitlint.js.org/reference/rules.html
export default {
rules: {
"type-case": [2, "always", "lower-case"],
"type-enum": [
2,
"always",
["feat", "enhancement", "fix", "chore", "content", "docs", "revert"],
],
"type-empty": [2, "never"],
"subject-case": [2, "always", "lower-case"],
"body-case": [2, "always", "lower-case"],
"header-case": [2, "always", "lower-case"],
},
};
62 changes: 62 additions & 0 deletions cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// NOTE: need to keep types and scope consistent with commitlint.config.js
// https://commitizen.github.io/cz-cli/
const types = [
{ value: "feature", name: "feature: ✨ A new feature" },
{
value: "enhancement",
name: "enhancement: 💪 A code change that neither fixes a bug nor adds a feature",
},
{ value: "fix", name: "fix: 🐛 A bug fix" },
{ value: "docs", name: "docs: 📚 Docs or guides content changes" },
{ value: "content", name: "content: 📝 Copy only changes or blog posts" },
{ value: "chore", name: "chore: 🛠 Other changes that don't modify src files" },
{ value: "revert", name: "revert: 🗑 Reverts a previous commit" },
];

export default {
prompter: async (cz, commit) => {
const { type } = await cz.prompt([
{
type: "list",
name: "type",
message: "Select the type of the change",
choices: types,
},
]);

const { subject } = await cz.prompt([
{
type: "input",
name: "subject",
message: "Write a short, imperative description of the change",
validate: (input) => {
if (input.length === 0) {
return "Subject is required";
}

return true;
},
},
]);

const { issue } = await cz.prompt([
{
type: "input",
name: "issue",
message: "Enter the issue associated with this change (e.g. 123)",
validate: (input) => {
if (input.startsWith("#")) {
return "Please do not include the #";
}

return true;
},
},
]);

const issueFormat = issue === "" ? "" : `#${issue} `;
const message = `${type}: ${issueFormat}${subject}`;

commit(message);
},
};
Loading