Skip to content

Commit

Permalink
Update CONTRIBUTING
Browse files Browse the repository at this point in the history
  • Loading branch information
wqcstrong committed Nov 27, 2024
1 parent 8f48b2d commit 74fbe0b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 40 deletions.
25 changes: 12 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ To get started, fork the [HuolalaTech/page-spy-api][page-spy-api] repository and
package main

import (
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
)

func main() {
container := container.Container()
container := container.Container()
err := container.Provide(func() *config.StaticConfig {
return &config.StaticConfig{}
})

if err != nil {
log.Fatal(err)
}
serve.Run()
if err != nil {
log.Fatal(err)
}
serve.Run()
}
```

Expand Down Expand Up @@ -153,7 +153,6 @@ Fork the [HuolalaTech/page-spy][page-spy-sdk] repository and clone it to your lo
3. You can use the following commands directly::

- `npx lerna run build`: Performs the build to generate the SDK. The product will be generated and placed in the `dist` folder of the project directory;
- `npx lerna run build:watch`: Build in watch mode. It will automatically build when the content is updated;
- `yarn test`: Runs unit tests;

## Debugging in Different Scenarios
Expand Down Expand Up @@ -196,7 +195,7 @@ VITE_API_BASE=example.com

> HINT: the "example.com" is just assumed that you have deployed the service at https://example.com, you should replace it with the actual deployment address.
After the service is started, open the debugging end address http://localhost:5173 in the browser. The port may be different, please access it according to the address printed by your local service. Click the "Inject SDK" menu at the top and follow the instructions to access it in the test project. The instantiation requires passing in the configuration:
After the service is started, open the debugging end address http://localhost:5173 in the browser. The port may be different, please access it according to the address printed by your local service. Click the "Doc" menu at the top and follow the instructions to access it in the test project. The instantiation requires passing in the configuration:

```ts
new PageSpy({
Expand All @@ -216,7 +215,7 @@ If you only want to focus on contributing to the SDK, follow the steps in [SDK S
It is recommended to take the `--scope` params execute the terminal command, which will automatically build when changes occur. For example:

```bash
$ npx lerna run build:watch --scope=@huolala-tech/page-spy-wechat
$ npx lerna run build --scope=@huolala-tech/page-spy-wechat -- -w
```

This will build and generate the SDK product in the `packages/*/dist` directory. Import the built SDK product into the test project, and instantiate PageSpy requires passing in the configuration:
Expand All @@ -230,4 +229,4 @@ new PageSpy({
});
```

Then start the test project. The PageSpy logo (white circular container with the PageSpy logo in the middle) should appear in the lower left corner of the test project page. Access the "Connections" of the test project through https://example.com, and the test project's debugging room should appear on the list. Now you can modify the SDK code and contribute to the SDK repository.
Then start the test project. The PageSpy logo (white circular container with the PageSpy logo in the middle) should appear in the lower right corner of the test project page. Access the "Connections" of the test project through https://example.com, and the test project's debugging room should appear on the list. Now you can modify the SDK code and contribute to the SDK repository.
25 changes: 12 additions & 13 deletions CONTRIBUTING_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ PageSpy は、GitHub Package (推奨) / [NPM package][npm-package] にホスト
package main

import (
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
)

func main() {
container := container.Container()
container := container.Container()
err := container.Provide(func() *config.StaticConfig {
return &config.StaticConfig{}
})

if err != nil {
log.Fatal(err)
}
serve.Run()
if err != nil {
log.Fatal(err)
}
serve.Run()
}
```

Expand Down Expand Up @@ -153,7 +153,6 @@ PageSpy は、GitHub Package (推奨) / [NPM package][npm-package] にホスト
3. 以下のコマンドを直接使用することができます::

- `npx lerna run build`: SDK を生成するためのビルドを行う。製品が生成され、プロジェクトディレクトリの `dist` フォルダに配置される;
- `npx lerna run build:watch`: ウォッチモードでビルド。コンテンツが更新されると自動的にビルドされます;
- `yarn test`: 単体テストの実行;

## さまざまなシナリオでのデバッグ
Expand Down Expand Up @@ -196,7 +195,7 @@ VITE_API_BASE=example.com

> ヒント: "example.com" は、https://example.com、サービスをデプロイしたと仮定しているだけなので、実際のデプロイアドレスに置き換えてください。
サービス開始後、ブラウザでデバッグ終了アドレス http://localhost:5173 を開いてください。ポートが異なる場合がありますので、各サービスが表示するアドレスに従ってアクセスしてください。上部にある "Inject SDK" メニューをクリックし、指示に従ってテストプロジェクトにアクセスします。インスタンス化には構成を渡す必要があります:
サービス開始後、ブラウザでデバッグ終了アドレス http://localhost:5173 を開いてください。ポートが異なる場合がありますので、各サービスが表示するアドレスに従ってアクセスしてください。上部にある "Doc" メニューをクリックし、指示に従ってテストプロジェクトにアクセスします。インスタンス化には構成を渡す必要があります:

```ts
new PageSpy({
Expand All @@ -216,7 +215,7 @@ SDK への貢献だけに集中したい場合は、[SDK セットアップ](#sd
`--scope` パラメータを使用してターミナル コマンドを実行することをお勧めします。変更が発生すると自動的にビルドされます。例えば:

```bash
$ npx lerna run build:watch --scope=@huolala-tech/page-spy-wechat
$ npx lerna run build --scope=@huolala-tech/page-spy-wechat -- -w
```

これにより、SDK 製品がビルドされ、`packages/*/dist` ディレクトリに生成されます。ビルドされた SDK 製品をテストプロジェクトにインポートし、PageSpy をインスタンス化するには、次の設定を渡す必要があります:
Expand All @@ -230,4 +229,4 @@ new PageSpy({
});
```

テストプロジェクトを開始します。テストプロジェクトのページの左下に PageSpy のロゴ(PageSpy のロゴが真ん中にある白い円形の容器)が表示されるはずです。https://example.com からテストプロジェクトの "Connections" にアクセスすると、テストプロジェクトのデバッグルームがリストに表示されるはずです。これで、SDK コードを修正し、SDK リポジトリにコントリビュートすることができます。
テストプロジェクトを開始します。テストプロジェクトのページの右下に PageSpy のロゴ(PageSpy のロゴが真ん中にある白い円形の容器)が表示されるはずです。https://example.com からテストプロジェクトの "Connections" にアクセスすると、テストプロジェクトのデバッグルームがリストに表示されるはずです。これで、SDK コードを修正し、SDK リポジトリにコントリビュートすることができます。
27 changes: 13 additions & 14 deletions CONTRIBUTING_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ Fork [HuolalaTech/page-spy-api][page-spy-api] 仓库并 clone 到本地,然后
package main

import (
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
"log"
"github.com/HuolalaTech/page-spy-api/config"
"github.com/HuolalaTech/page-spy-api/container"
"github.com/HuolalaTech/page-spy-api/serve"
)

func main() {
container := container.Container()
container := container.Container()
err := container.Provide(func() *config.StaticConfig {
return &config.StaticConfig{}
})

if err != nil {
log.Fatal(err)
}
serve.Run()
if err != nil {
log.Fatal(err)
}
serve.Run()
}
```

Expand Down Expand Up @@ -155,7 +155,6 @@ Fork [HuolalaTech/page-spy][page-spy-sdk] 仓库并 clone 到本地,page-spy
3. 以下命令可以直接使用:

- `npx lerna run build`:执行构建生成 SDK。产物将生成放在项目目录下的 dist 文件夹;
- `npx lerna run build:watch`:监听模式下的构建。当发现内容更新将自动构建;
- `yarn test`:执行单元测试;

## 分情景调试
Expand Down Expand Up @@ -198,14 +197,14 @@ VITE_API_BASE=example.com

> 请注意:这里的 "example.com" 只是假设你将服务部署在 https://example.com ,你应该替换为实际部署地址。
等待服务启动后,在浏览器打开调试端地址 http://localhost:5173 ,端口可能不一样,请按照你本地服务打印的地址访问。点击顶部「接入 SDK」菜单,按照指引在测试项目中接入,其中实例化需要传入配置:
等待服务启动后,在浏览器打开调试端地址 http://localhost:5173 ,端口可能不一样,请按照你本地服务打印的地址访问。点击「文档」菜单,按照指引在测试项目中接入,其中实例化需要传入配置:

```ts
new PageSpy({
api: 'example.com',
clientOrigin: 'http://localhost:5173',
project: '<任意名称>',
......
...
});
```

Expand All @@ -218,7 +217,7 @@ new PageSpy({
建议在监听构建命令后面指定 `--scope=` 参数,这样只有当你正在调整的代码在保存时会自动构建。例如:

```bash
$ npx lerna run build:watch --scope=@huolala-tech/page-spy-wechat
$ npx lerna run build --scope=@huolala-tech/page-spy-wechat -- -w
```

这将在 `packages/*/dist` 目录下生成 SDK 产物,在测试项目中引入,实例化 PgaeSpy 需要传入配置:
Expand All @@ -232,4 +231,4 @@ new PageSpy({
});
```

之后就可以启动测试项目,页面左下角应该出现了 PageSpy 的标志(白色圆形容器,中间包含了 PageSpy logo)。通过 https://example.com 访问调试端顶部菜单「房间列表」,测试项目的调试房间应该出现在列表上了。现在你可以修改 SDK 代码,开始为 SDK 仓库贡献。
之后就可以启动测试项目,页面右下角应该出现了 PageSpy 的标志(白色圆形容器,中间包含了 PageSpy logo)。通过 https://example.com 访问调试端顶部菜单「开始调试 - 在线实时」,测试项目的调试房间应该出现在列表上了。现在你可以修改 SDK 代码,开始为 SDK 仓库贡献。

0 comments on commit 74fbe0b

Please sign in to comment.