Handwritten own vue-cli

1. Install CLI-VUE
NPM the install -g @ VUE / CLI
https://cli.vuejs.org/zh/guide/cli-service.html

2.npm init -y initialization packet

Here Insert Picture Description
cyp:
#!/usr/bin/env node console.log("hello cyp");

package.json

{
  "name": "vue-cli",
  "version": "1.0.0",
  "description": "",
  "bin": {
    "yd": "./bin/cyp"   //插入这行代码
  },
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

sudo npm link / npm link: The link to the global packet to the

Here Insert Picture Description
4. npm install -g cyp: this can be contracted out to other people with friends

cyp:

#!/usr/bin/env node

// console.log("hello cyp");

//核心处理命令行
const program = require("commander") //cnpm install commander  --save 安装包

program.version = ("0.0.1", "-v --version"); //cyp -v

Here Insert Picture Description

cyp:

#!/usr/bin/env node

// console.log("hello cyp");

//核心处理命令行
const program = require("commander") //cnpm install commander  --save 安装commander包
// console.log("xxx")
program.version("0.0.1", "-v, --version"); //cyp -v

program.command("init", "初始化我们的项目");
program.parse(process.argv);

Here Insert Picture Description
7. The package for the gradation of characters: the install -save @ darkobits NPM / lolcatjs
https://www.npmjs.com/search?q=lolcat
Here Insert Picture Description
lolcat

https://www.npmjs.com/package/@darkobits/lolcatjs

npm install -g @darkobits/lolcatjs

cyp:

#!/usr/bin/env node

// console.log("hello cyp");

//核心处理命令行
const program = require("commander") //cnpm install commander  --save 安装commander包
//处理当用户进行版本号控制的时候
const Printer = require('@darkobits/lolcatjs');
// console.log("xxx")
program.version(Printer.default.fromString("hello world 加油,云苹"), "-v, --version"); //cyp -v

program.command("init", "初始化我们的项目");
program.parse(process.argv);

We can see colorful

Published 98 original articles · won praise 4 · views 20000 +

Guess you like

Origin blog.csdn.net/weixin_42416812/article/details/100518494
Recommended