26 lines
1015 B
JavaScript
26 lines
1015 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const dir = path.join(__dirname, 'app/src/components/three');
|
|
const files = fs.readdirSync(dir).filter(f => f.endsWith('.tsx') && f !== 'ViewerOrbitControls.tsx' && f !== 'WindArrow.tsx');
|
|
|
|
let updated = 0;
|
|
for (const file of files) {
|
|
const filePath = path.join(dir, file);
|
|
let content = fs.readFileSync(filePath, 'utf8');
|
|
|
|
if (content.includes("import { OrbitControls, Grid, Environment, Text } from '@react-three/drei';")) {
|
|
content = content.replace(
|
|
"import { OrbitControls, Grid, Environment, Text } from '@react-three/drei';",
|
|
"import { Grid, Environment, Text } from '@react-three/drei';\nimport { ViewerOrbitControls as OrbitControls } from './ViewerOrbitControls';"
|
|
);
|
|
fs.writeFileSync(filePath, content);
|
|
console.log(`Updated ${file}`);
|
|
updated++;
|
|
} else if (content.includes("import { OrbitControls")) {
|
|
console.log(`Manual check needed for ${file}`);
|
|
}
|
|
}
|
|
|
|
console.log(`Total updated: ${updated}`);
|