diff --git a/postInitScript.js b/postInitScript.js new file mode 100644 index 0000000..e2b3f85 --- /dev/null +++ b/postInitScript.js @@ -0,0 +1,31 @@ +import chalk from 'chalk'; +import {logger} from '@react-native-community/cli-tools'; +import path from 'path'; + +function printInitScript( + projectName: string, +) { + const relativeXcodeProjectPath = `visionos/${projectName}.xcworkspace`; + const projectDir = path.resolve(); + + const instructions = ` + ${chalk.cyan(`Run instructions for ${chalk.bold('visionOS')}`)}: + • cd "${projectDir}/visionos" + + • Install Cocoapods + • bundle install # you need to run this only once in your project. + • bundle exec pod install + • cd .. + + • npx react-native run-visionos + ${chalk.dim('- or -')} + • Open ${relativeXcodeProjectPath} in Xcode or run "xed -b ${relativeXcodeProjectPath}" + • Hit the Run button + `; + + logger.log(` + ${instructions} + `); +} + +export default printInitScript; diff --git a/template.config.js b/template.config.js index c075f1d..555c2d2 100644 --- a/template.config.js +++ b/template.config.js @@ -9,4 +9,6 @@ module.exports = { placeholderName: 'HelloWorld', titlePlaceholder: 'Hello App Display Name', templateDir: './template', + platforms: ['visionos'], + postInitScript: './postInitScript.js', };