diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e003d5621e8..0a4e824fb24 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -97,6 +97,7 @@ libs/storage-test-utils @bitwarden/team-platform-dev libs/messaging @bitwarden/team-platform-dev libs/messaging-internal @bitwarden/team-platform-dev libs/serialization @bitwarden/team-platform-dev +libs/guid @bitwarden/team-platform-dev # Web utils used across app and connectors apps/web/src/utils/ @bitwarden/team-platform-dev # Web core and shared files diff --git a/libs/guid/README.md b/libs/guid/README.md new file mode 100644 index 00000000000..506ef221a94 --- /dev/null +++ b/libs/guid/README.md @@ -0,0 +1,5 @@ +# guid + +Owned by: platform + +Guid utilities extracted from common diff --git a/libs/guid/eslint.config.mjs b/libs/guid/eslint.config.mjs new file mode 100644 index 00000000000..9c37d10e3ff --- /dev/null +++ b/libs/guid/eslint.config.mjs @@ -0,0 +1,3 @@ +import baseConfig from "../../eslint.config.mjs"; + +export default [...baseConfig]; diff --git a/libs/guid/jest.config.js b/libs/guid/jest.config.js new file mode 100644 index 00000000000..d1c4dc01098 --- /dev/null +++ b/libs/guid/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: "guid", + preset: "../../jest.preset.js", + testEnvironment: "node", + transform: { + "^.+\\.[tj]s$": ["ts-jest", { tsconfig: "/tsconfig.spec.json" }], + }, + moduleFileExtensions: ["ts", "js", "html"], + coverageDirectory: "../../coverage/libs/guid", +}; diff --git a/libs/guid/package.json b/libs/guid/package.json new file mode 100644 index 00000000000..9f7af0667a3 --- /dev/null +++ b/libs/guid/package.json @@ -0,0 +1,11 @@ +{ + "name": "@bitwarden/guid", + "version": "0.0.1", + "description": "Guid utilities extracted from common", + "private": true, + "type": "commonjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "license": "GPL-3.0", + "author": "platform" +} diff --git a/libs/guid/project.json b/libs/guid/project.json new file mode 100644 index 00000000000..e5d510b2e2a --- /dev/null +++ b/libs/guid/project.json @@ -0,0 +1,33 @@ +{ + "name": "guid", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/guid/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/guid", + "main": "libs/guid/src/index.ts", + "tsConfig": "libs/guid/tsconfig.lib.json", + "assets": ["libs/guid/*.md"] + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/guid/**/*.ts"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/guid/jest.config.js" + } + } + } +} diff --git a/libs/guid/src/guid.spec.ts b/libs/guid/src/guid.spec.ts new file mode 100644 index 00000000000..026f751a481 --- /dev/null +++ b/libs/guid/src/guid.spec.ts @@ -0,0 +1,8 @@ +import * as lib from "./index"; + +describe("guid", () => { + // This test will fail until something is exported from index.ts + it("should work", () => { + expect(lib).toBeDefined(); + }); +}); diff --git a/libs/guid/src/index.ts b/libs/guid/src/index.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libs/guid/tsconfig.eslint.json b/libs/guid/tsconfig.eslint.json new file mode 100644 index 00000000000..3daf120441a --- /dev/null +++ b/libs/guid/tsconfig.eslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": ["src/**/*.ts", "src/**/*.js"], + "exclude": ["**/build", "**/dist"] +} diff --git a/libs/guid/tsconfig.json b/libs/guid/tsconfig.json new file mode 100644 index 00000000000..62ebbd94647 --- /dev/null +++ b/libs/guid/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/guid/tsconfig.lib.json b/libs/guid/tsconfig.lib.json new file mode 100644 index 00000000000..9cbf6736007 --- /dev/null +++ b/libs/guid/tsconfig.lib.json @@ -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"] +} diff --git a/libs/guid/tsconfig.spec.json b/libs/guid/tsconfig.spec.json new file mode 100644 index 00000000000..1275f148a18 --- /dev/null +++ b/libs/guid/tsconfig.spec.json @@ -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"] +} diff --git a/package-lock.json b/package-lock.json index 04fde294530..34fd77c1a7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -332,6 +332,11 @@ "version": "0.0.0", "license": "GPL-3.0" }, + "libs/guid": { + "name": "@bitwarden/guid", + "version": "0.0.1", + "license": "GPL-3.0" + }, "libs/importer": { "name": "@bitwarden/importer", "version": "0.0.0", @@ -4590,6 +4595,10 @@ "resolved": "libs/tools/generator/extensions/navigation", "link": true }, + "node_modules/@bitwarden/guid": { + "resolved": "libs/guid", + "link": true + }, "node_modules/@bitwarden/importer": { "resolved": "libs/importer", "link": true diff --git a/tsconfig.base.json b/tsconfig.base.json index e321566393e..aa094ab8e41 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -33,6 +33,7 @@ "@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/guid": ["libs/guid/src/index.ts"], "@bitwarden/importer-core": ["./libs/importer/src"], "@bitwarden/importer-ui": ["./libs/importer/src/components"], "@bitwarden/key-management": ["./libs/key-management/src"],