| kind | 👋 Contributing |
|---|---|
| title | Contribute |
We use ESLint to enforce JS coding style and spot linting errors ASAP.
Our configuration is based on standardJS + some small tweaks (see .eslintrc.js).
All JavaScript files in src, stories and tasks are scanned.
You can run the lint check with:
npm run lintYou can run the lint check (with autofix) with:
npm run lint:fixYou can have a local preview of the Storybook (with live reload). It's a great development experience when you work on a component.
You can start the local Storybook with:
npm run storybook:devWhen the master branch is updated, the latest version of the Storybook is automatically published on the public preview.
The production build of the public Storybook is done with:
npm run storybook:buildAll our components and the different JavaScript files in src/lib are minified with Terser and end up in dist.
We also use a specific babel plugin to minify the HTML and the CSS in our LitElement components: babel-plugin-template-html-minifier.
To process those files through babel and terser and keep the sourcemaps, we wrote a small script in tasks/minify-components.js.
You can run the build process with:
npm run components:buildTo document our Web Components, we use web-component-analyzer.
We chose the markdown output, they all end up in .component-docs and we integrate them manually in Storybook's stories as notes.
You can generate the components' docs with:
npm run components:docsTo distribute our components for npm, we only package what's in dist.
When we publish a new version, a build (npm run components:build) of the components is automatically triggered.
You can import any given component like this:
import '@clevercloud/components/dist/atoms/cc-button.js';Commit messages must respect conventional commit.
Possible types are fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.
The scope should be the name of the component affected. If many components are affected, consider the following options:
- split into multiple commits
- use the main component. For instance, refactoring
cc-tcp-redirectioncomponent may surely affectcc-tcp-redirection-formcomponent too. In this case, prefer using the parent component as scope:refactor(cc-tcp-redirection-form). - avoid specifying any scope and add some details instead. However, you must understand that details won't be dumped into the CHANGELOG.
If none of these options suits your need, you can follow this how-to that will let you generate multiple CHANGELOG entries with one single commit.
To help you respect the rules, you should install a commit linter with the following command:
cd ${PATH_TO_THE_REPOSITORY_ROOT}
git config core.hooksPath '.githooks'