修复游戏创作脚本剩余ESLint错误
整理配置检查与测试文件导入顺序 调整配置向导无限循环写法通过Lint门禁
This commit is contained in:
@@ -5,6 +5,10 @@ import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import {
|
||||
appIdentifier,
|
||||
defaultRealSwarmTestTask,
|
||||
} from './agent-swarm-test-chat.mjs';
|
||||
import {
|
||||
askHidden,
|
||||
assertSafeGameCreatorConfigDestination,
|
||||
@@ -13,10 +17,6 @@ import {
|
||||
writeGameCreatorConfigAtomically,
|
||||
writeGameCreatorWizardConfig,
|
||||
} from './game-creator-config-wizard.mjs';
|
||||
import {
|
||||
appIdentifier,
|
||||
defaultRealSwarmTestTask,
|
||||
} from './agent-swarm-test-chat.mjs';
|
||||
|
||||
const packageConfig = JSON.parse(
|
||||
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
||||
|
||||
@@ -450,7 +450,7 @@ export async function readGameCreatorWizardConfigState(
|
||||
async function resolvePathThroughExistingAncestor(targetPath) {
|
||||
let cursor = path.resolve(targetPath);
|
||||
const missingSegments = [];
|
||||
while (true) {
|
||||
for (;;) {
|
||||
try {
|
||||
const canonical = await realpath(cursor);
|
||||
return path.join(canonical, ...missingSegments.reverse());
|
||||
@@ -476,7 +476,7 @@ function pathIsWithin(rootPath, targetPath) {
|
||||
|
||||
async function findContainingGitRoot(targetPath, runGit) {
|
||||
let cursor = targetPath;
|
||||
while (true) {
|
||||
for (;;) {
|
||||
const metadata = await lstat(cursor).catch((error) => {
|
||||
if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') return null;
|
||||
throw error;
|
||||
@@ -812,7 +812,7 @@ export async function askHidden(
|
||||
async function askChoice(title, choices, fallbackIndex = 0) {
|
||||
console.log(title);
|
||||
choices.forEach((choice, index) => console.log(` ${index + 1}. ${choice}`));
|
||||
while (true) {
|
||||
for (;;) {
|
||||
const answer = await askVisible(`请选择 [${fallbackIndex + 1}]: `);
|
||||
if (!answer) return fallbackIndex;
|
||||
const index = Number(answer) - 1;
|
||||
@@ -823,7 +823,7 @@ async function askChoice(title, choices, fallbackIndex = 0) {
|
||||
}
|
||||
|
||||
async function askRequired(prompt, fallback = '') {
|
||||
while (true) {
|
||||
for (;;) {
|
||||
const value = await askVisible(prompt, fallback);
|
||||
if (value.trim()) return value.trim();
|
||||
console.log('该项不能为空。');
|
||||
|
||||
@@ -17,16 +17,6 @@ import { deflateSync } from 'node:zlib';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
buildGameCreatorWizardConfig,
|
||||
gameCreatorProviderPresets,
|
||||
normalizeWizardBaseUrl,
|
||||
parseConfigWizardArguments,
|
||||
readGameCreatorWizardConfigState,
|
||||
resolveGameCreatorAppConfigDir,
|
||||
writeGameCreatorConfigAtomically,
|
||||
writeGameCreatorWizardConfig,
|
||||
} from '../scripts/game-creator-config-wizard.mjs';
|
||||
import {
|
||||
appIdentifier,
|
||||
buildCargoCliArguments,
|
||||
@@ -51,21 +41,31 @@ import {
|
||||
prepareSwarmTestRuntimeConfig,
|
||||
removeDirectoryWithTimeout,
|
||||
requiredSwarmManifestTaskIds,
|
||||
runnerEndpointFileName,
|
||||
resolveSwarmTestTimeoutMs,
|
||||
runnerEndpointFileName,
|
||||
shouldStartPersistentPreview,
|
||||
terminateChildTree,
|
||||
testProjectPrefix,
|
||||
testProjectSentinelName,
|
||||
testProjectSentinelSchema,
|
||||
testRuntimeConfigPrefix,
|
||||
testRuntimeConfigSentinelName,
|
||||
testRuntimeConfigSentinelSchema,
|
||||
terminateChildTree,
|
||||
ungeneratedGameEntryMarker,
|
||||
validatePngBytes,
|
||||
validatePreviewUrl,
|
||||
validateSwarmProjectArtifacts,
|
||||
} from '../scripts/agent-swarm-test-chat.mjs';
|
||||
import {
|
||||
buildGameCreatorWizardConfig,
|
||||
gameCreatorProviderPresets,
|
||||
normalizeWizardBaseUrl,
|
||||
parseConfigWizardArguments,
|
||||
readGameCreatorWizardConfigState,
|
||||
resolveGameCreatorAppConfigDir,
|
||||
writeGameCreatorConfigAtomically,
|
||||
writeGameCreatorWizardConfig,
|
||||
} from '../scripts/game-creator-config-wizard.mjs';
|
||||
|
||||
const appRoot = path.resolve(fileURLToPath(new URL('..', import.meta.url)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user