cliclicli
v0.0.8
Published
clicli-cli for clicliPure
Downloads
1
Readme
cliclicli脚手架
创建npm目录
mkdir cliclicli
cd cliclicli
npm init
安装相关依赖
- chalk 终端字符串样式库
- commander node.js 命令行接口的完整解决方案
- download-git-repo 用Node.js载并提取一个git仓库(GitHub,GitLab,Bitbucket)
- inquirer 常见的交互式命令行用户界面的集合
- ora 优雅的终端Loding
- shelljs Node.js复用Unix Shell命令
- yargs 解析命令行参数
编写代码
新建command.js, package.json中新增bin字段
{
"name": "cliclicli",
"version": "0.0.1",
"description": "clicli-cli for clicliPure",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"cliclicli": "command.js"
},
"keywords": [
"cliclicli"
],
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^3.0.0",
"commander": "^4.1.0",
"download-git-repo": "^3.0.2",
"inquirer": "^7.0.3",
"joao-cli": "0.0.6",
"ora": "^4.0.3",
"shelljs": "^0.8.3",
"yargs": "^15.1.0"
}
}
command.js一定要以#!/usr/bin/env node
开头,才能正常执行
本地调试
npm link
发布包
npm publish
注意: 切换到npm镜像
遇到git clone速度慢解决方案
在网站 https://www.ipaddress.com/ 解析地址 github.global.ssl.fastly.net github.com
Windows上的hosts文件路径在C:\Windows\System32\drivers\etc\hosts Mac/Linux的hosts文件路径在:sudo vim /etc/hosts
Vim /etc/hosts #此处应该是你本地解析出来的地址 199.232.5.??? github.global.ssl.fastly.net 192.30.253.??? github.com
刷线dns即可 Windows刷新dns: ipconfig /flushdns Linux刷新dns: systemctl restart nscd 或者 /etc/init.d/nscd restart Mac刷新dns: [最新的 OS X Mountain Lion or Lion 上刷新DNS] sudo killall -HUP mDNSResponder [较新的苹果Mac OS X系统刷新DNS] type dscacheutil -flushcache [比较老的刷新DNS] lookupd -flushcache