1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-11 14:48:46 +01:00
bitwarden-browser/libs/tools/generator/components
Matt Gibson 9c1e2ebd67
Typescript-strict-plugin (#12235)
* Use typescript-strict-plugin to iteratively turn on strict

* Add strict testing to pipeline

Can be executed locally through either `npm run test:types` for full type checking including spec files, or `npx tsc-strict` for only tsconfig.json included files.

* turn on strict for scripts directory

* Use plugin for all tsconfigs in monorepo

vscode is capable of executing tsc with plugins, but uses the most relevant tsconfig to do so. If the plugin is not a part of that config, it is skipped and developers get no feedback of strict compile time issues. These updates remedy that at the cost of slightly more complex removal of the plugin when the time comes.

* remove plugin from configs that extend one that already has it

* Update workspace settings to honor strict plugin

* Apply strict-plugin to native message test runner

* Update vscode workspace to use root tsc version

* `./node_modules/.bin/update-strict-comments` 🤖

This is a one-time operation. All future files should adhere to strict type checking.

* Add fixme to `ts-strict-ignore` comments

* `update-strict-comments` 🤖

repeated for new merge files
2024-12-09 20:58:50 +01:00
..
src Typescript-strict-plugin (#12235) 2024-12-09 20:58:50 +01:00
jest.config.js [PM-7289] implement generator libraries (#9549) 2024-06-11 16:06:37 -04:00
package.json [PM-9008] factor generator-extensions into separate libraries (#9724) 2024-06-20 10:49:23 -04:00
readme.md [PM-8282] credential generator (#11398) 2024-10-08 14:08:34 -04:00
tsconfig.json [PM-7289] Create generator libraries (#9432) 2024-05-30 15:38:31 -04:00
tsconfig.spec.json [PM-7289] Create generator libraries (#9432) 2024-05-30 15:38:31 -04:00

Using generator components

The components within this module require the following import.

import { GeneratorModule } from "@bitwarden/generator-components";

The credential generator provides access to all generator features.

<!-- Bound to active user -->
<tools-credential-generator />

<!-- Bound to a specific user -->
<tools-credential-generator [user-id]="userId" />

<!-- receive updates when a credential is generated.
     `$event` is a `GeneratedCredential`.
-->
<tools-credential-generator (onGenerated)="eventHandler($event)" />

Specialized components are provided for username and password generation. These components support the same properties as the credential generator.

<tools-password-generator [user-id]="userId" (onGenerated)="eventHandler($event)" />
<tools-username-generator [user-id]="userId" (onGenerated)="eventHandler($event)" />

The emission behavior of onGenerated varies according to credential type. When a credential supports immediate execution, the component automatically generates a value and emits from onGenerated. An additional emission occurs each time the user changes a setting. Users may also request a regeneration.

When a credential does not support immediate execution, then onGenerated fires only when the user clicks the "generate" button.