All Products
Search
Document Center

Command line tool

Last Updated: May 25, 2021

Initialize

If you need to add a new page after the project’s scaffold is initialized, you can simply copy and paste relevant content or use the following commands to add page definitions and component definitions.

init-page

Command syntax

 
  1. kylin init-page <pageName>

Precautions

  • pageName in the preceding command is a required parameter, and it specifies the English name of the page to be created.
  • If the current cwd contains package.json with the kylinApp field, the new page will be automatically added to kylinApp.pages.

init-component

Command syntax

 
  1. kylin init-component <componentName>

Precautions

  • componentName in the preceding command is a required parameter, and it specifies the English name of the component to be created.

  • If the current cwd contains package.json with kylinApp.pages specifying more than one page, the system prompts the specific page/components directory for the newly created component.

Build

This part describes the command syntax for tool building, and the build prompt for public resource package injection.

Command syntax

 
  1. kylin build # ... args

Items

Commonly used parameters

 
  1. kylin build --dev # dev building and static server
  2. kylin build --server --no-prod --hot # dev building, static server, and hot update enabling
  3. kylin build --server # prod building and static server
  4. kylin build --no-prod --watch # dev building and listening on file changes

Command line input parameters

Parameter Type Note
—dev Boolean Similar to the original build tool, it uses the dev conf and enables the server. If this parameter is enabled, the following settings will be forcibly made: prod=false, server=true, and hot=true.
—no-prod Boolean When prod is set to true, prod conf is used for compilation. When prod is set to false, dev conf is used for compilation. NODE_ENV is set in the same manner.
—server Boolean Only the static server is enabled. When this parameter is enabled, the following setting is forcibly made: watch=true.
—verbose Boolean The webpack output details.
—watch Boolean Whether to monitor file changes.
—no-compress Boolean Whether to disable compression. Compression is enabled by default.
—no-common Boolean Whether to disable CommonsChunkPlugin, which is enabled by default.
—hot Boolean Whether to enable hot update. Hot update is disabled by default. This parameter is used only when prod is set to false and server is set to true.
—open [entry] Boolean, String This parameter is valid only for --server. It is used to open the entry-specified URL. For --open without an entry specified, the first URL is processed.
—mock Boolean, String This parameter is used to enable the mock plug-in to read ./mock/mock.config.js.

kylinApp configuration options

Parameter Type Description
devPort Number Default listening IPv4 port 0.0.0.0:8090.
pageTemplate String Page template path.
output String Relative output directory.
options Object Additional options.
dirAlias Object Equivalent to webpack.resolve.alias, for example, { common:’./src/common/‘ }.

Build prompt

Public resource package injection

<script>/<link> labels corresponding to the following require/import package paths are automatically injected into HTML.

Package name Mapping global object Mapping path
fastclick FastClick as.alipayobjects.com/g/luna-component/luna-fastclick/0.1.0/index.js
vue Vue a.alipayobjects.com/g/h5-lib/vue/2.1.6/vue.min.js
es6-promise Promise as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js
fetch fetch as.alipayobjects.com/g/component/fetch/1.0.0/fetch.min.js
zepto Zepto a.alipayobjects.com/amui/zepto/1.1.3/zepto.js