Skip to content
Open
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
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The `redhat-developer/rhdh-plugins` repository is designed as a collaborative sp
- [Forking the Repository](#forking-the-repository)
- [Developing Plugins in Workspaces](#developing-plugins-in-workspaces)
- [Coding Guidelines](#coding-guidelines)
- [yarn fix](#yarn-fix)
- [Versioning](#versioning)
- [Creating Changesets](#creating-changesets)
- [Release](#release)
Expand Down Expand Up @@ -80,6 +81,29 @@ For consistency across the monorepo, we suggest following the same Yarn setup as

All code is formatted with `prettier` using the configuration in the repo. If possible we recommend configuring your editor to format automatically, but you can also use the `yarn prettier --write <file>` command to format files.

### yarn fix

From a workspace root (`workspaces/<name>`), run `yarn fix` before you consider the work done. Do not run it from the repository root; each workspace has its own install and its own `yarn fix`.

The command delegates to `backstage-cli repo fix`, then runs additional fixers when they are available. Execution order is defined in `scripts/workspace-fix.mjs`:

1. `backstage-cli repo fix` (pass `--publish` with `rhdhFix.publish` or `--publish`)
2. `sort-package-json` (skipped unless the workspace depends on it)
3. `backstage-cli repo lint --fix`
4. `markdownlint --fix` (skipped unless the workspace depends on it)
5. `prettier --write .` (always last among formatters)
6. `knip --fix` (opt-in only: `rhdhFix.knip` or `--knip`)

`yarn fix` exits 0 when every run fixer succeeds, even if files changed. It exits non-zero if a fixer fails. Missing optional fixers are skipped, not treated as failures.

`yarn fix --check` runs only `backstage-cli repo fix --check` (and `--publish` when configured). CI uses this mode; lint, prettier, and publish validation run as separate workflow steps.

Pass `--plugin <name>` to limit lint, prettier, and markdownlint to one plugin or package under the workspace (for example `yarn fix --plugin global-header`). Short names match a unique `plugins/<name>` or `plugins/*-<name>` directory. `backstage-cli repo fix` still runs for the full workspace.

Memory-heavy fixers run with `NODE_OPTIONS=--max-old-space-size=8192`, matching CI. Workspaces that build dynamic plugin bundles should list `dist-dynamic` and `dist-scalprum` in `.eslintignore` and `.prettierignore` so `repo lint --fix` and `prettier --write` do not traverse generated output. If a workspace still runs out of memory during `repo lint --fix`, set a higher value in `rhdhFix.nodeOptions` in that workspace's `package.json`.

To add a new fixer, change `scripts/workspace-fix.mjs` only. Workspace `package.json` files should keep `"fix": "node ../../scripts/workspace-fix.mjs"`. The `noop` workspace is the exception and stays a no-op.

## Versioning

For the versioning all packages in this repository are following the semantic versioning standard enforced through Changesets. This is the same approach as in the “backstage/community-plugins" repository. If this is your first time working with Changesets checkout [this documentation](https://github.com/backstage/backstage/blob/master/CONTRIBUTING.md#creating-changesets) or read a quick summary below.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Contributions are welcome! To contribute a plugin, please follow the guidelines
## Plugins Workflow

The `rhdh-plugins` repository is organized into multiple workspaces, with each workspace containing a plugin or a set of related plugins. Each workspace operates independently, with its own release cycle and dependencies managed via npm. When a new changeset is added (each workspace has its own `.changesets` directory), a "Version packages ($workspace_name)" PR is automatically generated. Merging this PR triggers the release of all plugins in the workspace and updates the corresponding `CHANGELOG` files.

## yarn fix

From a workspace directory (`workspaces/<name>`), run `yarn fix` to auto-correct fixable package, lint, and format issues. The pipeline is defined once in `scripts/workspace-fix.mjs`. See [CONTRIBUTING.md](CONTRIBUTING.md#yarn-fix) for the fixer order and how to add a new fixer.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"scripts": {
"create-workspace": "rhdh-repo-tools workspace create",
"test:workspace-fix": "node --test scripts/workspace-fix.test.mjs",
"postinstall": "husky",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write ."
Expand Down
Loading
Loading