We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
Please find the getting started guide, installation details, and more in the README of the repository.
-
If you haven't already, install Backstage.
-
Follow the Getting Started.
After your initial checkout, run yarn install
to get the project set up. This
also installs Husky hooks, which will run on every commit. If the Husky
installation fails, use yarn prepare
to install the hooks manually.
We use a small set of tools to keep the repository tidy and promote best practices:
- Prettier - Code formatter
- ESLint - Linter
- Lerna - Monorepo management
- Lint Staged - Run linters on staged files
- Husky - Git hooks
- Commitlint - Commit message linting
- Conventional Commits - Commit message format
- Automated versioning and changelog generation (pending, either using Commitizen or Semantic Release or even just Lerna)
To simplify semantic versioning and changelog generation, we use conventional commits. This means that commit messages should follow a specific format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
To keep it simple, we recommend a reduced set of allowed types (though, all conventional commit types are allowed):
fix
orfix!
: A (breaking) bug fix; influences the patch version (resp. major version, if breaking)feat
orfeat!
: A (breaking) new feature; influences the minor version (resp. major version, if breaking)refactor
: A code change that neither fixes a bug nor adds a featuretest
: Adding missing tests or correcting existing testsdocs
: Documentation only changeschore
: Anything else
The optional scope should be the name of the package affected by the change.
E.g. fix(dql): fix a bug in the DQL plugin
.
Commitlint ensures that the package is one of the known Lerna packages.
We aim to adhere to the Architecture Decision Records compiled by the Backstage team.
The ADRs with the most impact on development are:
- ADR003: Avoid default exports
- ADR004:
Export components using traceable
index.ts
files. - ADR006:
Avoid
React.FC
andReact.SFC
. - ADR007:
Use msw to mock service requests (avoid mocking of
fetch
). - ADR010: Use Luxon for date/time handling.
- ADR012:
Use Luxon's
toLocaleString
when formatting dates. - ADR011: Use a specific package structure for plugins.
- ADR013:
Use node-fetch in Backend
packages, stick to
fetchApiRef
in Frontend packages.
Besides that, we aim to provide a consistent codebase, thus we add the following soft-rules:
- Prefer
type
overinterface
for type definitions. - Prefer fat arrow functions over
function
keyword. - Use camel case for module (file) names.
Backstage uses Jest for all unit testing needs. Please provide thorough test coverage accordingly.
Start the tests from within your plugin directory with npm run test