Skip to content

Commit 3404b00

Browse files
committed
更新文档以反映模块系统的更改,替换“源”和“预设”为“模块”,并调整相关示例和命令。
1 parent 3e1ee21 commit 3404b00

File tree

5 files changed

+49
-29
lines changed

5 files changed

+49
-29
lines changed

docs/guide/cli.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,43 @@ npx objectql new object customer
8686

8787
## 3. Development Tools
8888

89-
### 3.1 `serve` (Dev Server)
89+
### 3.1 `dev` (Development Server)
9090

91-
Start a standalone development server.
92-
**Alias**: `s`
91+
Start the development server with hot-reload support.
92+
**Alias**: `d`
9393

9494
```bash
95-
npx objectql serve [options]
95+
npx objectql dev [options]
9696
```
9797

9898
**Options:**
9999

100100
| Option | Alias | Default | Description |
101101
| :--- | :--- | :--- | :--- |
102102
| `--port <number>` | `-p` | `3000` | Port to listen on. |
103-
| `--dir <path>` | `-d` | `.` | Directory containing schema. |
103+
| `--dir <path>` | `-d` | `.` | Root module directory (context). |
104+
| `--config <path>` | `-c` | - | Path to `objectql.config.ts`. |
105+
| `--modules <items>` | | - | Comma-separated list of modules to load (overrides config). Supports NPM packages (`@org/pkg`) or local paths (`./src/mod`). |
106+
| `--no-watch` | | `false` | Disable file watching. |
107+
108+
### 3.2 `start` (Production Server)
109+
110+
good Start the server in production mode.
111+
112+
```bash
113+
npx objectql start [options]
114+
```
115+
116+
**Options:**
117+
118+
| Option | Alias | Default | Description |
119+
| :--- | :--- | :--- | :--- |
120+
| `--port <number>` | `-p` | `3000` | Port to listen on. |
121+
| `--dir <path>` | `-d` | `.` | Root module directory (context). |
122+
| `--config <path>` | `-c` | - | Path to `objectql.config.ts`. |
123+
| `--modules <items>` | | - | Comma-separated list of modules to load (overrides config). |
104124

105-
### 3.2 `studio` (Admin UI)
125+
### 3.3 `studio` (Admin UI)
106126

107127
Starts the web-based admin studio to browse data and view schema.
108128
**Alias**: `ui`

docs/guide/configuration.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import { ObjectQL } from '@objectql/core';
1010

1111
export const db = new ObjectQL({
1212
connection: 'sqlite://data.db', // 1. Infrastructure
13-
presets: ['@objectql/preset-auth'], // 2. Base Capabilities
14-
source: ['src'], // 3. Application Logic
13+
modules: [
14+
'@objectql/starter-basic', // 2. External Module (NPM)
15+
'./src/modules/billing' // 3. Local Module
16+
],
17+
// source: ... (Deprecated, use modules)
1518
plugins: [] // 4. Extensions
1619
});
1720
```
@@ -26,14 +29,12 @@ The Connection String URI defining the database connection.
2629

2730
The engine will automatically load the appropriate driver (`@objectql/driver-sql` or `@objectql/driver-mongo`).
2831

29-
### `source` (string | string[])
30-
One or more directory paths (relative or absolute) containing your schema files (`*.object.yml`).
31-
The loader scans these directories recursively.
32+
### `modules` (string[])
33+
A list of modules to load. A module can be:
34+
1. **An NPM Package**: (e.g., `@objectql/starter-crm`). The loader resolves the package and looks for `src` or root directory files.
35+
2. **A Local Directory**: (e.g., `./src/my-module`). The loader scans the directory for schema files (`*.object.yml`).
3236

33-
### `presets` (string[])
34-
A list of NPM packages to load as presets.
35-
ObjectQL will try to resolve the package and load schema files from its directory.
36-
Useful for sharing common business objects (User, Role, File, etc.).
37+
This unifies the previous concepts of `source`, `dir` and `presets`.
3738

3839
### `plugins` ((ObjectQLPlugin | string)[])
3940
A list of plugin instances OR package names to extend the core functionality.

docs/guide/getting-started.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,12 @@ async function main() {
8282
// Detects 'sqlite', 'postgres', 'mongodb' automatically
8383
connection: 'sqlite://data.db',
8484

85-
// 2. Schema Source
86-
// Where your *.object.yml files are located
87-
source: ['src/objects'],
88-
89-
// 3. Load Presets (Optional)
90-
// Load standard objects from npm packages
91-
presets: ['@objectql/preset-auth']
85+
// 2. Load Modules
86+
// Load schema from local directories OR npm packages
87+
modules: [
88+
'src/objects', // Local Module
89+
'@objectql/starter-auth' // External Module (NPM)
90+
]
9291
});
9392

9493
await db.init();

docs/guide/plugins.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,16 @@ setup(app) {
228228
}
229229
```
230230

231-
### E. Manage Packages (Presets)
232-
Plugins can dynamically load or unload other packages. This is useful for plugins that act as "features" which bring in a set of dependencies.
231+
### E. Manage Modules
232+
Plugins can dynamically load or unload other modules. This is useful for plugins that act as "features" which bring in a set of dependencies.
233233

234234
```typescript
235235
setup(app) {
236-
// Dynamically load another package
237-
app.addPackage('@objectos/standard-objects');
236+
// Dynamically load another module
237+
app.addModule('@objectos/standard-objects');
238238

239-
// Or remove a package if it conflicts with this plugin
240-
app.removePackage('@objectos/legacy-objects');
239+
// Or remove a module if it conflicts with this plugin
240+
app.removeModule('@objectos/legacy-objects');
241241
}
242242
```
243243

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Welcome to the ObjectQL examples collection. This directory is organized to help
4444
| Example | Description | Proficiency |
4545
| :--- | :--- | :--- |
4646
| **[Enterprise Structure](./scenarios/enterprise-structure)** | **[NEW]** Best practices for organizing metadata in large-scale applications. Shows domain-driven module structure with 20+ objects across CRM, HR, Finance, and Project modules. | 🏢 Advanced |
47-
| **[Preset Usage](./scenarios/preset-usage)** | Shows how to consume pre-packaged business logic (presets) in an application. | 💡 Intermediate |
47+
| **[Module Usage](./scenarios/module-usage)** | Shows how to consume pre-packaged business logic (modules) in an application. | 💡 Intermediate |
4848

4949
## 🚧 Coming Soon
5050
We are working on high-fidelity examples:

0 commit comments

Comments
 (0)