Commit Graph

35 Commits

Author SHA1 Message Date
Gabriel Dugny c47f3d8a73 Flip boolean config
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-02-10 23:59:40 +01:00
Gabriel Dugny 2dac444c33 fix: Follow-up of #32345
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-16 21:32:12 +01:00
Gabriel Dugny 5773dbac78 chore: Update imports, rename components
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-16 21:18:44 +01:00
Gabriel Dugny 262ba22e7d chore: lint
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-16 10:34:44 +01:00
Gabriel Dugny 27798df0a3 Migrate techdocs-cli-embedded-app to NFS
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-01-11 20:25:25 +01: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
Paul Schultz b2bef924b2 feat: convert all enums to erasable-syntax compliant patterns
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-10-21 10:20:01 -05:00
Gabriel Dugny bc76c10bd4 fix(techdocs-cli): Missing styles, illegible pages
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-17 10:45:31 +02:00
Gabriel Dugny 43afbe50aa feat(techdocs): POC livereload for techdocs-cli serve (#30541)
* feat(techdocs): POC livereload for techdocs-cli serve

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

* chore: techdocs reload tests, refactor

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

---------

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-10-07 13:29:14 -04:00
Paul Schultz 2e26579e06 chore: update react imports
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-04-08 07:35:24 -05:00
Łukasz Jernaś 48adc60dd3 chore(material-ui): Remove more top-level @material-ui imports
Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
2024-10-21 12:30:21 +02:00
Łukasz Jernaś ea75c37c9b chore(material-ui): Don't use top level material-ui imports
This changes the @material-ui imports to not use top level imports
in packages/ as per eslint-rules enforced elsewhere.

Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
2024-10-10 11:47:14 +02:00
Vincenzo Scamporlino 178ffdd402 techdocs-cli-embedded-app: default techdocs.builder to local
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2024-05-07 14:25:39 +02:00
Camila Belo 43bf40c812 fix: techdocs cookie mocking date
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-03-12 09:53:51 +01:00
Camila Belo ff9906b68d fix: add issue token to dev api
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-03-12 09:00:51 +01:00
Patrik Oldsberg 7221db3702 switch app rendering to ReactDOM.createRoot
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-10-18 09:37:03 +02:00
Patrik Oldsberg 2e701b3796 refactor react-router -> react-router-dom
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2022-12-10 15:17:53 +01:00
Dmitry Lobanov f905853ad6 refactor: replace @material-ui Link
Signed-off-by: Dmitry Lobanov <lobanov.dmitry.s@gmail.com>
2022-10-25 13:05:18 +02:00
Axel Hecht 05fc47c525 [techdocs/cli] Use light theme if it's not dark, to avoid breaking the theme selector on other values in local storage
Fixes #12995

Signed-off-by: Axel Hecht <axel@pike.org>
2022-08-11 17:43:56 +02:00
Eric Peterson 37c8f8444c Better naming of providers, hooks, and types.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-05-23 15:37:45 +02:00
Eric Peterson 3533075dfd Replace SidebarContext with versioned provider and hook.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-05-23 15:35:30 +02:00
Anders Näsman a68de3c984 move TechDocsStorage api from @backstage/plugin-techdocs to @backstage/plugin-techdocs-react
Signed-off-by: Anders Näsman <andersn@spotify.com>
2022-04-27 13:10:42 +02:00
Eric Peterson 39a6eda01d Review feedback 2: electric boogaloo
Co-authored-by: Otto Sichert <git@ottosichert.de>
Co-authored-by: Anders Näsman <realandersn@users.noreply.github.com>
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-04-12 15:37:29 +02:00
Otto Sichert b05870bcb7 Move @backstage/techdocs-addons to @backstage/plugin-techdocs-react
Co-authored-by: Eric Peterson <iamEAP@users.noreply.github.com>
Co-authored-by: Anders Näsman <realandersn@users.noreply.github.com>
Signed-off-by: Otto Sichert <git@ottosichert.de>
2022-04-11 16:13:07 +02:00
Emma Indal a122923bd0 api-reports and prettier
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Eric Peterson <ericpeterson@spotify.com>
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2022-04-09 13:47:02 +02:00
Emma Indal 377309a98b use app theme api for techdocs cli embedded app
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Eric Peterson <ericpeterson@spotify.com>
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2022-04-09 13:47:02 +02:00
Emma Indal c969da2fcd fix techdocs-cli embedded app
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Eric Peterson <ericpeterson@spotify.com>
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2022-04-09 13:47:02 +02:00
Camila Belo 2605805cb5 fix(techdocs): embed cli app reader
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2022-04-09 13:47:02 +02:00
Camila Belo e0dc1e8ccd tests(techdocs): fix broken tests
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2022-04-09 13:46:47 +02:00
Emma Indal b44692890b tests fixups
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2022-03-14 22:39:18 +01:00
Fredrik Adelöw 36aa63022b deprecate EntityName, introduce CompoundEntityRef
deprecate getEntityName, introduce getCompoundEntityRef

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2022-03-02 21:54:45 +01:00
Camila Belo 89edb124f5 refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2022-02-21 10:29:35 +01:00
Camila Belo c3c3418912 feat(plugin-techdocs): adjust theme styles
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2022-02-18 10:19:01 +01:00
Patrik Oldsberg b70c186194 techdocs-cli: unified dev and production build through config detection
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2022-02-05 14:00:30 +01:00
Patrik Oldsberg a532ac2e10 embedded-techdocs-app -> techdocs-cli-embedded-app
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2022-02-03 11:53:28 +01:00