-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from f-lab-edu/feature/1
[#1] 프로젝트 셋업 / TDD를 위한 deeplyCopy 테스트 코드 작성 / Dual Package 지원
- Loading branch information
Showing
18 changed files
with
5,200 additions
and
1 deletion.
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,34 @@ | ||
name: Run Jest Tests on Pull Request | ||
|
||
on: | ||
# Triggers the workflow on pull request events but only for the "feature/*" branch | ||
pull_request: | ||
branches: ["main"] | ||
paths-ignore: # Ensure this is also considered to ignore certain paths if needed | ||
- '!feature/1' # Exclude the specific branch | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
if: github.head_ref != 'feature/1' # Condition to exclude the branch | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run Jest tests | ||
run: pnpm test -- --coverage |
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,24 @@ | ||
# Node.js 관련 무시 파일 | ||
node_modules/ | ||
npm-debug.log | ||
|
||
# OS별 무시 파일 | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# 특정 IDE 및 편집기 관련 무시 파일 | ||
.vscode/ | ||
.idea/ | ||
|
||
# 로그 파일 | ||
*.log | ||
|
||
# 환경 설정 파일 | ||
.env | ||
|
||
# 빌드관련 | ||
build/ | ||
|
||
# test file | ||
src/foo.* | ||
|
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 @@ | ||
src/ |
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,9 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"arrowParens": "always", | ||
"endOfLine": "lf" | ||
} |
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,2 +1,13 @@ | ||
# deeply-copy | ||
custom deep copy function to make a brand new immutable object | ||
|
||
A custom deep copy function to make a brand new immutable object. It handles copying self reference object or array. It supports dual packages (CJS/ESM) | ||
|
||
깊은 복사를 해 불변 객체로 반환한다. 모든 데이터 타입 복사가 가능하고, 객체나 배열의 순환 참조도 핸들링한다. 듀얼 패키지를 지원한다. | ||
|
||
# 프로젝트 인스톨 방법 | ||
|
||
[pnpm 설치](https://pnpm.io/installation) 후 `pnpm install` 실행 | ||
|
||
# Dual Package (CJS/ESM) 지원 | ||
|
||
듀얼 패키지 지원을 위한 라이브러리나 모듈러를 별도로 사용하지 않고, TSC와 pacakge.json만을 사용하여 CJS, ESM을 모두 지원하고 있음. |
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 @@ | ||
export default { | ||
presets: [['@babel/preset-env', { targets: { node: 'current' } }]], | ||
}; |
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 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
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 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"outDir": "../build/cjs" | ||
} | ||
} |
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 @@ | ||
// @ts-check | ||
import { includeIgnoreFile } from '@eslint/compat'; | ||
import path from 'node:path'; | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
import { fileURLToPath } from 'node:url'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const gitignorePath = path.resolve(__dirname, '.gitignore'); | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.strict, | ||
...tseslint.configs.stylistic, | ||
eslintConfigPrettier, | ||
includeIgnoreFile(gitignorePath), | ||
eslintPluginPrettierRecommended, | ||
); |
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 @@ | ||
{ | ||
"type": "module" | ||
} |
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,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES2020", | ||
"moduleResolution": "Node", | ||
"outDir": "../build/esm" | ||
} | ||
} |
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 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
rootDir: './src', | ||
}; |
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,60 @@ | ||
{ | ||
"name": "deeply-copy", | ||
"version": "1.0.1-canary.11.0", | ||
"description": "custom deep copy function to make a brand new immutable object", | ||
"type": "module", | ||
"main": "./build/esm/index.js", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./build/esm/index.d.ts", | ||
"default": "./build/esm/index.js" | ||
}, | ||
"require": { | ||
"types": "./build/cjs/index.d.js", | ||
"default": "./build/cjs/index.cjs" | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"build": "npm run build:cjs && npm run build:esm && npm run rename", | ||
"build:cjs": "tsc --p ./cjs/tsconfig.json", | ||
"build:esm": "tsc --p ./esm/tsconfig.json", | ||
"build:clean": "rm -rf ./build", | ||
"rename": "node --no-warnings=ExperimentalWarning --loader ts-node/esm renameFiles.ts", | ||
"lint": "pnpm eslint", | ||
"lint:fix": "pnpm eslint . --fix" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/f-lab-edu/deeply-copy.git" | ||
}, | ||
"keywords": [ | ||
"deepCopy", | ||
"deepClone" | ||
], | ||
"author": "Kangsik Kevin Lee", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/f-lab-edu/deeply-copy/issues" | ||
}, | ||
"homepage": "https://github.com/f-lab-edu/deeply-copy#readme", | ||
"devDependencies": { | ||
"@eslint/compat": "^1.1.0", | ||
"@eslint/js": "^9.5.0", | ||
"@jest/globals": "^29.7.0", | ||
"@types/eslint__js": "^8.42.3", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.14.9", | ||
"eslint": "^9.5.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"jest": "^29.7.0", | ||
"prettier": "3.3.2", | ||
"ts-jest": "^29.1.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5", | ||
"typescript-eslint": "^7.13.1" | ||
} | ||
} |
Oops, something went wrong.