This article was published on the blog of weidian front-end team

What is the bio

Note: BIO is currently only compatible with Mac platforms

Github address: bio-cli

NPM address: bio-cli

Front-end development one-stop solution.

With BIO, you can quickly develop the front end by focusing on the business logic and not the scaffolding configuration information.

In addition, BIO provides ESLint, StyleInt detection, and mock services.

The installation

  • Install Node.js (>= 8.9.1)

    https://nodejs.org/en/download/

  • Install the bio

    npm install bio-cli -g
    Copy the code

Quick to use

  • Step 1: Create the project directory

    mkdir demo
    
    cd demo
    Copy the code
  • Step 2: Initialize various projects

    • bio init bio-scaffold-vueInitializes the VUE project
    • bio init bio-scaffold-reactInitialize the React project
    • bio init bio-scaffold-pure: Initializes non-VUE/Non-React projects
  • Step 3: Debug

    bio run dev-daily
    Copy the code

Command set

  • Bio init < scaffold name on NPM source >

    • function

      Initialize the project directory.

      The command does the following:

      • Install scaffolding locally to ensure it is in place. Scaffolding is installed in the bio cache directory (/Users/ username /.bio/)
      • If the current directory is empty (or onlyREADME.md), this command will generate a demo file.
      • performnpm install.
    • The scaffold

      Bio currently has three scaffolds built in (Bio-scaffolds-vue, Bio-scaffolds-React, bio-scaffolds-Pure)

      Bio uses NPM hosting scaffolding. The default hosting is in the NPM official source. You can set up your own hosting source.The code address

    • Scaffold nickname

      Bio has nicknames for each of the three built-in scaffolds:

      bio-scaffold-vue --> vue
      bio-scaffold-react --> react
      bio-scaffold-pure --> pure
      Copy the code

      So all commands that refer to scaffold names can be replaced with nicknames.

      You can also add your own nickname, code address

  • Bio Run < scaffolding supported tasks > [-n, --no-watch]

    • function

      Start scaffolding task.

      The BIO starts the scaffold and passes the task name transparently to the scaffold to complete various tasks.

      So, the task name is variable, as long as scaffolding is supported.

      The three scaffolds we provide by default each provide the following six tasks:

      dev-daily
      dev-pre
      dev-prod
      build-daily
      build-pre
      build-prod
      Copy the code

      For details, see: Bio Built-in scaffolding task name.

      For example, after the bio-scaffiding-vue project is initialized, start its dev-daily task and run the following command:

      bio run dev-daily
      Copy the code
    • -n, –no-watch

      By default, bio starts a file listening service that synchronizes the current directory files to the scaffold directory, ensuring that the scaffold directory is always parent to the business directory for scaffold compilation. (source :(why guarantee father-son relationship?) )

      -n, –no-watch turns off the file listening service that synchronizes the current directory to the scaffold directory.

      For example:

      bio run dev-daily -n
      Copy the code
  • Bio scaffold show < name of scaffold on NPM source >

    Open the local directory where the scaffold is located.

  • bio scaffold create

    When you create a scaffold, you will be prompted with the new scaffold name

  • Bio Mock [port]

    Start the local mock service with the default port 7000

    If you want to specify a port number, you can do so, for example, Bio Mock 8000

  • bio lint init

    • function

      Initializing Lint will automatically mount lint execution hooks before git commit

  • bio lint [--fix] [-w, --watch]

    Perform lint checking and the BIO will generate a Lint result page for you to view

    • --fix: Automatically modifies the code format in the source code.
    • -w, --watch: enables file listening, which will trigger lint checks if a file changes
  • bio help

    Help information

The characteristics of the bio

link

  • Currently available scaffolding
  • Development bio scaffolding

TODO

  • Refine unit testing
  • Continuous integration
  • English Docs
  • Improve the scaffolding project demo

developers

  • Core: Liu Yuanyang @ Weidian
  • Lint: Ding Junjie @weidian

LICENSE

MIT