mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 04:03:29 +00:00
feat(platform): stand up a @bitwarden/state library
This commit is contained in:
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -194,3 +194,4 @@ apps/web/src/locales/en/messages.json
|
||||
**/tsconfig.json @bitwarden/team-platform-dev
|
||||
**/jest.config.js @bitwarden/team-platform-dev
|
||||
**/project.jsons @bitwarden/team-platform-dev
|
||||
libs/state @bitwarden/team-platform-dev
|
||||
|
||||
5
libs/state/README.md
Normal file
5
libs/state/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# state
|
||||
|
||||
Owned by: platform
|
||||
|
||||
Services, models, and functions for managing state in Bitwarden applications
|
||||
3
libs/state/eslint.config.mjs
Normal file
3
libs/state/eslint.config.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import baseConfig from "../../eslint.config.mjs";
|
||||
|
||||
export default [...baseConfig];
|
||||
10
libs/state/jest.config.js
Normal file
10
libs/state/jest.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
displayName: "state",
|
||||
preset: "../../jest.preset.js",
|
||||
testEnvironment: "node",
|
||||
transform: {
|
||||
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
|
||||
},
|
||||
moduleFileExtensions: ["ts", "js", "html"],
|
||||
coverageDirectory: "../../coverage/libs/state",
|
||||
};
|
||||
11
libs/state/package.json
Normal file
11
libs/state/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@bitwarden/state",
|
||||
"version": "0.0.1",
|
||||
"description": "Services, models, and functions for managing state in Bitwarden applications",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "GPL-3.0",
|
||||
"author": "platform"
|
||||
}
|
||||
33
libs/state/project.json
Normal file
33
libs/state/project.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "state",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/state/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/state",
|
||||
"main": "libs/state/src/index.ts",
|
||||
"tsConfig": "libs/state/tsconfig.lib.json",
|
||||
"assets": ["libs/state/*.md"]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["libs/state/**/*.ts"]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/state/jest.config.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
libs/state/src/index.ts
Normal file
0
libs/state/src/index.ts
Normal file
8
libs/state/src/state.spec.ts
Normal file
8
libs/state/src/state.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as lib from "./index";
|
||||
|
||||
describe("state", () => {
|
||||
// This test will fail until something is exported from index.ts
|
||||
it("should work", () => {
|
||||
expect(lib).toBeDefined();
|
||||
});
|
||||
});
|
||||
13
libs/state/tsconfig.json
Normal file
13
libs/state/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
10
libs/state/tsconfig.lib.json
Normal file
10
libs/state/tsconfig.lib.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["jest.config.js", "src/**/*.spec.ts"]
|
||||
}
|
||||
10
libs/state/tsconfig.spec.json
Normal file
10
libs/state/tsconfig.spec.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../..//dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node10",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
|
||||
}
|
||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -319,6 +319,11 @@
|
||||
"version": "0.0.0",
|
||||
"license": "GPL-3.0"
|
||||
},
|
||||
"libs/state": {
|
||||
"name": "@bitwarden/state",
|
||||
"version": "0.0.1",
|
||||
"license": "GPL-3.0"
|
||||
},
|
||||
"libs/storage-core": {
|
||||
"name": "@bitwarden/storage-core",
|
||||
"version": "0.0.1",
|
||||
@@ -3807,6 +3812,10 @@
|
||||
"resolved": "libs/tools/send/send-ui",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/state": {
|
||||
"resolved": "libs/state",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/storage-core": {
|
||||
"resolved": "libs/storage-core",
|
||||
"link": true
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
"@bitwarden/platform": ["./libs/platform/src"],
|
||||
"@bitwarden/platform/*": ["./libs/platform/src/*"],
|
||||
"@bitwarden/send-ui": ["./libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/state": ["libs/state/src/index.ts"],
|
||||
"@bitwarden/storage-core": ["libs/storage-core/src/index.ts"],
|
||||
"@bitwarden/ui-common": ["./libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["./libs/ui/common/src/setup-jest"],
|
||||
|
||||
Reference in New Issue
Block a user