-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/104/monorepo
- Loading branch information
Showing
139 changed files
with
12,327 additions
and
643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2022, | ||
sourceType: "module" | ||
}, | ||
plugins: ["@typescript-eslint/eslint-plugin"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
root: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true | ||
}, | ||
rules: { | ||
"@typescript-eslint/no-require-imports": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.yarn/** linguist-vendored | ||
/.yarn/releases/* binary | ||
/.yarn/plugins/**/* binary | ||
/.pnp.* binary linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
.DS_Store | ||
.DS_Store | ||
.env | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": false, | ||
"trailingComma": "none", | ||
"tabWidth": 2, | ||
"semi": false | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
moduleFileExtensions: ["js", "json", "ts", "tsx"], | ||
testRegex: ".*\\.spec\\.(ts|tsx)$", | ||
testEnvironment: "node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "clean-architecture-with-typescript", | ||
"private": true, | ||
"version": "3.1.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/falsy/clean-architecture-with-typescript.git" | ||
}, | ||
"author": "falsy", | ||
"license": "The Unlicense", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"lint": "eslint packages/*/src --ext .ts", | ||
"build:domains": "yarn workspace domains run build", | ||
"build:adapters": "yarn workspace adapters run build", | ||
"build:server": "yarn workspace api-server run build", | ||
"build:a": "yarn workspace client-a run build", | ||
"build:b": "yarn workspace client-b run build", | ||
"start:server": "yarn workspace api-server run start", | ||
"start:a": "yarn workspace client-a run start", | ||
"start:b": "yarn workspace client-b run start", | ||
"test:domains": "yarn workspace domains run test", | ||
"test:adapters": "yarn workspace adapters run test", | ||
"test:server": "yarn workspace api-server run test", | ||
"test:a": "yarn workspace client-a run test", | ||
"test:b": "yarn workspace client-b run test" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.13", | ||
"@typescript-eslint/eslint-plugin": "^8.10.0", | ||
"@typescript-eslint/parser": "^8.10.0", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.3.3", | ||
"ts-jest": "^29.2.5", | ||
"typescript": "^5.6.3" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: "../../.eslintrc.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# adapters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const baseConfig = require("../../jest.config") | ||
|
||
module.exports = { | ||
...baseConfig, | ||
roots: ["<rootDir>/src"], | ||
displayName: "adapters" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "adapters", | ||
"packageManager": "[email protected]", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"build": "rm -rf dist && rollup -c --bundleConfigAsCjs", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^26.0.1", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"rollup": "^4.21.0", | ||
"rollup-plugin-dts": "^6.1.1", | ||
"tslib": "^2.7.0" | ||
}, | ||
"engines": { | ||
"node": ">=20.16.0" | ||
}, | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"axios": "^1.7.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import resolve from "@rollup/plugin-node-resolve" | ||
import commonjs from "@rollup/plugin-commonjs" | ||
import typescript from "@rollup/plugin-typescript" | ||
import terser from "@rollup/plugin-terser" | ||
import dts from "rollup-plugin-dts" | ||
import json from "@rollup/plugin-json" | ||
|
||
import packageJson from "./package.json" | ||
|
||
export default [ | ||
{ | ||
input: "./src/index.ts", | ||
output: [ | ||
{ | ||
file: packageJson.main, | ||
format: "cjs", | ||
sourcemap: true | ||
}, | ||
{ | ||
file: packageJson.module, | ||
format: "esm", | ||
sourcemap: true | ||
} | ||
], | ||
plugins: [ | ||
typescript({ | ||
tsconfig: "./tsconfig.json" | ||
}), | ||
resolve(), | ||
commonjs(), | ||
terser(), | ||
json() | ||
] | ||
}, | ||
{ | ||
input: "dist/esm/types/src/index.d.ts", | ||
output: [{ file: "dist/index.d.ts", format: "esm" }], | ||
plugins: [dts.default()] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ICommentDTO, IUserInfoVO } from "domains" | ||
|
||
export default class CommentDTO implements ICommentDTO { | ||
readonly id: string | ||
readonly postId: string | ||
content: string | ||
readonly author: IUserInfoVO | ||
readonly createdAt: Date | ||
updatedAt: Date | ||
|
||
constructor(params: ICommentDTO) { | ||
this.id = params.id | ||
this.postId = params.postId | ||
this.content = params.content | ||
this.author = params.author | ||
this.createdAt = params.createdAt | ||
this.updatedAt = params.updatedAt | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { IPostDTO, IUserInfoVO } from "domains" | ||
|
||
export default class PostDTO implements IPostDTO { | ||
readonly id: string | ||
title: string | ||
content: string | ||
readonly author: IUserInfoVO | ||
readonly createdAt: Date | ||
updatedAt: Date | ||
|
||
constructor(post: IPostDTO) { | ||
this.id = post.id | ||
this.title = post.title | ||
this.content = post.content | ||
this.author = post.author | ||
this.createdAt = post.createdAt | ||
this.updatedAt = post.createdAt | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { IUserDTO } from "domains" | ||
|
||
export default class UserDTO implements IUserDTO { | ||
readonly id: string | ||
readonly name: string | ||
readonly email: string | ||
readonly createdAt: Date | ||
readonly updatedAt: Date | ||
|
||
constructor(params: IUserDTO) { | ||
this.id = params.id | ||
this.name = params.name | ||
this.email = params.email | ||
this.createdAt = params.createdAt | ||
this.updatedAt = params.updatedAt | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import CommentDTO from "./CommentDTO" | ||
import PostDTO from "./PostDTO" | ||
import UserDTO from "./UserDTO" | ||
|
||
export { CommentDTO, PostDTO, UserDTO } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { IClientHTTP } from "./infrastructures" | ||
import { CommentDTO, PostDTO, UserDTO } from "./dtos" | ||
import { | ||
CommentRepository, | ||
PostRepository, | ||
UserRepository | ||
} from "./repositories" | ||
import { | ||
IPostPresenter, | ||
PostPresenter, | ||
IUserPresenter, | ||
UserPresenter | ||
} from "./presenters" | ||
|
||
export { | ||
IClientHTTP, | ||
CommentDTO, | ||
PostDTO, | ||
UserDTO, | ||
CommentRepository, | ||
PostRepository, | ||
UserRepository, | ||
IPostPresenter, | ||
PostPresenter, | ||
IUserPresenter, | ||
UserPresenter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { IClientHTTP } from "./interfaces/IClientHTTP" | ||
|
||
export { IClientHTTP } |
16 changes: 16 additions & 0 deletions
16
packages/adapters/src/infrastructures/interfaces/IClientHTTP.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { AxiosRequestConfig, AxiosResponse } from "axios" | ||
|
||
export interface IClientHTTP { | ||
get<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> | ||
post<T>( | ||
url: string, | ||
data?: unknown, | ||
config?: AxiosRequestConfig | ||
): Promise<AxiosResponse<T>> | ||
put<T>( | ||
url: string, | ||
data?: unknown, | ||
config?: AxiosRequestConfig | ||
): Promise<AxiosResponse<T>> | ||
delete<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> | ||
} |
Oops, something went wrong.