Skip to content

Commit 8b5c473

Browse files
committed
docs: use GPT to polish the document language
1 parent 2666a6e commit 8b5c473

5 files changed

Lines changed: 95 additions & 86 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For best practices regarding this package, please refer to [zotero-plugin-templa
1616

1717
## Documentation
1818

19-
[Read the Docs to Learn More.](https://northword.github.io/zotero-plugin-scaffold)
19+
[Read the Docs to Learn More](https://northword.github.io/zotero-plugin-scaffold).
2020

2121
## Contributing
2222

docs/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ layout: home
55
hero:
66
name: "Scaffold"
77
text: "Zotero Plugins"
8-
tagline: The Modern Development Experience for Zotero Plugins
8+
tagline: "The Modern Development Framework for Zotero Plugins"
99
actions:
1010
- theme: brand
11-
text: Quick Start
11+
text: "Quick Start"
1212
link: /quick-start
1313

1414
features:
15-
- title: Dev Serve
16-
details: Auto reload your plugin when source code changed
15+
- title: "Dev Serve"
16+
details: "Automatically reload your plugin whenever the source code changes."
1717
link: /serve
18-
- title: Build Plugin
19-
details: TypeScript supported, many utils builders, and pack code to xpi
18+
- title: "Build Plugin"
19+
details: "Supports TypeScript, provides utility builders, and packages your code into an XPI file."
2020
link: /build
21-
- title: Test plugin
22-
details: Out-of-the-box test kits
21+
- title: "Test Plugin"
22+
details: "Comes with ready-to-use testing kits."
2323
link: /test
24-
- title: Release
25-
details: Auto bump version, and publish your plugin to GitHub
24+
- title: "Release"
25+
details: "Automatically bump the version and publish your plugin to GitHub."
2626
link: /release
2727
---

docs/quick-start.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
# Quick Start
22

3-
## Using in a blank project
3+
## Using in a Blank Project
44

5-
::: details WIP: Not yet implemented
5+
::: details WIP: Not Yet Implemented
66

77
```bash
8-
# npm
8+
# Using npm
99
npx zotero-plugin create
10-
# pnpm
10+
11+
# Using pnpm
1112
pnpm dlx zotero-plugin create
1213
```
1314

1415
:::
1516

16-
## Using in an existing project
17+
## Using in an Existing Project
1718

18-
### 01. Install
19+
### 01. Install the Package
20+
21+
You can install `zotero-plugin-scaffold` using your preferred package manager:
1922

2023
```bash
24+
# npm
2125
npm install -D zotero-plugin-scaffold
2226

27+
# yarn
2328
yarn add -D zotero-plugin-scaffold
2429

30+
# pnpm
2531
pnpm add -D zotero-plugin-scaffold
2632
```
2733

28-
### 02. Create a config file
34+
### 02. Create a Configuration File
2935

30-
The configuration file needs to be stored in the following location.
36+
The configuration file should be placed at one of the following locations:
3137

3238
```bash
33-
zotero-plugin.config.ts # also avaliable in *.js *.mjs *.cjs *.ts
39+
zotero-plugin.config.ts # Also supported: *.js, *.mjs, *.cjs, *.ts
3440
```
3541

36-
You can import helper `defineConfig` to get type hints. If no value is specified for an optional property, the default value will be used.
42+
You can use the `defineConfig` helper to enable type hints. Optional properties will default to predefined values if not explicitly specified.
3743

3844
```ts
3945
import { defineConfig } from "zotero-plugin-scaffold";
@@ -54,15 +60,15 @@ export default defineConfig({
5460
});
5561
```
5662

57-
Full config please refrence in [src/types](https://github.com/northword/zotero-plugin-scaffold/blob/main/src/types/config.ts).
63+
For a full list of configuration options, refer to the [type definitions](https://github.com/northword/zotero-plugin-scaffold/blob/main/src/types/config.ts).
5864

59-
### 03. Create a env file
65+
### 03. Create an Environment File
6066

61-
This file defines Zotero's runtime configuration such as binary paths, profile paths, and environment variables required for Node scripts to run.
67+
Define Zoteros runtime configuration (e.g., binary paths, profile paths, and environment variables) in a `.env` file.
6268

6369
::: warning
6470

65-
NOTE: Do not check-in this file to the repository!
71+
Do not commit this file to your repository!
6672

6773
:::
6874

@@ -71,17 +77,19 @@ NOTE: Do not check-in this file to the repository!
7177
```
7278

7379
```ini
74-
# The path of the Zotero binary file.
75-
# The path is `*/Zotero.app/Contents/MacOS/zotero` for macOS.
76-
ZOTERO_PLUGIN_ZOTERO_BIN_PATH = /path/to/zotero.exe
77-
78-
# The path of the profile used for development.
79-
# Start the profile manager by `/path/to/zotero.exe -p` to create a profile for development.
80-
# @see https://www.zotero.org/support/kb/profile_directory
81-
ZOTERO_PLUGIN_PROFILE_PATH = /path/to/profile
80+
# Path to the Zotero binary file.
81+
# For macOS, the path is typically `*/Zotero.app/Contents/MacOS/zotero`.
82+
ZOTERO_PLUGIN_ZOTERO_BIN_PATH=/path/to/zotero.exe
83+
84+
# Path to the profile used for development.
85+
# To create a profile for development, start the profile manager with `/path/to/zotero.exe -p`.
86+
# More info: https://www.zotero.org/support/kb/profile_directory
87+
ZOTERO_PLUGIN_PROFILE_PATH=/path/to/profile
8288
```
8389

84-
### 04. Add scripts to package.json
90+
### 04. Add Scripts to `package.json`
91+
92+
Add the following scripts for development:
8593

8694
```json
8795
{
@@ -93,20 +101,27 @@ ZOTERO_PLUGIN_PROFILE_PATH = /path/to/profile
93101
}
94102
```
95103

96-
### 05. Run
104+
### 05. Run the Plugin
105+
106+
Use the following commands to start development or build the plugin:
97107

98108
```bash
109+
# Start the development server
99110
pnpm run start
111+
112+
# Build the plugin
100113
pnpm run build
101114
```
102115

103-
## Using in NodeJS code
116+
## Using in Node.js Code
117+
118+
You can also use `zotero-plugin-scaffold` programmatically in your Node.js scripts:
104119

105120
```ts
106121
import { Build, Config } from "zotero-plugin-scaffold";
107122

108123
const config = await Config.loadConfig();
109124

110-
const Builder = new Build(config);
111-
await Builder.run();
125+
const builder = new Build(config);
126+
await builder.run();
112127
```

docs/release.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Release
22

3-
我们都知道,对于一个插件的发布,我们需要手动修改 `manifest.json` 中的 `version` 值,然后将其打包,上传到某个地方,随后,我们还需要更新 `update.json` 中的版本号和链接。
3+
When releasing a plugin, we typically need to manually update the `version` value in `manifest.json`, package the plugin, upload it somewhere, and then update the `version` and link in `update.json`.
44

5-
为了保持 Git 记录,我们在修改 version 值后,还需要提交代码并为这个提交添加 tag
5+
To maintain Git history, we also need to commit the changes and add a tag to the commit after updating the version.
66

7-
— 这太麻烦了!
7+
It’s too tedious!
88

9-
Scaffold 中,你只需要运行 `zotero-plugin release`,然后选择一个你需要的版本号,一切都将自动运行。
9+
With Scaffold, all you need to do is run `zotero-plugin release` and select the desired version number. Everything else will be handled automatically.

docs/test.md

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
11
# Testing
22

3-
`zotero-plugin-scaffold` can run [Mocha](https://mochajs.org/) / [Chai](https://www.chaijs.com/)-based tests against a live Zotero instance via a proxy plugin.
3+
`zotero-plugin-scaffold` enables testing with [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) in a live Zotero instance through a proxy plugin.
44

5-
A temporary profile and data directory will be created when launching Zotero, so tests can be run locally on the system Zotero installation.
5+
When running tests, a temporary profile and data directory are created, allowing the tests to execute locally on the installed Zotero application.
66

7-
## Why
7+
## Why Use This Approach?
88

9-
Since Zotero is a browser environment and has a lot of private APIs, if we use the mainstream Node-side testing scheme, we will inevitably need to mock a lot of methods, which will distort the test results.
9+
Zotero operates in a browser-like environment with many private APIs. Using conventional Node.js testing frameworks would require extensive mocking, leading to distorted test results.
1010

11-
In Scaffold, we use mocha as the testing framework, which is a simple but flexible enough testing framework for the browser side. We also use chai as an assertion library.
11+
To address this, Scaffold uses Mocha as a lightweight yet flexible browser-compatible testing framework, complemented by Chai for assertions.
1212

13-
When we start a test, we generate a temporary plugin in `.scaffold/test/resource/` that we use to run the test. Iterate through the test files in the `test.entries` directory and compile them in `.scaffold/test/resource/content`.
14-
15-
When Zotero starts up, it loads your plugin and the test plugin that was just generated separately, so we have complete access to all the APIs and can use them for testing.
13+
Tests are executed via a temporary plugin generated in `.scaffold/test/resource/`. The test files in the `test.entries` directory are compiled into `.scaffold/test/resource/content`. When Zotero launches, it loads both the primary plugin and the generated test plugin, providing full access to all APIs needed for testing.
1614

1715
## Usage
1816

1917
### Configuring Test Options
2018

21-
After configuring your project to be built with `zotero-plugin-scaffold`, add a `test` object to your configuration:
19+
After setting up your project with `zotero-plugin-scaffold`, add a `test` object to your configuration:
2220

23-
```ts twoslash
21+
```ts
2422
export default defineConfig({
2523
// ...
2624
test: {
27-
// Directories containing *.spec.js tests
25+
// Directories containing *.spec.js test files
2826
entries: ["test"],
29-
// Exit Zotero when the test is finished.
27+
// Exit Zotero after the tests complete
3028
exitOnFinish: true,
31-
// Function string that returns the initialization status of the plugin.
32-
// If set, the test will wait until the function returns true before running the test.
33-
// e.g.
34-
// if your plugin created a `MyPlugin` object beneath `Zotero` and it set an
35-
// `initialized` field to `true` at the end of its `startup` bootstrap method...
29+
// Function string that returns the plugin's initialization status
30+
// The test waits until this function returns true
31+
// Example: if your plugin sets `Zotero.MyPlugin.initialized` to `true` in its `startup` method...
3632
waitForPlugin: `() => Zotero.MyPlugin.initialized`,
3733
}
3834
});
3935
```
4036

4137
::: tip
42-
43-
See the `TestConfig` interface in [`src/types/config.ts`](https://github.com/northword/zotero-plugin-scaffold/blob/main/src/types/config.ts) for full documentation.
44-
38+
Refer to the `TestConfig` interface in [`src/types/config.ts`](https://github.com/northword/zotero-plugin-scaffold/blob/main/src/types/config.ts) for complete documentation.
4539
:::
4640

47-
Add a script to `package.json`:
41+
Add a `test` script to your `package.json`:
4842

4943
```json
5044
{
@@ -56,27 +50,29 @@ Add a script to `package.json`:
5650

5751
### Install Mocha and Chai
5852

59-
We recommend that you install `mocha.js` locally as a development dependency, as this will avoid some potential dependency conflicts:
53+
Install `mocha` as a local development dependency to avoid potential conflicts:
6054

6155
```bash
6256
npm install -D mocha @types/mocha @types/chai
6357
```
6458

65-
When Scaffold detects your locally installed mocha, it will automatically use your installed mocha, otherwise Scaffold will get the latest version of mocha from NPM.
59+
If Scaffold detects a local `mocha` installation, it will use it. Otherwise, it fetches the latest version from NPM. Due to unresolved ESM import issues with Chai, Scaffold always uses the remote version.
6660

67-
Since the ESM import issue for Chai has not been resolved, chai will always use the remote version.
61+
Cached versions of `mocha` and `chai` are stored in `.scaffold/cache`. Delete this cache if you need to force an update.
6862

69-
The mocha and chai downloaded from the remote will be cached in the `.scaffold/cache` directory, and you can delete the cache if you need to in order to force Scaffold to update their versions.
63+
### Writing Test Cases
7064

71-
### Write Your Test Cases
65+
Write test cases using [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) syntax.
7266

73-
You can then write your test file, see [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) for syntax.
67+
### Running Tests
7468

75-
### Run Test
69+
After writing your test cases, run them using:
7670

77-
一旦你完成测试代码的编写,你可以通过 `npm run test` 来启动测试。
71+
```bash
72+
npm run test
73+
```
7874

79-
`zotero-plugin test` 也提供了一些命令行参数,以便你可以覆盖配置文件中的设置,你可以通过 `zotero-plugin test --help` 来查看:
75+
You can override configuration settings with CLI parameters. Use `zotero-plugin test --help` to view available options:
8076

8177
```bash
8278
$ pnpm zotero-plugin test --help
@@ -92,26 +88,24 @@ Options:
9288

9389
## Watch Mode
9490

95-
In watch mode, Scaffold will:
91+
In watch mode, Scaffold automatically:
9692

97-
- When the source code changes, it will automatically recompile the source code, reload the plugins and re-run the tests;
98-
- When the test code changes, it will automatically re-run the tests;
93+
- Recompiles source code, reloads plugins, and reruns tests when the source changes.
94+
- Reruns tests when test files are modified.
9995

100-
This feature is not yet complete.
96+
This feature is still under development.
10197

102-
## Run Test on CI
98+
## Running Tests on CI
10399

104-
Most of the time, we want tests to run automatically on CI services such as GitHub Actions, for which we provide `headless` mode.
100+
To run tests automatically on CI services like GitHub Actions, Scaffold provides a `headless` mode.
105101

106-
In general, when we detect that you are running tests on a CI service, we will automatically enable headless mode. If you have a need to use headless locally, you just need to pass `headless` in the cli parameter or set `test.headless: true` in the configuration.
102+
By default, Scaffold enables headless mode on CI services. To enable it locally, pass `headless` as a CLI parameter or set `test.headless: true` in the configuration.
107103

108104
::: warning
109-
110-
Scaffold's built-in headless mode is only supported on Ubuntu 22.04, 24.04. If you are using a different Linux distribution, manually configure the headless environment, set Scaffold's `test.headless` to `false`, and start the test using something like `xvfb-run npm run test`, etc.
111-
105+
Scaffold's built-in headless mode supports only Ubuntu 22.04 and 24.04. For other Linux distributions, manually configure a headless environment, set `test.headless` to `false`, and use tools like `xvfb-run npm run test`.
112106
:::
113107

114-
For tests running on GitHub Actions, this is a typical workflow template:
108+
For GitHub Actions, use the following workflow template:
115109

116110
```yaml
117111
name: test
@@ -126,17 +120,17 @@ on:
126120

127121
jobs:
128122
test:
129-
runs-on: ubuntu-22.04
123+
runs-on: ubuntu-latest
130124
steps:
131125
- name: Checkout
132126
uses: actions/checkout@v4
133127

134128
- name: Setup Node.js
135129
uses: actions/setup-node@v4
136130

137-
- name: Install deps
131+
- name: Install dependencies
138132
run: npm install
139133

140-
- name: Test
134+
- name: Run tests
141135
run: npm test
142136
```

0 commit comments

Comments
 (0)