一、npm init
使用npm init生成package.json
复制代码
{
“name”: “whale-makelink”,
“version”: “1.0.5”,
“description”: “Make-link can get all the project folders of the current directory, and generate the project link directory in the readme.”,
“main”: “index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
},
“repository”: {
“type”: “git”,
“url”: “git@github.com:jingwhale/whale-makelink.git”
},
“keywords”: [
“makelink”
],
“author”: “jingwhale@yeah.net”,
“license”: “ISC”
}
复制代码
二、自定义命令
2.1、在package.json的bin下定义一个对象,这里makelink就是需要的命令,内容交给index.js
复制代码
{
“name”: “whale-makelink”,
“version”: “1.0.5”,
“description”: “Make-link can get all the project folders of the current directory, and generate the project link directory in the readme.”,