1. What is SCION
SCION
Is a special tool for initializing projects. As long as you have a set of templates, you can passSCION
It is convenient to initialize the project. At the same timeSCION
Allow you to add multiple sets of templates, greatly improving work efficiency.
AboutSCION
The birth of, can see my this article:“Teach you to build a front-end scaffold tool from scratch”.
Project address:https://github.com/jrainlau/s …
2. Installation
Throughyarn
Or ..npm
GlobalInstallation and use:
yarn add scion-cli --global
npm install scion-cli -g
3. Usage
carry outscion
Command for detailed usage and instructions:
Usage: scion <command>
Commands:
add|a Add a new template
list|l List all the templates
init|i Generate a new project
delete|d Delete a template
Options:
-h, --help output usage information
-V, --version output the version number
Note that if you are using
MacOS
Or ..Linux
System, in executionadd
Anddelete
When ordering, need to addsudo
Prefix.
4. Orders
add | a
This command adds a template message to thetemplates.json
Documents for future supplySCION
Use.
$ scion add
? Set the custom name of the template: my-first-template
? Owner/name of the template: jrainlau/scion
? Branch of the template: new
┌───────────────────┬────────────────┬────────┐
│ Template Name │ Owner/Name │ Branch │
├───────────────────┼────────────────┼────────┤
│ my-first-template │ jrainlau/scion │ new │
└───────────────────┴────────────────┴────────┘
✔ New template has been added successfully!
Scion
Useddownload-git-repoDownload the github project as a template.
list | l
Lists all saved templates.
$ scion list
┌────────────────────┬────────────────┬────────┐
│ Template Name │ Owner/Name │ Branch │
├────────────────────┼────────────────┼────────┤
│ my-first-template │ jrainlau/scion │ new │
├────────────────────┼────────────────┼────────┤
│ my-second-template │ jrainlau/motto │ master │
└────────────────────┴────────────────┴────────┘
init | i
After adding the template, initialize your project with this command.
$ scion init
? Template name: my-first-template
? Project name: my-project
? Where to init the project? ../
⠹ Downloading template ...
New project has been initialized successfully!
Is it very simple?
delete | d
Used to delete a template.
$ scion delete
? Which template you want to delete? my-second-template
┌───────────────────┬────────────────┬────────┐
│ Template Name │ Owner/Name │ Branch │
├───────────────────┼────────────────┼────────┤
│ my-first-template │ jrainlau/scion │ new │
└───────────────────┴────────────────┴────────┘
✔ Template has been deleted successfully
5. Understand what the template is
Simply put, a “template” is a project stored in github or gitlab. This project has a complete directory structure, and projects using it as a template will be expanded based on the current directory.
6. Upgrade Information
-
Usecli-tableOptimize the output of the template.
-
UseinquirerRealize the command line interaction function.
-
Usedownload-git-repoTo download the template, to avoid through
git clone
Will put.git
The folder was also downloaded. -
Fix problems that cannot be used across platforms (MacOS, Windows).