Common NPM Package and Installation

zhuzixiangshui 2018-05-29

CommonNPMPackageandInstallation

Mycolleaguesetsupacommonlibraryproject.Inthatlibraryproject,thesetupissimplyasfollow:

Thepackage.jsonisasfollow:

{

"name":“@sillycat/cscommon",

"version":"0.1.10",

"description":"Acollectionofcommonsoftwarepatternsusedbysillycatservices",

"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":“CarlLuo",

"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"

}

}

Commandpackthelibraryzipfile,itwillgeneratesillycat-cscommon-0.1.10.tgz

>npmpack

Inothertargetproject,wecandirectlyusethatzipfilebycommandasfollow:

>npminstall../../services.libs.common/sillycat-cscommon-0.1.10.tgz

Thatwillcreateadependenciesinthepackage.jsonfileasfollow:

“@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

相关推荐

heshizui / 0评论 2014-10-13