ASCF provides a command line tool to control the debugging, conversion, and compilation functions.
To install the command line tool, run the following command:
npm install @atomicservice/ascf-toolkit -g
To obtain the help information, run the following command:
ascf -h
To obtain the help information about the ASCF tool conversion behavior, run the following command:
ascf convert -h
To convert your mini program, run the following command, specifying the input (-i) and output (-o) directories. After the conversion, follow Development Guide to ensure compatibility with platform-specific features and to meet the required standards.
ascf convert -i .\path\to\miniprogram -o .path\to\atomicservice-project
To obtain the help information about the ASCF tool compilation behavior, run the following command:
ascf compile -h
The following is an example of the compilation command:
ascf compile .\path\to\atomicservice-project
Run the following command to enable the hot reload feature:
ascf compile .\path\to\atomicservice-project --serve
Before using hot reload, ensure that Waive restrictions for services under development has been enabled on the device (you can enable it in Developer options).
Category | Option | Description |
|---|---|---|
General | -h | Obtains the help information. |
-c | Clears the conversion output directory. | |
--logging=[level] | Specifies the minimum level of logs to be printed. Options (in ascending order of severity): debug, info, warn, and error. Default value: info. | |
Conversion | --notaddtodo | Ensures no TODO comments are added to the converted source code of unsupported APIs. |
Compilation | -m | Enables debug compilation. |
-p | Displays the current compilation progress. | |
--swc | Uses the speedy web compiler (SWC) to compile JavaScript code to improve the compilation efficiency. | |
--devtool=[type] | Customizes the source map generation behavior. The value of type indicates the generation mode. Default value: eval-cheap-source-map. | |
--templateHoist | Hoists templates to the page scope to eliminate redundant compilation code and reduce bundle size. For atomic services converted using the Taro framework, you need to configure templateHoist. | |
--skipApiValidator | Skips the support verification of APIs and components to improve the compilation performance. | |
--serve | Enables hot reload. Dependency requirements: The ASCF runtime version must be 1.0.10 or later. The ASCF Toolkit version must be 1.0.4 or later. NOTE: You are advised to use the SWC for compilation when enabling hot reload to improve its efficiency. | |
--disableSubpackages | Merges the subpackages into the main package during compilation in debug mode to improve build performance. Dependency requirements: The ASCF Toolkit version must be 1.0.4 or later. NOTE: You can set this parameter to false to disable this feature. In this case, subpackages will not be merged into the main package during debug compilation. |
Run the following command in the ascf_src directory where package.json is stored to install the npm package:
npm install
Run the following command to build the npm package:
ascf buildNpm <projectRoot>
If you use DevEco Studio to develop an ASCF project, run the following command to build the project:
hvigorw buildNpm