()
| 65 | } |
| 66 | |
| 67 | async function main() { |
| 68 | console.log('Setting up developer environment ...'); |
| 69 | |
| 70 | const rootDir = path.join(process.cwd(), '..'); |
| 71 | |
| 72 | // Step 1: NPM Install |
| 73 | const packageDir = path.join(rootDir, 'Package'); |
| 74 | executeStep('npm install', packageDir, 'NPM Install'); |
| 75 | |
| 76 | // Step 2: Build BabylonNative source tree |
| 77 | executeStep('npx gulp buildBabylonNativeSourceTree', packageDir, 'Build BabylonNative source tree'); |
| 78 | |
| 79 | // Step 3: NPM Install (Playground) |
| 80 | const playgroundDir = path.join(rootDir, 'Apps', 'Playground'); |
| 81 | executeStep('npm install', playgroundDir, 'NPM Install (Playground)'); |
| 82 | |
| 83 | // Step 4: Install Module |
| 84 | const moduleDir = path.join(rootDir, 'Modules', '@babylonjs', 'react-native'); |
| 85 | executeStep('npm install', moduleDir, 'Install Module'); |
| 86 | |
| 87 | // Step 5: Build TypeScript and Copy Files |
| 88 | console.log('\n🔄 Build Type script'); |
| 89 | console.log(`Working directory: ${packageDir}`); |
| 90 | console.log('Command: npx gulp buildTypeScript'); |
| 91 | |
| 92 | try { |
| 93 | execSync('npx gulp buildTypeScript', { |
| 94 | cwd: packageDir, |
| 95 | stdio: 'inherit', |
| 96 | encoding: 'utf8' |
| 97 | }); |
| 98 | console.log('✅ TypeScript build completed successfully'); |
| 99 | } catch (error) { |
| 100 | console.error('❌ TypeScript build failed with error:'); |
| 101 | console.error(error.message); |
| 102 | process.exit(1); |
| 103 | } |
| 104 | |
| 105 | // Copy files from Package/Assembled to Modules/@babylonjs/react-native |
| 106 | console.log('\n📁 Copying files from Package/Assembled to Modules/@babylonjs/react-native'); |
| 107 | const sourceDir = path.join(packageDir, 'Assembled'); |
| 108 | const targetDir = path.join(rootDir, 'Modules', '@babylonjs', 'react-native'); |
| 109 | |
| 110 | try { |
| 111 | copyRecursive(sourceDir, targetDir); |
| 112 | console.log('✅ Files copied successfully'); |
| 113 | } catch (error) { |
| 114 | console.error('❌ File copy failed with error:'); |
| 115 | console.error(error.message); |
| 116 | process.exit(1); |
| 117 | } |
| 118 | |
| 119 | console.log('\n🎉 All steps completed successfully!'); |
| 120 | } |
| 121 | |
| 122 | // Handle unhandled promise rejections |
| 123 | process.on('unhandledRejection', (reason, promise) => { |
no test coverage detected