CabloyJS provides corresponding npm scripts for different running environments

Unit-test Environment

  1. 1# Unit Test
  2. 2$ npm run test:backend
  3. 3# Code Coverage
  4. 4$ npm run cov:backend

Local Development Environment

  1. 1# Start backend service
  2. 2$ npm run dev:backend
  3. 3# Start frontend service
  4. 4$ npm run dev:front

Production Environment

  1. 1# Start backend service
  2. 2$ npm run start:backend
  3. 3# Start backend service (daemon)
  4. 4$ npm run start:backend -- --daemon --workers=2
  5. 5# Stop backend service
  6. 6$ npm run stop:backend

Build Frontend

In the production environment, you must build frontend codes, and then configure the nginx service

  1. 1$ npm run build:front
  2. 2$ npm run build:front -- --scene={sceneName}

CabloyJS uses WebPack to build the frontend of the project. Because the CabloyJS project is composed of a series of business modules, the modules codes can be precompiled in advance, which can significantly improve the construction speed when building the frontend of the whole project

In practice, if a project contains 40 business modules, it will take 70 seconds to build according to the normal build mechanism. The precompiled mechanism can be completed in 20 seconds. This is of great engineering significance for the development of large-scale web projects

Cli Terminal

In general, most frameworks provide Cli terminal tools to execute some tool scripts from the command line

The Cli terminal tools provided by CabloyJS are different. CabloyJS provides a powerful cli terminal engine, which is composed of Cli terminal runtime + numerous commands. The commands are provided by specific business modules. Therefore, we can dynamically add the commands by installing some business modules, so as to make the Cli terminal of CabloyJS extremely powerful and easy to use

The usage specifications of Cli terminal are as follows:

  1. 1$ npm run cli [command] [args] -- [options]