https://github.com/raoenhui/ice-first-cli
the first cli tool
https://github.com/raoenhui/ice-first-cli
javascript nodejs nodejs-api
Last synced: about 1 month ago
JSON representation
the first cli tool
- Host: GitHub
- URL: https://github.com/raoenhui/ice-first-cli
- Owner: raoenhui
- License: mit
- Created: 2018-03-02T03:04:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T03:59:16.000Z (over 8 years ago)
- Last Synced: 2025-03-02T21:06:38.796Z (over 1 year ago)
- Topics: javascript, nodejs, nodejs-api
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 创建脚手架 cli 入门教程
## 第一步 创建仓库
创建一个git仓库,可以在GitHub创建个git仓库,如[https://github.com/raoenhui/ice-first-cli](https://github.com/raoenhui/ice-first-cli)
## 第二步 编辑package
npm init 或直接创建package.json,将git仓库地址加入
``` json
{
"name": "ice-first-cli",
"version": "1.0.8",
"scripts": {
"test": "npm -v"
},
"bin": {
"ice-first-cli": "./bin/commit.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/raoenhui/ice-first-cli.git"
},
"keywords": [
"cli"
],
"devDependencies": {
"shelljs": "^0.8.1"
}
}
```
## 第三步 创建bin文件
创建bin文件夹,在bin中再创建commit.js文件。
```
#! /usr/bin/env node
var shell = require("shelljs");
shell.exec("echo shell.exec works1");
console.log('my first cli');
```
## 第四步 测试cli
控制台输入
```
sudo npm link
ice-first-cli
npm publish
```

## 第五步 完成
可从npm官网中找到,[https://www.npmjs.com/package/ice-first-cli](https://www.npmjs.com/package/ice-first-cli) .