Commit Graph

943 Commits

Author SHA1 Message Date
Patrik Oldsberg 55f6eb8c64 Move config files to CLI modules with lazy proxies
Move jest config files to cli-module-test-jest/config and node
transform + webpack-public-path to cli-module-build/config. Replace
originals in @backstage/cli/config with lazy proxies that forward
to the appropriate module or throw if it is not installed.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-15 22:11:43 +01:00
Patrik Oldsberg 7781ae5911 Add @backstage/cli-defaults package
Introduces a new `@backstage/cli-defaults` package that re-exports all
standard CLI modules as a single array, simplifying dependency management
for consumers. The CLI's `CliInitializer` is updated to support array
exports alongside single module exports. The create-app template,
changesets, and CLI fallback are updated to use `@backstage/cli-defaults`
instead of listing 11 individual modules.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-15 15:01:35 +01:00
Patrik Oldsberg 47b50ef3c4 Add back @types/webpack-env to CLI dependencies
The CLI provides tsconfig presets that include webpack-env in the
types array, so @types/webpack-env must remain a dependency of the
CLI package for consuming apps to compile correctly.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-15 12:56:32 +01:00
Patrik Oldsberg 9937a8aa8e Clean up CLI module dependencies and revert incorrect require() changes
Align dependency versions in CLI modules to match the original CLI
package versions. Move dependencies that are only used by modules out
of the main CLI package, and add missing dependencies to the modules
that actually use them. Revert import-to-require conversions in
cli-module-build that were incorrectly introduced during the split.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-15 12:40:25 +01:00
Patrik Oldsberg a151ad0814 Split CLI modules into separate packages
Extract each CLI module from packages/cli/src/modules/ into its own
package under packages/cli-module-*. This enables independent versioning
and clearer dependency boundaries for each CLI capability.

