mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
[PM-3587] create @bitwarden/vault lib (#6083)
* add libs/vault * update configs * update package lock * fix typo
This commit is contained in:
parent
019d4c2932
commit
5c576fd19e
@ -179,6 +179,12 @@
|
||||
"rules": {
|
||||
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/node/*", "src/**/*"] }]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["libs/vault/src/**/*.ts"],
|
||||
"rules": {
|
||||
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/vault/*", "src/**/*"] }]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -39,6 +39,7 @@ apps/desktop/src/vault @bitwarden/team-vault-dev
|
||||
apps/web/src/app/vault @bitwarden/team-vault-dev
|
||||
libs/angular/src/vault @bitwarden/team-vault-dev
|
||||
libs/common/src/vault @bitwarden/team-vault-dev
|
||||
libs/vault @bitwarden/team-vault-dev
|
||||
|
||||
## Admin Console team files ##
|
||||
apps/browser/src/admin-console @bitwarden/team-admin-console-dev
|
||||
|
1
.github/whitelist-capital-letters.txt
vendored
1
.github/whitelist-capital-letters.txt
vendored
@ -25,6 +25,7 @@
|
||||
./libs/common/src/abstractions/anonymousHub.service.ts
|
||||
./libs/common/src/services/anonymousHub.service.ts
|
||||
./libs/auth/README.md
|
||||
./libs/vault/README.md
|
||||
./README.md
|
||||
./LICENSE_BITWARDEN.txt
|
||||
./CONTRIBUTING.md
|
||||
|
@ -14,7 +14,8 @@
|
||||
"@bitwarden/auth": ["../../libs/auth/src"],
|
||||
"@bitwarden/common/*": ["../../libs/common/src/*"],
|
||||
"@bitwarden/components": ["../../libs/components/src"],
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"]
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"],
|
||||
"@bitwarden/vault": ["../../libs/auth/src"]
|
||||
},
|
||||
"useDefineForClassFields": false
|
||||
},
|
||||
|
@ -14,7 +14,8 @@
|
||||
"@bitwarden/auth": ["../../libs/auth/src"],
|
||||
"@bitwarden/common/*": ["../../libs/common/src/*"],
|
||||
"@bitwarden/components": ["../../libs/components/src"],
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"]
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"],
|
||||
"@bitwarden/vault": ["../../libs/vault/src"]
|
||||
},
|
||||
"useDefineForClassFields": false
|
||||
},
|
||||
|
@ -11,6 +11,7 @@
|
||||
"@bitwarden/components": ["../../libs/components/src"],
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"],
|
||||
"@bitwarden/importer": ["../../libs/importer/src"],
|
||||
"@bitwarden/vault": ["../../libs/vault/src"],
|
||||
"@bitwarden/web-vault/*": ["src/*"]
|
||||
}
|
||||
},
|
||||
|
@ -7,6 +7,7 @@
|
||||
"@bitwarden/common/*": ["../../libs/common/src/*"],
|
||||
"@bitwarden/components": ["../../libs/components/src"],
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"],
|
||||
"@bitwarden/vault": ["../../libs/vault/src"],
|
||||
"@bitwarden/web-vault/*": ["../../apps/web/src/*"]
|
||||
}
|
||||
},
|
||||
|
@ -27,6 +27,7 @@ module.exports = {
|
||||
"<rootDir>/libs/exporter/jest.config.js",
|
||||
"<rootDir>/libs/importer/jest.config.js",
|
||||
"<rootDir>/libs/node/jest.config.js",
|
||||
"<rootDir>/libs/vault/jest.config.js",
|
||||
],
|
||||
|
||||
// Workaround for a memory leak that crashes tests in CI:
|
||||
|
@ -3,12 +3,13 @@
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@bitwarden/angular/*": ["../angular/src/*"],
|
||||
"@bitwarden/auth": ["../auth/src/*"],
|
||||
"@bitwarden/auth": ["../auth/src"],
|
||||
"@bitwarden/common/*": ["../common/src/*"],
|
||||
"@bitwarden/components": ["../components/src"],
|
||||
"@bitwarden/exporter/*": ["../exporter/src/*"],
|
||||
"@bitwarden/importer": ["../importer/src"],
|
||||
"@bitwarden/node/*": ["../node/src/*"]
|
||||
"@bitwarden/node/*": ["../node/src/*"],
|
||||
"@bitwarden/vault": ["../vault/src"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
libs/vault/README.md
Normal file
3
libs/vault/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Vault
|
||||
|
||||
This lib represents the public API of the Vault team at Bitwarden. Modules are imported using `@bitwarden/vault`.
|
16
libs/vault/jest.config.js
Normal file
16
libs/vault/jest.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
const { pathsToModuleNameMapper } = require("ts-jest");
|
||||
|
||||
const { compilerOptions } = require("../shared/tsconfig.libs");
|
||||
|
||||
const sharedConfig = require("../../libs/shared/jest.config.angular");
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
module.exports = {
|
||||
...sharedConfig,
|
||||
displayName: "libs/vault tests",
|
||||
preset: "jest-preset-angular",
|
||||
setupFilesAfterEnv: ["<rootDir>/test.setup.ts"],
|
||||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
|
||||
prefix: "<rootDir>/",
|
||||
}),
|
||||
};
|
20
libs/vault/package.json
Normal file
20
libs/vault/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@bitwarden/vault",
|
||||
"version": "0.0.0",
|
||||
"description": "Common code used across Bitwarden JavaScript projects.",
|
||||
"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"
|
||||
}
|
||||
}
|
0
libs/vault/src/index.ts
Normal file
0
libs/vault/src/index.ts
Normal file
28
libs/vault/test.setup.ts
Normal file
28
libs/vault/test.setup.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
value: () => {
|
||||
return {
|
||||
display: "none",
|
||||
appearance: ["-webkit-appearance"],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(document, "doctype", {
|
||||
value: "<!DOCTYPE html>",
|
||||
});
|
||||
Object.defineProperty(document.body.style, "transform", {
|
||||
value: () => {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: webcrypto,
|
||||
});
|
5
libs/vault/tsconfig.json
Normal file
5
libs/vault/tsconfig.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../shared/tsconfig.libs",
|
||||
"include": ["src", "spec"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
4
libs/vault/tsconfig.spec.json
Normal file
4
libs/vault/tsconfig.spec.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"files": ["./test.setup.ts"]
|
||||
}
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -307,6 +307,10 @@
|
||||
"@bitwarden/common": "file:../common"
|
||||
}
|
||||
},
|
||||
"libs/vault": {
|
||||
"version": "0.0.0",
|
||||
"license": "GPL-3.0"
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
||||
@ -4592,6 +4596,10 @@
|
||||
"resolved": "libs/node",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/vault": {
|
||||
"resolved": "libs/vault",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/web-vault": {
|
||||
"resolved": "apps/web",
|
||||
"link": true
|
||||
|
@ -4,6 +4,7 @@ const config = require("./libs/components/tailwind.config.base");
|
||||
config.content = [
|
||||
"./libs/components/src/**/*.{html,ts,mdx}",
|
||||
"./libs/auth/src/**/*.{html,ts,mdx}",
|
||||
"./libs/vault/src/**/*.{html,ts,mdx}",
|
||||
"./apps/web/src/**/*.{html,ts,mdx}",
|
||||
"./bitwarden_license/bit-web/src/**/*.{html,ts,mdx}",
|
||||
"./.storybook/preview.js",
|
||||
|
@ -20,7 +20,8 @@
|
||||
"@bitwarden/common/*": ["./libs/common/src/*"],
|
||||
"@bitwarden/components": ["./libs/components/src"],
|
||||
"@bitwarden/exporter/*": ["./libs/exporter/src/*"],
|
||||
"@bitwarden/node/*": ["./libs/node/src/*"]
|
||||
"@bitwarden/node/*": ["./libs/node/src/*"],
|
||||
"@bitwarden/vault": ["./libs/vault/src"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
|
@ -22,7 +22,8 @@
|
||||
"@bitwarden/exporter/*": ["./libs/exporter/src/*"],
|
||||
"@bitwarden/importer": ["./libs/importer/src"],
|
||||
"@bitwarden/node/*": ["./libs/node/src/*"],
|
||||
"@bitwarden/web-vault/*": ["./apps/web/src/*"]
|
||||
"@bitwarden/web-vault/*": ["./apps/web/src/*"],
|
||||
"@bitwarden/vault": ["./libs/vault/src"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user