Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
- Node.js:
>=16.18.0
- Yarn:
>=1.21.1
To install all dependencies and build all packages run the following commands from the root of the project.
yarn
yarn build
You are ready to go! You can either develop your apps from apps
folder or run a playground of all components in development
mode.
Good pull requests, such as patches, improvements, and new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
Please ask first if somebody else is already working on this or the Contentful developers think your feature is in-scope. Generally always have a related issue with discussions for whatever you are including.
@contenful/field-editors
is a monorepo, meaning it is divided into independent sub-packages.
These packages can be found in the packages/
directory.
This monorepo is maintained using Lerna. Get started with Lerna by following this link.
We use storybook
as a components playground.
# to run playground in a development mode
yarn start
Go to a shared package and run the following command to watch for changes and rebuild the package once it's changed:
cd packages/_shared
yarn watch
Relevant for Contentful employees only.
It is convenient to link a local copy of a package to a locally running Contentful web application without publishing a package.
yarn
yarn build
cd packages/single-line
# register a symplink
yarn link
# watch for changes in the package
yarn watch
In the web app repository:
# create a symlink to a local folder
yarn link '@contentful/field-editor-single-line'
To add another package create a new directory in the packages
folder. Since we are using Lerna all package scripts are available from the root by running lerna run <script_name>
.
All commit messages should meet the conventional commit format. The easiest way is to use yarn cm
command which launches commit message wizard.
You don't need to worry about formatting your code. It is automatically reformatted using prettier
on every commit using Git hooks.
We use ESLint and Typescript ESLint for linting and checking code for errors.
All modern editors should automatically pick up configuration and show errors and warnings while you type.
# at the monorepo root
yarn lint
# at the monorepo root
yarn tsc
We use Jest and Testing Library for writing unit tests.
cd packages/single-line
yarn test
# at the monorepo root
yarn test:ci