`
sillycat
  • 浏览: 2553621 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Common NPM Package and Installation

 
阅读更多
Common NPM Package and Installation

My colleague sets up a common library project. In that library project, the set up is simply as follow:
The package.json is as follow:
{
    "name": “@sillycat/cscommon",
"version": "0.1.10",
"description": "A collection of common software patterns used by sillycat services",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
    "build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/luohuazju/services.libs.common.git"
},
"bugs": {
"url": "https://github.com/luohuazju/services.libs.common/issues"
},
"homepage": "https://github.com/luohuazju/services.libs.common",
"keywords": [],
"author": “Carl Luo",
"license": "ISC",
"devDependencies": {
    "@types/aws-sdk": "^2.7.0",
    "@types/node": "^10.1.2",
    "aws-sdk": "^2.245.1",
    "typescript": "^2.8.3"
},
"dependencies": {
    "idx": "^2.3.0"
}
}

Command pack the library zip file, it will generate  sillycat-cscommon-0.1.10.tgz
> npm pack

In other target project, we can directly use that zip file by command as follow:
> npm install ../../services.libs.common/sillycat-cscommon-0.1.10.tgz

That will create a dependencies in the package.json file as follow:
“@sillycat/cscommon": "file:../../services.libs.common/sillycat-cscommon-0.1.10.tgz",

References:
http://podefr.tumblr.com/post/30488475488/locally-test-your-npm-modules-without-publishing
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics