0
0
Fork 0
mirror of https://github.com/bitwarden/clients.git synced 2024-11-23 09:47:43 +01:00

[PM-9008] factor generator-extensions into separate libraries (#9724)

This commit is contained in:
✨ Audrey ✨ 2024-06-20 10:49:23 -04:00 committed by GitHub
parent 8bd2118d77
commit 639debe91b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 178 additions and 58 deletions

View file

@ -206,11 +206,29 @@
}
},
{
"files": ["libs/tools/generator/extensions/src/**/*.ts"],
"files": ["libs/tools/generator/extensions/history/src/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{ "patterns": ["@bitwarden/generator-extensions/*", "src/**/*"] }
{ "patterns": ["@bitwarden/generator-history/*", "src/**/*"] }
]
}
},
{
"files": ["libs/tools/generator/extensions/legacy/src/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{ "patterns": ["@bitwarden/generator-legacy/*", "src/**/*"] }
]
}
},
{
"files": ["libs/tools/generator/extensions/navigation/src/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{ "patterns": ["@bitwarden/generator-navigation/*", "src/**/*"] }
]
}
},

View file

@ -21,7 +21,9 @@
"@bitwarden/components": ["../../libs/components/src"],
"@bitwarden/generator-components": ["../../libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["../../libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [
"../../libs/tools/export/vault-export/vault-export-core/src"
],

View file

@ -19,7 +19,9 @@
"@bitwarden/components": ["../../libs/components/src"],
"@bitwarden/generator-components": ["../../libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["../../libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [
"../../libs/tools/export/vault-export/vault-export-core/src"
],

View file

@ -14,7 +14,9 @@
"@bitwarden/components": ["../../libs/components/src"],
"@bitwarden/generator-components": ["../../libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["../../libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [
"../../libs/tools/export/vault-export/vault-export-core/src"
],

View file

@ -13,7 +13,9 @@
"@bitwarden/components": ["../../libs/components/src"],
"@bitwarden/generator-components": ["../../libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["../../libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [
"../../libs/tools/export/vault-export/vault-export-core/src"
],

View file

@ -14,7 +14,9 @@
"@bitwarden/components": ["../../libs/components/src"],
"@bitwarden/generator-components": ["../../libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["../../libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [
"../../libs/tools/export/vault-export/vault-export-core/src"
],

View file

@ -32,6 +32,9 @@ module.exports = {
"<rootDir>/libs/components/jest.config.js",
"<rootDir>/libs/tools/export/vault-export/vault-export-core/jest.config.js",
"<rootDir>/libs/tools/generator/core/jest.config.js",
"<rootDir>/libs/tools/generator/extensions/history/jest.config.js",
"<rootDir>/libs/tools/generator/extensions/legacy/jest.config.js",
"<rootDir>/libs/tools/generator/extensions/navigation/jest.config.js",
"<rootDir>/libs/importer/jest.config.js",
"<rootDir>/libs/platform/jest.config.js",
"<rootDir>/libs/node/jest.config.js",

View file

@ -12,7 +12,9 @@
"@bitwarden/components": ["../components/src"],
"@bitwarden/generator-components": ["../tools/generator/components/src"],
"@bitwarden/generator-core": ["../tools/generator/core/src"],
"@bitwarden/generator-extensions": ["../tools/generator/extensions/src"],
"@bitwarden/generator-history": ["../tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["../tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["../tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": ["../tools/export/vault-export/vault-export-core/src"],
"@bitwarden/vault-export-ui": ["../tools/export/vault-export/vault-export-ui/src"],
"@bitwarden/importer/core": ["../importer/src"],

View file

@ -1,7 +1,7 @@
{
"name": "@bitwarden/generator-components",
"version": "0.0.0",
"description": "Angular components for the Bitwarden generators",
"description": "Angular components for the Bitwarden credential generators",
"keywords": [
"bitwarden"
],

View file

@ -1,7 +1,7 @@
{
"name": "@bitwarden/generator-core",
"version": "0.0.0",
"description": "TODO",
"description": "Common Bitwarden credential generation logic",
"keywords": [
"bitwarden"
],

View file

@ -1,5 +1,3 @@
export { GeneratorHistoryService } from "../../../extensions/src/history/generator-history.abstraction";
export { GeneratorNavigationService } from "../../../extensions/src/navigation/generator-navigation.service.abstraction";
export { GeneratorService } from "./generator.service.abstraction";
export { GeneratorStrategy } from "./generator-strategy.abstraction";
export { PolicyEvaluator } from "./policy-evaluator.abstraction";

View file

@ -1,13 +1,13 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../../../shared/tsconfig.libs");
const { compilerOptions } = require("../../../../shared/tsconfig.libs");
/** @type {import('jest').Config} */
module.exports = {
testMatch: ["**/+(*.)+(spec).+(ts)"],
preset: "ts-jest",
testEnvironment: "../../../shared/test.environment.ts",
testEnvironment: "../../../../shared/test.environment.ts",
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/../../",
prefix: "<rootDir>/../../../",
}),
};

View file

@ -1,7 +1,7 @@
{
"name": "@bitwarden/generator-extensions",
"name": "@bitwarden/generator-history",
"version": "0.0.0",
"description": "TODO",
"description": "Bitwarden credential generator history service",
"keywords": [
"bitwarden"
],

View file

@ -1,4 +1,4 @@
import { GeneratorCategory, GeneratedCredential } from "./";
import { GeneratorCategory, GeneratedCredential } from ".";
describe("GeneratedCredential", () => {
describe("constructor", () => {

View file

@ -1,5 +1,5 @@
{
"extends": "../../../shared/tsconfig.libs",
"extends": "../../../../shared/tsconfig.libs",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

View file

@ -0,0 +1,13 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../../../../shared/tsconfig.libs");
/** @type {import('jest').Config} */
module.exports = {
testMatch: ["**/+(*.)+(spec).+(ts)"],
preset: "ts-jest",
testEnvironment: "../../../../shared/test.environment.ts",
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/../../../",
}),
};

View file

@ -0,0 +1,26 @@
{
"name": "@bitwarden/generator-legacy",
"version": "0.0.0",
"description": "Deprecated Bitwarden credential generation services",
"keywords": [
"bitwarden"
],
"author": "Bitwarden Inc.",
"homepage": "https://bitwarden.com",
"repository": {
"type": "git",
"url": "https://github.com/bitwarden/clients"
},
"license": "GPL-3.0",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch"
},
"dependencies": {
"@bitwarden/common": "file:../../../common",
"@bitwarden/generator-core": "file:../core",
"@bitwarden/generator-history": "file:../extensions/history",
"@bitwarden/generator-navigation": "file:../extensions/navigation"
}
}

View file

@ -4,9 +4,8 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
import { StateProvider } from "@bitwarden/common/platform/state";
import { engine, services, strategies } from "@bitwarden/generator-core";
import { LocalGeneratorHistoryService } from "../history";
import { DefaultGeneratorNavigationService } from "../navigation";
import { LocalGeneratorHistoryService } from "@bitwarden/generator-history";
import { DefaultGeneratorNavigationService } from "@bitwarden/generator-navigation";
import { LegacyPasswordGenerationService } from "./legacy-password-generation.service";
import { PasswordGenerationServiceAbstraction } from "./password-generation.service.abstraction";

View file

@ -6,8 +6,7 @@ import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { StateProvider } from "@bitwarden/common/platform/state";
import { engine, services, strategies } from "@bitwarden/generator-core";
import { DefaultGeneratorNavigationService } from "../navigation";
import { DefaultGeneratorNavigationService } from "@bitwarden/generator-navigation";
import { LegacyUsernameGenerationService } from "./legacy-username-generation.service";
import { UsernameGenerationServiceAbstraction } from "./username-generation.service.abstraction";

View file

@ -0,0 +1,6 @@
export * from "./password-generation.service.abstraction";
export * from "./create-legacy-password-generation-service";
export * from "./password-generator-options";
export * from "./username-generation.service.abstraction";
export * from "./create-legacy-username-generation-service";
export * from "./username-generation-options";

View file

@ -14,16 +14,20 @@ import {
PasswordGeneratorPolicy,
policies,
} from "@bitwarden/generator-core";
import { mockAccountServiceWith } from "../../../../../common/spec";
import { GeneratedCredential, GeneratorHistoryService, GeneratedPasswordHistory } from "../history";
import {
GeneratedCredential,
GeneratorHistoryService,
GeneratedPasswordHistory,
} from "@bitwarden/generator-history";
import {
GeneratorNavigationService,
DefaultGeneratorNavigation,
GeneratorNavigation,
GeneratorNavigationEvaluator,
GeneratorNavigationPolicy,
} from "../navigation";
} from "@bitwarden/generator-navigation";
import { mockAccountServiceWith } from "../../../../../common/spec";
import { LegacyPasswordGenerationService } from "./legacy-password-generation.service";
import { PasswordGeneratorOptions } from "./password-generator-options";

View file

@ -22,13 +22,16 @@ import {
PasswordGeneratorPolicy,
PolicyEvaluator,
} from "@bitwarden/generator-core";
import { GeneratedCredential, GeneratorHistoryService, GeneratedPasswordHistory } from "../history";
import {
GeneratedCredential,
GeneratorHistoryService,
GeneratedPasswordHistory,
} from "@bitwarden/generator-history";
import {
GeneratorNavigationService,
GeneratorNavigation,
GeneratorNavigationPolicy,
} from "../navigation";
} from "@bitwarden/generator-navigation";
import { PasswordGenerationServiceAbstraction } from "./password-generation.service.abstraction";
import { PasswordGeneratorOptions } from "./password-generator-options";

View file

@ -24,15 +24,15 @@ import {
SubaddressGenerationOptions,
policies,
} from "@bitwarden/generator-core";
import { mockAccountServiceWith } from "../../../../../common/spec";
import {
GeneratorNavigationPolicy,
GeneratorNavigationEvaluator,
DefaultGeneratorNavigation,
GeneratorNavigation,
GeneratorNavigationService,
} from "../navigation";
} from "@bitwarden/generator-navigation";
import { mockAccountServiceWith } from "../../../../../common/spec";
import { LegacyUsernameGenerationService } from "./legacy-username-generation.service";
import { UsernameGeneratorOptions } from "./username-generation-options";

View file

@ -14,8 +14,7 @@ import {
Forwarders,
SubaddressGenerationOptions,
} from "@bitwarden/generator-core";
import { GeneratorNavigationService, GeneratorNavigation } from "../navigation";
import { GeneratorNavigationService, GeneratorNavigation } from "@bitwarden/generator-navigation";
import { UsernameGeneratorOptions } from "./username-generation-options";
import { UsernameGenerationServiceAbstraction } from "./username-generation.service.abstraction";

View file

@ -1,8 +1,7 @@
import { Observable } from "rxjs";
import { PasswordGeneratorPolicyOptions } from "@bitwarden/common/admin-console/models/domain/password-generator-policy-options";
import { GeneratedPasswordHistory } from "../history";
import { GeneratedPasswordHistory } from "@bitwarden/generator-history";
import { PasswordGeneratorOptions } from "./password-generator-options";

View file

@ -1,6 +1,5 @@
import { PassphraseGenerationOptions, PasswordGenerationOptions } from "@bitwarden/generator-core";
import { GeneratorNavigation } from "../navigation";
import { GeneratorNavigation } from "@bitwarden/generator-navigation";
/** Request format for credential generation.
* This type includes all properties suitable for reactive data binding.

View file

@ -0,0 +1,5 @@
{
"extends": "../../../../shared/tsconfig.libs",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

View file

@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}

View file

@ -0,0 +1,13 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../../../../shared/tsconfig.libs");
/** @type {import('jest').Config} */
module.exports = {
testMatch: ["**/+(*.)+(spec).+(ts)"],
preset: "ts-jest",
testEnvironment: "../../../../shared/test.environment.ts",
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/../../../",
}),
};

View file

@ -0,0 +1,24 @@
{
"name": "@bitwarden/generator-navigation",
"version": "0.0.0",
"description": "Bitwarden credential generator selection settings service",
"keywords": [
"bitwarden"
],
"author": "Bitwarden Inc.",
"homepage": "https://bitwarden.com",
"repository": {
"type": "git",
"url": "https://github.com/bitwarden/clients"
},
"license": "GPL-3.0",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch"
},
"dependencies": {
"@bitwarden/common": "file:../../../common",
"@bitwarden/generator-core": "file:../core"
}
}

View file

@ -16,7 +16,7 @@ import {
GeneratorNavigationEvaluator,
DefaultGeneratorNavigationService,
DefaultGeneratorNavigation,
} from "./";
} from ".";
const SomeUser = "some user" as UserId;

View file

@ -0,0 +1,5 @@
{
"extends": "../../../../shared/tsconfig.libs",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

View file

@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}

View file

@ -1,9 +0,0 @@
export * as history from "./history";
export * as legacyPassword from "./legacy-password";
export * as legacyUsername from "./legacy-username";
export * as navigation from "./navigation";
export { GeneratorHistoryService } from "./history";
export { GeneratorNavigationService } from "./navigation";
export { PasswordGenerationServiceAbstraction } from "./legacy-password";
export { UsernameGenerationServiceAbstraction } from "./legacy-username";

View file

@ -1,3 +0,0 @@
export * from "./password-generation.service.abstraction";
export * from "./create-generation-service";
export * from "./password-generator-options";

View file

@ -1,3 +0,0 @@
export * from "./username-generation.service.abstraction";
export * from "./create-generation-service";
export * from "./username-generation-options";

View file

@ -23,7 +23,9 @@
"@bitwarden/components": ["./libs/components/src"],
"@bitwarden/generator-components": ["./libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["./libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["./libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["./libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["./libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["./libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": [".libs/tools/export/vault-export/vault-export-core/src"],
"@bitwarden/vault-export-ui": [".libs/tools/export/vault-export/vault-export-ui/src"],
"@bitwarden/importer/core": ["./libs/importer/src"],

View file

@ -24,7 +24,9 @@
"@bitwarden/components": ["./libs/components/src"],
"@bitwarden/generator-components": ["./libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["./libs/tools/generator/core/src"],
"@bitwarden/generator-extensions": ["./libs/tools/generator/extensions/src"],
"@bitwarden/generator-history": ["./libs/tools/generator/extensions/history/src"],
"@bitwarden/generator-legacy": ["./libs/tools/generator/extensions/legacy/src"],
"@bitwarden/generator-navigation": ["./libs/tools/generator/extensions/navigation/src"],
"@bitwarden/vault-export-core": ["./libs/tools/export/vault-export/vault-export-core/src"],
"@bitwarden/vault-export-ui": ["./libs/tools/export/vault-export/vault-export-ui/src"],
"@bitwarden/importer/core": ["./libs/importer/src"],