Initial commit of 001code-html Scratch frontend project.

Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:37:45 +08:00
commit 6e0a1fbcbb
11350 changed files with 965674 additions and 0 deletions

98
README.md Normal file
View File

@@ -0,0 +1,98 @@
001code-html
系灵丌编程001CODE前端项目。
## scratch-gui 本地开发
- 目录位置:`scratch-gui\`
- Node 版本建议:`>= 18``npm >= 9`Windows
### 安装依赖
```bash
cd scratch-gui
```
```bash
npm ci
```
### 启动开发服务器
```bash
npm start
```
### 生产构建
```bash
npm run build
```
## 与子包联动npm link
`scratch-gui` 依赖内部包:`scratch-vm``scratch-blocks`。为在本地联动开发它们的改动,使用 `npm link`
> 提示:每个子包先安装依赖并构建,再 `npm link`。在 `scratch-gui` 中再链接对应包名。
### 链接 scratch-vm
```bash
cd scratch-vm
```
```bash
npm install
```
```bash
npm link
```
### 链接 scratch-blocks
```bash
cd scratch-blocks
```
```bash
npm install
```
```bash
npm link
```
### scratch-gui 链接 scratch-blocks scratch-vm
```bash
cd ..\scratch-gui
```
```bash
npm link scratch-blocks scratch-vm
```
### 解除链接(恢复使用包管理器安装的版本)
```bash
cd scratch-gui
```
```bash
npm unlink scratch-vm
```
```bash
npm unlink scratch-render
```
```bash
npm unlink scratch-blocks
```
```bash
npm unlink scratch-l10n
```
```bash
npm i
```
## Docker 运行期配置(可选)
- 通过 `/env.config.json` 注入运行时配置(例如 `API_BASE` / `DEPLOY_ENV`ENTRYPOINT 启动时替换占位符。
- 开发环境如果未启用 Docker`env.config.json` 仍为占位时,前端会自动回退读取 `process.env.*`
常见问题
- 若容器启动失败提示找不到入口脚本,确认 Dockerfile 已 `COPY docker-conf/entrypoint.sh``chmod +x`,且无 CRLF 行尾。
- 确保静态服务器对 `/env.config.json` 返回 `Content-Type: application/json`,并避免 SPA 重写。