1. 통합개발환경 세팅

통합개발환경 세팅을 해보자

  • TypeScript

  • ESLint

  • React

  • Parcel

  • React Router

  • styled-components

  • styled-reset

  • usehooks-ts

  • usestore-ts

    • Axios

    • tsyringe

    • reflect-metadata

  • jest-dom

    • MSW

  • CodeceptJS

순서대로 설치 및 테스트 진행

1. 프로젝트 폴더 생성 및 진입

2. npm 글로벌 설치

3. Node 버전 잡기

4. npm 패키지 초기화

5. TS 및 ESLint 설치

Typescript 설치

Typescript 설정 파일 생성

tsconfig.json 파일에서 jsx 항목 수정

ESLint 설치

ESLint 설정

ESLint Airbnb 스타일 적용

Airbnb 스타일 다시 적용(TS에서 Airbnb 지원하지 않기 때문)

.eslintrc.js 파일 수정

prettier 충돌 방지

.eslintrc.js 파일 수정

.eslintignore 파일 생성


6. Jest 설치

jest.config.js

jest.config.js 생성


React 설치

기본 파일 생성

  • index.html

  • src/main.tsx

  • src/App.tsx


Parcel 설치

parcel-reporter-static-files-copy 설치

static folder 생성

Root path 에 static 폴더를 만든다. 정적 이미지 등을 해당 폴더에 넣는다.

.gitignore 파일 생성

  • VisualStudioCode, react, macOS, Node 키워드로 생성(gitignore.io)

아래의 폴더는 반드시 추가할 것

package.json 수정

실행 테스트


MSW 설치 및 관련 파일 생성

TODO: 추후 보완할 것

  • src/setupTests.ts

  • src/mocks/server.ts

  • src/mocks/handler.ts 파일 추가

jest.config.js 설정 변경

TODO: 추후 보완할 것

setupFilesAfterEnv 의 속성에 setupTests.ts 파일 추가


React Router 설치

styled-components 설치

/src/.swcrc 파일 생성

main.tsx 수정

App.tsx 수정

/src/routes.tsx 파일 생성 /src/components/Layout.tsx 파일 생성 /src/pages/HomePage.tsx 파일 생성

/src/styles 폴더 생성

  • /src/styles/defaultTheme.ts 파일 생성

  • /src/styles/Theme.ts 파일 생성

  • /src/styles/styled.d.ts 파일 생성

  • /src/styles/GlobalStyle.ts 파일 생성

  • App.tsx 수정

helper 만들어주기

/src/utils/test-helpers.tsx


Axios 설치

tsyringe, reflect-metadata, usestore-ts 설치

/src/main.tsx, src/setupTests.ts 파일 수정

tsconfig.json 수정

jest.config.js 파일 수정


CodeceptJS 설치

부가 설정

  • codecept.conf.ts 에서 config의 타입 제거 및 수정.

  • tests/steps.d.ts 파일 생성

  • steps_files.js 파일 tests 폴더로 이동

  • tsconfig.json 파일 수정

    • CodeceptJS가 내부적으로 ts-node 사용하기 때문에

  • /tests/.eslintrc.js 파일 생성

  • .gitignore 에 output/ 추가

  • package.json 수정

Last updated