Giter Club home page Giter Club logo

choerodon-front-boot's Introduction

Choerodon Boot

Choerodon front boot is a toolkit about front end package management, startup, compilation. It is mainly used to provide custom some configurations file to create a project of React that can be modified to some extent.

The construction project can be used on macOS, Windows or Linux. Teams can be developed in modules, greatly speeding up development.

  • The project uses webpack for construction.
  • React and Mobx are used as the main development technology.

Install

$ npm install choerodon-front-boot -S

Configuration

  • Create a configuration file named config.js
import autoprefixer from 'autoprefixer';
// default config of Choerodon
const config = {
  port: 9090,
  output: './dist',
  htmlTemplate: 'index.template.html',
  devServerConfig: {},
  postcssConfig: {
    plugins: [
      autoprefixer({
        browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
      }),
    ],
  },
  babelConfig(config) {
    return config;
  },
  webpackConfig(config) {
    return config;
  },
  enterPoints(mode) {
    // By default, it returns empty object.
    // In javascript files, words `process.env.XXX` will be replaced with the key of returned map object like `XXX` from this function .
    // e.g.
    // development env
    if (mode === 'start') {
      return {
        API_HOST: 'http://api.example.org', // The `server` property of root config will be overwritten by this.
      }
    }
    // production env
    if (mode === 'build') {
      return {
        API_HOST: 'an `enterpoint` placeholder string', // Reference to `enterpoint.sh`
      }
    }
  },
  entryName: 'index',
  root: '/',
  routes: null, // By default, routes use main in package.json
  server: 'http://api.example.com', // API server
  fileServer: 'http://file.example.com', // File server
  clientid: 'localhost',
  titlename: 'Choerodon', // HTML title
  favicon: 'favicon.ico', // Page favicon
  theme: { // less/sass modify vars
    'primary-color': '#3F51B5', 
  },
}

Run

$choerodon-front-boot start --config config.js

Once running, open http://localhost:9090

Dist

$choerodon-front-boot build --config config.js

Init Menu

First, you should make sure that you have Menu.yml under ./{1}/src/app/{1}/config/Menu.yml. And also should have language/en.yml & language/zh.ymlใ€‚

A Menu.yml file like this:

#Menu.yml
"iam": code
  icon: IAM  # icon ode
  sort: 1  # sort
  delete: "true"  # Whether it should be deleted
  site:  # menu level
    - "organization": # code
        sort: 1  # sort
        Routes: /iam/organization  # route
        icon: manage_organization  # icon
        permission:  # permissions
          - 'iam-service.organization.enableOrganization' 

A language/en.yml file like this:

#language/en.yml
"iam": "platform settings"
# site
"iam.organization": "Organization"

Then, you can run the script to initialize the menu.

$python ./{1}/node_modules/choerodon-front-boot/structure/configAuto.py {1}
$python ./{1}/node_modules/choerodon-front-boot/structure/sql.py [-i HOST] [-p PORT] [-u USER] [-s PASSWD] [-a ATTRS] [-d DELETE]

{1} is your module name.

Dependencies

  • Node environment (6.9.0+)
  • Git environment
  • Python environment(2.7)

Related documents and information

Reporting Issues

If you find any shortcomings or bugs, please describe them in the issue.

How to Contribute

Pull requests are welcome! Follow to know for more information on how to contribute.

choerodon-front-boot's People

Contributors

hughhzwu avatar devane001 avatar midkingking avatar

Watchers

James Cloos 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.