본 문서에서는 NodeJS의 패키지에 대한 기본적인 내용들과 자주 사용되는 패키지에 대한 간략한 개요를 다룬다.
최종수정일:2023.06.07
노드 모듈의 최상위 디렉터리에 위치하며 해당 모듈에 대한 메타데이터를 담고있다. "name" 필드와 "version" 필드는 필수적이다.
지시자 | 설명 | 예시 |
---|---|---|
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" |
keywords | npm 검색 시 사용될 키워드 | "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
등등 다양한 필드가 존재한다.
name