NPM 배포하기
NPM
패키지 개발
$ npm init -y$ npm install commander개발버전 사용
배포
배포버전 사용
버전 업데이트
Last updated
$ npm init -y$ npm install commanderLast updated
#!/usr/bin/env node
const { program } = require('commander')
function init() {
console.log('init project');
}
program.action(args => {
init();
});
program.parse(process.argv);{
"name": "npm-release-version",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"npm-release-version": "./bin/index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"commander": "^11.0.0"
}
}
$ npm link
$ npm-release-version$ npm install -g
$ npm-release-version$ npm ls -g --depth=0$ npm uninstall npm-release-version -g$ npm login$ npm whoami$ npm info {패키지 이름}$ npm publish$ npm install {패키지 이름} -g$ npx {패키지 이름} -g$ npm publish