Coder Social home page Coder Social logo

ya-cli's Introduction

ya-cli

Simple CLI for scaffolding Ya projects

安装

环境 : Node.js , npm 3.0+、 Git.

npm install -g yz-cli

创建项目

在要创建项目的路径执行 ‘ya init’。

$ ya

  Usage: ya <command> [options]

  Options:

    -V, --version  output the version number
    -h, --help     output usage information

$ ya init

  Usage: ya-init [project-name]


  Options:

    -o, --offline  使用已经下载的本地模板
    --template [value] 选择使用的模板
    -i, --install  下载模板后自动安装依赖
    -h, --help     output usage information

$ ya update
  Usage: ya-update [project-name]

  Options:

    -h, --help          output usage information
    -o, --offline       使用本地模板
    --template [value]  选择使用的模板
    -i, --install       下载模板后自动安装依赖

Examples:

创建 / 更新项目

$ ya init project1

在当前目录创建 / 更新项目

$ ya init

更新当前项目

$ ya update project1

在当前目录更新项目

$ ya update

使用本地模板 & 自动安装依赖

$ ya init project1 -i -o

默认模板进行开发

默认模板 使用如下

开发环境

开启本地服务器开发并热替换。默认开启 eslint(standard)、flow。

$ cd [project]
$ npm run dev

生产

$ npm run build

mock

使用mockjs规则生成 mock 数据。

$ npm run mock

开启 mock 服务后即可本地 mock 请求。配置规则参考 tools/config dev.proxyTable。可于/src/mock 文件夹按请求地址创建 js/json 文件并填写符合 mockjs 规则或普通数据。如:

c2s('/ya/modules/test')

对应
  \ya
  -- \modules
  ---- \test.json

flow

默认集成在eslint中。
也可以关闭自行使用 $ npm run flow 检测,或 $ npm run flowserver 实时监听。
使用eslint时,如遇到提示模块未发现。可手动执行stopflow关闭flow服务后重新
$ npm run dev

自定义模板

自定义模板无需发布到 npm,只需上传到 github 并通过 template 参数使用即可

$ ya init project1 --template q13/vue-spa-template

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.