일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 최단경로문제
- java
- 시급합니다
- npm
- BFS
- 개발자
- OAuth
- 내돈내산
- YBM전화영어
- 백엔드스쿨
- webServlet
- 백엔드
- 원격근무
- Queue
- 프로젝트진행
- 전화영어
- OpenAPI프로젝트
- 탐색알고리즘
- 자바스크립트
- 프로그래머스
- Node.js
- 백엔드공부
- 교육철학과 교육사
- 제로베이스
- maven
- Spring
- 탄력근무
- 그래프탐색
- JavaScript
- 자료구조
- Today
- Total
인생자취
TIL | Node.js 개발 환경 설정하기 본문
1. Visual Studio Code (VSCode) 설치
https://code.visualstudio.com/
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
code.visualstudio.com
- 마이크로소프트가 후원하는 소스코드 편집기(에디터). (참고로 VSCode는 IDE가 아니므로 빌드를 하기 위해서는 별도의 컴파일 환경을 구축해야 함.)
- 노드를 코딩하는데 매우 유용함.
- 마이크로소프트 github에서 vscode의 인기(?)를 직접 확인해볼것.
https://github.com/microsoft/vscode
GitHub - microsoft/vscode: Visual Studio Code
Visual Studio Code. Contribute to microsoft/vscode development by creating an account on GitHub.
github.com
2. 커스터마이징한 개발환경을 설정할 수 있음.
- 커맨드 팔레트에서 원하는 설정으로 이동할 수 있음.
* 커맨드 팔레트 접근을 위한 바인딩 키
1) Windows : Ctrl + Shift + P
2) MacOS : Cmd + Shift + P
- keybindings.json : 커스터마이징한 설정이 저장됨.
- keyboard shortcuts : 키보드에 바인딩된 명령어를 알 수 있음.
- settings.json을 찾은 후 defaultsettings.json에서 가져와서 변경하면됨.
예) "workbench.colorTheme" : "Abyss"
2. Node.js 설치
Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org
- LTS(Long Term Support)는 장기 지원되는 버전으로 일반 버전과는 달리 안정성에 중점을 두었다.
- tj/N : Node version management tool은 binary CLI(Command Line Interface)로 노드 버전관리에 유리하다.
GitHub - tj/n: Node version management
Node version management. Contribute to tj/n development by creating an account on GitHub.
github.com
- Node Package Manager(npm) 버전 확인
$ npm -v
- TERMINAL(터미널)에서 package.json 설치 (-y로 옵션을 지정하면 to skip the questionnaire altogether을 의미하므로 default인 json파일을 생성함.)
- package.json 설치목적 : 본 프로젝트는 npm이 관리하는 패키지라는 것을 의미함. package.json은 패키지의 메타데이터를 포함.
$ npm init -y
https://docs.npmjs.com/cli/v8/commands/npm-init
npm-init | npm Docs
Create a package.json file
docs.npmjs.com
3. 컴파일 에러를 적게 만들기 위한 환경 세팅
- Formatting : Prettier / 세미콜론의 개수, state의 수 등 미적인 것과 관련한 환경을 제공함.
- prettier 플러그인 설치 (esbenp.prettier-vscode)
$ npm install --save-dev prettier
https://prettier.io/docs/en/configuration.html
Prettier · Opinionated Code Formatter
Opinionated Code Formatter
prettier.io
- Linting : ESLint / 코드의 일관성을 높이고 버그를 방지하는 것을 목표로 코딩 컨벤션에 위배되는 코드나 문법적인 오류 패턴 실시간으로 찾아줌.
$ npm install --save-dev eslint
https://eslint.org/docs/latest/user-guide/getting-started
Getting Started with ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
eslint.org
- airbnb javascript style guide를 활용. (eslint 규칙으로 만들어져있음.)
https://github.com/airbnb/javascript
GitHub - airbnb/javascript: JavaScript Style Guide
JavaScript Style Guide. Contribute to airbnb/javascript development by creating an account on GitHub.
github.com
$ npm install --save-dev eslint-config-airbnb-base
https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base
GitHub - airbnb/javascript: JavaScript Style Guide
JavaScript Style Guide. Contribute to airbnb/javascript development by creating an account on GitHub.
github.com
$ npm install --save-dev eslint-plugin-import
https://github.com/import-js/eslint-plugin-import
GitHub - import-js/eslint-plugin-import: ESLint plugin with rules that help validate proper imports.
ESLint plugin with rules that help validate proper imports. - GitHub - import-js/eslint-plugin-import: ESLint plugin with rules that help validate proper imports.
github.com
- prettier와 eslint의 충돌이 발생하는 경우를 해결하기 위한 패키지 설치
$ npm install --save-dev eslint-config-prettier
https://github.com/prettier/eslint-config-prettier
GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier.
Turns off all rules that are unnecessary or might conflict with Prettier. - GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier.
github.com
- ".eslintrc.js"생성 후에는 다음 블로그를 참고할 것.
https://backend-intro.vlpt.us/1/01.html
1-1. 프로젝트 생성 및 ESLint 설정 · GitBook
1-1. 프로젝트 생성 및 ESLint 설정 프로젝트 생성 웹서버 프로젝트를 위한 디렉토리를 만들고, 해당 디렉토리에서 yarn init 을 통하여 패키지 정보를 생성하세요. 그 다음엔, koa 를 설치합니다. $ mkdi
backend-intro.vlpt.us
- module.exports = { extends: ['airbnb-base', ...]}
- ".vscode"폴더 생성, ".vscode/settings.json"을 만들면 본 프로젝트에만 적용되는 설정을 입력할 수 있음.
- type 에러를 잡기 위해서(type checking) typescript 설치
$ npm install --save-dev typescript
- type 에러를 체크하기 위해 .js 상단에 "// @ts-check"를 적은 후 코드를 작성할 것.
- type checking의 엄격(?)한 설정을 지정하기 위해서는 jsconfig.json reference를 참고하여 수정한다.
https://code.visualstudio.com/docs/languages/jsconfig
jsconfig.json Reference
View the reference for jsconfig.json.
code.visualstudio.com
*본 내용은 강의를 학습한 후 학습자의 관점에서 정리한 내용입니다. 문제시 댓글로 남겨주시면 감사드리겠습니다.
'개발 > Dev | 웹개발' 카테고리의 다른 글
TIL | 토이프로젝트 / 웹서버 만들기 (0) | 2022.07.19 |
---|---|
TIL | 비동기적 코드의 간결화 (0) | 2022.07.16 |
TIL | JavaScript 기초 개념 및 용어 정리 (0) | 2022.07.15 |
TIL | JavaScript 기초이론 2 (0) | 2022.07.13 |
TIL | JavaScript 기초이론 (0) | 2022.07.12 |