[NodeJS]패키지

Philip Sung·2023년 6월 7일
0

[NodeJS]

목록 보기
3/4
post-thumbnail

01 개요

본 문서에서는 NodeJS의 패키지에 대한 기본적인 내용들과 자주 사용되는 패키지에 대한 간략한 개요를 다룬다.

최종수정일:2023.06.07



02 package.json

노드 모듈의 최상위 디렉터리에 위치하며 해당 모듈에 대한 메타데이터를 담고있다. "name" 필드와 "version" 필드는 필수적이다.

02.01 필드 목록

지시자설명예시
name패키지명"name": "SamplePackage"
preferGlobal모듈의 전역 설치 선호"preferGlobal" : true
version모듈 버전 정보"version": 1.0.0
author프로젝트 작성자명"author": "SampleUser@Samplehost.com"
description모듈에 대한 설명"description": "SampleText"
contributors모듈 공한 개발자"contributors": [{"name": "A", "email":"A@B"}]
bin프로젝트와 같이 전역 설치될 바이너리"bin: { "Samplebin": "./bin/Samplebin"}
scripts콘솔 앱 실행 매개변수 지정"scripts" { "start": "node ./bin/Samplebin", "test": "echo test"}
main애플리케이션 메인 진입점 지정"main": ".bin/Samplebin"
repository저장소 형식과 패키지 위치 지정"repository": {"type": "git", "location": "http://A.com/B.git"
keywordsnpm 검색 시 사용될 키워드"keywords": [ "SampleKeyA", "SampleKeyB" ]
depenencies종속석이 있는 모듈과 버전, *와 x 와일드카드"dependencies": { "express": "latest", "connect": "2.x.x"
engines패키지에 사용된 node 버전"engines": {"node": ">=6.5"}

이 외에도 homepage bugs license files config repository devDependencies 등등 다양한 필드가 존재한다.

02.02 필드 주의사항

name

  • 214글자 미만
  • .이나 _로 시작할 수 없음
  • 소문자만 사용
  • URL-safe
profile
Philip Sung

0개의 댓글