Introduction to 👽

The previous content shared with you is to clarify exactly what content and functionality should be contained in the template of scaffolding. This part alone carries out to see the relationship with scaffolding is not big, but scaffolding development is an indispensable link.

Today we are going to talk about scaffolding: defining the function of scaffolding and introducing scaffolding libraries. After this part is over, tomorrow we will officially move to the development phase introduction, and I welcome your continued attention ━(‘ ∀´) Blue 亻!

👽 Definition of scaffolding function

Those familiar with VUE-CLI or UMI should know that both scaffolds have a wide variety of functions, but the core function of both scaffolds is the same: creating project templates. Our development of scaffolding is no exception, the overall functional flow chart of scaffolding is as follows:

Let’s go back to the core function of template generation.

The templates in scaffolding can be divided into static templates and dynamic templates according to the generation mode. Static templates are easy to understand: the template defined initially looks like the scaffold generated after the template looks like, scaffolding in which more play a pull role. Dynamic templates are a little more flexible and are dynamically generated based on user choice and input through a tool like Mustache.

There are also three different scenarios for template sources. The first: directly embed the template in the scaffold. This method is simple and direct, and template generation is fast, but template management is not very convenient, suitable for individuals or small teams. Second: Store the template in the GitLab/Github repository. In this way, when a template needs to be generated, the template will be pulled from the corresponding warehouse address, and the generation speed is limited by the extraction speed. Third: through NPM to pull the template, the principle is not much different from the second.

This development we will choose the most simple and direct way: embedded template, static generation.

👽 Introduction to dependent libraries

🚩commander: command line tool under nodejs.

🚩chalk: command line output beautification tool under nodejs.

🚩fs-extra: extension of fs module in nodejs.

🚩 Inquirer: command-line user interaction tool under nodejs.

🚩ora: command line loading under nodejs.

🚩shelljs: shell script execution tool in nodejs.

After this part is introduced, the development phase can be officially started. Please look forward to the follow-up!

👽 ‘Let’s Encapsulate scaffolding’ series

🚁 Day 1: Scaffolding template idea

🚁 Day 2: Definition of project specifications