|
1 | 1 | # React Helsinki Headless CMS |
2 | 2 |
|
| 3 | +React UI component library to visualize [Headless CMS](https://github.com/City-of-Helsinki/headless-cms) |
| 4 | +data using [Helsinki Design System](https://github.com/City-of-Helsinki/helsinki-design-system). |
| 5 | + |
| 6 | +<!-- START doctoc generated TOC please keep comment here to allow auto update --> |
| 7 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 8 | +**Table of Contents** |
| 9 | + |
| 10 | +- [Introduction](#introduction) |
| 11 | + - [The known clients that are using this library](#the-known-clients-that-are-using-this-library) |
| 12 | +- [Installation](#installation) |
| 13 | +- [Development](#development) |
| 14 | + - [When to develop](#when-to-develop) |
| 15 | + - [Available scripts](#available-scripts) |
| 16 | + - [Development environments](#development-environments) |
| 17 | + - [Module structure](#module-structure) |
| 18 | + - [Husky Git Hooks](#husky-git-hooks) |
| 19 | + - [Pre-commit Hook](#pre-commit-hook) |
| 20 | + - [Commit-msg Hook](#commit-msg-hook) |
| 21 | + - [CI](#ci) |
| 22 | + - [CD](#cd) |
| 23 | + - [Storybook](#storybook) |
| 24 | + - [Apollo](#apollo) |
| 25 | + - [NextJS](#nextjs) |
| 26 | + - [Use as a application dependency](#use-as-a-application-dependency) |
| 27 | + - [Build](#build) |
| 28 | + - [Releasing new versions](#releasing-new-versions) |
| 29 | +- [Testing](#testing) |
| 30 | + - [Testing in IDE terminal](#testing-in-ide-terminal) |
| 31 | +- [Usage](#usage) |
| 32 | +- [Publishing new versions](#publishing-new-versions) |
| 33 | +- [Known issues](#known-issues) |
| 34 | + |
| 35 | +<!-- END doctoc generated TOC please keep comment here to allow auto update --> |
| 36 | + |
3 | 37 | ## Introduction |
4 | 38 |
|
5 | 39 | React Helsinki Headless CMS - is a highly customized component library based on [HDS](https://github.com/City-of-Helsinki/helsinki-design-system). It is designed for Helsinki City Web applications which are using preconfigured Wordpress Headless CMS environments (compatible with the library). This library is a set of unified visual components for Pages, Artciles, Artcicle Archives which provide: |
@@ -81,6 +115,36 @@ This library consists of three modules. |
81 | 115 | - Apollo module that wraps core module components with logic that is able to fetch data with the help of an `ApolloClient` instance. |
82 | 116 | - Nextjs module that provides utilities when working with `Nextjs` and `Apollo`. |
83 | 117 |
|
| 118 | +### Husky Git Hooks |
| 119 | + |
| 120 | +This project uses [Husky](https://typicode.github.io/husky/#/) to manage Git hooks. Husky is configured to run specific scripts before committing changes to ensure code quality and consistency. |
| 121 | + |
| 122 | +#### Pre-commit Hook |
| 123 | + |
| 124 | +The pre-commit hook is configured to run the following commands: |
| 125 | + |
| 126 | +```sh |
| 127 | +yarn doctoc . |
| 128 | +yarn lint-staged --relative |
| 129 | +``` |
| 130 | + |
| 131 | +- `yarn doctoc .`: This command updates the table of contents in your markdown files. |
| 132 | +- `yarn lint-staged --relative`: This command runs linting on staged files to ensure they meet the project's coding standards. The lint-staged configuration can be found from [package.json](./package.json). |
| 133 | + - Using `--relative` flag to reduce command line length, |
| 134 | + as the combined length of all the absolute paths for a large commit can get quite long |
| 135 | + |
| 136 | +> NOTE: `doctoc` and `husky` does not work seamlessly together, since the `doctoc` does update the TOCs of the markdown files, but does not reject the pre-commit hook execution, and only leaves the refactored files as unstaged in Git. |
| 137 | +
|
| 138 | +#### Commit-msg Hook |
| 139 | + |
| 140 | +The commit-msg hook is configured to run the following command: |
| 141 | + |
| 142 | +```sh |
| 143 | +npx --no-install commitlint --edit "$1" |
| 144 | +``` |
| 145 | + |
| 146 | +- `npx --no-install commitlint --edit "$1"`: This command uses [Commitlint](https://commitlint.js.org/#/) to lint commit messages based on the project's commit message conventions. This repo follows the [Conventional Commits](#conventional-commits). |
| 147 | + |
84 | 148 | ### CI |
85 | 149 |
|
86 | 150 | Checks |
|
0 commit comments