54 lines
1.9 KiB
JavaScript
54 lines
1.9 KiB
JavaScript
/**
|
|
* Script to fix missing commas in game mode data files after effects removal
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const gameModeFiles = [
|
|
'src/data/modes/trainingGameData.js',
|
|
'src/data/modes/humiliationGameData.js',
|
|
'src/data/modes/dressUpGameData.js',
|
|
'src/data/modes/enduranceGameData.js'
|
|
];
|
|
|
|
function fixCommasInFile(filePath) {
|
|
console.log(`Fixing commas in: ${filePath}`);
|
|
|
|
let content = fs.readFileSync(filePath, 'utf8');
|
|
|
|
// Fix missing commas after preview/type/text lines followed by nextStep with proper spacing
|
|
content = content.replace(/("preview": "[^"]*")\s*\n(\s*nextStep:)/g, '$1,\n$2');
|
|
content = content.replace(/("type": "[^"]*")\s*\n(\s*nextStep:)/g, '$1,\n$2');
|
|
content = content.replace(/("text": "[^"]*")\s*\n(\s*nextStep:)/g, '$1,\n$2');
|
|
|
|
// Fix missing commas after any property followed by nextStep (without quotes around nextStep)
|
|
content = content.replace(/([^,])\s*\n(\s*nextStep:\s*"[^"]*")/g, '$1,\n$2');
|
|
|
|
// Fix missing commas in choice/step objects - between } and { on different lines
|
|
content = content.replace(/(\})\s*\n(\s*\{)/g, '$1,\n$2');
|
|
|
|
// Fix missing commas after duration/actionText followed by nextStep
|
|
content = content.replace(/(duration: \d+)\s*\n(\s*nextStep:)/g, '$1,\n$2');
|
|
content = content.replace(/("actionText": "[^"]*")\s*\n(\s*nextStep:)/g, '$1,\n$2');
|
|
|
|
fs.writeFileSync(filePath, content);
|
|
console.log(`Fixed commas in: ${filePath}`);
|
|
}
|
|
|
|
function main() {
|
|
console.log('Fixing missing commas in game mode files...');
|
|
|
|
gameModeFiles.forEach(file => {
|
|
const fullPath = path.join(process.cwd(), file);
|
|
if (fs.existsSync(fullPath)) {
|
|
fixCommasInFile(fullPath);
|
|
} else {
|
|
console.log(`File not found: ${fullPath}`);
|
|
}
|
|
});
|
|
|
|
console.log('All comma issues fixed!');
|
|
}
|
|
|
|
main(); |