What is scaffolding? The essence of scaffolding is an operating system client, which is executed through the command line.
When we develop, many people now almost rely on the framework and just type commands to build the basic system. But have you ever thought about why we go through a series of processes when we type commands? Let's take vue as an example
vue create demo
Why is it executed when we enter it? Think about it first and look below
The above command is composed of 3 parts
Main command: vue
command: create
Param of command: demo
First execute which vue to see where vue is
Go to the specified directory and go to vue
It is also very clear in the code that when vue is actually executed, it points to node_modules/@vue/cli/bin/vue.js
Here comes the question again. Why is there @vue under node_modules?
Because when we want to use the vue command, we must install npm i -g @vue/cli globally, so there will be @vue in the global node_modules
From the above, we can know that when vue ..... is executed, a vue.js file is actually executed
Then look at the analysis chart
In a brief summary of the scaffolding execution principle
1. Enter vue create demo in the terminal
2. The terminal parses out the vue command
3. The terminal finds the vue command in the environment variable
4. The terminal links to the actual file vue.js according to the vue command
5. The terminal uses node to execute vue.js
6. vue.js parsing command / options
7. vue.js execute command
8. After the execution is completed, the execution exits
After the principle analysis, I will explain it in depth later.