Skip to content

Commit

Permalink
Merge pull request #105 from falsy/feature/104/monorepo closed #104
Browse files Browse the repository at this point in the history
Feature/104/monorepo
  • Loading branch information
falsy authored Oct 22, 2024
2 parents 81a38bb + 7a1fd86 commit 920a696
Show file tree
Hide file tree
Showing 139 changed files with 12,327 additions and 643 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
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
22 changes: 22 additions & 0 deletions .eslintrc.js
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"
}
}
4 changes: 4 additions & 0 deletions .gitattributes
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store
.DS_Store
.env
node_modules
dist
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": false,
"trailingComma": "none",
"tabWidth": 2,
"semi": false
}
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
379 changes: 88 additions & 291 deletions README-ko.md

Large diffs are not rendered by default.

373 changes: 88 additions & 285 deletions README.md

Large diffs are not rendered by default.

Binary file added _images/aggregate-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/aggregate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed _images/configuration-dark.png
Binary file not shown.
Binary file removed _images/configuration.png
Binary file not shown.
Binary file removed _images/nestjs-dependency-injection-dark.png
Binary file not shown.
Binary file removed _images/nestjs-dependency-injection.png
Binary file not shown.
Binary file added _images/packages-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed _images/web-api-dark.png
Binary file not shown.
Binary file removed _images/web-api.png
Binary file not shown.
66 changes: 0 additions & 66 deletions _sql/parcel-tracking.sql

This file was deleted.

6 changes: 6 additions & 0 deletions jest.config.js
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"
}
43 changes: 43 additions & 0 deletions package.json
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]"
}
3 changes: 3 additions & 0 deletions packages/adapters/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: "../../.eslintrc.js"
}
1 change: 1 addition & 0 deletions packages/adapters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# adapters
7 changes: 7 additions & 0 deletions packages/adapters/jest.config.js
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"
}
31 changes: 31 additions & 0 deletions packages/adapters/package.json
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"
}
}
40 changes: 40 additions & 0 deletions packages/adapters/rollup.config.js
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()]
}
]
19 changes: 19 additions & 0 deletions packages/adapters/src/dtos/CommentDTO.ts
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
}
}
19 changes: 19 additions & 0 deletions packages/adapters/src/dtos/PostDTO.ts
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
}
}
17 changes: 17 additions & 0 deletions packages/adapters/src/dtos/UserDTO.ts
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
}
}
5 changes: 5 additions & 0 deletions packages/adapters/src/dtos/index.ts
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 }
27 changes: 27 additions & 0 deletions packages/adapters/src/index.ts
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
}
3 changes: 3 additions & 0 deletions packages/adapters/src/infrastructures/index.ts
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 packages/adapters/src/infrastructures/interfaces/IClientHTTP.ts
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>>
}
Loading

0 comments on commit 920a696

Please sign in to comment.