Skip to content

Commit 97532a7

Browse files
committed
style(docs): improve formatting and consistency in documentation
- Added new lines for better readability in copilot-instructions.md - Unified formatting in README.md and examples - Simplified console log statements in demo.ts and release.ts - Enhanced code readability in archetype.ts and world.ts by adjusting line breaks
1 parent 30319ed commit 97532a7

File tree

13 files changed

+70
-136
lines changed

13 files changed

+70
-136
lines changed

.github/copilot-instructions.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
# @codehz/ecs - AI Coding Guidelines
22

33
## Project Overview
4+
45
This is an Entity Component System (ECS) library built with TypeScript and Bun runtime. The project follows modern TypeScript practices with strict type checking and ESNext features.
56

67
## Runtime & Environment
8+
79
- **Runtime**: Bun (not Node.js) - use `bun` commands instead of `npm`/`yarn`
810
- **Language**: TypeScript with ESNext target and strict mode enabled
911
- **Module System**: ES modules with `"module": "Preserve"` and bundler resolution
1012

1113
## Development Workflow
14+
1215
- **Install**: `bun install` (not `npm install`)
1316
- **Run**: `bun run src/index.ts` (direct execution, no build step)
1417
- **TypeScript**: `bunx tsc --noEmit` (Configured for modern features with strict checking - noEmit mode for bundler compatibility)
1518
- **Testing**: `bun test` (set up tests as needed)
1619

1720
## Code Patterns
21+
1822
- **Imports**: Use ES module syntax with `.ts` extensions allowed due to `"allowImportingTsExtensions": true`
1923
- **Type Checking**: Strict mode with additional checks like `noUncheckedIndexedAccess` and `noImplicitOverride`
2024

2125
## Architecture Notes
26+
2227
- **Entry Point**: `src/index.ts` - single file currently, expand with ECS components/systems
2328
- **Dependencies**: Minimal setup - add peer dependencies for TypeScript integration
2429

2530
## Key Files
31+
2632
- `tsconfig.json`: Modern TypeScript config with bundler mode
2733
- `package.json`: Module configuration with Bun-specific settings
2834
- `src/index.ts`: Main entry point (currently minimal)</content>
29-
<parameter name="filePath">d:\Developer\ecs\.github\copilot-instructions.md
35+
<parameter name="filePath">d:\Developer\ecs\.github\copilot-instructions.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ world.registerComponentLifecycleHook(PositionId, {
6464
},
6565
onRemoved: (entityId, componentType) => {
6666
console.log(`组件 ${componentType} 被从实体 ${entityId} 移除`);
67-
}
67+
},
6868
});
6969

7070
// 你也可以只注册其中一个钩子
7171
world.registerComponentLifecycleHook(VelocityId, {
7272
onRemoved: (entityId, componentType) => {
7373
console.log(`组件 ${componentType} 被从实体 ${entityId} 移除`);
74-
}
74+
},
7575
});
7676

7777
// 添加组件时会触发钩子

bun.lock

Lines changed: 1 addition & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/simple/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Entity 1024: Position (2.00, 1.00)
4545
Entity 1025: Position (9.00, 12.00)
4646
4747
...
48-
```
48+
```

examples/simple/demo.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { World } from "../../src/world";
21
import { createComponentId } from "../../src/entity";
3-
import type { System } from "../../src/system";
42
import type { Query } from "../../src/query";
3+
import type { System } from "../../src/system";
4+
import { World } from "../../src/world";
55

66
// 定义组件类型
77
type Position = { x: number; y: number };
@@ -54,14 +54,16 @@ function main() {
5454
// 注册组件钩子
5555
world.registerComponentLifecycleHook(PositionId, {
5656
onAdded: (entityId, componentType, component) => {
57-
console.log(`组件添加钩子触发: 实体 ${entityId} 添加了 ${componentType} 组件,值为 (${component.x}, ${component.y})`);
58-
}
57+
console.log(
58+
`组件添加钩子触发: 实体 ${entityId} 添加了 ${componentType} 组件,值为 (${component.x}, ${component.y})`,
59+
);
60+
},
5961
});
6062

6163
world.registerComponentLifecycleHook(VelocityId, {
6264
onRemoved: (entityId, componentType) => {
6365
console.log(`组件移除钩子触发: 实体 ${entityId} 移除了 ${componentType} 组件`);
64-
}
66+
},
6567
});
6668

6769
// 执行命令以应用组件添加

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"devDependencies": {
66
"@types/bun": "latest",
77
"husky": "^9.1.7",
8-
"lint-staged": "^16.2.6",
9-
"organize-imports-cli": "^0.10.0"
8+
"lint-staged": "^16.2.6"
109
},
1110
"scripts": {
1211
"test": "bun test",
@@ -19,7 +18,6 @@
1918
},
2019
"lint-staged": {
2120
"*.{ts,tsx}": [
22-
"organize-imports-cli",
2321
"prettier --write"
2422
],
2523
"*.{json,md}": [

scripts/build.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// scripts/dist.ts - 构建脚本
22

33
import { $ } from "bun";
4-
import { readdirSync } from "fs";
54

65
export async function build() {
76
const startTime = Date.now();
@@ -36,9 +35,7 @@ export async function build() {
3635
console.log(`✅ Build successful in ${buildTime}ms!`);
3736
console.log(`📦 Generated ${result.outputs.length} files:`);
3837
for (const output of result.outputs) {
39-
const size = output.size
40-
? `${(output.size / 1024).toFixed(1)} KB`
41-
: "unknown";
38+
const size = output.size ? `${(output.size / 1024).toFixed(1)} KB` : "unknown";
4239
console.log(` ${output.path} (${size})`);
4340
}
4441
console.log();

0 commit comments

Comments
 (0)