1. What is SCION

SCION is a tool for initializing projects. As long as you have a set of templates, you can easily initialize projects through SCION. SCION also allows you to add multiple sets of templates, greatly increasing productivity.

Check out my article on SCION’s birth: How to Build a Front-end scaffolding Tool from Scratch.

Project Address: github.com/jrainlau/s….

2, installation,

It can be used through YARN or NPM global installation:



yarn add scion-cli --globalCopy the code


npm install scion-cli -gCopy the code

3. Way of use

Run the scion command to obtain the 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 numberCopy the code

Note that if you are using MacOS or Linux, you need to prefix the add and delete commands with sudo.

4, the command

add | a

This command adds template information to the templates.json file for future use by SCION.



$ 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!Copy the code

Scion uses download-git-repo to download the github project as a template.

list | l

Lists all saved templates.



$ scion list┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ the Template Name │ Owner/Name │ Branch │ ├ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ┤ │my-first- the template │ jrainlau/scion │ new │ ├ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ┤ │my-second- the template │ jrainlau/motto │ master │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ┘Copy the code

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 theproject? . / ⠹ Downloading the template... New project has been initialized successfully!Copy the code

Is it easy?

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 successfullyCopy the code

5. Understand what a template is

Simply put, a “template” is a github or GitLab project that has a complete directory structure, and projects that use it as a template will expand on the current directory.

6. Upgrade information

  • Optimize the output of the template using cli-table.

  • Use inquirer for command line interaction.

  • Use the download-git-repo command to download the template. Git clone will also download the.git folder.

  • Fixed an issue where cross-platform (MacOS, Windows) cannot be used.