Skip to content

fix(repo-tools): fix yarn create-workspace - #4882

Open
christoph-jerolimov wants to merge 2 commits into
mainfrom
fix/create-workspace
Open

christoph-jerolimov wants to merge 2 commits into
mainfrom
fix/create-workspace

Conversation

@christoph-jerolimov

@christoph-jerolimov christoph-jerolimov commented Sep 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Updates @backstage/cli / create-app deps and pins create-app@0.9.1 (Backstage 1.54) so yarn create-workspace scaffolds successfully again
  • Fixes lazy command loading for ESM default exports and turns the workspace README into a Handlebars template
  • Adds backstage.json and aligns prettier/repo-tools package metadata with the newer Backstage tooling

Test plan

  • From repo root, run yarn create-workspace (or the workspace create CLI entry) and confirm a new workspace is generated under workspaces/
  • Verify the generated workspace README is rendered from the .hbs template with the workspace name
  • Confirm workspaces/repo-tools still builds/lints after the CLI dependency bump

Made with Cursor

Align create-app and CLI deps with Backstage 1.54 so workspace scaffolding works again.

Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@rhdh-gh-app

rhdh-gh-app Bot commented Sep 20, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/rhdh-repo-tools workspaces/repo-tools/packages/cli none v0.0.1

@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Restore repo-tools workspace scaffolding with Backstage 1.54

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Restores workspace scaffolding with a Backstage 1.54-compatible create-app version.
• Supports ESM-wrapped command exports during lazy command loading.
• Generates workspace-specific README content from a Handlebars template.
Diagram

graph TD
  Command["Workspace command"] --> Loader["Lazy loader"] --> Creator["Workspace creator"] --> CreateApp["create-app 0.9.1"] --> Template["README template"] --> Workspace["New workspace"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Declare create-app as a workspace dependency
  • ➕ Uses the repository lockfile for fully reproducible scaffolding
  • ➕ Avoids downloading the generator during each invocation
  • ➕ Can support offline or restricted-network development environments
  • ➖ Adds another maintained dependency to repo-tools
  • ➖ Requires a script or binary-resolution change
  • ➖ Broadens the hotfix beyond the existing npx execution model
2. Adopt native ESM command modules
  • ➕ Removes reliance on CommonJS default-export wrapping
  • ➕ Allows direct access to named dynamic-import exports
  • ➖ Requires broader build and package-format changes
  • ➖ Carries greater compatibility risk across all CLI commands
  • ➖ Is disproportionate to the immediate scaffolding regression

Recommendation: Keep the PR's pinned npx generator and targeted lazy-loader adaptation as the lowest-risk Backstage 1.54 compatibility fix. Consider declaring create-app directly only if reproducible or offline scaffolding becomes a requirement; a native ESM migration should remain a separate architectural change.

Files changed (6) +64 / -22

Bug fix (2) +21 / -14
index.tsResolve lazily loaded actions from ESM default wrappers +18/-12

Resolve lazily loaded actions from ESM default wrappers

• Refactors the lazy action wrapper to accept a module loader and type-checked action export name. Commands now resolve actions from the dynamically imported module's default export wrapper before execution.

workspaces/repo-tools/packages/cli/src/commands/index.ts

createWorkspace.tsPin workspace generation to create-app 0.9.1 +3/-2

Pin workspace generation to create-app 0.9.1

• Pins create-app to the Backstage 1.54-compatible release and passes the workspace name through the generator environment for template rendering.

workspaces/repo-tools/packages/cli/src/lib/workspaces/createWorkspace.ts

Documentation (1) +29 / -0
README.md.hbsTemplate generated workspace documentation +29/-0

Template generated workspace documentation

• Replaces the static README source with a Handlebars template containing the workspace name, plugin documentation placeholders, and updated startup instructions.

workspaces/repo-tools/packages/cli/src/lib/workspaces/templates/workspace/README.md.hbs

Other (3) +14 / -8
backstage.jsonDeclare the Backstage 1.54.6 workspace version +3/-0

Declare the Backstage 1.54.6 workspace version

• Adds Backstage version metadata so newer CLI tooling can identify the repo-tools workspace release baseline.

workspaces/repo-tools/backstage.json

package.jsonAlign repo-tools dependencies and formatting configuration +8/-5

Align repo-tools dependencies and formatting configuration

• Upgrades Backstage CLI and repo-tools packages, adds CLI defaults, and adopts Backstage's Prettier configuration. It also adds a formatting fix script and moves knip to development dependencies.

workspaces/repo-tools/package.json

package.jsonUpgrade CLI package Backstage dependencies +3/-3

Upgrade CLI package Backstage dependencies

• Aligns the custom CLI with Backstage 1.54-compatible CLI, CLI node, and error package versions.

workspaces/repo-tools/packages/cli/package.json

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@rhdh-qodo-merge

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge Bot added documentation Improvements or additions to documentation Bug fix labels Sep 20, 2026
@rhdh-qodo-merge

Copy link
Copy Markdown

Important

The /generate_labels command by Qodo is sunsetting on the 1st of October 2026 and will no longer be available. We recommend switching to the latest Qodo review capabilities. Learn more

@christoph-jerolimov christoph-jerolimov changed the title fix(repo-tools): restore yarn create-workspace for new workspaces fix(repo-tools): fix yarn create-workspace to create new workspaces Sep 20, 2026
@christoph-jerolimov christoph-jerolimov changed the title fix(repo-tools): fix yarn create-workspace to create new workspaces fix(repo-tools): fix yarn create-workspace Sep 20, 2026
Align the workspace TypeScript version with newer Backstage CLI tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
40.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug fix documentation Improvements or additions to documentation workspace/repo-tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant