diff --git a/README.md b/README.md index 2acead5..4e8424d 100644 --- a/README.md +++ b/README.md @@ -415,7 +415,8 @@ Packager so try to avoid doing so. - You can launch your app on the simulator without opening Xcode by running `react-native run-ios` in your app's root directory (since RN 0.19.0). -- To change advanced settings run `re-natal xcode` to quickly open the Xcode project. +- To change advanced settings run `re-natal xcode` to quickly open the Xcode project. (A workspace +will be opened in preference to a project if present.) - If you have customized project layout and `re-natal upgrade` does not fit you well, then these commands might be useful for you: @@ -450,7 +451,7 @@ $ node ../re-natal/index.js init [options] create a new ClojureScript React Native project upgrade upgrades project files to current installed version of re-natal (the upgrade of re-natal itself is done via npm) add-platform adds additional app platform: 'windows' - UWP app, 'wpf' - WPF app - xcode open Xcode project + xcode open Xcode project (or workspace if present) deps install all dependencies for the project use-figwheel generate index.*.js for development with figwheel use-android-device sets up the host for android device type: 'real' - localhost, 'avd' - 10.0.2.2, 'genymotion' - 10.0.3.2, IP diff --git a/re-natal.coffee b/re-natal.coffee index aba1087..3dbc70f 100644 --- a/re-natal.coffee +++ b/re-natal.coffee @@ -690,17 +690,21 @@ addPlatform = (platform) -> logErr message openXcode = (name) -> + if fs.existsSync "ios/#{name}.xcworkspace" + openTarget = "#{name}.xcworkspace" + else + openTarget = "#{name}.xcodeproj" try - exec "open ios/#{name}.xcodeproj" + exec "open ios/#{openTarget}" catch {message} logErr \ if message.match /ENOENT/i """ - Cannot find #{name}.xcodeproj in ios. + Cannot find #{openTarget} in ios. Run this command from your project's root directory. """ else if message.match /EACCES/i - "Invalid permissions for opening #{name}.xcodeproj in ios" + "Invalid permissions for opening #{openTarget} in ios" else message @@ -733,7 +737,8 @@ extractRequiresFromSourceFile = (file) -> buildRequireByPlatformMap = () -> onlyUserCljs = (item) -> fpath.extname(item.path) == '.cljs' and - item.path.indexOf('/target/') < 0 # ignore target dir + item.path.indexOf('/target/') < 0 and # ignore target dir + item.path.indexOf('/re-natal/') < 0 # ignore re-natal internal cljs files (can happen if re-natal is installed as a devDependency) files = klawSync process.cwd(), nodir: true filter: onlyUserCljs @@ -955,7 +960,7 @@ cli.command 'add-platform ' addPlatform(platform) cli.command 'xcode' - .description 'open Xcode project' + .description 'open Xcode project (or workspace if present)' .action -> ensureOSX -> ensureXcode ->