5

This is my second open source project. The first open source project is an okr tree diagram. There are currently 349 stars. The address is as follows: https://github.com/qq449245884/vue-okr-tree , The energy is limited, and there is relatively little maintenance in the near future. If you are interested, you can join in the maintenance.

Now let’s take a look at my second open source project, which is mainly used by our team. The purpose is to reduce some trivial work and increase development efficiency.

background

For new projects in the team, we all use our own public library, our own set of eslint specifications and git commit related checks. If there are new projects, we have to copy the configuration from the old projects one by one, which is relatively inefficient.

In order to solve these pain points, we need to have our own scaffolding to help us complete these time-consuming tasks.

Why do we need scaffolding? There are three main reasons:

  • Reduce repetitive work, no longer need to copy other projects and delete irrelevant code, or create a project and file from scratch
  • Dynamically generate projects and configuration files based on interaction
  • Multiple collaboration is more convenient, no need to pass the files back and forth

Research

Install

npm install --global ztjy-cli

Command use

version

ztjy -v  或 ztjy --version

View current template

ztjy ls

illustrate:

If it is the company's intranet environment, choose to use the template

Initialization project

We can use the init command to select a template to initialize our new project.

ztjy init

Executing init will first let the user select a template to initialize, if it is the company's intranet, choose not to github template starting with 06153ba9ce0931

package.json to fill in the name and version of the project, corresponding name and description , as shown below:

Note : If the download fails, it may be due to network problems. You can try more times.

After the download is successful, you can see our designated my-vue-template project in the current directory.

add template

If the existing template does not have what we want, we can add a new template with the add

ztjy add

After executing the add enter the name, description and download address of the project in turn.

The download address here needs to conform to the specified format. The template is download-git-repo library, so the specific address format can be referred to:

https://gitlab.com/flippidippi/download-git-repo

Delete template

If the template is no longer needed, we can use the del command to delete:

ztjy del 模板名称

project address:

gitubh: https://github.com/qq449245884/ztjy-cli

Sanfang library introduction

<!-- 终端样式库 -->
"chalk": "^3.0.0",
<!-- 命令行交互 -->
"commander": "^5.0.0",
<!-- 从git拉模板 -->
"download-git-repo": "^3.0.2",
<!-- fs操作拓展 -->
"fs-extra": "^9.0.0",
<!-- 模板引擎 -->
"handlebars": "^4.7.3",
<!-- 命令行交互 -->
"inquirer": "^7.1.0",
<!-- 加载效果,图标 -->
"ora": "^4.0.3"

~~End, I am Shuwanzhi, welcome to give me a like.

code is deployed, the possible bugs cannot be known in real time. In order to solve these bugs afterwards, a lot of time was spent on log debugging. By the way, I would like to recommend a useful BUG monitoring tool Fundebug .

comminicate

Have dreams and dry goods, search for [Moving to the World] Follow this wise brush who is still doing dishes in the early morning.

This article GitHub https://github.com/qq449245884/xiaozhi has been included, the first-line interview complete test site, information and my series of articles.


王大冶
68.1k 声望105k 粉丝