clients/libs/nx-plugin
Will Martin 69c937e592
[CL-954] Upgrade to Angular 21 (#19725)
* prune desktop packages

* Fix @napi-rs/cli version mismatch in desktop napi workspace

Aligns package.json declaration with the locked version (3.2.0) to
resolve npm workspace inconsistency that was blocking ng update.

* update Storybook to v10

* update Angular to v21

* override jest in ng builder

* Add jest-environment-jsdom as explicit dependency

Previously installed as a side effect of a jest@29 override; removing
that override caused it to disappear from node_modules.

* Add .claude/worktrees/ to .gitignore

* Restore @napi-rs/cli to 3.5.1 to match main

* Pin jest-environment-jsdom to 29.7.0 and add to renovate config

* Override jest-environment-jsdom to 29.7.0 in build-angular context

* Add isolatedModules to libs/subscription tsconfig.spec.json to fix Angular 21 module resolution

* Change moduleResolution to bundler for Angular 21 subpath export compatibility

* Add isolatedModules to Angular libs with old spec tsconfig pattern

* Disable emitDecoratorMetadata in spec tsconfigs with isolatedModules

* Fix HostListener event parameter types for Angular 21 compiler strictness

* Revert accidental change to access-selector spec

* Remove accidentally generated desktop package-lock.json

* Fix type-only imports/exports caught by Rolldown in Storybook v10/Vite v8

* fix vault-wrapper type error from Angular 21 stricter generic inference

ngComponentOutlet accepts Type<unknown>; annotate computed() explicitly
since VaultComponent is generic and VaultOrigComponent is not, preventing
TypeScript from inferring a compatible union constructor type.

* Fix kitchen-sink interaction tests for Storybook v10

Replace fire-and-forget navigateTo + synchronous getByRole with
navigateAndWaitFor<T>, which sets the hash and retries the ready
callback via waitFor. Storybook v10 starts play functions before
Angular's initial router navigation completes, so synchronous DOM
queries after navigation were failing intermittently.

* Provide ZoneJS change detection scheduler for Storybook stories

Angular 21 no longer sets up the ZoneJS change detection scheduler by
default in bootstrapApplication. Storybook's Angular renderer uses
bootstrapApplication internally and does not add provideZoneChangeDetection
automatically, so Default CD components relying on zone.js to trigger
re-renders after async operations were not updating before Chromatic
snapshots.

* Wait for dialog/side nav to render before Chromatic snapshot

After userEvent.click the dialog and side nav open asynchronously.
Without an explicit waitFor, Chromatic captures the snapshot before the
resulting UI state is present.

* Fix kitchen-sink waitFor: re-query side nav button, use querySelector for dialog

- openSideNav: re-query the toggle button inside waitFor to avoid reading
  a stale DOM reference after Angular re-renders the element post-click
- SimpleDialogOpen / VirtualScrollBlockingDialog: replace getByRole("dialog")
  with querySelector("cdk-dialog-container") to avoid testing-library's
  visibility check failing on a momentarily inaccessible overlay element

* Revert kitchen-sink stories to main

* Bump Angular, Storybook, and ng-select to latest patch versions

* Trigger pre-commit hooks on merge

* Regenerate package-lock.json with --force to fix npm ci sync
2026-05-18 10:55:47 -05:00
..
docs Update command to reset nx (#18022) 2025-12-17 19:09:07 +00:00
src fix(nx): use relative paths in tsconfig.base.json for TypeScript 7 compatibility (#18295) 2026-01-09 21:22:54 +01:00
eslint.config.mjs feat(nx): add basic-lib generator for streamlined library creation (#14992) 2025-06-05 14:20:23 -04:00
generators.json feat(nx): add basic-lib generator for streamlined library creation (#14992) 2025-06-05 14:20:23 -04:00
jest.config.ts feat(nx): add basic-lib generator for streamlined library creation (#14992) 2025-06-05 14:20:23 -04:00
package.json fix(basic-lib generator): Ensure all project.json files have a rootDir value (#16384) 2025-09-22 12:32:23 -04:00
project.json fix(basic-lib generator): Ensure all project.json files have a rootDir value (#16384) 2025-09-22 12:32:23 -04:00
README.md docs: document the basic-lib generator (#15891) 2025-08-05 12:21:16 -04:00
tsconfig.eslint.json build(nx): create per-lib tsconfig.eslint configs (#15519) 2025-07-07 14:17:52 -07:00
tsconfig.json [CL-954] Upgrade to Angular 21 (#19725) 2026-05-18 10:55:47 -05:00
tsconfig.lib.json feat(nx): add basic-lib generator for streamlined library creation (#14992) 2025-06-05 14:20:23 -04:00
tsconfig.spec.json feat(nx): add basic-lib generator for streamlined library creation (#14992) 2025-06-05 14:20:23 -04:00

@bitwarden/nx-plugin

The @bitwarden/nx-plugin library is a custom Nx plugin developed specifically for Bitwarden projects. It provides generators tailored to Bitwarden's architecture and coding standards.

Overview

This plugin extends Nx's capabilities with Bitwarden-specific nx generators that help maintain consistency across the codebase.

What are Nx Generators?

Nx generators are code generation tools that follow templates to create or modify files in your project. They can:

  • Create new files from templates
  • Modify existing files
  • Update configuration files
  • Ensure consistent project structure
  • Automate repetitive tasks

If you're familiar with the code generation tools of say, the angular CLI, then you can just think of =nx= generators as that but on a larger scale. Generators can be run using the Nx CLI with the nx generate command (or the shorthand nx g).

When to Use Generators

Use generators when:

  • Creating new libraries, components, or features that follow a standard pattern
  • You want to ensure consistency across similar parts of your application
  • You need to automate repetitive setup tasks
  • You want to reduce the chance of human error in project setup

How @bitwarden/nx-plugin Fits Into the Project Architecture

@bitwarden/nx-plugin is designed to:

  1. Enforce Bitwarden's architectural decisions and code organization
  2. Streamline the creation of new libraries and components
  3. Ensure consistent configuration across the project
  4. Automate updates to project metadata and configuration files
  5. Reduce the learning curve for new contributors

By using this plugin, we maintain a consistent approach to code organization and structure across the entire project.

Installation and Setup

The plugin is included as a development dependency in the project. If you're working with a fresh clone of the repository, it will be installed when you run:

npm install

No additional setup is required to use the generators provided by the plugin.

Available Generators

The plugin currently includes the following generators:

  • basic-lib: Creates a new library with standard configuration and structure. Specific documentation for the basic-lib generator can be found here

Additional generators may be added in the future to support other common patterns in the Bitwarden codebase.

Creating A Nx Generator

This library is maintained by platform, but anyone from any team can add a generator if there is any amount of value added. If you need to create a new generator please do so by running

npx nx generate @nx/plugin:generator libs/nx-plugin/src/generators/your-generator-name-here}

This will create a basic generator structure for you to get started with.

Further Learning

To learn more about Nx plugins and how they work: