Home
Sign Up
Sign In
推荐关注
›
Meteor
›
JSLint
-
a JavaScript code quality tool
›
jsFiddle
›
D3.js
›
WebStorm
推荐书目
›
JavaScript 权威指南第 5 版
›
Closure: The Definitive Guide
Advertisement
V2EX
›
JavaScript
集成一个外部指令到 npm package 里
inpm
·
Dec 20, 2017
· 2868 views
This topic created in 3239 days ago, the information mentioned may be changed or developed.
我想集成一个外部命令在我的 npm package 里面,Just like this : xxx init,xxx login
npm
package
XXX
init
1 replies
•
2017-12-22 16:48:55 +08:00
flowfire
Dec 22, 2017
1
1
比如你想让 test init 调用 index.js
就在 package.json 里加上
"bin": {
"test": "index.js"
}
然后发布到 npm 上。这样别人如果用 -g 参数安装你的模块,就可以使用 test 命令调用 index.js 文件
如果你想在本地测试,使用
npm link
命令把本地的包软连接到全局即可
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1314 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms ·
UTC 22:18
·
PVG 06:18
·
LAX 14:18
·
JFK 17:18
♥ Do have faith in what you're doing.
❯