1、Addtwoconfigurefile
Youshouldaddtwoconfigurefileinyouproject,theyarepackage.jsonandREADME.mdfiles.
package.jsonlikethis:
{
"name": "myweb",
"version": "0.0.1",
"description": "Node.js module to do some thing",
"preferGlobal": "true",
"main": "index.js",
"bin": { "myweb": "index.js" },
"author": "Danhuang",
"keywords": ["myweb", "nodejs", "nodejs framework"],
"repository" : {
"type": "git",
"url": "https://tnodejs@github.com/tnodejs/myweb-nodejs.git"
},
"dependencies": {
"commander": "0.5.2"
},
"engines": { "node": "*" }
}
Sincewe'dwantmywebtobeusedasacommandlinetool,wehaveset"preferGlobal":"true"and"bin":{"myweb":"index.js"}.Ifitwerealibrarymodule,thatwouldnothavebeenrequired.
Youmustcheckthatthenameisyourprojectname,andurlintherepositorythatwecanaccesstotheprojectcodeingithub.
README.mdisthe'introductionandguidefile'fortheproject,formattedinGitHubflavoredMarkdown(http://github.github.com/github-flavored-markdown/).
2、Youcanaddmoduleinlinux,windows,mac.
A.cdmywebdirectoryandrunnpmlink
npm link
B.Ifitthrowthepermissiondenie,thenyoucabrunthesudonpmlink
sudo npm link
C.Afterthatwewillfindanewfloderwhichnameis'node_modules'inmywebdirectory.
D.Butwedon'twantitscontentstobepartofthegitrepository,solet'saddnode_modulesto.gitignore.
echo node_modules/ >> .gitignore
E.Nowweshouldaddautornameandpassword.
Then,youwillinputyourname,passwordandemail.
npm adduser
F.Afterallofthestep,wecanpublishthenodejsmodule.
npm publish
3、Testforthenpmmodule
Wecanusenpminstallthemodulethatwehadaddedbefore.
npminstallmyweb
Afterruningtheit,wewillfindourmodule(myweb)stayinthenode_modulesfloder.
分享到:
相关推荐
how-to-npm, 模块,教你如何模块 how-to-npm 模块,教你如何模块。先决条件要使用这个项目,你需要 NodeJS 。 访问 http://www.nodejs.org 下载并了解更多信息 !用法npm i -g how-to-npm
基于Facebook的create react app的NPM库启动套件
Open this probject in atom-typescript. Press F6 to build. And then npm publish away.This project can be consumed flawlessly from the sister project ts-npm-module-consume
npm i -g how-to-npm how-to-npm 这将引导您逐步了解如何设置工作环境,安装依赖项,登录npm,发布模块等,所有这些都从您自己的笔记本电脑的安全性出发。 公开来源 这是一个。 做出重大和有价值贡献的个人将获得对...
generator-npm-module 为NPM模块设计的自强生成器 入门 $ npm install -g yo generator-npm-module 在新目录中启动生成器,并按照说明进行操作: $ yo npm-module 执照 国际学习中心
npm packagenpm packagenpm packagenpm packagenpm packagenpm package
$ npm install -g create-npm-package 用法 建立新套件 $ create-npm-package my-package 跳过npm名称检查 软件包名称是否存在会自动检查,但是您可以跳过它! $ create-npm-package my-package --skip-check 跳过...
Cannot find module Roaming\npm\node_modules\layaair2-cmd\layaair2-cmd.js
react-native-create-module 使用单个命令创建React Native库的工具。...安装要求:Node 6.0+ $ npm install -g react-native-create-module命令行用法导航到一个空目录以执行命令。 $ react-native-
长截图;如何在Windows系统上安装node.js和NPM;环境配置参考。
安装npm install create-module --global用法create-module <package> [--check] [--offline] 请执行以下工作流程:mkdir < package>cd < package># create <githubrepo> for <package>git initgit remote add ...
怎么做 nodeschool.io how-to-npm研讨会练习
用于构建 es6 就绪的 npm 包的项目支架 安装 git clone https://github.com/RoanixS2k12/es6-npm-module.git npm install 更新信息 不要忘记修改 package.json 文件中的相关... npm run test # run the test suite in
This is an npm module for qrcode JavaScript library
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
npm-模块-生成器 NPM ...安装用做: $ npm install npm-module-generator -g用法为了拥有默认值,您需要在.npmrc定义一些设置: $ npm config set init.author.name " Your Name "$ npm config set init.author.url " ...
前端开源库-npm-programmaticNPM编程,以编程方式使用NPM命令
发布react npm组件demo,支持css module、自定义打包配置,轻松上手
Starting from the ground up, learn new syntax (or how to reuse older syntax) to transform code from clunky bug-susceptible scripts to clear and elegant programs that are easy to read and easy to ...
npm更新从npm存储库或任何节点模块存储库发出更新事件。用法const NPM = require ( 'npm-updates' ) ;const npm = new NPM ( ) ;npm . on ( 'update' , ( info ) => { console .... log ( 'new module!' , info .