Module mapping:
- auth → @backstage/cli-module-auth
- build → @backstage/cli-module-build
- config → @backstage/cli-module-config
- create-github-app → @backstage/cli-module-create-github-app
- info → @backstage/cli-module-info
- lint → @backstage/cli-module-lint
- maintenance → @backstage/cli-module-maintenance
- migrate → @backstage/cli-module-migrate
- new → @backstage/cli-module-new
- test → @backstage/cli-module-test-jest
- translations → @backstage/cli-module-translations

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 7d055ef0c4 Merge cli-plugin-api into cli-node
Move createCliPlugin and related types from the standalone
@backstage/cli-plugin-api package into @backstage/cli-node and
remove the now-empty package.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 0be3eab18b cli: initial cli-plugin-api
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:42 +01:00
github-actions[bot] ed7c4e3bef Version Packages (next) 2026-03-10 17:34:12 +00:00
Patrik Oldsberg 1097f68579 Merge pull request #33181 from backstage/rugvip/cli-boolean-flag-negation
cli: enable --no- prefix negation for boolean flags
2026-03-10 18:27:53 +01:00
Patrik Oldsberg feaf449008 cli: enable --no- prefix negation for boolean flags
Bump cleye to ^2.3.0 (which pulls in type-flag 4.1.0) and enable
booleanFlagNegation: true in all cli() invocations so that boolean
flags automatically support --no-<flag> prefix negation.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-10 17:20:38 +01:00
Fredrik Adelöw 1fd15249ad remove @types/tar
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-03-10 16:44:41 +01:00
Fredrik Adelöw da2a0f974c Merge pull request #33242 from backstage/renovate/react-monorepo
fix(deps): update dependency react-refresh to ^0.18.0
2026-03-10 16:39:28 +01:00
Ben Lambert d0f4cd215b feat(cli): add auth commands for OIDC login (#32920)
* feat(cli): add auth commands for OIDC login

Signed-off-by: benjdlambert <ben@blam.sh>

* address PR review feedback

- move CIMD check before callback server start
- add try/finally for callback server cleanup
- validate URLs with human-readable errors
- deduplicate config URL candidates
- preserve selected flag on re-authentication
- delete accessToken on logout
- log token refresh to stderr in show command
- fix command descriptions to reference CIMD not DCR
- type keytar as optionalDependency, rename storage paths
- add auth-backend changeset

Signed-off-by: benjdlambert <ben@blam.sh>

* migrate auth module from yargs to cleye pattern

Signed-off-by: benjdlambert <ben@blam.sh>

* address PR review feedback

- consolidate storage imports in auth.ts
- add withMetadataLock to setSelectedInstance
- skip file permission tests on Windows
- clarify changeset endpoint path

Signed-off-by: benjdlambert <ben@blam.sh>

* address review feedback from Rugvip and Copilot

- use stdout for user-facing messages instead of stderr
- remove clientSecret remnants from logout
- make refresh_token optional in token response schema
- add timeout to CIMD metadata fetch
- pass same state to callback server and authorize URL
- remove inaccurate test comment

Signed-off-by: benjdlambert <ben@blam.sh>

* validate state in callback server, add CIMD endpoint tests

- localServer now validates the OAuth state parameter in the request
  handler and returns 400 on mismatch
- Added tests for the CIMD metadata endpoint in OidcRouter covering
  both disabled and enabled cases

Signed-off-by: benjdlambert <ben@blam.sh>

* revert validateRequest to use Zod error details

Signed-off-by: benjdlambert <ben@blam.sh>

* fix callback server hanging by closing keep-alive connections

Signed-off-by: benjdlambert <ben@blam.sh>

* rename secret store service prefix to backstage-cli:auth-instance

Signed-off-by: benjdlambert <ben@blam.sh>

---------

Signed-off-by: benjdlambert <ben@blam.sh>
2026-03-10 13:28:25 +00:00
renovate[bot] 4a75544809 fix(deps): update dependency react-refresh to ^0.18.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-09 21:06:46 +00:00
Patrik Oldsberg d9fb094376 Merge pull request #33061 from backstage/rugvip/migrate-cli-to-cleye
cli: migrate remaining commands from commander to cleye
2026-03-06 15:59:09 +01:00
github-actions[bot] db0d171511 Version Packages (next) 2026-03-03 14:16:49 +00:00
Patrik Oldsberg f01dbf301e Use shell-quote for script argument parsing
Replace custom splitShellArgs with shell-quote's parse() for proper
shell argument tokenization in createScriptOptionsParser.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-03-03 11:11:26 +01:00
Patrik Oldsberg 0d2d0f2e07 Add lazy loader pattern for CLI command execution
Extend `BackstageCommand.execute` to accept either a direct function or a
`{ loader }` object for lazy loading command implementations. Convert
several build and migrate commands to use the new pattern. Switch from
`program.parse` to `program.parseAsync` to properly await async actions.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-26 19:56:57 +01:00
Patrik Oldsberg 61cb976207 Consolidate Lockfile classes: move toString() and versioning utils to cli-node
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 11:59:30 +01:00
github-actions[bot] 4bd6a3a1af Version Packages (next) 2026-02-24 19:24:06 +00:00
Patrik Oldsberg eeb74ffe79 Merge pull request #32934 from soapraj/soapraj/bump-bfj-v9
cli: bump bfj dependency from ^8.0.0 to ^9.0.2
2026-02-21 17:33:13 +01:00
Fredrik Adelöw d95cf37ce3 Merge pull request #32583 from Believe-SA/commander-14
chore: update dependency commander to v14
2026-02-20 21:04:31 +01:00
Raghunandan Balachandran 5e10165839 cli: bump bfj dependency from ^8.0.0 to ^9.0.2
The only usage of bfj in @backstage/cli is `bfj.write(path, data)` in
bundle.ts for writing bundle-stats.json. The write API is unchanged in
v9 and v9.0.0/v9.0.1 are deprecated, so the range starts at ^9.0.2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Raghunandan Balachandran <raghunandan@spotify.com>
2026-02-20 10:57:52 +01:00
renovate[bot] 092b41f397 chore(deps): update dependency webpack to ~5.105.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-19 09:16:46 +00:00
dependabot[bot] 6738cf0842 build(deps): bump minimatch from 9.0.5 to 10.2.1 (#32915)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 9.0.5 to 10.2.1.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v9.0.5...v10.2.1)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 10.2.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-19 08:58:00 +01:00
github-actions[bot] e6df5d52ce Version Packages 2026-02-17 16:06:18 +00:00
Gabriel Dugny de62a9d322 chore: update dependency commander to v14, remove old @types/commander
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-02-16 17:29:25 +01:00
Patrik Oldsberg 903a854ebc Merge branch 'master' into runtime-module-federation-enablement
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-12 23:46:00 +01:00
github-actions[bot] 7c41134684 Version Packages (next) 2026-02-10 16:14:59 +00:00
Patrik Oldsberg 9848734ce6 Merge pull request #32761 from backstage/rugvip/css-exports-support
cli: add support for CSS exports in package build
2026-02-10 13:23:02 +01:00
Patrik Oldsberg fb3bc36690 cli: Switch CSS bundling from lightningcss to postcss-import
postcss-import naturally preserves @layer declarations during bundling,
eliminating the need for custom layer parsing and restoration logic.
This simplifies the implementation while also preserving source comments.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 16:01:16 +01:00
Patrik Oldsberg 4f9d980943 cli: Add support for CSS exports in package build
This adds support for CSS entry points in package exports. When a package
declares a CSS file in its exports field, the CLI will now automatically
bundle it during `backstage-cli package build` and rewrite the export
path from src/ to dist/ at publish time.

The CSS bundling uses lightningcss to resolve @import statements and
preserves @layer declarations that would otherwise be stripped during
bundling.

This allows packages like @backstage/ui to use the standard build command
instead of custom build scripts for CSS bundling.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 13:53:05 +01:00
renovate[bot] 73351c2736 chore(deps): update dependency webpack to ~5.104.0 [security]
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-05 20:44:36 +00:00
github-actions[bot] 1ea737c1e2 Version Packages (next) 2026-02-03 14:24:29 +00:00
github-actions[bot] d4b85dddee Version Packages (next) 2026-01-27 15:51:11 +00:00
David Festal c324bf71be Move module federation enablement in app-next at runtime.
Signed-off-by: David Festal <dfestal@redhat.com>
Assisted-by: Cursor
2026-01-27 14:54:05 +01:00
David Festal 0a67ed0dde Upgrade to 0.21.6
Signed-off-by: David Festal <dfestal@redhat.com>
Assisted-by: Cursor
2026-01-27 14:51:17 +01:00
Fredrik Adelöw 69d880e171 Bump to latest zod
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-26 13:52:02 +01:00
Fredrik Adelöw 4fc7bf037a upgrade to tar v7
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-22 12:58:08 +01:00
github-actions[bot] 2e902e7b43 Version Packages 2026-01-20 16:40:05 +00:00
Jon Koops 4eeba9ed61 Upgrade zod-validation-error to version 4
Signed-off-by: Jon Koops <jonkoops@gmail.com>
2026-01-14 14:46:55 +01:00
Backstage Service Account 9f1ee3e667 Version Packages (next) (#32222)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-30 16:06:20 +01:00
Backstage Service Account fea3e3972d Version Packages (next) (#32150) 2025-12-23 18:22:06 +01:00
Ben Lambert 9ee5996d4b Revert "microsite: pin swc"
Signed-off-by: benjdlambert <ben@blam.sh>

chore: bump minimum required swc

Signed-off-by: benjdlambert <ben@blam.sh>

chore: add chantgeset

Signed-off-by: benjdlambert <ben@blam.sh>
2025-12-18 08:16:33 +01:00
Hellgren Heikki 320c6a91ed fix(cli): bump swc core version for es2023/2024 support
fixes issues with backstage 1.46.0 if the
@swc/core version is resolved to lower than 1.8.0

Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-12-17 08:49:18 +02:00
github-actions[bot] c24788d5bb Version Packages 2025-12-16 14:08:20 +00:00
Johan Persson cd0b8a11a3 chore: make jest a peer dependency with v29/v30 support
Move jest from dependencies to peer dependencies, allowing users to
choose between Jest 29 and Jest 30.

The CLI now detects the Jest version at runtime and uses the
appropriate environment:
- Jest 29: Uses standard jest-environment-jsdom
- Jest 30: Uses a custom environment based on @jest/environment-jsdom-abstract
  with fixes for Web API globals (fetch, streams, Error, etc.)

The cross-fetch polyfill is only injected for Jest 29, as with Jest 30+
our patched Jest environment is used. The network request blocker is made
MSW-compatible by checking if fetch was wrapped before blocking.

Jest 30 (with jsdom v27) fixes `Could not parse CSS stylesheet`
warnings/errors when testing components from @backstage/ui or other
packages using CSS `@layer` declarations.

New peer dependencies (install based on your Jest version):
- jest (required, ^29 or ^30)
- Jest 29 requires: jest-environment-jsdom
- Jest 30 requires: @jest/environment-jsdom-abstract, jsdom

Production code changes for jsdom 27 testability:
- AppIdentityProxy: extract navigateToUrl method for spying
- LiveReloadAddon: export utils.reloadPage for spying
- collect.ts: export internal.resolvePackagePath for mocking

MockFetchApi: evaluate global.fetch at call time instead of construction
time, allowing MSW to patch fetch after MockFetchApi is constructed.

Test adaptations for jsdom 27:
- Use RGB values instead of named colors in CSS assertions
- Update error format expectations (hyphenated type names, SyntaxError
  instead of FetchError for JSON parse errors)
- Simplify URL error assertions for cross-version compatibility
- Fix accessible name whitespace handling for external links
- Use history.replaceState for location mocking (non-configurable)
- Use fireEvent.blur for contentEditable elements
- Move async assertions inside waitFor for race conditions
- Remove Blob.prototype.text polyfill (now native)
- Remove test case using credentials in plugin:// URLs

Test adaptations for Jest 30:
- Replace `expect.objectContaining([...])` with direct array equality
- Replace `expect.objectContaining({ length: N })` with
  `expect.any(Array)` + separate `toHaveLength()` assertions
- Use child process for native Node.js module resolution in
  collect.test.ts to work around Jest 30's resolver behavior
- Update snapshot headers for new Jest format

Also removes the jest-haste-map patch which is no longer needed.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
2025-12-11 18:06:55 +01:00
github-actions[bot] e08f48a9b5 Version Packages (next) 2025-12-09 15:00:09 +00:00
Fredrik Adelöw 2bae83ab2e Version Policy Update - Node 22 to 24
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2025-12-08 10:53:38 +01:00
renovate[bot] 122664749c fix(deps): update dependency esbuild to ^0.27.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-05 11:07:28 +00:00