init: 微信小游戏项目初始化
基础工程骨架:game.js 入口、Canvas 渲染、DevTools 项目配置。 包含 CLAUDE.md / AGENTS.md 及 KB 知识库接入。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
# WeChat DevTools
|
||||
node_modules/
|
||||
miniprogram_npm/
|
||||
*.wasm
|
||||
|
||||
# Build
|
||||
dist/
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
30
AGENTS.md
Normal file
30
AGENTS.md
Normal file
@@ -0,0 +1,30 @@
|
||||
<!-- BRIEFING: auto-maintained -->
|
||||
## Project State
|
||||
- **Project**: wechat-minigame — 微信小游戏
|
||||
- **Stage**: 初始化
|
||||
- **Last action**: project init
|
||||
- **Next task**: 讨论游戏类型、玩法设计和技术方案,制定开发计划
|
||||
- **Hard constraints**: Canvas rendering | 4MB first package | No DOM/BOM | 60fps target
|
||||
- **KB**: ~/pro/kb/projects/wechat-minigame/
|
||||
<!-- END BRIEFING -->
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
game.js # Entry point
|
||||
game.json # Global config
|
||||
project.config.json # DevTools project config
|
||||
js/ # Game logic
|
||||
images/ # Image assets
|
||||
audio/ # Audio assets
|
||||
```
|
||||
|
||||
## Build & Dev Commands
|
||||
|
||||
No CLI build/test commands. Use WeChat DevTools for preview and debugging.
|
||||
|
||||
## Coding Style
|
||||
|
||||
- ES6+ modules (import/export)
|
||||
- Canvas-based rendering, no DOM
|
||||
- Data files use JS module wrapping (no JSON require)
|
||||
36
CLAUDE.md
Normal file
36
CLAUDE.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# wechat-minigame
|
||||
|
||||
<!-- BRIEFING: auto-maintained, do not edit manually -->
|
||||
## 项目速览
|
||||
- **项目**:wechat-minigame — 微信小游戏
|
||||
- **阶段**:初始化
|
||||
- **上次结论**:项目初始化
|
||||
- **下一步**:与 Codex 讨论游戏类型、玩法设计和技术方案
|
||||
- **关键约束**:Canvas 渲染 | 首包 4MB | 无 DOM/BOM | 60fps 目标
|
||||
- **KB 指针**:~/pro/kb/projects/wechat-minigame/
|
||||
<!-- END BRIEFING -->
|
||||
|
||||
## 开发环境
|
||||
|
||||
- 平台:微信小游戏(非小程序)
|
||||
- 渲染:Canvas 2D / WebGL
|
||||
- 调试工具:微信开发者工具
|
||||
- 无 npm/build/test CLI,在 DevTools 中模拟器验证
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
game.js # 入口
|
||||
game.json # 全局配置
|
||||
project.config.json # DevTools 项目配置
|
||||
js/ # 游戏逻辑
|
||||
images/ # 图片素材
|
||||
audio/ # 音频素材
|
||||
```
|
||||
|
||||
## 平台约束
|
||||
|
||||
- `require()` 不支持 JSON,数据用 JS module 包装
|
||||
- 首包 ≤ 4MB,分包总计 ≤ 20MB
|
||||
- 不支持 DOM/BOM,仅微信 API 子集
|
||||
- Canvas 是全局单例,通过 `wx.createCanvas()` 获取
|
||||
0
audio/.gitkeep
Normal file
0
audio/.gitkeep
Normal file
10
game.json
Normal file
10
game.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"showStatusBar": false,
|
||||
"networkTimeout": {
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"uploadFile": 5000,
|
||||
"downloadFile": 5000
|
||||
}
|
||||
}
|
||||
0
images/.gitkeep
Normal file
0
images/.gitkeep
Normal file
12
js/main.js
Normal file
12
js/main.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { windowWidth, windowHeight } = wx.getSystemInfoSync()
|
||||
|
||||
const canvas = wx.createCanvas()
|
||||
const ctx = canvas.getContext('2d')
|
||||
|
||||
ctx.fillStyle = '#ffffff'
|
||||
ctx.fillRect(0, 0, windowWidth, windowHeight)
|
||||
|
||||
ctx.fillStyle = '#333333'
|
||||
ctx.font = '24px sans-serif'
|
||||
ctx.textAlign = 'center'
|
||||
ctx.fillText('微信小游戏', windowWidth / 2, windowHeight / 2)
|
||||
41
project.config.json
Normal file
41
project.config.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"miniprogramRoot": "./",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"coverView": true,
|
||||
"nodeModules": false,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"uglifyFileName": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"useIsolateContext": true,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false
|
||||
},
|
||||
"compileType": "game",
|
||||
"appid": "",
|
||||
"projectname": "wechat-minigame",
|
||||
"condition": {}
|
||||
}
|
||||
Reference in New Issue
Block a user