1const { getConfig } = require('@expo/config'); 2const fs = require('fs'); 3const path = require('path'); 4 5const possibleProjectRoot = process.argv[2]; 6const destinationDir = process.argv[3]; 7 8// Remove projectRoot validation when we no longer support React Native <= 62 9let projectRoot; 10if (fs.existsSync(path.join(possibleProjectRoot, 'package.json'))) { 11 projectRoot = possibleProjectRoot; 12} else if (fs.existsSync(path.join(possibleProjectRoot, '..', 'package.json'))) { 13 projectRoot = path.resolve(possibleProjectRoot, '..'); 14} 15 16process.chdir(projectRoot); 17 18const { exp } = getConfig(projectRoot, { 19 isPublicConfig: true, 20 skipSDKVersionRequirement: true, 21}); 22fs.writeFileSync(path.join(destinationDir, 'app.config'), JSON.stringify(exp)); 23