107ac75b1Sopenharmony_ci# compiler 207ac75b1Sopenharmony_ci 307ac75b1Sopenharmony_ci**The compiler tool chain for ace2.0.** 407ac75b1Sopenharmony_ci 507ac75b1Sopenharmony_ci## Usage 607ac75b1Sopenharmony_ciHere are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms. 707ac75b1Sopenharmony_ci 807ac75b1Sopenharmony_ci### 1. Install 907ac75b1Sopenharmony_ci 1007ac75b1Sopenharmony_ciFirst, enter the root directory of the compiler: 1107ac75b1Sopenharmony_ci``` 1207ac75b1Sopenharmony_ci$ cd compiler/ 1307ac75b1Sopenharmony_ci``` 1407ac75b1Sopenharmony_ciAnd then install the npm dependencies(You must have node&npm installed): 1507ac75b1Sopenharmony_ci``` 1607ac75b1Sopenharmony_ci$ npm install 1707ac75b1Sopenharmony_ci``` 1807ac75b1Sopenharmony_ci**Note**: If some errors occur, delete the generated package `node_modules`, please check the following items: 1907ac75b1Sopenharmony_ci 2007ac75b1Sopenharmony_ciFirst, check whether your node version is 12.x or later; 2107ac75b1Sopenharmony_ciSecondly, config npm proxy and run `npm install` again. 2207ac75b1Sopenharmony_ci``` 2307ac75b1Sopenharmony_cinpm config set strict-ssl false 2407ac75b1Sopenharmony_cinpm config set registry https://registry.npm.taobao.org 2507ac75b1Sopenharmony_ci``` 2607ac75b1Sopenharmony_ci 2707ac75b1Sopenharmony_ci### 2. Quick Start 2807ac75b1Sopenharmony_ci 2907ac75b1Sopenharmony_ciFor a quick start 3007ac75b1Sopenharmony_ci 3107ac75b1Sopenharmony_ciIn the root directory of `compiler/`: 3207ac75b1Sopenharmony_ci``` 3307ac75b1Sopenharmony_ci$ npm run build 3407ac75b1Sopenharmony_ci$ npm run compile 3507ac75b1Sopenharmony_ci``` 3607ac75b1Sopenharmony_ciThe `sample` project will be compiled. The output is in the `sample/build` directory. 3707ac75b1Sopenharmony_ci 3807ac75b1Sopenharmony_ci### 3. Create a new project 3907ac75b1Sopenharmony_ci 4007ac75b1Sopenharmony_ciThe way to create a new project 4107ac75b1Sopenharmony_ci 4207ac75b1Sopenharmony_ciIn the root directory of `compiler/`: 4307ac75b1Sopenharmony_ci``` 4407ac75b1Sopenharmony_ci$ npm run build 4507ac75b1Sopenharmony_ci$ npm run create [projectName] 4607ac75b1Sopenharmony_ci``` 4707ac75b1Sopenharmony_ci 4807ac75b1Sopenharmony_ci**Note**: If `projectName` is empty, create the `HelloAce` project by default. 4907ac75b1Sopenharmony_ci 5007ac75b1Sopenharmony_ciFor example, use the following line to create a project named `foo`: 5107ac75b1Sopenharmony_ci``` 5207ac75b1Sopenharmony_ci$ npm run create foo 5307ac75b1Sopenharmony_ci``` 5407ac75b1Sopenharmony_ciThe directory structure of project `foo`: 5507ac75b1Sopenharmony_ci- foo 5607ac75b1Sopenharmony_ci - pages 5707ac75b1Sopenharmony_ci - index.ets 5807ac75b1Sopenharmony_ci - app.ets 5907ac75b1Sopenharmony_ci - manifest.json 6007ac75b1Sopenharmony_ci 6107ac75b1Sopenharmony_ci### 4. Create a new page 6207ac75b1Sopenharmony_ci 6307ac75b1Sopenharmony_ciFor example, create a file `bar.ets` in the `page` directory. And then add the following lines to `"page"` field in `manifest.json`: 6407ac75b1Sopenharmony_ci``` 6507ac75b1Sopenharmony_ci "pages": [ 6607ac75b1Sopenharmony_ci "pages/index", 6707ac75b1Sopenharmony_ci "pages/bar" 6807ac75b1Sopenharmony_ci ] 6907ac75b1Sopenharmony_ci``` 7007ac75b1Sopenharmony_ci 7107ac75b1Sopenharmony_ci### 5. Compile a project 7207ac75b1Sopenharmony_ci 7307ac75b1Sopenharmony_ciThe way to compile a project 7407ac75b1Sopenharmony_ci 7507ac75b1Sopenharmony_ciIn the root directory of `compiler/`: 7607ac75b1Sopenharmony_ci``` 7707ac75b1Sopenharmony_ci$ npm run build 7807ac75b1Sopenharmony_ci$ npm run compile [projectName] 7907ac75b1Sopenharmony_ci``` 8007ac75b1Sopenharmony_ci 8107ac75b1Sopenharmony_ci**Note**: If `projectName` is empty, compile the `sample` project by default. In the project root directory, the compilation result is in the `build` directory. 82