From 1a7dd82ff721ae2d5adc47cac3628a3ce6ecb926 Mon Sep 17 00:00:00 2001 From: zhumeisongsong Date: Thu, 14 Nov 2024 19:47:52 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20initial=20usecase=20of=20us?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++- libs/user/usecase/README.md | 7 ++++++ libs/user/usecase/eslint.config.js | 3 +++ libs/user/usecase/jest.config.ts | 10 +++++++++ libs/user/usecase/project.json | 9 ++++++++ libs/user/usecase/src/index.ts | 1 + .../user/usecase/src/lib/user-usecase.spec.ts | 7 ++++++ libs/user/usecase/src/lib/user-usecase.ts | 3 +++ libs/user/usecase/tsconfig.json | 22 +++++++++++++++++++ libs/user/usecase/tsconfig.lib.json | 11 ++++++++++ libs/user/usecase/tsconfig.spec.json | 14 ++++++++++++ tsconfig.base.json | 3 ++- 12 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 libs/user/usecase/README.md create mode 100644 libs/user/usecase/eslint.config.js create mode 100644 libs/user/usecase/jest.config.ts create mode 100644 libs/user/usecase/project.json create mode 100644 libs/user/usecase/src/index.ts create mode 100644 libs/user/usecase/src/lib/user-usecase.spec.ts create mode 100644 libs/user/usecase/src/lib/user-usecase.ts create mode 100644 libs/user/usecase/tsconfig.json create mode 100644 libs/user/usecase/tsconfig.lib.json create mode 100644 libs/user/usecase/tsconfig.spec.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 7158154..0974368 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "cSpell.words": [ "nestjs", - "supergraph" + "supergraph", + "usecase" ] } \ No newline at end of file diff --git a/libs/user/usecase/README.md b/libs/user/usecase/README.md new file mode 100644 index 0000000..55f764c --- /dev/null +++ b/libs/user/usecase/README.md @@ -0,0 +1,7 @@ +# user-usecase + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test user-usecase` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/user/usecase/eslint.config.js b/libs/user/usecase/eslint.config.js new file mode 100644 index 0000000..07e518f --- /dev/null +++ b/libs/user/usecase/eslint.config.js @@ -0,0 +1,3 @@ +const baseConfig = require('../../../eslint.config.js'); + +module.exports = [...baseConfig]; diff --git a/libs/user/usecase/jest.config.ts b/libs/user/usecase/jest.config.ts new file mode 100644 index 0000000..f265dce --- /dev/null +++ b/libs/user/usecase/jest.config.ts @@ -0,0 +1,10 @@ +export default { + displayName: 'user-usecase', + preset: '../../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../../coverage/libs/user/usecase', +}; diff --git a/libs/user/usecase/project.json b/libs/user/usecase/project.json new file mode 100644 index 0000000..721c75a --- /dev/null +++ b/libs/user/usecase/project.json @@ -0,0 +1,9 @@ +{ + "name": "user-usecase", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/user/usecase/src", + "projectType": "library", + "tags": [], + "// targets": "to see all targets run: nx show project user-usecase --web", + "targets": {} +} diff --git a/libs/user/usecase/src/index.ts b/libs/user/usecase/src/index.ts new file mode 100644 index 0000000..4a77ee3 --- /dev/null +++ b/libs/user/usecase/src/index.ts @@ -0,0 +1 @@ +export * from './lib/user-usecase'; diff --git a/libs/user/usecase/src/lib/user-usecase.spec.ts b/libs/user/usecase/src/lib/user-usecase.spec.ts new file mode 100644 index 0000000..db5d6da --- /dev/null +++ b/libs/user/usecase/src/lib/user-usecase.spec.ts @@ -0,0 +1,7 @@ +import { userUsecase } from './user-usecase'; + +describe('userUsecase', () => { + it('should work', () => { + expect(userUsecase()).toEqual('user-usecase'); + }); +}); diff --git a/libs/user/usecase/src/lib/user-usecase.ts b/libs/user/usecase/src/lib/user-usecase.ts new file mode 100644 index 0000000..55af887 --- /dev/null +++ b/libs/user/usecase/src/lib/user-usecase.ts @@ -0,0 +1,3 @@ +export function userUsecase(): string { + return 'user-usecase'; +} diff --git a/libs/user/usecase/tsconfig.json b/libs/user/usecase/tsconfig.json new file mode 100644 index 0000000..0dc79ca --- /dev/null +++ b/libs/user/usecase/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noPropertyAccessFromIndexSignature": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/user/usecase/tsconfig.lib.json b/libs/user/usecase/tsconfig.lib.json new file mode 100644 index 0000000..e583571 --- /dev/null +++ b/libs/user/usecase/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/libs/user/usecase/tsconfig.spec.json b/libs/user/usecase/tsconfig.spec.json new file mode 100644 index 0000000..69a251f --- /dev/null +++ b/libs/user/usecase/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index ac6d8fe..4acfc6a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -17,7 +17,8 @@ "paths": { "@libs/config": ["libs/config/src/index.ts"], "@prompt/domain": ["libs/prompt/domain/src/index.ts"], - "@user/domain": ["libs/user/domain/src/index.ts"] + "@user/domain": ["libs/user/domain/src/index.ts"], + "@user/usecase": ["libs/user/usecase/src/index.ts"] } }, "exclude": ["node_modules", "tmp"]