diff --git a/README.md b/README.md index 45229bb42b64479261f9d6dfc77ee1e32108082a..209c2671678feccc08f00c94f53325224ad2c6bb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ - [ts2abc ](#ts2abc-) - [Introduction](#introduction) - [Directory Structure](#directory-structure) - - [Note](#note) + - [Build](#Build) - [Usage Guidelines](#usage-guidelines) - [Repositories Involved](#repositories-involved) @@ -28,13 +28,27 @@ For more infomation, see: [ARK Runtime Subsystem](https://gitee.com/openharmony/ ``` -## Note +## Build -ts2abc uses the command line interaction mode and converts JS code into ARK bytecode files that can be run on an ARK runtime system. ts2abc supports Windows, Linux, and macOS. +ts2abc uses the command line interaction mode and converts JS code into ARK bytecode files that can be run on an ARK runtime system. ts2abc supports Windows, Linux, and macOS. Front-end tools, converting JS source code into ARK bytecode, can be built by specifing the `--build-target` with `ark_ts2abc` on Linux. + +``` +$ ./build.sh --product-name Hi3516DV300 --build-target ark_ts2abc +``` ### Usage Guidelines -You can run **node --expose-gc _your\_path_\_to/index.js \[options\] _your\_file_.js** to convert a JS file into an ARK bytecode file using ts2abc. If no parameter is specified for **\[options\]**, an ARK binary file is generated by default. The **index.js** file is the executable file generated after ts2abc compilation. +Install `node` and `npm` + +convert JS to ARK bytecode + +``` +$ cd out/ohos-arm-release/clang_x64/ark/ark/build +$ npm install +$ node --expose-gc src/index.js [options] file.js +``` + +If no parameter is specified for **\[options\]**, an ARK binary file is generated by default.

Option

diff --git a/README_zh.md b/README_zh.md index 8bf1d569e97f3bd1b6ec3fe9ab6b0cb10bfa3b1b..447e2c22494165fe3481d277db1900e4dd4674b7 100644 --- a/README_zh.md +++ b/README_zh.md @@ -3,7 +3,7 @@ - [ts2abc组件](#ts2abc组件) - [简介](#简介) - [目录](#目录) - - [说明](#说明) + - [编译构建](#编译构建) - [使用说明](#使用说明) - [相关仓](#相关仓) @@ -28,13 +28,27 @@ ts2abc组件是方舟运行时子系统的前端工具,支持将JavaScript文 └── ts2abc # abc文件生成相关 ``` -## 说明 +## 编译构建 -ts2abc组件采用命令行交互方式,支持将JavaScript代码转换为方舟字节码文件,使其能够在方舟运行时上运行。支持Windows/Linux/MacOS平台。 +ts2abc组件采用命令行交互方式,支持将JavaScript代码转换为方舟字节码文件,使其能够在方舟运行时上运行。支持Windows/Linux/MacOS平台。方舟前端工具在linux平台上可通过全量编译或指定编译前端工具链获取。 + +``` +$ ./build.sh --product-name Hi3516DV300 --build-target ark_ts2abc +``` ### 使用说明 -ts2abc组件将JavaScript文件转换为方舟字节码文件,命令行格式为: node --expose-gc your\_path\_to/index.js \[options\] your\_file.js。当不输入任何option参数时,默认生成方舟二进制文件。其中index.js是ts2abc组件编译后的可执行文件。 +安装`node`和`npm` + +使用ts2abc组件将JavaScript文件转换为方舟字节码文件 + +``` +$ cd out/ohos-arm-release/clang_x64/ark/ark/build +$ npm install +$ node --expose-gc src/index.js [options] file.js +``` + +当不输入任何option参数时,默认生成方舟二进制文件。

选项