refactor: 重组目录结构,脚本收进 scripts/,配置独立成 config/
根目录原来平铺了构建脚本、运行器配置、两个 .cmd 启动器和一份中文名的 实跑报告,四类东西混在一起,新人分不清哪个是源码、哪个是产物。这次按 职责分层重排: - 构建与检查脚本收进 scripts/:build.mjs、check.mjs - 一键启动器收进 scripts/:start-headless.cmd、start-dev.cmd - 运行器配置独立成 config/runner.config.mjs(日常调参不用重新 build) - 真机测试收进 dev/tests/:real-cdp / real-test / real-e2e / real-run - 运行报告改成 ASCII 名并移入 docs/reports/run-report-v203.md - v2.0.x 时期的 7 份原始抓取片段归档到 docs/archive/v2.0-snapshots/, docs/evidence/ 只留当前版本的有效证据 - 测试每次重新生成的 3 张截图(e2e-01-after-login、e2e-02-playing、 real-chrome-login)移出仓库并加入 .gitignore,改写到 .run-tmp/screenshots/; docs/screenshots/ 只保留手工挑选的 5 张展示图 路径修正:build.mjs 的 ROOT 上跳一级;dev/tests/ 四个脚本 ROOT 上跳两级、 对 runner/browser.mjs 的引用改 ../../;runner/config.mjs 默认配置文件路径改 config/runner.config.mjs;两个 .cmd 的 cd 改为仓库根、start-dev.cmd 指向 dev/serve.mjs;package.json 全部 npm scripts 同步;README、dev/README、证据 文件与源码注释里的路径一并更新。 顺带修掉测试里硬编码的 v2.7.0 断言:版本号改为从 package.json 读取。 验证:npm run build(104798 字节 / 102.3 KB)、npm run check(24/24)、 npm run test:real:headless(24/24 通过)。
This commit is contained in:
1 parent
ae117222df
commit
c1e883d67f
32 files changed
+148
-125
No files matched your search
@@ -0,0 +1,60 @@
|
||||
@echo off
|
||||
rem ---------------------------------------------------------------
|
||||
rem This file must stay PURE ASCII.
|
||||
rem cmd.exe reads batch files byte-by-byte with the current code page;
|
||||
rem multi-byte characters (e.g. Chinese) corrupt line offsets and make
|
||||
rem it report nonsense like "'npm' is not recognized".
|
||||
rem All Chinese messages come from the Node runner output instead.
|
||||
rem
|
||||
rem Usage:
|
||||
rem scripts\start-headless.cmd use config␍unner.config.mjs
|
||||
rem scripts\start-headless.cmd --help print all options
|
||||
rem scripts\start-headless.cmd --max 3 command line overrides config file
|
||||
rem ---------------------------------------------------------------
|
||||
setlocal
|
||||
chcp 65001 >nul
|
||||
cd /d "%~dp0.."
|
||||
title YunXueTang Assistant - headless runner
|
||||
|
||||
where node >nul 2>nul
|
||||
if errorlevel 1 goto no_node
|
||||
|
||||
if exist "yun-xue-tang-assistant.user.js" goto have_build
|
||||
echo [build] build output not found, running npm run build ...
|
||||
call npm run build
|
||||
if errorlevel 1 goto build_fail
|
||||
|
||||
:have_build
|
||||
if not exist "config␍unner.config.mjs" goto no_config
|
||||
echo [config] config␍unner.config.mjs found, editing it is enough (no rebuild needed)
|
||||
goto run
|
||||
|
||||
:no_config
|
||||
echo [warn] config␍unner.config.mjs not found, built-in defaults will be used
|
||||
|
||||
:run
|
||||
echo [run] headless runner starting, press Ctrl+C to stop
|
||||
echo.
|
||||
node "runner/headless.mjs" %*
|
||||
set RC=%ERRORLEVEL%
|
||||
|
||||
if "%RC%"=="0" goto done
|
||||
echo.
|
||||
echo [exit] code %RC%
|
||||
echo 0 finished 1 no progress 2 env/args error 3 login failed
|
||||
echo full log: run-logs\headless.log
|
||||
pause
|
||||
exit /b %RC%
|
||||
|
||||
:done
|
||||
exit /b 0
|
||||
|
||||
:no_node
|
||||
echo [error] node.exe not found. Install Node.js 22+ from https://nodejs.org/
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:build_fail
|
||||
echo [error] build failed. Run npm install first.
|
||||
pause
|
||||
exit /b 1
|
||||
Reference in new issue
Block a user