Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] PNPM + Turborepo를 통한 모노레포 환경 구성 #3

Merged
merged 17 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages/eslint/*
packages/tsconfig/*
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Issue Template
about: Issue 템플릿
title: "[Feat]"
title: '[Feat]'
labels: ''
assignees: ''

---

<!-- 제목양식을 지켜주세요! [Feat] {제목~~} -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Pull Request Template
about: PR 템플릿
title: "[Feat]"
title: '[Feat]'
labels: ''
assignees: ''

---

<!-- 제목양식을 지켜주세요! [Feat] {제목~~} -->
Expand Down
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Dependencies
node_modules
.pnp
.pnp.js

# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
build
dist


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sh .husky/commit-msg.sh "$1"
35 changes: 35 additions & 0 deletions .husky/commit-msg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

# 커밋 메시지 파일의 내용
commit_msg=$(cat "$1")

# 주석과 빈 줄을 제거하는 함수
remove_comments_and_empty_lines() {
echo "$1" | sed '/^#/d' | sed '/^\s*$/d'
}

# 주석과 빈 줄을 제거한 커밋 메시지
cleaned_msg=$(remove_comments_and_empty_lines "$commit_msg")

subject=$(echo "$cleaned_msg" | head -n1)

pattern="^(feat|test|fix|docs|test|refactor|design|style|chore): .+(\#[0-9]+)?$"

if ! echo "$subject" | grep -qE "$pattern"; then
echo ""
echo "오류: 유효하지 않은 커밋 메시지 형식입니다."
echo "올바른 형식: {타입}: {메시지}{#이슈번호(선택사항)}"
echo "유효한 타입: feat|test|fix|docs|test|refactor|design|style|chore"
echo "예시 - fix: 커밋 메시지 #123"
echo ""
echo "오류가 발생한 커밋 메시지:"
echo ""
echo "$cleaned_msg"
echo ""
exit 1
fi

echo ""
echo "커밋 완료!"
echo ""
exit 0
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
11 changes: 11 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
printWidth: 100,
useTabs: false,
semi: true,
trailingComma: 'es5',
bracketSpacing: true,
bracketSameLine: false,
arrowParens: 'always',
singleQuote: true,
tabWidth: 2,
};
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[:ledger: 팀 노션](https://rain-spatula-0a1.notion.site/12ae944ce960809eaf09e494ae58b73d?v=1b9cf2c65c7c4abd90a58ec5405973df&pvs=4) | [:busts_in_silhouette: 그라운드 룰](https://github.com/boostcampwm-2024/web21-boostproject/wiki/%EA%B7%B8%EB%9D%BC%EC%9A%B4%EB%93%9C%EB%A3%B0) | [:mag: 위키](https://github.com/boostcampwm-2024/web21-boostproject/wiki)

## :wave: 팀원 소개
| <div align = "center"><b>지석호</b></div> | <div align = "center"><b>노종빈</b></div> | <div align = "center"><b>심은서</b></div> | <div align = "center"><b>이지은</b></div> | <div align = "center"><b>황성하</b></div> |
| :---: | :---: | :---: | :---: | :---: |

| <div align = "center"><b>지석호</b></div> | <div align = "center"><b>노종빈</b></div> | <div align = "center"><b>심은서</b></div> | <div align = "center"><b>이지은</b></div> | <div align = "center"><b>황성하</b></div> |
| :-----------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: |
| <img src="https://avatars.githubusercontent.com/u/60173534?v=4" width="100" height="100" /> | <img src="https://avatars.githubusercontent.com/u/95959567?v=4" width="100" height="100" /> | <img src="https://avatars.githubusercontent.com/u/55528304?v=4" width="100" height="100" /> | <img src="https://avatars.githubusercontent.com/u/112913242?v=4" width="100" height="100" /> | <img src="https://avatars.githubusercontent.com/u/58902013?v=4" width="100" height="100" /> |
| [@seoko97](https://github.com/seoko97) | [@begong313](https://github.com/begong313) | [@simeunseo](https://github.com/simeunseo) | [@Jieun1ee](https://github.com/Jieun1ee) | [@Fixtar](https://github.com/Fixtar) |
| Web FE·BE | Web FE·BE | Web FE | Web BE | Web BE |
| [@seoko97](https://github.com/seoko97) | [@begong313](https://github.com/begong313) | [@simeunseo](https://github.com/simeunseo) | [@Jieun1ee](https://github.com/Jieun1ee) | [@Fixtar](https://github.com/Fixtar) |
| Web FE·BE | Web FE·BE | Web FE | Web BE | Web BE |
7 changes: 7 additions & 0 deletions apps/client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [require.resolve('@repo/lint')],
parserOptions: {
project: true,
},
};
16 changes: 16 additions & 0 deletions apps/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@app/client",
"version": "0.0.0",
"private": true,
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"@repo/shards": "workspace:*",
"@repo/types": "workspace:*"
},
"devDependencies": {
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*"
}
}
Empty file added apps/client/src/index.ts
Empty file.
10 changes: 10 additions & 0 deletions apps/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@repo/tsconfig/base.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts"]
}
7 changes: 7 additions & 0 deletions apps/server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [require.resolve('@repo/lint')],
parserOptions: {
project: true,
},
};
16 changes: 16 additions & 0 deletions apps/server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@app/server",
"version": "0.0.0",
"private": true,
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"@repo/shards": "workspace:*",
"@repo/types": "workspace:*"
},
"devDependencies": {
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*"
}
}
Empty file added apps/server/src/index.ts
Empty file.
10 changes: 10 additions & 0 deletions apps/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@repo/tsconfig/nestjs.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts"]
}
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "web21",
"private": true,
"scripts": {
"dev": "turbo dev",
"lint": "turbo lint",
"build": "turbo run build",
"build:apps": "turbo run build --filter=./apps/*",
"build:packages": "turbo run build --filter=./packages/*",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"",
"prepare": "husky"
},
"devDependencies": {
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"turbo": "^2.0.7",
"typescript": "^5.6.3"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"**/*.{json,md}": [
"prettier --write"
]
}
}
46 changes: 46 additions & 0 deletions packages/eslint/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const pathsConfig = require('./paths');
const namingConfig = require('./naming');

/** @type {import("eslint").Linter.Config} */
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'import', 'prettier'],
parserOptions: {
ecmaVersion: 2023,
sourceType: 'module',
},
env: {
es2023: true,
browser: true,
node: true,
},
settings: {
...pathsConfig.settings,
},
rules: {
'prettier/prettier': ['error', { singleQuote: true }],

// 기본 규칙
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn'],
'no-undef': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',

// 분리된 규칙들 병합
...namingConfig.rules,
...pathsConfig.rules,
},
ignorePatterns: ['node_modules/', 'dist/', 'build/', '.eslintrc.js'],
};
45 changes: 45 additions & 0 deletions packages/eslint/naming.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
{
selector: 'typeAlias',
format: ['PascalCase'],
custom: {
regex: '^T[A-Z]',
match: false,
},
},
{
selector: 'typeParameter',
format: ['PascalCase'],
custom: {
regex: '^T[A-Z]',
match: false,
},
},
],
},
};
22 changes: 22 additions & 0 deletions packages/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@repo/lint",
"version": "0.0.0",
"private": true,
"main": "index.js",
"files": [
"index.js"
],
"dependencies": {
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1"
},
"peerDependencies": {
"eslint": "^8.56.0",
"typescript": ">=5.0.0"
}
}
Loading