Skip to content

Commit

Permalink
chore(README): update init script
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed Apr 11, 2022
1 parent 62bf571 commit 3303578
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ For iOS, we recommend to use iOS simulator when first try. However, you can chan
>
> `npm run build`: Build each front-end sdk package.
2. Choose a demo to build with `npm run buildexample -- [hippy-react-demo|hippy-vue-demo]` at root directory.
2. Choose a demo to build with `npm run buildexample [hippy-react-demo|hippy-vue-demo]` at root directory.
3. Start the Xcode and build the iOS app with `open framework/js/examples/ios-demo/HippyDemo.xcodeproj`.

> If `Step 2` throw error, you can `cd` to `framework/js/examples` hippy-react-demo or hippy-vue-demo, and run `npm install --legacy-peer-deps` to install demo dependencies first.
Expand All @@ -81,7 +81,7 @@ Before build the android app, please make sure the SDK and NDK is installed, And
>
> `npm run build`: Build each front-end sdk package.
2. Choose a demo to build with `npm run buildexample -- [hippy-react-demo|hippy-vue-demo]` at root directory.
2. Choose a demo to build with `npm run buildexample [hippy-react-demo|hippy-vue-demo]` at root directory.
3. Open the `framework/js/examples/android-demo` with Android Studio.
4. Connect Android phone with USB cable and make sure USB debugging mode is enabled(Run `adb devices` on the computer terminal to check cellphone connection status).
5. Open the project with Android Studio, run and install the apk.
Expand All @@ -95,11 +95,11 @@ Before build the android app, please make sure the SDK and NDK is installed, And
### Debug the js demo

