mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-20247] Initialize user-core library (#15029)
* Initialize user-core library * Run `npm install` * Fix patched generator bug
This commit is contained in:
6
libs/user-core/README.md
Normal file
6
libs/user-core/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# user-core
|
||||
|
||||
Owned by: auth
|
||||
|
||||
The very basic concept that constitutes a user, this needs to be very low level to facilitate
|
||||
Platform keeping their own code low level.
|
||||
3
libs/user-core/eslint.config.mjs
Normal file
3
libs/user-core/eslint.config.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import baseConfig from "../../eslint.config.mjs";
|
||||
|
||||
export default [...baseConfig];
|
||||
10
libs/user-core/jest.config.js
Normal file
10
libs/user-core/jest.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
displayName: "user-core",
|
||||
preset: "../../jest.preset.js",
|
||||
testEnvironment: "node",
|
||||
transform: {
|
||||
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
|
||||
},
|
||||
moduleFileExtensions: ["ts", "js", "html"],
|
||||
coverageDirectory: "../../coverage/libs/user-core",
|
||||
};
|
||||
10
libs/user-core/package.json
Normal file
10
libs/user-core/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@bitwarden/user-core",
|
||||
"version": "0.0.0",
|
||||
"description": "The very basic concept that constitutes a user, this needs to be very low level to facilitate Platform keeping their own code low level.",
|
||||
"type": "commonjs",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "GPL-3.0",
|
||||
"author": "auth"
|
||||
}
|
||||
27
libs/user-core/project.json
Normal file
27
libs/user-core/project.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "user-core",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/user-core/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/user-core",
|
||||
"main": "libs/user-core/src/index.ts",
|
||||
"tsConfig": "libs/user-core/tsconfig.lib.json",
|
||||
"assets": ["libs/user-core/*.md"]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/user-core/jest.config.js",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
libs/user-core/src/index.ts
Normal file
9
libs/user-core/src/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Opaque } from "type-fest";
|
||||
|
||||
/**
|
||||
* The main identifier for a user. It is a string that should be in valid guid format.
|
||||
*
|
||||
* You should avoid `as UserId`-ing strings as much as possible and instead retrieve the {@see UserId} from
|
||||
* a valid source instead.
|
||||
*/
|
||||
export type UserId = Opaque<string, "UserId">;
|
||||
13
libs/user-core/tsconfig.json
Normal file
13
libs/user-core/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/user-core/tsconfig.lib.json
Normal file
10
libs/user-core/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/user-core/tsconfig.spec.json
Normal file
10
libs/user-core/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"]
|
||||
}
|
||||
Reference in New Issue
Block a user