gus-cli
[![npm version](https://badge.fury.io/js/gus-cli.svg)](https://www.npmjs.com/package/gus-cli) [![Build Status](https://travis-ci.org/ephoton/gus-cli.svg?branch=master)](https://travis-ci.org/ephoton/gus-cli) [![Coverage Status](https://coveralls.io/repos/
Last updated a year ago by ephoton .
MIT · Original npm · Tarball · package.json
$ cnpm install gus-cli 
SYNC missed versions from official npm registry.

npm version Build Status Coverage Status

gus-cli

⚒ Command line interface for gus projects.

Prerequisites

  • Node.js 7+
  • TypeScript 2+

Installation

npm install -g gus-cli

Usage

  • init [type] [name]

    Initialize a project, app, or component.

  • build [options] <app>

    Build a gus app.

    -w, --watch Build and watch.

  • dev <app>

    Build and watch a gus app in development environment. Mock server and Webpack HMR are actived.

  • start <app>

    Start and daemonize a gus app.

  • stop <app>

    Stop a gus app.

Gus Project

A simple project contains multi gus apps. For example:

project
├───desktop             # An app named 'desktop'.
├───dist                # Build path.
├───mobile              # An app named 'mobile'.
└───package.json

Use command 'gus init project' to initialize a project.

Gus App

A serveless app use React and TypeScript for front-end engineers.

The directory structure could be like this:

project
├───mock                # Mock data
│   ├───order.ts
│   └───user.ts
├───page                # Pages
│   ├───dashboard
│   ├───layout
│   └───index.tsx       # Entry file for pages.
├───style               # Styles
├───config.json         # Config file
├───index.tsx           # Entry file for front-end.
└───init.tsx            # Entry file for back-end.

config options

A gus must have a config file named 'config.json'.

interface AppConfigInfo {
  server: {
    port: number;            // server port, default is 4000.
    static: string[];        // static resources, default is ['dist','node_modules']
    favicon: string;         // favicon path, default is './favicon.ico'.
  };
  style: {
    path: string;            // style source directory, default is './style'.
    items: {
      [key: string]: string;
    }
  };
  mock: {
    path: string;            // path of mock server, default is './mock'.
    active: boolean;         // enable or not, default is true.
  };
}

mock server

Each file under the directory should have a default module types:

interface MockData {
  path: string;
  method: 'get' | 'post' | 'delete' | 'head' | 'put';
  data: {};
}

For example:

export default [{
  path: '/user/1',
  method: 'get',
  data: {
    success: true,
    code: 123,
    message: '',
    data: {
      id: 1,
      name: 'bob'
    }
  }
}];

Features

  • Hot module replacement support.
  • Mock server in development mode.
  • Serverless project and app for font-end engineers.
  • Fully TypeScript support.

License

MIT License.

Current Tags

  • 1.0.13                                ...           latest (a year ago)

4 Versions

  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 0
Dependencies (50)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |