好用的项目初始化工具 SCION 升级啦!

栏目: Node.js · 发布时间: 6年前

内容简介:写于 2017.05.11关于

写于 2017.05.11

好用的项目初始化工具 SCION 升级啦!

1、什么是SCION

SCION 是一个专门用于初始化项目的工具。只要你有一套模板,就能通过 SCION 方便地把项目初始化出来。同时 SCION 允许你添加多套模板,大大提升了工作效率。

关于 SCION 的诞生,可以查看我的这篇文章: 《教你从零开始搭建一款前端脚手架工具》

项目地址: github.com/jrainlau/sc…

2、安装

可以通过 yarn 或者 npm 全局 安装使用:

yarn add scion-cli --global
复制代码
npm install scion-cli -g
复制代码

3、使用方式

执行 scion 命令,获取详细使用方式及说明:

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
复制代码

注意,如果你正在使用 MacOS 或者 Linux 系统,在执行 adddelete 命令的时候,需要加上 sudo 前缀。

4、命令

add | a

这条命令会添加一个模板信息到 templates.json 文件内,以便将来供 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!
复制代码

Scion 使用了 download-git-repo 去下载位于github的项目作为模板。

好用的项目初始化工具 SCION 升级啦!

list | l

列出所有已保存的模板。

$ scion list

┌────────────────────┬────────────────┬────────┐
│ Template Name      │ Owner/Name     │ Branch │
├────────────────────┼────────────────┼────────┤
│ my-first-template  │ jrainlau/scion │ new    │
├────────────────────┼────────────────┼────────┤
│ my-second-template │ jrainlau/motto │ master │
└────────────────────┴────────────────┴────────┘
复制代码
好用的项目初始化工具 SCION 升级啦!

init | i

在添加了模板以后,通过这条命令初始化你的项目。

$ scion init

? Template name: my-first-template
? Project name: my-project
? Where to init the project? ../
⠹ Downloading template...

New project has been initialized successfully!
复制代码

是不是很简单呢?

好用的项目初始化工具 SCION 升级啦!

delete | d

用于删除一个模板。

$ 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
复制代码
好用的项目初始化工具 SCION 升级啦!

5、明白模板是什么

简单来说,一个“模板”就是一个保存在github或者gitlab项目,这个项目有着完整的目录结构,以其为模板的项目都会在当前的目录基础上进行扩展。

6、升级信息

  • 使用 cli-table 优化模板的输出。

  • 使用 inquirer 实现命令行交互功能。

  • 使用 download-git-repo 去下载模板,避免了通过 git clone 会把 .git 文件夹也下载下来的问题。

  • 修复无法跨平台(MacOS, Windows)使用的问题。


以上所述就是小编给大家介绍的《好用的项目初始化工具 SCION 升级啦!》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

HTTP Essentials

HTTP Essentials

Stephen A. Thomas、Stephen Thomas / Wiley / 2001-03-08 / USD 34.99

The first complete reference guide to the essential Web protocol As applications and services converge and Web technologies not only assume HTTP but require developers to manipulate it, it is be......一起来看看 《HTTP Essentials》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

html转js在线工具
html转js在线工具

html转js在线工具