- 玩法一 数字一笔:规则库、求解器、26 关、竖屏触摸 Web 原型、测试 - 玩法二 连连气球:连消畅玩版核心、Web 原型、Cocos 球槽组件与导出脚本 - 玩法三 六边一笔:规则库、求解器、10 关 + 转墙实验包、Web 原型、测试 - 产品文档、UI 设计规范、各玩法 GDD / HANDOFF - 文档移除全部外部参考作引用;删除玩法二 v0 旧稿
23 lines
1.4 KiB
JavaScript
23 lines
1.4 KiB
JavaScript
import { access, readdir, writeFile } from 'node:fs/promises';
|
|
import { resolve } from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
let declarations = process.argv[2] || process.env.COCOS_TYPES;
|
|
if (!declarations) {
|
|
const root = '/Applications/Cocos/Creator';
|
|
try {
|
|
for (const version of (await readdir(root)).sort((a, b) => b.localeCompare(a, undefined, { numeric: true }))) {
|
|
const candidate = `${root}/${version}/CocosCreator.app/Contents/Resources/resources/3d/engine/bin/.declarations/cc.d.ts`;
|
|
try { await access(candidate); declarations = candidate; break; } catch {}
|
|
}
|
|
} catch {}
|
|
}
|
|
if (!declarations) throw new Error('请用 COCOS_TYPES 或命令参数提供 Creator 的 cc.d.ts 路径。');
|
|
const target = resolve('cocos/export/02-connect-1234');
|
|
const config = resolve('cocos/export/tsconfig.check.json');
|
|
await writeFile(config, JSON.stringify({ compilerOptions: { target: 'ES2020', module: 'ESNext', moduleResolution: 'Bundler',
|
|
lib: ['ES2020', 'DOM'], strict: true, experimentalDecorators: true, useDefineForClassFields: false,
|
|
noEmit: true, skipLibCheck: true, types: [], baseUrl: '.', paths: { cc: [resolve(declarations)] } }, include: [target] }, null, 2));
|
|
console.log(`检查真实 Creator 类型:${declarations}`);
|
|
const result = spawnSync(process.execPath, ['node_modules/typescript/bin/tsc', '-p', config], { stdio: 'inherit' });
|
|
process.exit(result.status ?? 1);
|