Yarn berry Zero-install with Ts
새로운 프로젝트에 yarn berry 적용시
yarn init -2
기존의 프로젝트를 yarn berry로 마이그레이션 할 경우
yarn set version berry
기존의 프로젝트를 안정화 버전으로 마이그레이션
yarn set version stable
익스프레스 설치
yarn add express
개발자 환경 설치
yarn add --dev @types/express typescript ts-node
.gitignore 수정
: gitignore는 같은 yarn berry를 사용하더라도 zero-install인 경우와 아닌 경우가 다르다
# using zero install
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# not using zero install
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
tsconfig.json 수정
: 기본 설정에서 필요한 설정을 추가하여 작성
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*"]
}
},
"include": ["app.ts"],
"exclude": ["node_modules"]
}