Git Product home page Git Product logo

portable-cli's Introduction

portable-cli

一个简易的脚手架,目前已经配置两个模板

  • blog:一个使用 issue 来写 blog 的模板,预览 issues blog
  • admin:一个 Vue + element ui 的后台管理系统,预览 admin-system

使用

  1. 安装
npm install -g portable-cli
  1. 查看模板
portable-cli list

➡️  Template name: blog, Github address https://github.com/niexia/issues-blog-template.git
➡️  Template name: admin, Github address https://github.com/niexia/vue-element-admin.git
  1. 使用模板创建项目
# portable-cli create <template-name> <project-name>

portable-cli create blog my-blog

PORTABLE CLI v1.0.2
📦 Creating project in /Users/yangjin/Documents/enrich-github/my-blog.

⠋  Download project template. This might take a while...

🗃  Initializing git repository...

🎉  Successfully created project my-blog.
  1. 添加模板
# portable-cli add <template-name> <git-repo-address>

portable-cli add my-blog-template https://github.com/niexia/issues-blog-template.git

🎉  Successfully add project template my-blog-template.

# list template

portable-cli list

➡️  Template name: blog, Github address https://github.com/niexia/issues-blog-template.git

➡️  Template name: admin, Github address https://github.com/niexia/vue-element-admin.git

➡️  Template name: my-blog-template, Github address https://github.com/niexia/issues-blog-template.git
  1. 删除模板
# portable-cli delete <template-name>

portable-cli delete my-blog-template 

? Make sure that you want to delete the template my-blog-template? Yes

🎉  Successfully delete project template my-blog-template.

为什么需要脚手架

随着项目逐渐复杂和增加之后

  1. 每个项目都需要设置一样的配置,复制粘贴
  2. 多个项目的配置和结构容易出现不统一,不好管理

通过使用脚手架,配置一系列的指令,同时定义好不同选择对应的模板,就可以根据实际情况的选择,直接生成一套合适的项目代码,解决上面的问题。

设计

在脚手架内部提供一些能力,和用户进行交互

  1. 根据不同场景定义好对应的模板,统一项目结构,相关的代码设计
  2. 脚手架通过命令式和用户进行交互,选择对应的模板进行初始化项目
  3. 脚手架和模板解耦,支持对模板进行管理

License

MIT

portable-cli's People

Contributors

niexia avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.