1. Follow [Build the iOS simulator with js demo](https://github.com/Tencent/Hippy#build-the-ios-simulator-with-js-demo) or [Build the Android app with js demo](https://github.com/Tencent/Hippy#build-the-android-app-with-js-demo) first to build the App.
2. Run `npm run init:example -- [hippy-react-demo|hippy-vue-demo]` at root directory.
3. Run `npm run debugexample -- [hippy-react-demo|hippy-vue-demo] dev` at root directory.
4. Run `npm run debugexample -- [hippy-react-demo|hippy-vue-demo] debug` at root directory.
2. Run `npm run init:example [hippy-react-demo|hippy-vue-demo]` at root directory.
3. Run `npm run debugexample [hippy-react-demo|hippy-vue-demo] debug` at root directory.
4. Run `npm run debugexample [hippy-react-demo|hippy-vue-demo] dev` at root directory.

> Or you can `cd` to `framework/js/examples/hippy-react-demo` or `framework/js/examples/hippy-vue-demo` to run `npm run hippy:dev` and `npm run hippy:debug` instead.
> Or you can `cd` to `framework/js/examples/hippy-react-demo` or `framework/js/examples/hippy-vue-demo` directory to run `npm run hippy:debug` and `npm run hippy:dev` instead.
>
> On example debug mode, npm packages such as @hippy/react, @hippy/vue are linked to `framework/js/packages` > `[different package]` > `dist`(not node_modules), so if you have changed js package source code and want to make it take effect in target example, please call `npm run build` at root directory again.
>
Expand Down
12 changes: 6 additions & 6 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Windows 用户者需要以下软件:
>
> `npm run build`:编译每一个 JS SDK 包。
2. 选择一个前端范例项目来进行编译,在项目根目录运行 `npm run buildexample -- [hippy-react-demo|hippy-vue-demo]`
2. 选择一个前端范例项目来进行编译,在项目根目录运行 `npm run buildexample [hippy-react-demo|hippy-vue-demo]`
3. 启动 Xcode 并且开始编译终端 App:`open framework/js/examples/ios-demo/HippyDemo.xcodeproj`

> 如果步骤2出现错误,可以先 `cd``framework/js/examples` hippy-react-demo 或者 hippy-vue-demo 目录下,执行 `npm install --legacy-peer-deps`,提前将 demo 的 NPM 包依赖先安装好。
Expand All @@ -80,7 +80,7 @@ Windows 用户者需要以下软件:
> `npx lerna bootstrap`:安装前端每一个 package 依赖。(Hippy 采用 [Lerna](https://lerna.js.org/) 管理多 JS SDK 包仓库,如果出现 `lerna command is not found`, 先执行 `npm install lerna -g` 全局安装 `Lerna`。)
>
> `npm run build`:编译每一个 JS SDK 包。
2. 选择一个前端范例项目来进行编译,在项目根目录运行 `npm run buildexample -- [hippy-react-demo|hippy-vue-demo]`
2. 选择一个前端范例项目来进行编译,在项目根目录运行 `npm run buildexample [hippy-react-demo|hippy-vue-demo]`
3. 用 Android Studio 来打开终端范例工程 `framework/js/examples`
4. 用 USB 数据线插上你的 Android 手机,需要确认手机已经打开 USB 调试模式(可通过在电脑 Terminal 执行 `adb devices` 判断手机是否已经连上了电脑)。
5. 运行工程,并安装 APK。
Expand All @@ -94,11 +94,11 @@ Windows 用户者需要以下软件:
### 调试前端 Demo

1. 先按照 **[使用 JS 范例来构建 iOS App]****[使用 JS 范例来构建 Android App]** 步骤执行。
2. 根目录执行 `npm run init:example -- [hippy-react-demo|hippy-vue-demo]`
3. 根目录执行 `npm run debugexample -- [hippy-react-demo|hippy-vue-demo] dev`
4. 根目录执行 `npm run debugexample -- [hippy-react-demo|hippy-vue-demo] debug`
2. 根目录执行 `npm run init:example [hippy-react-demo|hippy-vue-demo]`
3. 根目录执行 `npm run debugexample [hippy-react-demo|hippy-vue-demo] debug`
4. 根目录执行 `npm run debugexample [hippy-react-demo|hippy-vue-demo] dev`

> 你也可以 `cd``framework/js/examples/hippy-react-demo` 或者 `framework/js/examples/hippy-vue-demo` 目录去分别执行 `npm run hippy:dev``npm run hippy:debug` 开启 Debug 模式`。
> 你也可以 `cd``framework/js/examples/hippy-react-demo` 或者 `framework/js/examples//hippy-vue-demo` 目录去分别执行 `npm run hippy:debug``npm run hippy:dev`
>
> 在 example 调试模式下,@hippy/react@hippy/vue 等 npm 模块会直接链接到 `framework/js/packages` > `[different package]` > `dist` 目录下面的 js 文件(非 node_modules),所以如果你修改了 packages 下的 JS 源代码并且想让其在 example 中生效,请重新在根目录执行 `npm run build`
>
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
test,
} = require('shelljs');

const cmdExample = 'please execute command like \'npm run buildexample -- hippy-react-demo\' or \'npm run buildexample -- hippy-vue-demo\'';
const cmdExample = 'please execute command like \'npm run buildexample hippy-react-demo\' or \'npm run buildexample hippy-vue-demo\'';
const example = process.argv[2];
if (!example) {
console.error(`❌ No example argument found, ${cmdExample}.`);
Expand Down
4 changes: 2 additions & 2 deletions scripts/debug-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
test,
} = require('shelljs');

const cmdExample = 'please execute command like \'npm run debugexample -- hippy-react-demo dev\' or \'npm run debugexample -- hippy-react-demo debug\'';
const cmdExample = 'please execute command like \'npm run debugexample hippy-react-demo dev\' or \'npm run debugexample hippy-react-demo debug\'';

const example = process.argv[2];
if (!example) {
Expand All @@ -34,7 +34,7 @@ pushd(DEMO_PATH);

const execOptions = { stdio: 'inherit' };
if (!fs.existsSync(path.resolve(DEMO_PATH, 'node_modules'))) {
console.error(`❌ ${example} dependencies have not been installed, please execute 'npm run init:example -- ${example}' first.`);
console.error(`❌ ${example} dependencies have not been installed, please execute 'npm run init:example ${example}' first.`);
process.exit(1);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/init-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
rm,
} = require('shelljs');

const cmdExample = 'please execute command like \'npm run init:example -- hippy-react-demo\' or \'npm run init:example -- hippy-vue-demo\'';
const cmdExample = 'please execute command like \'npm run init:example hippy-react-demo\' or \'npm run init:example hippy-vue-demo\'';
const example = process.argv[2];
if (!example) {
console.error(`❌ No example argument found, ${cmdExample}`);
Expand Down

0 comments on commit 3303578

Please sign in to comment.