From cd43fb8005e4d380ae795a666c041682ebb0a5df Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Fri, 7 Dec 2018 04:47:03 -0800 Subject: [PATCH] Remove local-cli Summary: This diff removes all files from the local-cli from react-native-github. The only leftover is the `cli.js` which redirects to `react-native-local-cli` and the templates folder which I'll move in a follow-up. This diff simply removes all files, it makes no code changes. There will be a cleanup diff on top of this one. Reviewed By: TheSavior Differential Revision: D13338367 fbshipit-source-id: 1afabdb34202596fb13186d728df74482c9bc609 --- local-cli/.npmignore | 2 - local-cli/__mocks__/beeper.js | 15 - local-cli/__mocks__/fs.js | 61 - local-cli/__mocks__/path.js | 22 - local-cli/bundle/__mocks__/sign.js | 16 - local-cli/bundle/buildBundle.js | 76 -- local-cli/bundle/bundle.js | 34 - local-cli/bundle/bundleCommandLineArgs.js | 96 -- local-cli/bundle/filterPlatformAssetScales.js | 46 - local-cli/bundle/getAssetDestPathAndroid.js | 27 - local-cli/bundle/getAssetDestPathIOS.js | 23 - local-cli/bundle/ramBundle.js | 34 - local-cli/bundle/saveAssets.js | 84 -- local-cli/bundle/types.flow.js | 13 - local-cli/cliEntry.js | 169 --- local-cli/commands.js | 79 -- local-cli/core/Constants.js | 20 - local-cli/core/__fixtures__/android.js | 93 -- local-cli/core/__fixtures__/commands.js | 27 - local-cli/core/__fixtures__/dependencies.js | 36 - .../files/AndroidManifest-debug.xml | 3 - .../__fixtures__/files/AndroidManifest.xml | 4 - local-cli/core/__fixtures__/files/Main.java | 15 - .../core/__fixtures__/files/ReactPackage.java | 34 - .../core/__fixtures__/files/ReactPackage.kt | 26 - .../core/__fixtures__/files/package.json | 62 - .../core/__fixtures__/files/project.pbxproj | 804 ------------- local-cli/core/__fixtures__/ios.js | 32 - local-cli/core/__fixtures__/projects.js | 37 - .../android/findAndroidAppFolder-test.js | 43 - .../__tests__/android/findManifest-test.js | 37 - .../android/findPackageClassName-test.js | 58 - .../android/getDependencyConfig-test.js | 62 - .../android/getProjectConfig-test.js | 89 -- .../__tests__/android/readManifest-test.js | 45 - local-cli/core/__tests__/findAssets-test.js | 43 - local-cli/core/__tests__/findPlugins-test.js | 84 -- .../__tests__/ios/findPodfilePath-test.js | 31 - .../__tests__/ios/findPodspecName-test.js | 55 - .../core/__tests__/ios/findProject-test.js | 94 -- .../__tests__/ios/getProjectConfig-test.js | 52 - local-cli/core/__tests__/makeCommand-test.js | 47 - .../core/android/findAndroidAppFolder.js | 32 - local-cli/core/android/findManifest.js | 28 - .../core/android/findPackageClassName.js | 31 - local-cli/core/android/index.js | 136 --- local-cli/core/android/readManifest.js | 21 - local-cli/core/findAssets.js | 32 - local-cli/core/findPlugins.js | 133 --- local-cli/core/index.js | 170 --- local-cli/core/ios/findPodfilePath.js | 20 - local-cli/core/ios/findPodspecName.js | 34 - local-cli/core/ios/findProject.js | 61 - local-cli/core/ios/index.js | 62 - local-cli/core/makeCommand.js | 38 - local-cli/core/wrapCommands.js | 20 - local-cli/dependencies/dependencies.js | 111 -- local-cli/eject/eject.js | 111 -- .../copyProjectTemplateAndReplace.js | 178 --- local-cli/generator/printRunInstructions.js | 39 - local-cli/generator/promptSync.js | 144 --- local-cli/generator/templates.js | 199 ---- local-cli/info/info.js | 85 -- local-cli/init/init.js | 122 -- local-cli/install/install.js | 44 - local-cli/install/uninstall.js | 44 - local-cli/library/library.js | 87 -- local-cli/link/__fixtures__/Info.plist | 12 - .../android/0.17/MainActivity.java | 85 -- .../android/0.17/patchedMainActivity.java | 87 -- .../android/0.18/MainActivity.java | 46 - .../android/0.18/patchedMainActivity.java | 48 - .../android/0.20/MainActivity.java | 47 - .../link/__fixtures__/android/build.gradle | 12 - .../__fixtures__/android/patchedBuild.gradle | 16 - .../android/patchedSettings.gradle | 12 - .../link/__fixtures__/android/settings.gradle | 10 - .../link/__fixtures__/linearGradient.pbxproj | 258 ----- .../link/__fixtures__/pods/PodfileSimple | 8 - .../__fixtures__/pods/PodfileWithFunction | 30 - .../link/__fixtures__/pods/PodfileWithMarkers | 34 - .../link/__fixtures__/pods/PodfileWithTarget | 32 - local-cli/link/__fixtures__/project.pbxproj | 1011 ----------------- .../link/__tests__/android/applyPatch-test.js | 25 - .../__tests__/android/isInstalled-test.js | 31 - .../__tests__/android/makeBuildPatch-test.js | 52 - .../__tests__/android/makeImportPatch-test.js | 29 - .../android/makePackagePatch-test.js | 35 - .../android/makeSettingsPatch-test.js | 83 -- .../android/makeStringsPatch-test.js | 29 - .../android/normalizeProjectName-test.js | 23 - .../__tests__/getDependencyConfig-test.js | 34 - .../__tests__/getProjectDependencies-test.js | 35 - .../link/__tests__/groupFilesByType-test.js | 25 - .../__tests__/ios/addFileToProject-test.js | 36 - .../ios/addProjectToLibraries-test.js | 38 - .../__tests__/ios/addSharedLibraries-test.js | 51 - .../link/__tests__/ios/createGroup-test.js | 57 - .../__tests__/ios/getBuildProperty-test.js | 30 - local-cli/link/__tests__/ios/getGroup-test.js | 49 - .../__tests__/ios/getHeaderSearchPath-test.js | 110 -- .../__tests__/ios/getHeadersInFolder-test.js | 48 - local-cli/link/__tests__/ios/getPlist-test.js | 32 - .../link/__tests__/ios/getPlistPath-test.js | 30 - .../link/__tests__/ios/getTargets-test.js | 32 - .../__tests__/ios/hasLibraryImported-test.js | 35 - .../link/__tests__/ios/isInstalled-test.js | 39 - .../ios/mapHeaderSearchPaths-test.js | 47 - .../ios/removeProjectFromLibraries-test.js | 44 - .../ios/removeProjectFromProject-test.js | 45 - .../__tests__/ios/removeSharedLibrary-test.js | 43 - .../link/__tests__/ios/writePlist-test.js | 62 - local-cli/link/__tests__/link-test.js | 249 ---- .../__tests__/pods/findLineToAddPod-test.js | 50 - .../pods/findMarkedLinesInPodfile-test.js | 43 - .../__tests__/pods/findPodTargetLine-test.js | 34 - .../link/__tests__/pods/isInstalled-test.js | 42 - .../__tests__/pods/removePodEntry-test.js | 52 - .../link/__tests__/promiseWaterfall-test.js | 48 - local-cli/link/android/copyAssets.js | 29 - local-cli/link/android/fs.js | 17 - local-cli/link/android/index.js | 18 - local-cli/link/android/isInstalled.js | 16 - local-cli/link/android/patches/applyParams.js | 18 - local-cli/link/android/patches/applyPatch.js | 19 - .../link/android/patches/makeBuildPatch.js | 23 - .../link/android/patches/makeImportPatch.js | 15 - .../link/android/patches/makePackagePatch.js | 19 - .../link/android/patches/makeSettingsPatch.js | 31 - .../link/android/patches/makeStringsPatch.js | 27 - .../android/patches/normalizeProjectName.js | 12 - local-cli/link/android/patches/revokePatch.js | 17 - .../link/android/registerNativeModule.js | 42 - local-cli/link/android/unlinkAssets.js | 33 - .../link/android/unregisterNativeModule.js | 53 - local-cli/link/commandStub.js | 10 - local-cli/link/getDependencyConfig.js | 26 - local-cli/link/getProjectDependencies.js | 20 - local-cli/link/groupFilesByType.js | 36 - local-cli/link/ios/addFileToProject.js | 23 - local-cli/link/ios/addProjectToLibraries.js | 22 - local-cli/link/ios/addSharedLibraries.js | 25 - local-cli/link/ios/addToHeaderSearchPaths.js | 14 - local-cli/link/ios/common/isInstalled.js | 18 - .../link/ios/common/registerNativeModule.js | 24 - .../link/ios/common/unregisterNativeModule.js | 30 - local-cli/link/ios/copyAssets.js | 51 - local-cli/link/ios/createGroup.js | 34 - local-cli/link/ios/createGroupWithMessage.js | 34 - local-cli/link/ios/getBuildProperty.js | 31 - local-cli/link/ios/getGroup.js | 44 - local-cli/link/ios/getHeaderSearchPath.js | 62 - local-cli/link/ios/getHeadersInFolder.js | 32 - local-cli/link/ios/getPlist.js | 27 - local-cli/link/ios/getPlistPath.js | 24 - local-cli/link/ios/getTargets.js | 37 - local-cli/link/ios/hasLibraryImported.js | 20 - local-cli/link/ios/index.js | 18 - local-cli/link/ios/isInstalled.js | 27 - local-cli/link/ios/mapHeaderSearchPaths.js | 48 - local-cli/link/ios/registerNativeModule.js | 87 -- .../link/ios/removeFromHeaderSearchPaths.js | 19 - .../removeFromPbxItemContainerProxySection.js | 28 - .../ios/removeFromPbxReferenceProxySection.js | 24 - .../link/ios/removeFromProjectReferences.js | 37 - .../link/ios/removeFromStaticLibraries.js | 30 - local-cli/link/ios/removeProductGroup.js | 20 - .../link/ios/removeProjectFromLibraries.js | 21 - .../link/ios/removeProjectFromProject.js | 35 - local-cli/link/ios/removeSharedLibraries.js | 20 - local-cli/link/ios/unlinkAssets.js | 62 - local-cli/link/ios/unregisterNativeModule.js | 75 -- local-cli/link/ios/writePlist.js | 33 - local-cli/link/link.js | 186 --- local-cli/link/pods/addPodEntry.js | 35 - local-cli/link/pods/findLineToAddPod.js | 34 - .../link/pods/findMarkedLinesInPodfile.js | 21 - local-cli/link/pods/findPodTargetLine.js | 26 - local-cli/link/pods/isInstalled.js | 31 - local-cli/link/pods/readPodfile.js | 17 - local-cli/link/pods/registerNativeModule.js | 38 - local-cli/link/pods/removePodEntry.js | 21 - local-cli/link/pods/savePodFile.js | 17 - local-cli/link/pods/unregisterNativeModule.js | 22 - local-cli/link/pollParams.js | 19 - local-cli/link/promiseWaterfall.js | 23 - local-cli/link/promisify.js | 13 - local-cli/link/unlink.js | 167 --- local-cli/logAndroid/logAndroid.js | 53 - local-cli/logIOS/logIOS.js | 91 -- local-cli/runAndroid/adb.js | 49 - local-cli/runAndroid/runAndroid.js | 491 -------- .../__tests__/findMatchingSimulator-test.js | 717 ------------ .../runIOS/__tests__/findXcodeProject-test.js | 65 -- .../__tests__/parseIOSDevicesList-test.js | 48 - local-cli/runIOS/findMatchingSimulator.js | 93 -- local-cli/runIOS/findXcodeProject.js | 43 - local-cli/runIOS/parseIOSDevicesList.js | 38 - local-cli/runIOS/runIOS.js | 455 -------- local-cli/server/checkNodeVersion.js | 46 - .../server/middleware/MiddlewareManager.js | 71 -- .../middleware/copyToClipBoardMiddleware.js | 29 - .../middleware/getDevToolsMiddleware.js | 70 -- .../getSecurityHeadersMiddleware.js | 27 - local-cli/server/middleware/index.html | 10 - local-cli/server/middleware/indexPage.js | 21 - .../middleware/loadRawBodyMiddleware.js | 23 - .../openStackFrameInEditorMiddleware.js | 24 - .../server/middleware/statusPageMiddleware.js | 22 - .../middleware/systraceProfileMiddleware.js | 32 - local-cli/server/runServer.js | 128 --- local-cli/server/server.js | 129 --- local-cli/server/util/copyToClipBoard.js | 41 - .../server/util/debugger-ui/DeltaPatcher.js | 131 --- .../__tests__/DeltaPatcher-test.js | 111 -- .../server/util/debugger-ui/debuggerWorker.js | 86 -- .../util/debugger-ui/deltaUrlToBlobUrl.js | 69 -- local-cli/server/util/debugger-ui/index.html | 280 ----- local-cli/server/util/external/xsel | Bin 129416 -> 0 bytes local-cli/server/util/jsPackagerClient.js | 122 -- local-cli/server/util/launchChrome.js | 62 - local-cli/server/util/launchEditor.js | 247 ---- local-cli/server/util/messageSocket.js | 235 ---- local-cli/server/util/webSocketProxy.js | 75 -- local-cli/setup_env.bat | 4 - local-cli/setup_env.sh | 8 - local-cli/upgrade/upgrade.js | 172 --- local-cli/util/Config.js | 98 -- local-cli/util/PackageManager.js | 74 -- local-cli/util/__mocks__/log.js | 13 - .../__tests__/findSymlinkedModules-test.js | 353 ------ local-cli/util/assertRequiredOptions.js | 33 - local-cli/util/copyAndReplace.js | 140 --- local-cli/util/findReactNativeScripts.js | 28 - local-cli/util/findSymlinkedModules.js | 108 -- local-cli/util/findSymlinksPaths.js | 60 - local-cli/util/isPackagerRunning.js | 36 - local-cli/util/isValidPackageName.js | 16 - local-cli/util/log.js | 30 - local-cli/util/parseCommandLine.js | 81 -- local-cli/util/walk.js | 27 - local-cli/util/yarn.js | 60 - local-cli/wrong-react-native.js | 44 - 243 files changed, 16113 deletions(-) delete mode 100644 local-cli/.npmignore delete mode 100644 local-cli/__mocks__/beeper.js delete mode 100644 local-cli/__mocks__/fs.js delete mode 100644 local-cli/__mocks__/path.js delete mode 100644 local-cli/bundle/__mocks__/sign.js delete mode 100644 local-cli/bundle/buildBundle.js delete mode 100644 local-cli/bundle/bundle.js delete mode 100644 local-cli/bundle/bundleCommandLineArgs.js delete mode 100644 local-cli/bundle/filterPlatformAssetScales.js delete mode 100644 local-cli/bundle/getAssetDestPathAndroid.js delete mode 100644 local-cli/bundle/getAssetDestPathIOS.js delete mode 100644 local-cli/bundle/ramBundle.js delete mode 100644 local-cli/bundle/saveAssets.js delete mode 100644 local-cli/bundle/types.flow.js delete mode 100644 local-cli/cliEntry.js delete mode 100644 local-cli/commands.js delete mode 100644 local-cli/core/Constants.js delete mode 100644 local-cli/core/__fixtures__/android.js delete mode 100644 local-cli/core/__fixtures__/commands.js delete mode 100644 local-cli/core/__fixtures__/dependencies.js delete mode 100644 local-cli/core/__fixtures__/files/AndroidManifest-debug.xml delete mode 100644 local-cli/core/__fixtures__/files/AndroidManifest.xml delete mode 100644 local-cli/core/__fixtures__/files/Main.java delete mode 100644 local-cli/core/__fixtures__/files/ReactPackage.java delete mode 100644 local-cli/core/__fixtures__/files/ReactPackage.kt delete mode 100644 local-cli/core/__fixtures__/files/package.json delete mode 100644 local-cli/core/__fixtures__/files/project.pbxproj delete mode 100644 local-cli/core/__fixtures__/ios.js delete mode 100644 local-cli/core/__fixtures__/projects.js delete mode 100644 local-cli/core/__tests__/android/findAndroidAppFolder-test.js delete mode 100644 local-cli/core/__tests__/android/findManifest-test.js delete mode 100644 local-cli/core/__tests__/android/findPackageClassName-test.js delete mode 100644 local-cli/core/__tests__/android/getDependencyConfig-test.js delete mode 100644 local-cli/core/__tests__/android/getProjectConfig-test.js delete mode 100644 local-cli/core/__tests__/android/readManifest-test.js delete mode 100644 local-cli/core/__tests__/findAssets-test.js delete mode 100644 local-cli/core/__tests__/findPlugins-test.js delete mode 100644 local-cli/core/__tests__/ios/findPodfilePath-test.js delete mode 100644 local-cli/core/__tests__/ios/findPodspecName-test.js delete mode 100644 local-cli/core/__tests__/ios/findProject-test.js delete mode 100644 local-cli/core/__tests__/ios/getProjectConfig-test.js delete mode 100644 local-cli/core/__tests__/makeCommand-test.js delete mode 100644 local-cli/core/android/findAndroidAppFolder.js delete mode 100644 local-cli/core/android/findManifest.js delete mode 100644 local-cli/core/android/findPackageClassName.js delete mode 100644 local-cli/core/android/index.js delete mode 100644 local-cli/core/android/readManifest.js delete mode 100644 local-cli/core/findAssets.js delete mode 100644 local-cli/core/findPlugins.js delete mode 100644 local-cli/core/index.js delete mode 100644 local-cli/core/ios/findPodfilePath.js delete mode 100644 local-cli/core/ios/findPodspecName.js delete mode 100644 local-cli/core/ios/findProject.js delete mode 100644 local-cli/core/ios/index.js delete mode 100644 local-cli/core/makeCommand.js delete mode 100644 local-cli/core/wrapCommands.js delete mode 100644 local-cli/dependencies/dependencies.js delete mode 100644 local-cli/eject/eject.js delete mode 100644 local-cli/generator/copyProjectTemplateAndReplace.js delete mode 100644 local-cli/generator/printRunInstructions.js delete mode 100644 local-cli/generator/promptSync.js delete mode 100644 local-cli/generator/templates.js delete mode 100644 local-cli/info/info.js delete mode 100644 local-cli/init/init.js delete mode 100644 local-cli/install/install.js delete mode 100644 local-cli/install/uninstall.js delete mode 100644 local-cli/library/library.js delete mode 100644 local-cli/link/__fixtures__/Info.plist delete mode 100644 local-cli/link/__fixtures__/android/0.17/MainActivity.java delete mode 100644 local-cli/link/__fixtures__/android/0.17/patchedMainActivity.java delete mode 100644 local-cli/link/__fixtures__/android/0.18/MainActivity.java delete mode 100644 local-cli/link/__fixtures__/android/0.18/patchedMainActivity.java delete mode 100644 local-cli/link/__fixtures__/android/0.20/MainActivity.java delete mode 100644 local-cli/link/__fixtures__/android/build.gradle delete mode 100644 local-cli/link/__fixtures__/android/patchedBuild.gradle delete mode 100644 local-cli/link/__fixtures__/android/patchedSettings.gradle delete mode 100644 local-cli/link/__fixtures__/android/settings.gradle delete mode 100644 local-cli/link/__fixtures__/linearGradient.pbxproj delete mode 100644 local-cli/link/__fixtures__/pods/PodfileSimple delete mode 100644 local-cli/link/__fixtures__/pods/PodfileWithFunction delete mode 100644 local-cli/link/__fixtures__/pods/PodfileWithMarkers delete mode 100644 local-cli/link/__fixtures__/pods/PodfileWithTarget delete mode 100644 local-cli/link/__fixtures__/project.pbxproj delete mode 100644 local-cli/link/__tests__/android/applyPatch-test.js delete mode 100644 local-cli/link/__tests__/android/isInstalled-test.js delete mode 100644 local-cli/link/__tests__/android/makeBuildPatch-test.js delete mode 100644 local-cli/link/__tests__/android/makeImportPatch-test.js delete mode 100644 local-cli/link/__tests__/android/makePackagePatch-test.js delete mode 100644 local-cli/link/__tests__/android/makeSettingsPatch-test.js delete mode 100644 local-cli/link/__tests__/android/makeStringsPatch-test.js delete mode 100644 local-cli/link/__tests__/android/normalizeProjectName-test.js delete mode 100644 local-cli/link/__tests__/getDependencyConfig-test.js delete mode 100644 local-cli/link/__tests__/getProjectDependencies-test.js delete mode 100644 local-cli/link/__tests__/groupFilesByType-test.js delete mode 100644 local-cli/link/__tests__/ios/addFileToProject-test.js delete mode 100644 local-cli/link/__tests__/ios/addProjectToLibraries-test.js delete mode 100644 local-cli/link/__tests__/ios/addSharedLibraries-test.js delete mode 100644 local-cli/link/__tests__/ios/createGroup-test.js delete mode 100644 local-cli/link/__tests__/ios/getBuildProperty-test.js delete mode 100644 local-cli/link/__tests__/ios/getGroup-test.js delete mode 100644 local-cli/link/__tests__/ios/getHeaderSearchPath-test.js delete mode 100644 local-cli/link/__tests__/ios/getHeadersInFolder-test.js delete mode 100644 local-cli/link/__tests__/ios/getPlist-test.js delete mode 100644 local-cli/link/__tests__/ios/getPlistPath-test.js delete mode 100644 local-cli/link/__tests__/ios/getTargets-test.js delete mode 100644 local-cli/link/__tests__/ios/hasLibraryImported-test.js delete mode 100644 local-cli/link/__tests__/ios/isInstalled-test.js delete mode 100644 local-cli/link/__tests__/ios/mapHeaderSearchPaths-test.js delete mode 100644 local-cli/link/__tests__/ios/removeProjectFromLibraries-test.js delete mode 100644 local-cli/link/__tests__/ios/removeProjectFromProject-test.js delete mode 100644 local-cli/link/__tests__/ios/removeSharedLibrary-test.js delete mode 100644 local-cli/link/__tests__/ios/writePlist-test.js delete mode 100644 local-cli/link/__tests__/link-test.js delete mode 100644 local-cli/link/__tests__/pods/findLineToAddPod-test.js delete mode 100644 local-cli/link/__tests__/pods/findMarkedLinesInPodfile-test.js delete mode 100644 local-cli/link/__tests__/pods/findPodTargetLine-test.js delete mode 100644 local-cli/link/__tests__/pods/isInstalled-test.js delete mode 100644 local-cli/link/__tests__/pods/removePodEntry-test.js delete mode 100644 local-cli/link/__tests__/promiseWaterfall-test.js delete mode 100644 local-cli/link/android/copyAssets.js delete mode 100644 local-cli/link/android/fs.js delete mode 100644 local-cli/link/android/index.js delete mode 100644 local-cli/link/android/isInstalled.js delete mode 100644 local-cli/link/android/patches/applyParams.js delete mode 100644 local-cli/link/android/patches/applyPatch.js delete mode 100644 local-cli/link/android/patches/makeBuildPatch.js delete mode 100644 local-cli/link/android/patches/makeImportPatch.js delete mode 100644 local-cli/link/android/patches/makePackagePatch.js delete mode 100644 local-cli/link/android/patches/makeSettingsPatch.js delete mode 100644 local-cli/link/android/patches/makeStringsPatch.js delete mode 100644 local-cli/link/android/patches/normalizeProjectName.js delete mode 100644 local-cli/link/android/patches/revokePatch.js delete mode 100644 local-cli/link/android/registerNativeModule.js delete mode 100644 local-cli/link/android/unlinkAssets.js delete mode 100644 local-cli/link/android/unregisterNativeModule.js delete mode 100644 local-cli/link/commandStub.js delete mode 100644 local-cli/link/getDependencyConfig.js delete mode 100644 local-cli/link/getProjectDependencies.js delete mode 100644 local-cli/link/groupFilesByType.js delete mode 100644 local-cli/link/ios/addFileToProject.js delete mode 100644 local-cli/link/ios/addProjectToLibraries.js delete mode 100644 local-cli/link/ios/addSharedLibraries.js delete mode 100644 local-cli/link/ios/addToHeaderSearchPaths.js delete mode 100644 local-cli/link/ios/common/isInstalled.js delete mode 100644 local-cli/link/ios/common/registerNativeModule.js delete mode 100644 local-cli/link/ios/common/unregisterNativeModule.js delete mode 100644 local-cli/link/ios/copyAssets.js delete mode 100644 local-cli/link/ios/createGroup.js delete mode 100644 local-cli/link/ios/createGroupWithMessage.js delete mode 100644 local-cli/link/ios/getBuildProperty.js delete mode 100644 local-cli/link/ios/getGroup.js delete mode 100644 local-cli/link/ios/getHeaderSearchPath.js delete mode 100644 local-cli/link/ios/getHeadersInFolder.js delete mode 100644 local-cli/link/ios/getPlist.js delete mode 100644 local-cli/link/ios/getPlistPath.js delete mode 100644 local-cli/link/ios/getTargets.js delete mode 100644 local-cli/link/ios/hasLibraryImported.js delete mode 100644 local-cli/link/ios/index.js delete mode 100644 local-cli/link/ios/isInstalled.js delete mode 100644 local-cli/link/ios/mapHeaderSearchPaths.js delete mode 100644 local-cli/link/ios/registerNativeModule.js delete mode 100644 local-cli/link/ios/removeFromHeaderSearchPaths.js delete mode 100644 local-cli/link/ios/removeFromPbxItemContainerProxySection.js delete mode 100644 local-cli/link/ios/removeFromPbxReferenceProxySection.js delete mode 100644 local-cli/link/ios/removeFromProjectReferences.js delete mode 100644 local-cli/link/ios/removeFromStaticLibraries.js delete mode 100644 local-cli/link/ios/removeProductGroup.js delete mode 100644 local-cli/link/ios/removeProjectFromLibraries.js delete mode 100644 local-cli/link/ios/removeProjectFromProject.js delete mode 100644 local-cli/link/ios/removeSharedLibraries.js delete mode 100644 local-cli/link/ios/unlinkAssets.js delete mode 100644 local-cli/link/ios/unregisterNativeModule.js delete mode 100644 local-cli/link/ios/writePlist.js delete mode 100644 local-cli/link/link.js delete mode 100644 local-cli/link/pods/addPodEntry.js delete mode 100644 local-cli/link/pods/findLineToAddPod.js delete mode 100644 local-cli/link/pods/findMarkedLinesInPodfile.js delete mode 100644 local-cli/link/pods/findPodTargetLine.js delete mode 100644 local-cli/link/pods/isInstalled.js delete mode 100644 local-cli/link/pods/readPodfile.js delete mode 100644 local-cli/link/pods/registerNativeModule.js delete mode 100644 local-cli/link/pods/removePodEntry.js delete mode 100644 local-cli/link/pods/savePodFile.js delete mode 100644 local-cli/link/pods/unregisterNativeModule.js delete mode 100644 local-cli/link/pollParams.js delete mode 100644 local-cli/link/promiseWaterfall.js delete mode 100644 local-cli/link/promisify.js delete mode 100644 local-cli/link/unlink.js delete mode 100644 local-cli/logAndroid/logAndroid.js delete mode 100644 local-cli/logIOS/logIOS.js delete mode 100644 local-cli/runAndroid/adb.js delete mode 100644 local-cli/runAndroid/runAndroid.js delete mode 100644 local-cli/runIOS/__tests__/findMatchingSimulator-test.js delete mode 100644 local-cli/runIOS/__tests__/findXcodeProject-test.js delete mode 100644 local-cli/runIOS/__tests__/parseIOSDevicesList-test.js delete mode 100644 local-cli/runIOS/findMatchingSimulator.js delete mode 100644 local-cli/runIOS/findXcodeProject.js delete mode 100644 local-cli/runIOS/parseIOSDevicesList.js delete mode 100644 local-cli/runIOS/runIOS.js delete mode 100644 local-cli/server/checkNodeVersion.js delete mode 100644 local-cli/server/middleware/MiddlewareManager.js delete mode 100644 local-cli/server/middleware/copyToClipBoardMiddleware.js delete mode 100644 local-cli/server/middleware/getDevToolsMiddleware.js delete mode 100644 local-cli/server/middleware/getSecurityHeadersMiddleware.js delete mode 100644 local-cli/server/middleware/index.html delete mode 100644 local-cli/server/middleware/indexPage.js delete mode 100644 local-cli/server/middleware/loadRawBodyMiddleware.js delete mode 100644 local-cli/server/middleware/openStackFrameInEditorMiddleware.js delete mode 100644 local-cli/server/middleware/statusPageMiddleware.js delete mode 100644 local-cli/server/middleware/systraceProfileMiddleware.js delete mode 100644 local-cli/server/runServer.js delete mode 100644 local-cli/server/server.js delete mode 100644 local-cli/server/util/copyToClipBoard.js delete mode 100644 local-cli/server/util/debugger-ui/DeltaPatcher.js delete mode 100644 local-cli/server/util/debugger-ui/__tests__/DeltaPatcher-test.js delete mode 100644 local-cli/server/util/debugger-ui/debuggerWorker.js delete mode 100644 local-cli/server/util/debugger-ui/deltaUrlToBlobUrl.js delete mode 100644 local-cli/server/util/debugger-ui/index.html delete mode 100755 local-cli/server/util/external/xsel delete mode 100644 local-cli/server/util/jsPackagerClient.js delete mode 100644 local-cli/server/util/launchChrome.js delete mode 100644 local-cli/server/util/launchEditor.js delete mode 100644 local-cli/server/util/messageSocket.js delete mode 100644 local-cli/server/util/webSocketProxy.js delete mode 100755 local-cli/setup_env.bat delete mode 100755 local-cli/setup_env.sh delete mode 100644 local-cli/upgrade/upgrade.js delete mode 100644 local-cli/util/Config.js delete mode 100644 local-cli/util/PackageManager.js delete mode 100644 local-cli/util/__mocks__/log.js delete mode 100644 local-cli/util/__tests__/findSymlinkedModules-test.js delete mode 100644 local-cli/util/assertRequiredOptions.js delete mode 100644 local-cli/util/copyAndReplace.js delete mode 100644 local-cli/util/findReactNativeScripts.js delete mode 100644 local-cli/util/findSymlinkedModules.js delete mode 100644 local-cli/util/findSymlinksPaths.js delete mode 100644 local-cli/util/isPackagerRunning.js delete mode 100644 local-cli/util/isValidPackageName.js delete mode 100644 local-cli/util/log.js delete mode 100644 local-cli/util/parseCommandLine.js delete mode 100644 local-cli/util/walk.js delete mode 100644 local-cli/util/yarn.js delete mode 100755 local-cli/wrong-react-native.js diff --git a/local-cli/.npmignore b/local-cli/.npmignore deleted file mode 100644 index e40506d719b..00000000000 --- a/local-cli/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -__fixtures__ -__tests__ diff --git a/local-cli/__mocks__/beeper.js b/local-cli/__mocks__/beeper.js deleted file mode 100644 index 9fbb40caad1..00000000000 --- a/local-cli/__mocks__/beeper.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -// beeper@1.1.0 has a return statement outside of a function -// and therefore doesn't parse. Let's mock it so that we can -// run the tests. -module.exports = function() {}; diff --git a/local-cli/__mocks__/fs.js b/local-cli/__mocks__/fs.js deleted file mode 100644 index a3691e3f38b..00000000000 --- a/local-cli/__mocks__/fs.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const path = require('path'); -const MemoryFS = require('metro-memory-fs'); -let fs; - -function setMockFilesystem(object, platform) { - reset(platform); - const root = platform === 'win32' ? 'c:\\' : '/'; - mockDir(root, {...object}); - return root; -} - -function mockDir(dirPath, desc) { - for (const entName in desc) { - const ent = desc[entName]; - const entPath = path.join(dirPath, entName); - if (typeof ent === 'string' || ent instanceof Buffer) { - fs.writeFileSync(entPath, ent); - continue; - } - if (typeof ent !== 'object') { - throw new Error(require('util').format('invalid entity:', ent)); - } - if (ent.SYMLINK != null) { - fs.symlinkSync(ent.SYMLINK, entPath); - continue; - } - fs.mkdirSync(entPath); - mockDir(entPath, ent); - } -} - -function reset(platform) { - if (path.mock == null) { - throw new Error( - 'to use this "fs" module mock, you must also mock the "path" module', - ); - } - path.mock.reset(platform); - const cwd = () => (platform === 'win32' ? 'c:\\' : '/'); - fs = new MemoryFS({platform, cwd}); - Object.assign(mockFs, fs); -} - -const mockFs = {}; -mockFs.__setMockFilesystem = setMockFilesystem; -mockFs.mock = {clear: reset}; - -reset('posix'); - -module.exports = mockFs; diff --git a/local-cli/__mocks__/path.js b/local-cli/__mocks__/path.js deleted file mode 100644 index 813a2525c6b..00000000000 --- a/local-cli/__mocks__/path.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const mockPath = {}; - -function reset(platform) { - Object.assign(mockPath, jest.requireActual('path')[platform]); -} - -mockPath.mock = {reset}; - -reset('posix'); - -module.exports = mockPath; diff --git a/local-cli/bundle/__mocks__/sign.js b/local-cli/bundle/__mocks__/sign.js deleted file mode 100644 index 31fda82f57c..00000000000 --- a/local-cli/bundle/__mocks__/sign.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -function sign(source) { - return source; -} - -module.exports = sign; diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js deleted file mode 100644 index 356cb7d0b87..00000000000 --- a/local-cli/bundle/buildBundle.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const log = require('../util/log').out('bundle'); -const Server = require('metro/src/Server'); - -const outputBundle = require('metro/src/shared/output/bundle'); -const path = require('path'); -const saveAssets = require('./saveAssets'); - -import type {RequestOptions, OutputOptions} from './types.flow'; -import type {ConfigT} from 'metro-config/src/configTypes.flow'; - -async function buildBundle( - args: OutputOptions & { - assetsDest: mixed, - entryFile: string, - maxWorkers: number, - resetCache: boolean, - transformer: string, - minify: boolean, - }, - configPromise: Promise, - /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error - * found when Flow v0.85 was deployed. To see the error, delete this comment - * and run Flow. */ - output = outputBundle, -) { - // This is used by a bazillion of npm modules we don't control so we don't - // have other choice than defining it as an env variable here. - process.env.NODE_ENV = args.dev ? 'development' : 'production'; - const config = await configPromise; - - let sourceMapUrl = args.sourcemapOutput; - if (sourceMapUrl && !args.sourcemapUseAbsolutePath) { - sourceMapUrl = path.basename(sourceMapUrl); - } - - const requestOpts: RequestOptions = { - entryFile: args.entryFile, - sourceMapUrl, - dev: args.dev, - minify: args.minify !== undefined ? args.minify : !args.dev, - platform: args.platform, - }; - - const server = new Server({...config, resetCache: args.resetCache}); - - try { - const bundle = await output.build(server, requestOpts); - - await output.save(bundle, args, log); - - // Save the assets of the bundle - const outputAssets = await server.getAssets({ - ...Server.DEFAULT_BUNDLE_OPTIONS, - ...requestOpts, - bundleType: 'todo', - }); - - // When we're done saving bundle output and the assets, we're done. - return await saveAssets(outputAssets, args.platform, args.assetsDest); - } finally { - server.end(); - } -} - -module.exports = buildBundle; diff --git a/local-cli/bundle/bundle.js b/local-cli/bundle/bundle.js deleted file mode 100644 index 8c42982b47b..00000000000 --- a/local-cli/bundle/bundle.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const buildBundle = require('./buildBundle'); -const bundleCommandLineArgs = require('./bundleCommandLineArgs'); -const outputBundle = require('metro/src/shared/output/bundle'); - -/** - * Builds the bundle starting to look for dependencies at the given entry path. - */ -function bundleWithOutput(argv, configPromise, args, output) { - if (!output) { - output = outputBundle; - } - return buildBundle(args, configPromise, output); -} - -module.exports = { - name: 'bundle', - description: 'builds the javascript bundle for offline use', - func: bundleWithOutput, - options: bundleCommandLineArgs, - - // not used by the CLI itself - withOutput: bundleWithOutput, -}; diff --git a/local-cli/bundle/bundleCommandLineArgs.js b/local-cli/bundle/bundleCommandLineArgs.js deleted file mode 100644 index ef95e2a9fea..00000000000 --- a/local-cli/bundle/bundleCommandLineArgs.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = [ - { - command: '--entry-file ', - description: - 'Path to the root JS file, either absolute or relative to JS root', - }, - { - command: '--platform [string]', - description: 'Either "ios" or "android"', - default: 'ios', - }, - { - command: '--transformer [string]', - description: 'Specify a custom transformer to be used', - }, - { - command: '--dev [boolean]', - description: 'If false, warnings are disabled and the bundle is minified', - parse: val => (val === 'false' ? false : true), - default: true, - }, - { - command: '--minify [boolean]', - description: - 'Allows overriding whether bundle is minified. This defaults to ' + - 'false if dev is true, and true if dev is false. Disabling minification ' + - 'can be useful for speeding up production builds for testing purposes.', - parse: val => (val === 'false' ? false : true), - }, - { - command: '--bundle-output ', - description: - 'File name where to store the resulting bundle, ex. /tmp/groups.bundle', - }, - { - command: '--bundle-encoding [string]', - description: - 'Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).', - default: 'utf8', - }, - { - command: '--max-workers [number]', - description: - 'Specifies the maximum number of workers the worker-pool ' + - 'will spawn for transforming files. This defaults to the number of the ' + - 'cores available on your machine.', - parse: (workers: string) => Number(workers), - }, - { - command: '--sourcemap-output [string]', - description: - 'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map', - }, - { - command: '--sourcemap-sources-root [string]', - description: - "Path to make sourcemap's sources entries relative to, ex. /root/dir", - }, - { - command: '--sourcemap-use-absolute-path', - description: 'Report SourceMapURL using its full path', - default: false, - }, - { - command: '--assets-dest [string]', - description: - 'Directory name where to store assets referenced in the bundle', - }, - { - command: '--verbose', - description: 'Enables logging', - default: false, - }, - { - command: '--reset-cache', - description: 'Removes cached files', - default: false, - }, - { - command: '--read-global-cache', - description: - 'Try to fetch transformed JS code from the global cache, if configured.', - default: false, - }, -]; diff --git a/local-cli/bundle/filterPlatformAssetScales.js b/local-cli/bundle/filterPlatformAssetScales.js deleted file mode 100644 index d75512e8688..00000000000 --- a/local-cli/bundle/filterPlatformAssetScales.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -'use strict'; - -const ALLOWED_SCALES = { - ios: [1, 2, 3], -}; - -function filterPlatformAssetScales( - platform: string, - scales: $ReadOnlyArray, -): $ReadOnlyArray { - const whitelist = ALLOWED_SCALES[platform]; - if (!whitelist) { - return scales; - } - const result = scales.filter(scale => whitelist.indexOf(scale) > -1); - if (result.length === 0 && scales.length > 0) { - // No matching scale found, but there are some available. Ideally we don't - // want to be in this situation and should throw, but for now as a fallback - // let's just use the closest larger image - const maxScale = whitelist[whitelist.length - 1]; - for (const scale of scales) { - if (scale > maxScale) { - result.push(scale); - break; - } - } - - // There is no larger scales available, use the largest we have - if (result.length === 0) { - result.push(scales[scales.length - 1]); - } - } - return result; -} - -module.exports = filterPlatformAssetScales; diff --git a/local-cli/bundle/getAssetDestPathAndroid.js b/local-cli/bundle/getAssetDestPathAndroid.js deleted file mode 100644 index 49b92f2cf29..00000000000 --- a/local-cli/bundle/getAssetDestPathAndroid.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const assetPathUtils = require('../../Libraries/Image/assetPathUtils'); -const path = require('path'); - -import type {PackagerAsset} from '../../Libraries/Image/AssetRegistry'; - -function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string { - const androidFolder = assetPathUtils.getAndroidResourceFolderName( - asset, - scale, - ); - const fileName = assetPathUtils.getAndroidResourceIdentifier(asset); - return path.join(androidFolder, fileName + '.' + asset.type); -} - -module.exports = getAssetDestPathAndroid; diff --git a/local-cli/bundle/getAssetDestPathIOS.js b/local-cli/bundle/getAssetDestPathIOS.js deleted file mode 100644 index 55479c2568c..00000000000 --- a/local-cli/bundle/getAssetDestPathIOS.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const path = require('path'); - -import type {PackagerAsset} from '../../Libraries/Image/AssetRegistry'; - -function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string { - const suffix = scale === 1 ? '' : '@' + scale + 'x'; - const fileName = asset.name + suffix + '.' + asset.type; - return path.join(asset.httpServerLocation.substr(1), fileName); -} - -module.exports = getAssetDestPathIOS; diff --git a/local-cli/bundle/ramBundle.js b/local-cli/bundle/ramBundle.js deleted file mode 100644 index 796389034ff..00000000000 --- a/local-cli/bundle/ramBundle.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const bundleWithOutput = require('./bundle').withOutput; -const bundleCommandLineArgs = require('./bundleCommandLineArgs'); -const outputUnbundle = require('metro/src/shared/output/RamBundle'); - -/** - * Builds the bundle starting to look for dependencies at the given entry path. - */ -function ramBundle(argv, config, args) { - return bundleWithOutput(argv, config, args, outputUnbundle); -} - -module.exports = { - name: 'ram-bundle', - description: - 'builds javascript as a "Random Access Module" bundle for offline use', - func: ramBundle, - options: bundleCommandLineArgs.concat({ - command: '--indexed-ram-bundle', - description: - 'Force the "Indexed RAM" bundle file format, even when building for android', - default: false, - }), -}; diff --git a/local-cli/bundle/saveAssets.js b/local-cli/bundle/saveAssets.js deleted file mode 100644 index d43197ec573..00000000000 --- a/local-cli/bundle/saveAssets.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const filterPlatformAssetScales = require('./filterPlatformAssetScales'); -const fs = require('fs'); -const getAssetDestPathAndroid = require('./getAssetDestPathAndroid'); -const getAssetDestPathIOS = require('./getAssetDestPathIOS'); -const log = require('../util/log').out('bundle'); -const mkdirp = require('mkdirp'); -const path = require('path'); - -function saveAssets(assets, platform, assetsDest) { - if (!assetsDest) { - console.warn('Assets destination folder is not set, skipping...'); - return Promise.resolve(); - } - - const getAssetDestPath = - platform === 'android' ? getAssetDestPathAndroid : getAssetDestPathIOS; - - const filesToCopy = Object.create(null); // Map src -> dest - assets.forEach(asset => { - const validScales = new Set( - filterPlatformAssetScales(platform, asset.scales), - ); - asset.scales.forEach((scale, idx) => { - if (!validScales.has(scale)) { - return; - } - const src = asset.files[idx]; - const dest = path.join(assetsDest, getAssetDestPath(asset, scale)); - filesToCopy[src] = dest; - }); - }); - - return copyAll(filesToCopy); -} - -function copyAll(filesToCopy) { - const queue = Object.keys(filesToCopy); - if (queue.length === 0) { - return Promise.resolve(); - } - - log('Copying ' + queue.length + ' asset files'); - return new Promise((resolve, reject) => { - const copyNext = error => { - if (error) { - return reject(error); - } - if (queue.length === 0) { - log('Done copying assets'); - resolve(); - } else { - const src = queue.shift(); - const dest = filesToCopy[src]; - copy(src, dest, copyNext); - } - }; - copyNext(); - }); -} - -function copy(src, dest, callback) { - const destDir = path.dirname(dest); - mkdirp(destDir, err => { - if (err) { - return callback(err); - } - fs.createReadStream(src) - .pipe(fs.createWriteStream(dest)) - .on('finish', callback); - }); -} - -module.exports = saveAssets; diff --git a/local-cli/bundle/types.flow.js b/local-cli/bundle/types.flow.js deleted file mode 100644 index 04bc1c38508..00000000000 --- a/local-cli/bundle/types.flow.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -export type {OutputOptions, RequestOptions} from 'metro/src/shared/types.flow'; diff --git a/local-cli/cliEntry.js b/local-cli/cliEntry.js deleted file mode 100644 index e53356220d9..00000000000 --- a/local-cli/cliEntry.js +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const {configPromise} = require('./core'); - -const assertRequiredOptions = require('./util/assertRequiredOptions'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const chalk = require('chalk'); -const childProcess = require('child_process'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const commander = require('commander'); -const commands = require('./commands'); -const init = require('./init/init'); -const path = require('path'); -const pkg = require('../package.json'); - -import type {CommandT} from './commands'; -import type {RNConfig} from './core'; - -commander.version(pkg.version); - -const defaultOptParser = val => val; - -const handleError = err => { - console.error(); - console.error(err.message || err); - console.error(); - if (err.stack) { - console.error(err.stack); - console.error(); - } - process.exit(1); -}; - -// Custom printHelpInformation command inspired by internal Commander.js -// one modified to suit our needs -function printHelpInformation() { - let cmdName = this._name; - if (this._alias) { - cmdName = cmdName + '|' + this._alias; - } - - const sourceInformation = this.pkg - ? [` ${chalk.bold('Source:')} ${this.pkg.name}@${this.pkg.version}`, ''] - : []; - - let output = [ - '', - chalk.bold(chalk.cyan(` react-native ${cmdName} ${this.usage()}`)), - this._description ? ` ${this._description}` : '', - '', - ...sourceInformation, - ` ${chalk.bold('Options:')}`, - '', - this.optionHelp().replace(/^/gm, ' '), - '', - ]; - - if (this.examples && this.examples.length > 0) { - const formattedUsage = this.examples - .map(example => ` ${example.desc}: \n ${chalk.cyan(example.cmd)}`) - .join('\n\n'); - - output = output.concat([ - chalk.bold(' Example usage:'), - '', - formattedUsage, - ]); - } - - return output.concat(['', '']).join('\n'); -} - -function printUnknownCommand(cmdName) { - console.log( - [ - '', - cmdName - ? chalk.red(` Unrecognized command '${cmdName}'`) - : chalk.red(" You didn't pass any command"), - ` Run ${chalk.cyan( - 'react-native --help', - )} to see list of all available commands`, - '', - ].join('\n'), - ); -} - -const addCommand = (command: CommandT, cfg: RNConfig) => { - const options = command.options || []; - - const cmd = commander - .command(command.name, undefined, { - noHelp: !command.description, - }) - .description(command.description) - .action(function runAction() { - const passedOptions = this.opts(); - const argv: Array = Array.from(arguments).slice(0, -1); - - Promise.resolve() - .then(() => { - assertRequiredOptions(options, passedOptions); - return command.func(argv, cfg, passedOptions); - }) - .catch(handleError); - }); - - cmd.helpInformation = printHelpInformation.bind(cmd); - cmd.examples = command.examples; - cmd.pkg = command.pkg; - - options.forEach(opt => - cmd.option( - opt.command, - opt.description, - opt.parse || defaultOptParser, - typeof opt.default === 'function' ? opt.default(cfg) : opt.default, - ), - ); - - // Placeholder option for --config, which is parsed before any other option, - // but needs to be here to avoid "unknown option" errors when specified - cmd.option('--config [string]', 'Path to the CLI configuration file'); -}; - -async function run() { - const config = await configPromise; - const setupEnvScript = /^win/.test(process.platform) - ? 'setup_env.bat' - : 'setup_env.sh'; - - childProcess.execFileSync(path.join(__dirname, setupEnvScript)); - - commands.forEach(cmd => addCommand(cmd, config)); - - commander.parse(process.argv); - - const isValidCommand = commands.find( - cmd => cmd.name.split(' ')[0] === process.argv[2], - ); - - if (!isValidCommand) { - printUnknownCommand(process.argv[2]); - return; - } - - if (!commander.args.length) { - commander.help(); - } -} - -module.exports = { - run: run, - init: init, -}; diff --git a/local-cli/commands.js b/local-cli/commands.js deleted file mode 100644 index 35a7f74def1..00000000000 --- a/local-cli/commands.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const {getProjectCommands} = require('./core'); - -import type {RNConfig} from './core'; - -export type CommandT = { - name: string, - description?: string, - usage?: string, - func: (argv: Array, config: RNConfig, args: Object) => ?Promise, - options?: Array<{ - command: string, - description?: string, - parse?: (val: string) => any, - default?: ((config: RNConfig) => mixed) | mixed, - }>, - examples?: Array<{ - desc: string, - cmd: string, - }>, - pkg?: { - version: string, - name: string, - }, -}; - -const documentedCommands = [ - require('./server/server'), - require('./runIOS/runIOS'), - require('./runAndroid/runAndroid'), - require('./library/library'), - require('./bundle/bundle'), - require('./bundle/ramBundle'), - require('./eject/eject'), - require('./link/link'), - require('./link/unlink'), - require('./install/install'), - require('./install/uninstall'), - require('./upgrade/upgrade'), - require('./logAndroid/logAndroid'), - require('./logIOS/logIOS'), - require('./dependencies/dependencies'), - require('./info/info'), -]; - -// The user should never get here because projects are inited by -// using `react-native-cli` from outside a project directory. -const undocumentedCommands = [ - { - name: 'init', - func: () => { - console.log( - [ - 'Looks like React Native project already exists in the current', - 'folder. Run this command from a different folder or remove node_modules/react-native', - ].join('\n'), - ); - }, - }, -]; - -const commands: Array = [ - ...documentedCommands, - ...undocumentedCommands, - ...getProjectCommands(), -]; - -module.exports = commands; diff --git a/local-cli/core/Constants.js b/local-cli/core/Constants.js deleted file mode 100644 index edf9cd51799..00000000000 --- a/local-cli/core/Constants.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -'use strict'; - -const ASSET_REGISTRY_PATH = 'react-native/Libraries/Image/AssetRegistry'; -const ASSET_SOURCE_RESOLVER_PATH = - 'react-native/Libraries/Image/AssetSourceResolver'; - -module.exports = { - ASSET_REGISTRY_PATH, - ASSET_SOURCE_RESOLVER_PATH, -}; diff --git a/local-cli/core/__fixtures__/android.js b/local-cli/core/__fixtures__/android.js deleted file mode 100644 index d5f603069fc..00000000000 --- a/local-cli/core/__fixtures__/android.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = jest.requireActual('fs'); -const path = jest.requireActual('path'); - -const manifest = fs.readFileSync( - path.join(__dirname, './files/AndroidManifest.xml'), -); -const mainJavaClass = fs.readFileSync( - path.join(__dirname, './files/Main.java'), -); - -function generateValidFileStructure(classFileName) { - return { - src: { - 'AndroidManifest.xml': manifest, - main: { - com: { - some: { - example: { - 'Main.java': mainJavaClass, - [classFileName]: fs.readFileSync( - path.join(__dirname, `./files/${classFileName}`), - ), - }, - }, - }, - }, - }, - }; -} - -exports.valid = generateValidFileStructure('ReactPackage.java'); - -exports.validKotlin = generateValidFileStructure('ReactPackage.kt'); - -exports.userConfigManifest = { - src: { - main: { - 'AndroidManifest.xml': manifest, - com: { - some: { - example: { - 'Main.java': mainJavaClass, - 'ReactPackage.java': fs.readFileSync( - path.join(__dirname, './files/ReactPackage.java'), - ), - }, - }, - }, - }, - debug: { - 'AndroidManifest.xml': fs.readFileSync( - path.join(__dirname, './files/AndroidManifest-debug.xml'), - ), - }, - }, -}; - -exports.corrupted = { - src: { - 'AndroidManifest.xml': manifest, - main: { - com: { - some: { - example: {}, - }, - }, - }, - }, -}; - -exports.noPackage = { - src: { - 'AndroidManifest.xml': manifest, - main: { - com: { - some: { - example: { - 'Main.java': mainJavaClass, - }, - }, - }, - }, - }, -}; diff --git a/local-cli/core/__fixtures__/commands.js b/local-cli/core/__fixtures__/commands.js deleted file mode 100644 index 5331649a7bd..00000000000 --- a/local-cli/core/__fixtures__/commands.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -exports.single = { - func: () => {}, - description: 'Test action', - name: 'test', -}; - -exports.multiple = [ - { - func: () => {}, - description: 'Test action #1', - name: 'test1', - }, - { - func: () => {}, - description: 'Test action #2', - name: 'test2', - }, -]; diff --git a/local-cli/core/__fixtures__/dependencies.js b/local-cli/core/__fixtures__/dependencies.js deleted file mode 100644 index f5a3c1c333e..00000000000 --- a/local-cli/core/__fixtures__/dependencies.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = jest.requireActual('fs'); -const path = require('path'); -const android = require('./android'); - -const pjson = fs.readFileSync(path.join(__dirname, 'files', 'package.json')); - -module.exports = { - valid: { - 'package.json': pjson, - android: android.valid, - }, - withAssets: { - 'package.json': pjson, - android: android.valid, - fonts: { - 'A.ttf': '', - 'B.ttf': '', - }, - images: { - 'C.jpg': '', - }, - }, - noPackage: { - 'package.json': pjson, - android: android.noPackage, - }, -}; diff --git a/local-cli/core/__fixtures__/files/AndroidManifest-debug.xml b/local-cli/core/__fixtures__/files/AndroidManifest-debug.xml deleted file mode 100644 index 0c29eab6721..00000000000 --- a/local-cli/core/__fixtures__/files/AndroidManifest-debug.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/local-cli/core/__fixtures__/files/AndroidManifest.xml b/local-cli/core/__fixtures__/files/AndroidManifest.xml deleted file mode 100644 index 83cf6c79916..00000000000 --- a/local-cli/core/__fixtures__/files/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/local-cli/core/__fixtures__/files/Main.java b/local-cli/core/__fixtures__/files/Main.java deleted file mode 100644 index 5ddddfae8e4..00000000000 --- a/local-cli/core/__fixtures__/files/Main.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.some.example; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class SomeExamplePackage {} diff --git a/local-cli/core/__fixtures__/files/ReactPackage.java b/local-cli/core/__fixtures__/files/ReactPackage.java deleted file mode 100644 index 08695ebb760..00000000000 --- a/local-cli/core/__fixtures__/files/ReactPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.some.example; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class SomeExampleJavaPackage implements ReactPackage { - - @Override - public List createNativeModules( - ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new SomeExampleModule(reactContext)); - return modules; - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} diff --git a/local-cli/core/__fixtures__/files/ReactPackage.kt b/local-cli/core/__fixtures__/files/ReactPackage.kt deleted file mode 100644 index 17b0db22bd9..00000000000 --- a/local-cli/core/__fixtures__/files/ReactPackage.kt +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.some.example; - -import android.view.View -import com.facebook.react.ReactPackage -import com.facebook.react.bridge.NativeModule -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.uimanager.ReactShadowNode -import com.facebook.react.uimanager.ViewManager -import java.util.* - -class SomeExampleKotlinPackage : ReactPackage { - - override fun createNativeModules(reactContext: ReactApplicationContext): MutableList - = mutableListOf(MaterialPaletteModule(reactContext)) - - override fun createViewManagers(reactContext: ReactApplicationContext?): - MutableList> = Collections.emptyList() - -} diff --git a/local-cli/core/__fixtures__/files/package.json b/local-cli/core/__fixtures__/files/package.json deleted file mode 100644 index 5c197853c52..00000000000 --- a/local-cli/core/__fixtures__/files/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "react-native-vector-icons", - "version": "1.0.0", - "description": "Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling. Choose from 3000+ bundled icons or use your own.", - "main": "index.js", - "bin": { - "generate-icon": "./generate-icon.js" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "rm -rf {Fonts,Entypo.js,EvilIcons.js,FontAwesome.js,Foundation.js,Ionicons.js,MaterialIcons.js,Octicons.js,Zocial.js} && mkdir Fonts && npm run build-entypo && npm run build-evilicons && npm run build-fontawesome && npm run build-foundation && npm run build-ionicons && npm run build-materialicons && npm run build-octicons && npm run build-zocial", - "build-entypo": "mkdir -p tmp/svg && curl https://dl.dropboxusercontent.com/u/4339492/entypo.zip > tmp/entypo.zip && unzip -j tmp/entypo.zip *.svg -x __MACOSX/* -d tmp/svg && fontcustom compile tmp/svg -o tmp -n Entypo -t css -h && node generate-icon tmp/Entypo.css --componentName=Entypo --fontFamily=Entypo > Entypo.js && cp tmp/Entypo.ttf Fonts && rm -rf {tmp,.fontcustom-manifest.json}", - "build-evilicons": "fontcustom compile node_modules/evil-icons/assets/icons -o tmp -n EvilIcons -t css -h && node generate-icon tmp/EvilIcons.css --prefix=.icon-ei- --componentName=EvilIcons --fontFamily=EvilIcons > EvilIcons.js && cp tmp/EvilIcons.ttf Fonts && rm -rf {tmp,.fontcustom-manifest.json}", - "build-fontawesome": "node generate-icon node_modules/font-awesome/css/font-awesome.css --prefix=.fa- --componentName=FontAwesome --fontFamily=FontAwesome > FontAwesome.js && cp node_modules/font-awesome/fonts/fontawesome-webfont.ttf Fonts/FontAwesome.ttf", - "build-foundation": "node generate-icon bower_components/foundation-icon-fonts/foundation-icons.css --prefix=.fi- --componentName=Foundation --fontFamily=fontcustom > Foundation.js && cp bower_components/foundation-icon-fonts/foundation-icons.ttf Fonts/Foundation.ttf", - "build-ionicons": "node generate-icon bower_components/ionicons/css/ionicons.css --prefix=.ion- --componentName=Ionicons --fontFamily=Ionicons > Ionicons.js && cp bower_components/ionicons/fonts/ionicons.ttf Fonts/Ionicons.ttf", - "build-materialicons": "mkdir -p tmp/svg && for f in ./node_modules/material-design-icons/*/svg/production/ic_*_48px.svg; do t=${f/*\\/ic_/}; t=${t/_48px/}; cp \"$f\" \"./tmp/svg/${t//_/-}\"; done && fontcustom compile tmp/svg -o tmp -n MaterialIcons -t css -h && node generate-icon tmp/MaterialIcons.css --componentName=MaterialIcons --fontFamily=MaterialIcons > MaterialIcons.js && cp tmp/MaterialIcons.ttf Fonts && rm -rf {tmp,.fontcustom-manifest.json}", - "build-octicons": "node generate-icon bower_components/octicons/octicons/octicons.css --prefix=.octicon- --componentName=Octicons --fontFamily=octicons > Octicons.js && cp bower_components/octicons/octicons/octicons.ttf Fonts/Octicons.ttf", - "build-zocial": "node generate-icon bower_components/css-social-buttons/css/zocial.css --prefix=.zocial. --componentName=Zocial --fontFamily=zocial > Zocial.js && cp bower_components/css-social-buttons/css/zocial.ttf Fonts/Zocial.ttf" - }, - "keywords": [ - "react-native", - "react-component", - "react-native-component", - "react", - "mobile", - "ios", - "android", - "ui", - "icon", - "icons", - "vector", - "retina", - "font" - ], - "author": { - "name": "Joel Arvidsson", - "email": "joel@oblador.se" - }, - "homepage": "https://github.com/oblador/react-native-vector-icons", - "bugs": { - "url": "https://github.com/oblador/react-native-vector-icons/issues" - }, - "repository": { - "type": "git", - "url": "git://github.com/oblador/react-native-vector-icons.git" - }, - "license": "MIT", - "peerDependencies": { - "react-native": ">=0.4.0 || 0.5.0-rc1 || 0.6.0-rc || 0.7.0-rc || 0.7.0-rc.2 || 0.8.0-rc || 0.8.0-rc.2 || 0.9.0-rc || 0.10.0-rc || 0.11.0-rc || 0.12.0-rc || 0.13.0-rc || 0.14.0-rc || 0.15.0-rc || 0.16.0-rc" - }, - "dependencies": { - "lodash": "^4.17.10", - "yargs": "^3.30.0", - "rnpm-plugin-test": "*" - }, - "devDependencies": { - "evil-icons": "^1.7.6", - "font-awesome": "^4.4.0", - "material-design-icons": "^2.1.1" - } -} diff --git a/local-cli/core/__fixtures__/files/project.pbxproj b/local-cli/core/__fixtures__/files/project.pbxproj deleted file mode 100644 index b27d06606be..00000000000 --- a/local-cli/core/__fixtures__/files/project.pbxproj +++ /dev/null @@ -1,804 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* androidTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* androidTestTests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 672DE8B31B124B8088D0D29F /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5255B7628A54AC2A9B4B2A0 /* libBVLinearGradient.a */; }; - 68FEB18F24414EF981BD7940 /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 53C67FE8F7294B7A83790610 /* libCodePush.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - C6C437D070BA42D6BE39198B /* libRCTVideo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A7396DFBAFA4CA092E367F5 /* libRCTVideo.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = androidTest; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* androidTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = androidTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* androidTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = androidTestTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* androidTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = androidTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = androidTest/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = androidTest/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = androidTest/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = androidTest/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = androidTest/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 53C67FE8F7294B7A83790610 /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libCodePush.a; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; - B5255B7628A54AC2A9B4B2A0 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = ""; }; - 467A6CBCB2164E7D9B673D4C /* CodePush.xcodeproj */ = {isa = PBXFileReference; name = "CodePush.xcodeproj"; path = "../node_modules/react-native-code-push/CodePush.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - FD7121847BA447D8B737F22A /* BVLinearGradient.xcodeproj */ = {isa = PBXFileReference; name = "BVLinearGradient.xcodeproj"; path = "../node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - 409DA945815C46DEB4F254DB /* RCTVideo.xcodeproj */ = {isa = PBXFileReference; name = "RCTVideo.xcodeproj"; path = "../node_modules/react-native-video/RCTVideo.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - 3A7396DFBAFA4CA092E367F5 /* libRCTVideo.a */ = {isa = PBXFileReference; name = "libRCTVideo.a"; path = "libRCTVideo.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - 672DE8B31B124B8088D0D29F /* libBVLinearGradient.a in Frameworks */, - 68FEB18F24414EF981BD7940 /* libCodePush.a in Frameworks */, - C6C437D070BA42D6BE39198B /* libRCTVideo.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* androidTestTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* androidTestTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = androidTestTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* androidTest */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = androidTest; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - 467A6CBCB2164E7D9B673D4C /* CodePush.xcodeproj */, - FD7121847BA447D8B737F22A /* BVLinearGradient.xcodeproj */, - 409DA945815C46DEB4F254DB /* RCTVideo.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* androidTest */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* androidTestTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* androidTest.app */, - 00E356EE1AD99517003FC87E /* androidTestTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* androidTestTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "androidTestTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = androidTestTests; - productName = androidTestTests; - productReference = 00E356EE1AD99517003FC87E /* androidTestTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* androidTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "androidTest" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = androidTest; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* androidTest.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "androidTest" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* androidTest */, - 00E356ED1AD99517003FC87E /* androidTestTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "../node_modules/react-native/scripts/react-native-xcode.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* androidTestTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* androidTest */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = androidTest; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = androidTestTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/androidTest.app/androidTest"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = androidTestTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/androidTest.app/androidTest"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEAD_CODE_STRIPPING = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)", - "$(SRCROOT)/../node_modules/react-native-code-push", - "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", - "$(SRCROOT)/../node_modules/react-native-video", - ); - INFOPLIST_FILE = androidTest/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = androidTest; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)", - "$(SRCROOT)/../node_modules/react-native-code-push", - "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", - "$(SRCROOT)/../node_modules/react-native-video", - ); - INFOPLIST_FILE = androidTest/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = androidTest; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)", - "$(SRCROOT)/../node_modules/react-native-code-push", - "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", - "$(SRCROOT)/../node_modules/react-native-video", - ); - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)", - "$(SRCROOT)/../node_modules/react-native-code-push", - "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", - "$(SRCROOT)/../node_modules/react-native-video", - ); - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "androidTestTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "androidTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "androidTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/local-cli/core/__fixtures__/ios.js b/local-cli/core/__fixtures__/ios.js deleted file mode 100644 index 1792f67309e..00000000000 --- a/local-cli/core/__fixtures__/ios.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = jest.requireActual('fs'); -const path = require('path'); - -exports.valid = { - 'demoProject.xcodeproj': { - 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj'), - ), - }, - 'TestPod.podspec': 'empty', -}; - -exports.validTestName = { - 'MyTestProject.xcodeproj': { - 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj'), - ), - }, -}; - -exports.pod = { - 'TestPod.podspec': 'empty', -}; diff --git a/local-cli/core/__fixtures__/projects.js b/local-cli/core/__fixtures__/projects.js deleted file mode 100644 index c3d42d693ba..00000000000 --- a/local-cli/core/__fixtures__/projects.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const android = require('./android'); -const ios = require('./ios'); - -const flat = { - android: android.valid, - ios: ios.valid, - Podfile: 'empty', -}; - -const nested = { - android: { - app: android.valid, - }, - ios: ios.valid, -}; - -const withExamples = { - Examples: flat, - ios: ios.valid, - android: android.valid, -}; - -const withPods = { - Podfile: 'content', - ios: ios.pod, -}; - -module.exports = {flat, nested, withExamples, withPods}; diff --git a/local-cli/core/__tests__/android/findAndroidAppFolder-test.js b/local-cli/core/__tests__/android/findAndroidAppFolder-test.js deleted file mode 100644 index 331dfe8e178..00000000000 --- a/local-cli/core/__tests__/android/findAndroidAppFolder-test.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const fs = require('fs'); -const findAndroidAppFolder = require('../../android/findAndroidAppFolder'); -const mocks = require('../../__fixtures__/android'); - -describe('android::findAndroidAppFolder', () => { - beforeAll(() => { - fs.__setMockFilesystem({ - empty: {}, - nested: { - android: { - app: mocks.valid, - }, - }, - flat: { - android: mocks.valid, - }, - }); - }); - - it('returns an android app folder if it exists in the given folder', () => { - expect(findAndroidAppFolder('/flat')).toBe('android'); - expect(findAndroidAppFolder('/nested')).toBe('android/app'); - }); - - it('returns `null` if there is no android app folder', () => { - expect(findAndroidAppFolder('/empty')).toBeNull(); - }); -}); diff --git a/local-cli/core/__tests__/android/findManifest-test.js b/local-cli/core/__tests__/android/findManifest-test.js deleted file mode 100644 index 242b20a7471..00000000000 --- a/local-cli/core/__tests__/android/findManifest-test.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findManifest = require('../../android/findManifest'); -const fs = require('fs'); -const mocks = require('../../__fixtures__/android'); - -describe('android::findManifest', () => { - beforeAll(() => { - fs.__setMockFilesystem({ - empty: {}, - flat: { - android: mocks.valid, - }, - }); - }); - - it('returns a manifest path if file exists in the folder', () => { - expect(typeof findManifest('/flat')).toBe('string'); - }); - - it('returns `null` if there is no manifest in the folder', () => { - expect(findManifest('/empty')).toBeNull(); - }); -}); diff --git a/local-cli/core/__tests__/android/findPackageClassName-test.js b/local-cli/core/__tests__/android/findPackageClassName-test.js deleted file mode 100644 index 5c15fd658bb..00000000000 --- a/local-cli/core/__tests__/android/findPackageClassName-test.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const mocks = require('../../__fixtures__/android'); -const findPackageClassName = require('../../android/findPackageClassName'); -const fs = require('fs'); - -['posix', 'win32'].forEach(platform => { - let root; - describe(`android::findPackageClassName (${platform})`, () => { - beforeAll(() => { - root = fs.__setMockFilesystem( - { - empty: {}, - flatJava: { - android: mocks.valid, - }, - flatKotlin: { - android: mocks.validKotlin, - }, - }, - platform, - ); - }); - - it('returns manifest content if file exists in the folder', () => { - expect(typeof findPackageClassName(root + 'flatJava')).toBe('string'); - }); - - it('returns the name of the java class implementing ReactPackage', () => { - expect(findPackageClassName(root + 'flatJava')).toBe( - 'SomeExampleJavaPackage', - ); - }); - - it('returns the name of the kotlin class implementing ReactPackage', () => { - expect(findPackageClassName(root + 'flatKotlin')).toBe( - 'SomeExampleKotlinPackage', - ); - }); - - it('returns `null` if there are no matches', () => { - expect(findPackageClassName(root + 'empty')).toBeNull(); - }); - }); -}); diff --git a/local-cli/core/__tests__/android/getDependencyConfig-test.js b/local-cli/core/__tests__/android/getDependencyConfig-test.js deleted file mode 100644 index 7a43db319c7..00000000000 --- a/local-cli/core/__tests__/android/getDependencyConfig-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const getDependencyConfig = require('../../android').dependencyConfig; -const fs = require('fs'); -const mocks = require('../../__fixtures__/android'); - -const userConfig = {}; - -describe('android::getDependencyConfig', () => { - beforeAll(() => { - fs.__setMockFilesystem({ - empty: {}, - nested: { - android: { - app: mocks.valid, - }, - }, - corrupted: { - android: { - app: mocks.corrupted, - }, - }, - noPackage: { - android: {}, - }, - }); - }); - - it('returns an object with android project configuration', () => { - expect(getDependencyConfig('/nested', userConfig)).not.toBeNull(); - expect(typeof getDependencyConfig('/nested', userConfig)).toBe('object'); - }); - - it('returns `null` if manifest file has not been found', () => { - expect(getDependencyConfig('/empty', userConfig)).toBeNull(); - }); - - it('returns `null` if android project was not found', () => { - expect(getDependencyConfig('/empty', userConfig)).toBeNull(); - }); - - it('returns `null` if android project does not contain ReactPackage', () => { - expect(getDependencyConfig('/noPackage', userConfig)).toBeNull(); - }); - - it('returns `null` if it cannot find a packageClassName', () => { - expect(getDependencyConfig('/corrupted', userConfig)).toBeNull(); - }); -}); diff --git a/local-cli/core/__tests__/android/getProjectConfig-test.js b/local-cli/core/__tests__/android/getProjectConfig-test.js deleted file mode 100644 index 863138c9507..00000000000 --- a/local-cli/core/__tests__/android/getProjectConfig-test.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const getProjectConfig = require('../../android').projectConfig; -const fs = require('fs'); -const mocks = require('../../__fixtures__/android'); - -describe('android::getProjectConfig', () => { - beforeAll(() => { - fs.__setMockFilesystem({ - empty: {}, - nested: { - android: { - app: mocks.valid, - }, - }, - flat: { - android: mocks.valid, - }, - multiple: { - android: mocks.userConfigManifest, - }, - noManifest: { - android: {}, - }, - }); - }); - - it("returns `null` if manifest file hasn't been found and userConfig is not defined", () => { - const userConfig = undefined; - const folder = '/noManifest'; - - expect(getProjectConfig(folder, userConfig)).toBeNull(); - }); - - it("returns `null` if manifest file hasn't been found", () => { - const userConfig = {}; - const folder = '/noManifest'; - - expect(getProjectConfig(folder, userConfig)).toBeNull(); - }); - - describe('returns an object with android project configuration for', () => { - it('nested structure', () => { - const userConfig = {}; - const folder = '/nested'; - - expect(getProjectConfig(folder, userConfig)).not.toBeNull(); - expect(typeof getProjectConfig(folder, userConfig)).toBe('object'); - }); - - it('flat structure', () => { - const userConfig = {}; - const folder = '/flat'; - - expect(getProjectConfig(folder, userConfig)).not.toBeNull(); - expect(typeof getProjectConfig(folder, userConfig)).toBe('object'); - }); - - it('multiple', () => { - const userConfig = { - manifestPath: 'src/main/AndroidManifest.xml', - }; - const folder = '/multiple'; - - expect(getProjectConfig(folder, userConfig)).not.toBeNull(); - expect(typeof getProjectConfig(folder, userConfig)).toBe('object'); - }); - }); - - it('should return `null` if android project was not found', () => { - const userConfig = {}; - const folder = '/empty'; - - expect(getProjectConfig(folder, userConfig)).toBeNull(); - }); -}); diff --git a/local-cli/core/__tests__/android/readManifest-test.js b/local-cli/core/__tests__/android/readManifest-test.js deleted file mode 100644 index 2b8f41e4f5f..00000000000 --- a/local-cli/core/__tests__/android/readManifest-test.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findManifest = require('../../android/findManifest'); -const readManifest = require('../../android/readManifest'); -const fs = require('fs'); -const mocks = require('../../__fixtures__/android'); - -describe('android::readManifest', () => { - beforeAll(() => { - fs.__setMockFilesystem({ - empty: {}, - nested: { - android: { - app: mocks.valid, - }, - }, - }); - }); - - it('returns manifest content if file exists in the folder', () => { - const manifestPath = findManifest('/nested'); - expect(readManifest(manifestPath)).not.toBeNull(); - expect(typeof readManifest(manifestPath)).toBe('object'); - }); - - it('throws an error if there is no manifest in the folder', () => { - const fakeManifestPath = findManifest('/empty'); - expect(() => { - readManifest(fakeManifestPath); - }).toThrow(); - }); -}); diff --git a/local-cli/core/__tests__/findAssets-test.js b/local-cli/core/__tests__/findAssets-test.js deleted file mode 100644 index cf880b23df2..00000000000 --- a/local-cli/core/__tests__/findAssets-test.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findAssets = require('../findAssets'); -const dependencies = require('../__fixtures__/dependencies'); -const fs = require('fs'); - -describe('findAssets', () => { - beforeEach(() => { - fs.__setMockFilesystem({testDir: dependencies.withAssets}); - }); - - it('returns an array of all files in given folders', () => { - const assets = findAssets('/testDir', ['fonts', 'images']); - - expect(Array.isArray(assets)).toBeTruthy(); - expect(assets).toHaveLength(3); - }); - - it('prepends assets paths with the folder path', () => { - const assets = findAssets('/testDir', ['fonts', 'images']); - - assets.forEach(assetPath => { - expect(assetPath).toContain('testDir'); - }); - }); - - it('returns an empty array if given assets are null', () => { - expect(findAssets('/testDir', null)).toHaveLength(0); - }); -}); diff --git a/local-cli/core/__tests__/findPlugins-test.js b/local-cli/core/__tests__/findPlugins-test.js deleted file mode 100644 index 6d350da542f..00000000000 --- a/local-cli/core/__tests__/findPlugins-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const findPlugins = require('../findPlugins'); -const path = require('path'); - -const ROOT = path.join(__dirname, '..', '..', '..'); -const pjsonPath = path.join(ROOT, 'package.json'); - -describe('findPlugins', () => { - beforeEach(() => { - jest.resetModules(); - }); - - it('returns an array of dependencies', () => { - jest.mock(pjsonPath, () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - })); - - expect(findPlugins([ROOT])).toHaveProperty('commands'); - expect(findPlugins([ROOT])).toHaveProperty('platforms'); - expect(findPlugins([ROOT]).commands).toHaveLength(1); - expect(findPlugins([ROOT]).commands[0]).toBe('rnpm-plugin-test'); - expect(findPlugins([ROOT]).platforms).toHaveLength(0); - }); - - it('returns an empty array if there are no plugins in this folder', () => { - jest.mock(pjsonPath, () => ({})); - expect(findPlugins([ROOT])).toHaveProperty('commands'); - expect(findPlugins([ROOT])).toHaveProperty('platforms'); - expect(findPlugins([ROOT]).commands).toHaveLength(0); - expect(findPlugins([ROOT]).platforms).toHaveLength(0); - }); - - it('returns an object with empty arrays if there is no package.json in the supplied folder', () => { - expect(findPlugins(['fake-path'])).toHaveProperty('commands'); - expect(findPlugins(['fake-path'])).toHaveProperty('platforms'); - expect(findPlugins(['fake-path']).commands).toHaveLength(0); - expect(findPlugins(['fake-path']).platforms).toHaveLength(0); - }); - - it('returns plugins from both dependencies and dev dependencies', () => { - jest.mock(pjsonPath, () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - devDependencies: {'rnpm-plugin-test-2': '*'}, - })); - expect(findPlugins([ROOT])).toHaveProperty('commands'); - expect(findPlugins([ROOT])).toHaveProperty('platforms'); - expect(findPlugins([ROOT]).commands).toHaveLength(2); - expect(findPlugins([ROOT]).platforms).toHaveLength(0); - }); - - it('returns unique list of plugins', () => { - jest.mock(pjsonPath, () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - devDependencies: {'rnpm-plugin-test': '*'}, - })); - expect(findPlugins([ROOT]).commands).toHaveLength(1); - }); - - it('returns plugins in scoped modules', () => { - jest.mock(pjsonPath, () => ({ - dependencies: { - '@org/rnpm-plugin-test': '*', - '@org/react-native-test': '*', - '@react-native/test': '*', - '@react-native-org/test': '*', - }, - })); - - expect(findPlugins([ROOT])).toHaveProperty('commands'); - expect(findPlugins([ROOT])).toHaveProperty('platforms'); - expect(findPlugins([ROOT]).commands[0]).toBe('@org/rnpm-plugin-test'); - }); -}); diff --git a/local-cli/core/__tests__/ios/findPodfilePath-test.js b/local-cli/core/__tests__/ios/findPodfilePath-test.js deleted file mode 100644 index 227d2451250..00000000000 --- a/local-cli/core/__tests__/ios/findPodfilePath-test.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findPodfilePath = require('../../ios/findPodfilePath'); -const fs = require('fs'); -const projects = require('../../__fixtures__/projects'); -const ios = require('../../__fixtures__/ios'); - -describe('ios::findPodfilePath', () => { - it('returns null if there is no Podfile', () => { - fs.__setMockFilesystem(ios.valid); - expect(findPodfilePath('')).toBeNull(); - }); - - it('returns Podfile path if it exists', () => { - fs.__setMockFilesystem(projects.withPods); - expect(findPodfilePath('/ios')).toContain('Podfile'); - }); -}); diff --git a/local-cli/core/__tests__/ios/findPodspecName-test.js b/local-cli/core/__tests__/ios/findPodspecName-test.js deleted file mode 100644 index 14d73cd7d82..00000000000 --- a/local-cli/core/__tests__/ios/findPodspecName-test.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findPodspecName = require('../../ios/findPodspecName'); -const fs = require('fs'); -const projects = require('../../__fixtures__/projects'); -const ios = require('../../__fixtures__/ios'); - -describe('ios::findPodspecName', () => { - it('returns null if there is not podspec file', () => { - fs.__setMockFilesystem(projects.flat); - expect(findPodspecName('')).toBeNull(); - }); - - it('returns podspec name if only one exists', () => { - fs.__setMockFilesystem(ios.pod); - expect(findPodspecName('/')).toBe('TestPod'); - }); - - it('returns podspec name that match packet directory', () => { - fs.__setMockFilesystem({ - user: { - PacketName: { - 'Another.podspec': 'empty', - 'PacketName.podspec': 'empty', - }, - }, - }); - expect(findPodspecName('/user/PacketName')).toBe('PacketName'); - }); - - it('returns first podspec name if not match in directory', () => { - fs.__setMockFilesystem({ - user: { - packet: { - 'Another.podspec': 'empty', - 'PacketName.podspec': 'empty', - }, - }, - }); - expect(findPodspecName('/user/packet')).toBe('Another'); - }); -}); diff --git a/local-cli/core/__tests__/ios/findProject-test.js b/local-cli/core/__tests__/ios/findProject-test.js deleted file mode 100644 index 0083e9bd0d7..00000000000 --- a/local-cli/core/__tests__/ios/findProject-test.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const findProject = require('../../ios/findProject'); -const fs = require('fs'); -const projects = require('../../__fixtures__/projects'); -const ios = require('../../__fixtures__/ios'); - -describe('ios::findProject', () => { - it('returns path to xcodeproj if found', () => { - fs.__setMockFilesystem(projects.flat); - expect(findProject('/')).not.toBeNull(); - }); - - it('returns null if there are no projects', () => { - fs.__setMockFilesystem({testDir: projects}); - expect(findProject('/')).toBeNull(); - }); - - it('returns ios project regardless of its name', () => { - fs.__setMockFilesystem({ios: ios.validTestName}); - expect(findProject('/')).not.toBeNull(); - }); - - it('ignores node_modules', () => { - fs.__setMockFilesystem({node_modules: projects.flat}); - expect(findProject('/')).toBeNull(); - }); - - it('ignores Pods', () => { - fs.__setMockFilesystem({Pods: projects.flat}); - expect(findProject('/')).toBeNull(); - }); - - it('ignores Pods inside `ios` folder', () => { - fs.__setMockFilesystem({ - ios: { - Pods: projects.flat, - DemoApp: projects.flat.ios, - }, - }); - expect(findProject('/')).toBe('ios/DemoApp/demoProject.xcodeproj'); - }); - - it('ignores xcodeproj from example folders', () => { - fs.__setMockFilesystem({ - examples: projects.flat, - Examples: projects.flat, - example: projects.flat, - KeychainExample: projects.flat, - Zpp: projects.flat, - }); - - expect(findProject('/').toLowerCase()).not.toContain('example'); - }); - - it('ignores xcodeproj from sample folders', () => { - fs.__setMockFilesystem({ - samples: projects.flat, - Samples: projects.flat, - sample: projects.flat, - KeychainSample: projects.flat, - Zpp: projects.flat, - }); - - expect(findProject('/').toLowerCase()).not.toContain('sample'); - }); - - it('ignores xcodeproj from test folders at any level', () => { - fs.__setMockFilesystem({ - test: projects.flat, - IntegrationTests: projects.flat, - tests: projects.flat, - Zpp: { - tests: projects.flat, - src: projects.flat, - }, - }); - - expect(findProject('/').toLowerCase()).not.toContain('test'); - }); -}); diff --git a/local-cli/core/__tests__/ios/getProjectConfig-test.js b/local-cli/core/__tests__/ios/getProjectConfig-test.js deleted file mode 100644 index d1af61e4b29..00000000000 --- a/local-cli/core/__tests__/ios/getProjectConfig-test.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -const getProjectConfig = require('../../ios').projectConfig; -const fs = require('fs'); -const projects = require('../../__fixtures__/projects'); - -describe('ios::getProjectConfig', () => { - const userConfig = {}; - - beforeEach(() => { - fs.__setMockFilesystem({testDir: projects}); - }); - - it('returns an object with ios project configuration', () => { - const folder = '/testDir/nested'; - - expect(getProjectConfig(folder, userConfig)).not.toBeNull(); - expect(typeof getProjectConfig(folder, userConfig)).toBe('object'); - }); - - it('returns `null` if ios project was not found', () => { - const folder = '/testDir/empty'; - - expect(getProjectConfig(folder, userConfig)).toBeNull(); - }); - - it('returns normalized shared library names', () => { - const projectConfig = getProjectConfig('/testDir/nested', { - sharedLibraries: ['libc++', 'libz.tbd', 'HealthKit', 'HomeKit.framework'], - }); - - expect(projectConfig.sharedLibraries).toEqual([ - 'libc++.tbd', - 'libz.tbd', - 'HealthKit.framework', - 'HomeKit.framework', - ]); - }); -}); diff --git a/local-cli/core/__tests__/makeCommand-test.js b/local-cli/core/__tests__/makeCommand-test.js deleted file mode 100644 index c9842efa861..00000000000 --- a/local-cli/core/__tests__/makeCommand-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -let spawnError = false; - -jest.setMock('child_process', { - spawn: () => ({ - on: (event, cb) => cb(spawnError), - }), -}); - -const makeCommand = require('../makeCommand'); - -describe('makeCommand', () => { - const command = makeCommand('echo'); - - it('generates a function around shell command', () => { - expect(typeof command).toBe('function'); - }); - - it('throws an error if there is no callback provided', () => { - expect(command).toThrow(); - }); - - it('invokes a callback after command execution', () => { - const spy = jest.fn(); - command(spy); - expect(spy.mock.calls).toHaveLength(1); - }); - - it('throws an error if spawn ended up with error', () => { - spawnError = true; - const cb = jest.fn(); - expect(() => { - command(cb); - }).toThrow(); - }); -}); diff --git a/local-cli/core/android/findAndroidAppFolder.js b/local-cli/core/android/findAndroidAppFolder.js deleted file mode 100644 index 41e1319a048..00000000000 --- a/local-cli/core/android/findAndroidAppFolder.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -/** - * @param {String} folder Folder to seek in - * @return {String} - */ -module.exports = function findAndroidAppFolder(folder) { - const flat = 'android'; - const nested = path.join('android', 'app'); - - if (fs.existsSync(path.join(folder, nested))) { - return nested; - } - - if (fs.existsSync(path.join(folder, flat))) { - return flat; - } - - return null; -}; diff --git a/local-cli/core/android/findManifest.js b/local-cli/core/android/findManifest.js deleted file mode 100644 index 4c04ed7cba4..00000000000 --- a/local-cli/core/android/findManifest.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const glob = require('glob'); -const path = require('path'); - -/** - * Find an android application path in the folder - * - * @param {String} folder Name of the folder where to seek - * @return {String} - */ -module.exports = function findManifest(folder) { - const manifestPath = glob.sync(path.join('**', 'AndroidManifest.xml'), { - cwd: folder, - ignore: ['node_modules/**', '**/build/**', 'Examples/**', 'examples/**'], - })[0]; - - return manifestPath ? path.join(folder, manifestPath) : null; -}; diff --git a/local-cli/core/android/findPackageClassName.js b/local-cli/core/android/findPackageClassName.js deleted file mode 100644 index a1bfaf6f232..00000000000 --- a/local-cli/core/android/findPackageClassName.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const glob = require('glob'); -const path = require('path'); - -/** - * Gets package's class name (class that implements ReactPackage) - * by searching for its declaration in all Java/Kotlin files present in the folder - * - * @param {String} folder Folder to find java/kt files - */ -module.exports = function getPackageClassName(folder) { - const files = glob.sync('**/+(*.java|*.kt)', {cwd: folder}); - - const packages = files - .map(filePath => fs.readFileSync(path.join(folder, filePath), 'utf8')) - .map(file => file.match(/class (.*) +(implements|:) ReactPackage/)) - .filter(match => match); - - return packages.length ? packages[0][1] : null; -}; diff --git a/local-cli/core/android/index.js b/local-cli/core/android/index.js deleted file mode 100644 index 2106ed7a9a7..00000000000 --- a/local-cli/core/android/index.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const findAndroidAppFolder = require('./findAndroidAppFolder'); -const findManifest = require('./findManifest'); -const findPackageClassName = require('./findPackageClassName'); -const path = require('path'); -const readManifest = require('./readManifest'); - -const getPackageName = manifest => manifest.attr.package; - -/** - * Gets android project config by analyzing given folder and taking some - * defaults specified by user into consideration - */ -exports.projectConfig = function projectConfigAndroid(folder, userConfig = {}) { - const src = userConfig.sourceDir || findAndroidAppFolder(folder); - - if (!src) { - return null; - } - - const sourceDir = path.join(folder, src); - const isFlat = sourceDir.indexOf('app') === -1; - const manifestPath = userConfig.manifestPath - ? path.join(sourceDir, userConfig.manifestPath) - : findManifest(sourceDir); - - if (!manifestPath) { - return null; - } - - const manifest = readManifest(manifestPath); - - const packageName = userConfig.packageName || getPackageName(manifest); - - if (!packageName) { - throw new Error(`Package name not found in ${manifestPath}`); - } - - const packageFolder = - userConfig.packageFolder || packageName.replace(/\./g, path.sep); - - const mainFilePath = path.join( - sourceDir, - userConfig.mainFilePath || - `src/main/java/${packageFolder}/MainApplication.java`, - ); - - const stringsPath = path.join( - sourceDir, - userConfig.stringsPath || 'src/main/res/values/strings.xml', - ); - - const settingsGradlePath = path.join( - folder, - 'android', - userConfig.settingsGradlePath || 'settings.gradle', - ); - - const assetsPath = path.join( - sourceDir, - userConfig.assetsPath || 'src/main/assets', - ); - - const buildGradlePath = path.join( - sourceDir, - userConfig.buildGradlePath || 'build.gradle', - ); - - return { - sourceDir, - isFlat, - folder, - stringsPath, - manifestPath, - buildGradlePath, - settingsGradlePath, - assetsPath, - mainFilePath, - }; -}; - -/** - * Same as projectConfigAndroid except it returns - * different config that applies to packages only - */ -exports.dependencyConfig = function dependencyConfigAndroid( - folder, - userConfig = {}, -) { - const src = userConfig.sourceDir || findAndroidAppFolder(folder); - - if (!src) { - return null; - } - - const sourceDir = path.join(folder, src); - const manifestPath = userConfig.manifestPath - ? path.join(sourceDir, userConfig.manifestPath) - : findManifest(sourceDir); - - if (!manifestPath) { - return null; - } - - const manifest = readManifest(manifestPath); - const packageName = userConfig.packageName || getPackageName(manifest); - const packageClassName = findPackageClassName(sourceDir); - - /** - * This module has no package to export - */ - if (!packageClassName) { - return null; - } - - const packageImportPath = - userConfig.packageImportPath || - `import ${packageName}.${packageClassName};`; - - const packageInstance = - userConfig.packageInstance || `new ${packageClassName}()`; - - return {sourceDir, folder, manifest, packageImportPath, packageInstance}; -}; - -exports.linkConfig = require('../../link/android'); diff --git a/local-cli/core/android/readManifest.js b/local-cli/core/android/readManifest.js deleted file mode 100644 index 159cb601d70..00000000000 --- a/local-cli/core/android/readManifest.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const xml = require('xmldoc'); - -/** - * @param {String} manifestPath - * @return {XMLDocument} Parsed manifest's content - */ -module.exports = function readManifest(manifestPath) { - return new xml.XmlDocument(fs.readFileSync(manifestPath, 'utf8')); -}; diff --git a/local-cli/core/findAssets.js b/local-cli/core/findAssets.js deleted file mode 100644 index a06596d1016..00000000000 --- a/local-cli/core/findAssets.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const glob = require('glob'); -const path = require('path'); - -const findAssetsInFolder = folder => - glob.sync(path.join(folder, '**'), {nodir: true}); - -/** - * Given an array of assets folders, e.g. ['Fonts', 'Images'], - * it globs in them to find all files that can be copied. - * - * It returns an array of absolute paths to files found. - */ -module.exports = function findAssets(folder, assets) { - return (assets || []) - .map(assetsFolder => path.join(folder, assetsFolder)) - .reduce( - (_assets, assetsFolder) => - _assets.concat(findAssetsInFolder(assetsFolder)), - [], - ); -}; diff --git a/local-cli/core/findPlugins.js b/local-cli/core/findPlugins.js deleted file mode 100644 index 7d76b5b6f5f..00000000000 --- a/local-cli/core/findPlugins.js +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const path = require('path'); -const union = require('lodash').union; -const uniq = require('lodash').uniq; -const flatten = require('lodash').flatten; - -const RNPM_PLUGIN_PATTERNS = [/^rnpm-plugin-/, /^@(.*)\/rnpm-plugin-/]; - -const REACT_NATIVE_PLUGIN_PATTERNS = [ - /^react-native-/, - /^@(.*)\/react-native-/, - /^@react-native(.*)\/(?!rnpm-plugin-)/, -]; - -/** - * Filter dependencies by name pattern - * @param {String} dependency Name of the dependency - * @return {Boolean} If dependency is a rnpm plugin - */ -const isRNPMPlugin = dependency => - RNPM_PLUGIN_PATTERNS.some(pattern => pattern.test(dependency)); -const isReactNativePlugin = dependency => - REACT_NATIVE_PLUGIN_PATTERNS.some(pattern => pattern.test(dependency)); - -const readPackage = folder => { - try { - return require(path.join(folder, 'package.json')); - } catch (e) { - return null; - } -}; - -const findPluginsInReactNativePackage = pjson => { - if (!pjson.rnpm || !pjson.rnpm.plugin) { - return []; - } - - return path.join(pjson.name, pjson.rnpm.plugin); -}; - -const findPlatformsInPackage = pjson => { - if (!pjson.rnpm || !pjson.rnpm.platform) { - return []; - } - - return path.join(pjson.name, pjson.rnpm.platform); -}; - -const getEmptyPluginConfig = () => ({ - commands: [], - platforms: [], - haste: { - platforms: [], - providesModuleNodeModules: [], - }, -}); - -const findHasteConfigInPackageAndConcat = (pjson, haste) => { - if (!pjson.rnpm || !pjson.rnpm.haste) { - return; - } - let pkgHaste = pjson.rnpm.haste; - - if (pkgHaste.platforms) { - haste.platforms = haste.platforms.concat(pkgHaste.platforms); - } - - if (pkgHaste.providesModuleNodeModules) { - haste.providesModuleNodeModules = haste.providesModuleNodeModules.concat( - pkgHaste.providesModuleNodeModules, - ); - } -}; - -const findPluginInFolder = folder => { - const pjson = readPackage(folder); - - if (!pjson) { - return getEmptyPluginConfig(); - } - - const deps = union( - Object.keys(pjson.dependencies || {}), - Object.keys(pjson.devDependencies || {}), - ); - - return deps.reduce((acc, pkg) => { - let commands = acc.commands; - let platforms = acc.platforms; - let haste = acc.haste; - if (isRNPMPlugin(pkg)) { - commands = commands.concat(pkg); - } - if (isReactNativePlugin(pkg)) { - const pkgJson = readPackage(path.join(folder, 'node_modules', pkg)); - if (pkgJson) { - commands = commands.concat(findPluginsInReactNativePackage(pkgJson)); - platforms = platforms.concat(findPlatformsInPackage(pkgJson)); - findHasteConfigInPackageAndConcat(pkgJson, haste); - } - } - return {commands: commands, platforms: platforms, haste: haste}; - }, getEmptyPluginConfig()); -}; - -/** - * Find plugins in package.json of the given folder - * @param {String} folder Path to the folder to get the package.json from - * @type {Object} Object of commands and platform plugins - */ -module.exports = function findPlugins(folders) { - const plugins = folders.map(findPluginInFolder); - return { - commands: uniq(flatten(plugins.map(p => p.commands))), - platforms: uniq(flatten(plugins.map(p => p.platforms))), - haste: { - platforms: uniq(flatten(plugins.map(p => p.haste.platforms))), - providesModuleNodeModules: uniq( - flatten(plugins.map(p => p.haste.providesModuleNodeModules)), - ), - }, - }; -}; diff --git a/local-cli/core/index.js b/local-cli/core/index.js deleted file mode 100644 index 0d2a441620f..00000000000 --- a/local-cli/core/index.js +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const android = require('./android'); -const Config = require('../util/Config'); -const findPlugins = require('./findPlugins'); -const findAssets = require('./findAssets'); -const ios = require('./ios'); -const wrapCommands = require('./wrapCommands'); -const {ASSET_REGISTRY_PATH} = require('./Constants'); - -const flatten = require('lodash').flatten; -const minimist = require('minimist'); -const path = require('path'); - -import type {CommandT} from '../commands'; -import type {ConfigT} from 'metro-config/src/configTypes.flow'; - -export type RNConfig = { - ...ConfigT, - /** - * Returns an object with all platform configurations. - */ - getPlatformConfig(): Object, - /** - * Returns project config from the current working directory - */ - getProjectConfig(): Object, - /** - * Returns dependency config from /packageName - */ - getDependencyConfig(pkgName: string): Object, -}; - -const getRNPMConfig = folder => - // $FlowFixMe non-literal require - require(path.join(folder, './package.json')).rnpm || {}; - -const attachPackage = (command, pkg) => - Array.isArray(command) - ? command.map(cmd => attachPackage(cmd, pkg)) - : {...command, pkg}; - -const appRoot = process.cwd(); -const plugins = findPlugins([appRoot]); -const pluginPlatforms = plugins.platforms.reduce((acc, pathToPlatforms) => { - return Object.assign( - acc, - // $FlowFixMe non-literal require - require(path.join(appRoot, 'node_modules', pathToPlatforms)), - ); -}, {}); - -const defaultConfig = { - hasteImplModulePath: require.resolve('../../jest/hasteImpl'), - - getPlatforms(): Array { - return ['ios', 'android', 'native', ...plugins.haste.platforms]; - }, - - getProvidesModuleNodeModules(): Array { - return ['react-native', ...plugins.haste.providesModuleNodeModules]; - }, -}; - -const defaultRNConfig = { - getPlatformConfig(): Object { - return { - ios, - android, - ...pluginPlatforms, - }; - }, - - getProjectConfig(): Object { - const platforms = this.getPlatformConfig(); - const folder = process.cwd(); - const rnpm = getRNPMConfig(folder); - - let config = Object.assign({}, rnpm, { - assets: findAssets(folder, rnpm.assets), - }); - - Object.keys(platforms).forEach(key => { - config[key] = platforms[key].projectConfig(folder, rnpm[key] || {}); - }); - - return config; - }, - - getDependencyConfig(packageName: string) { - const platforms = this.getPlatformConfig(); - const folder = path.join(process.cwd(), 'node_modules', packageName); - const rnpm = getRNPMConfig(folder); - - let config = Object.assign({}, rnpm, { - assets: findAssets(folder, rnpm.assets), - commands: wrapCommands(rnpm.commands), - params: rnpm.params || [], - }); - - Object.keys(platforms).forEach(key => { - config[key] = platforms[key].dependencyConfig(folder, rnpm[key] || {}); - }); - - return config; - }, -}; - -/** - * Loads the CLI configuration - */ -async function getCliConfig(): Promise { - const cliArgs = minimist(process.argv.slice(2)); - const config = await Config.load( - typeof cliArgs.config === 'string' - ? path.resolve(__dirname, cliArgs.config) - : null, - ); - - // $FlowFixMe Metro configuration is immutable. - config.transformer.assetRegistryPath = ASSET_REGISTRY_PATH; - config.resolver.hasteImplModulePath = - config.resolver.hasteImplModulePath || defaultConfig.hasteImplModulePath; - config.resolver.platforms = config.resolver.platforms - ? config.resolver.platforms.concat(defaultConfig.getPlatforms()) - : defaultConfig.getPlatforms(); - config.resolver.providesModuleNodeModules = config.resolver - .providesModuleNodeModules - ? config.resolver.providesModuleNodeModules.concat( - defaultConfig.getProvidesModuleNodeModules(), - ) - : defaultConfig.getProvidesModuleNodeModules(); - - return {...defaultRNConfig, ...config}; -} - -/** - * Returns an array of project commands used by the CLI to load - */ -function getProjectCommands(): Array { - const commands = plugins.commands.map(pathToCommands => { - const name = - pathToCommands[0] === '@' - ? pathToCommands - .split(path.sep) - .slice(0, 2) - .join(path.sep) - : pathToCommands.split(path.sep)[0]; - - return attachPackage( - require(path.join(appRoot, 'node_modules', pathToCommands)), - require(path.join(appRoot, 'node_modules', name, 'package.json')), - ); - }); - - return flatten(commands); -} - -module.exports.configPromise = getCliConfig(); -module.exports.getProjectCommands = getProjectCommands; diff --git a/local-cli/core/ios/findPodfilePath.js b/local-cli/core/ios/findPodfilePath.js deleted file mode 100644 index 67232535468..00000000000 --- a/local-cli/core/ios/findPodfilePath.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -module.exports = function findPodfilePath(projectFolder) { - const podFilePath = path.join(projectFolder, '..', 'Podfile'); - const podFileExists = fs.existsSync(podFilePath); - - return podFileExists ? podFilePath : null; -}; diff --git a/local-cli/core/ios/findPodspecName.js b/local-cli/core/ios/findPodspecName.js deleted file mode 100644 index 1041a0a9991..00000000000 --- a/local-cli/core/ios/findPodspecName.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const glob = require('glob'); -const path = require('path'); - -module.exports = function findPodspecName(folder) { - const podspecs = glob.sync('*.podspec', {cwd: folder}); - let podspecFile = null; - if (podspecs.length === 0) { - return null; - } else if (podspecs.length === 1) { - podspecFile = podspecs[0]; - } else { - const folderParts = folder.split(path.sep); - const currentFolder = folderParts[folderParts.length - 1]; - const toSelect = podspecs.indexOf(currentFolder + '.podspec'); - if (toSelect === -1) { - podspecFile = podspecs[0]; - } else { - podspecFile = podspecs[toSelect]; - } - } - - return podspecFile.replace('.podspec', ''); -}; diff --git a/local-cli/core/ios/findProject.js b/local-cli/core/ios/findProject.js deleted file mode 100644 index d98695d67fb..00000000000 --- a/local-cli/core/ios/findProject.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const glob = require('glob'); -const path = require('path'); - -/** - * Glob pattern to look for xcodeproj - */ -const GLOB_PATTERN = '**/*.xcodeproj'; - -/** - * Regexp matching all test projects - */ -const TEST_PROJECTS = /test|example|sample/i; - -/** - * Base iOS folder - */ -const IOS_BASE = 'ios'; - -/** - * These folders will be excluded from search to speed it up - */ -const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules)/**']; - -/** - * Finds iOS project by looking for all .xcodeproj files - * in given folder. - * - * Returns first match if files are found or null - * - * Note: `./ios/*.xcodeproj` are returned regardless of the name - */ -module.exports = function findProject(folder) { - const projects = glob - .sync(GLOB_PATTERN, { - cwd: folder, - ignore: GLOB_EXCLUDE_PATTERN, - }) - .filter(project => { - return path.dirname(project) === IOS_BASE || !TEST_PROJECTS.test(project); - }) - .sort((projectA, projectB) => { - return path.dirname(projectA) === IOS_BASE ? -1 : 1; - }); - - if (projects.length === 0) { - return null; - } - - return projects[0]; -}; diff --git a/local-cli/core/ios/index.js b/local-cli/core/ios/index.js deleted file mode 100644 index df876115046..00000000000 --- a/local-cli/core/ios/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const findProject = require('./findProject'); -const findPodfilePath = require('./findPodfilePath'); -const findPodspecName = require('./findPodspecName'); -const path = require('path'); - -/** - * For libraries specified without an extension, add '.tbd' for those that - * start with 'lib' and '.framework' to the rest. - */ -const mapSharedLibaries = libraries => { - return libraries.map(name => { - if (path.extname(name)) { - return name; - } - return name + (name.indexOf('lib') === 0 ? '.tbd' : '.framework'); - }); -}; - -/** - * Returns project config by analyzing given folder and applying some user defaults - * when constructing final object - */ -exports.projectConfig = function projectConfigIOS(folder, userConfig) { - const project = userConfig.project || findProject(folder); - - /** - * No iOS config found here - */ - if (!project) { - return null; - } - - const projectPath = path.join(folder, project); - - return { - sourceDir: path.dirname(projectPath), - folder: folder, - pbxprojPath: path.join(projectPath, 'project.pbxproj'), - podfile: findPodfilePath(projectPath), - podspec: findPodspecName(folder), - projectPath: projectPath, - projectName: path.basename(projectPath), - libraryFolder: userConfig.libraryFolder || 'Libraries', - sharedLibraries: mapSharedLibaries(userConfig.sharedLibraries || []), - plist: userConfig.plist || [], - }; -}; - -exports.dependencyConfig = exports.projectConfig; - -exports.linkConfig = require('../../link/ios'); diff --git a/local-cli/core/makeCommand.js b/local-cli/core/makeCommand.js deleted file mode 100644 index d1d0fe8194f..00000000000 --- a/local-cli/core/makeCommand.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const spawn = require('child_process').spawn; - -module.exports = function makeCommand(command) { - return cb => { - if (!cb) { - throw new Error( - `You missed a callback function for the ${command} command`, - ); - } - - const args = command.split(' '); - const cmd = args.shift(); - - const commandProcess = spawn(cmd, args, { - stdio: 'inherit', - stdin: 'inherit', - }); - - commandProcess.on('close', function prelink(code) { - if (code) { - throw new Error(`Error occurred during executing "${command}" command`); - } - - cb(); - }); - }; -}; diff --git a/local-cli/core/wrapCommands.js b/local-cli/core/wrapCommands.js deleted file mode 100644 index 1f3ce34ab3f..00000000000 --- a/local-cli/core/wrapCommands.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const makeCommand = require('./makeCommand'); - -module.exports = function wrapCommands(commands) { - const mappedCommands = {}; - Object.keys(commands || []).forEach(k => { - mappedCommands[k] = makeCommand(commands[k]); - }); - return mappedCommands; -}; diff --git a/local-cli/dependencies/dependencies.js b/local-cli/dependencies/dependencies.js deleted file mode 100644 index 192926a84d1..00000000000 --- a/local-cli/dependencies/dependencies.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const Metro = require('metro'); - -const denodeify = require('denodeify'); -const fs = require('fs'); -const path = require('path'); - -async function dependencies(argv, configPromise, args, packagerInstance) { - const rootModuleAbsolutePath = args.entryFile; - const config = await configPromise; - if (!fs.existsSync(rootModuleAbsolutePath)) { - return Promise.reject( - new Error(`File ${rootModuleAbsolutePath} does not exist`), - ); - } - - config.cacheStores = []; - - const relativePath = path.relative( - config.projectRoot, - rootModuleAbsolutePath, - ); - - const options = { - platform: args.platform, - entryFile: relativePath, - dev: args.dev, - minify: false, - generateSourceMaps: !args.dev, - }; - - const writeToFile = args.output; - const outStream = writeToFile - ? fs.createWriteStream(args.output) - : process.stdout; - - const deps = packagerInstance - ? await packagerInstance.getOrderedDependencyPaths(options) - : await Metro.getOrderedDependencyPaths(config, options); - - deps.forEach(modulePath => { - // Temporary hack to disable listing dependencies not under this directory. - // Long term, we need either - // (a) JS code to not depend on anything outside this directory, or - // (b) Come up with a way to declare this dependency in Buck. - const isInsideProjectRoots = - config.watchFolders.filter(root => modulePath.startsWith(root)).length > - 0; - - if (isInsideProjectRoots) { - outStream.write(modulePath + '\n'); - } - }); - return writeToFile - ? denodeify(outStream.end).bind(outStream)() - : Promise.resolve(); -} - -module.exports = { - name: 'dependencies', - description: 'lists dependencies', - func: dependencies, - options: [ - { - command: '--entry-file ', - description: 'Absolute path to the root JS file', - }, - { - command: '--output [path]', - description: - 'File name where to store the output, ex. /tmp/dependencies.txt', - }, - { - command: '--platform [extension]', - description: 'The platform extension used for selecting modules', - }, - { - command: '--transformer [path]', - description: 'Specify a custom transformer to be used', - }, - { - command: '--max-workers [number]', - description: - 'Specifies the maximum number of workers the worker-pool ' + - 'will spawn for transforming files. This defaults to the number of the ' + - 'cores available on your machine.', - parse: (workers: string) => Number(workers), - }, - { - command: '--dev [boolean]', - description: 'If false, skip all dev-only code path', - parse: val => (val === 'false' ? false : true), - default: true, - }, - { - command: '--verbose', - description: 'Enables logging', - default: false, - }, - ], -}; diff --git a/local-cli/eject/eject.js b/local-cli/eject/eject.js deleted file mode 100644 index ff7d085be54..00000000000 --- a/local-cli/eject/eject.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const copyProjectTemplateAndReplace = require('../generator/copyProjectTemplateAndReplace'); -const path = require('path'); -const fs = require('fs'); - -/** - * The eject command re-creates the `android` and `ios` native folders. Because native code can be - * difficult to maintain, this new script allows an `app.json` to be defined for the project, which - * is used to configure the native app. - * - * The `app.json` config may contain the following keys: - * - * - `name` - The short name used for the project, should be TitleCase - * - `displayName` - The app's name on the home screen - */ - -function eject() { - const doesIOSExist = fs.existsSync(path.resolve('ios')); - const doesAndroidExist = fs.existsSync(path.resolve('android')); - if (doesIOSExist && doesAndroidExist) { - console.error( - 'Both the iOS and Android folders already exist! Please delete `ios` and/or `android` ' + - 'before ejecting.', - ); - process.exit(1); - } - - let appConfig = null; - try { - appConfig = require(path.resolve('app.json')); - } catch (e) { - console.error( - 'Eject requires an `app.json` config file to be located at ' + - `${path.resolve( - 'app.json', - )}, and it must at least specify a \`name\` for the project ` + - "name, and a `displayName` for the app's home screen label.", - ); - process.exit(1); - } - - const appName = appConfig.name; - if (!appName) { - console.error( - 'App `name` must be defined in the `app.json` config file to define the project name. ' + - 'It must not contain any spaces or dashes.', - ); - process.exit(1); - } - const displayName = appConfig.displayName; - if (!displayName) { - console.error( - 'App `displayName` must be defined in the `app.json` config file, to define the label ' + - 'of the app on the home screen.', - ); - process.exit(1); - } - - const templateOptions = {displayName}; - - if (!doesIOSExist) { - console.log('Generating the iOS folder.'); - copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - 'local-cli', - 'templates', - 'HelloWorld', - 'ios', - ), - path.resolve('ios'), - appName, - templateOptions, - ); - } - - if (!doesAndroidExist) { - console.log('Generating the Android folder.'); - copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - 'local-cli', - 'templates', - 'HelloWorld', - 'android', - ), - path.resolve('android'), - appName, - templateOptions, - ); - } -} - -module.exports = { - name: 'eject', - description: 'Re-create the iOS and Android folders and native code', - func: eject, - options: [], -}; diff --git a/local-cli/generator/copyProjectTemplateAndReplace.js b/local-cli/generator/copyProjectTemplateAndReplace.js deleted file mode 100644 index 8f04b439fae..00000000000 --- a/local-cli/generator/copyProjectTemplateAndReplace.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const chalk = require('chalk'); -const copyAndReplace = require('../util/copyAndReplace'); -const path = require('path'); -const prompt = require('./promptSync')(); -const walk = require('../util/walk'); - -/** - * Util for creating a new React Native project. - * Copy the project from a template and use the correct project name in - * all files. - * @param srcPath e.g. '/Users/martin/AwesomeApp/node_modules/react-native/local-cli/templates/HelloWorld' - * @param destPath e.g. '/Users/martin/AwesomeApp' - * @param newProjectName e.g. 'AwesomeApp' - * @param options e.g. { - * upgrade: true, - * force: false, - * displayName: 'Hello World', - * ignorePaths: ['template/file/to/ignore.md'], - * } - */ -function copyProjectTemplateAndReplace( - srcPath, - destPath, - newProjectName, - options, -) { - if (!srcPath) { - throw new Error('Need a path to copy from'); - } - if (!destPath) { - throw new Error('Need a path to copy to'); - } - if (!newProjectName) { - throw new Error('Need a project name'); - } - - options = options || {}; - - walk(srcPath).forEach(absoluteSrcFilePath => { - // 'react-native upgrade' - if (options.upgrade) { - // Don't upgrade these files - const fileName = path.basename(absoluteSrcFilePath); - // This also includes __tests__/index.*.js - if (fileName === 'index.ios.js') { - return; - } - if (fileName === 'index.android.js') { - return; - } - if (fileName === 'index.js') { - return; - } - if (fileName === 'App.js') { - return; - } - } - - const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); - const relativeRenamedPath = translateFilePath(relativeFilePath) - .replace(/HelloWorld/g, newProjectName) - .replace(/helloworld/g, newProjectName.toLowerCase()); - - // Templates may contain files that we don't want to copy. - // Examples: - // - Dummy package.json file included in the template only for publishing to npm - // - Docs specific to the template (.md files) - if (options.ignorePaths) { - if (!Array.isArray(options.ignorePaths)) { - throw new Error('options.ignorePaths must be an array'); - } - if ( - options.ignorePaths.some(ignorePath => ignorePath === relativeFilePath) - ) { - // Skip copying this file - return; - } - } - - let contentChangedCallback = null; - if (options.upgrade && !options.force) { - contentChangedCallback = (_, contentChanged) => { - return upgradeFileContentChangedCallback( - absoluteSrcFilePath, - relativeRenamedPath, - contentChanged, - ); - }; - } - copyAndReplace( - absoluteSrcFilePath, - path.resolve(destPath, relativeRenamedPath), - { - 'Hello App Display Name': options.displayName || newProjectName, - HelloWorld: newProjectName, - helloworld: newProjectName.toLowerCase(), - }, - contentChangedCallback, - ); - }); -} - -/** - * There are various files in the templates folder in the RN repo. We want - * these to be ignored by tools when working with React Native itself. - * Example: _babelrc file is ignored by Babel, renamed to .babelrc inside - * a real app folder. - * This is especially important for .gitignore because npm has some special - * behavior of automatically renaming .gitignore to .npmignore. - */ -function translateFilePath(path) { - if (!path) { - return path; - } - return path - .replace('_BUCK', 'BUCK') - .replace('_gitignore', '.gitignore') - .replace('_gitattributes', '.gitattributes') - .replace('_babelrc', '.babelrc') - .replace('_flowconfig', '.flowconfig') - .replace('_buckconfig', '.buckconfig') - .replace('_watchmanconfig', '.watchmanconfig'); -} - -function upgradeFileContentChangedCallback( - absoluteSrcFilePath, - relativeDestPath, - contentChanged, -) { - if (contentChanged === 'new') { - console.log(chalk.bold('new') + ' ' + relativeDestPath); - return 'overwrite'; - } else if (contentChanged === 'changed') { - console.log( - chalk.bold(relativeDestPath) + - ' ' + - 'has changed in the new version.\nDo you want to keep your ' + - relativeDestPath + - ' or replace it with the ' + - 'latest version?\nIf you ever made any changes ' + - "to this file, you'll probably want to keep it.\n" + - 'You can see the new version here: ' + - absoluteSrcFilePath + - '\n' + - 'Do you want to replace ' + - relativeDestPath + - '? ' + - 'Answer y to replace, n to keep your version: ', - ); - const answer = prompt(); - if (answer === 'y') { - console.log('Replacing ' + relativeDestPath); - return 'overwrite'; - } else { - console.log('Keeping your ' + relativeDestPath); - return 'keep'; - } - } else if (contentChanged === 'identical') { - return 'keep'; - } else { - throw new Error( - `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`, - ); - } -} - -module.exports = copyProjectTemplateAndReplace; diff --git a/local-cli/generator/printRunInstructions.js b/local-cli/generator/printRunInstructions.js deleted file mode 100644 index 7110f646a7f..00000000000 --- a/local-cli/generator/printRunInstructions.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -var chalk = require('chalk'); -var path = require('path'); - -function printRunInstructions(projectDir, projectName) { - const absoluteProjectDir = path.resolve(projectDir); - // iOS - const xcodeProjectPath = - path.resolve(projectDir, 'ios', projectName) + '.xcodeproj'; - const relativeXcodeProjectPath = path.relative( - process.cwd(), - xcodeProjectPath, - ); - console.log(chalk.white.bold('To run your app on iOS:')); - console.log(' cd ' + absoluteProjectDir); - console.log(' react-native run-ios'); - console.log(' - or -'); - console.log(' Open ' + relativeXcodeProjectPath + ' in Xcode'); - console.log(' Hit the Run button'); - // Android - console.log(chalk.white.bold('To run your app on Android:')); - console.log(' cd ' + absoluteProjectDir); - console.log( - ' Have an Android emulator running (quickest way to get started), or a device connected', - ); - console.log(' react-native run-android'); -} - -module.exports = printRunInstructions; diff --git a/local-cli/generator/promptSync.js b/local-cli/generator/promptSync.js deleted file mode 100644 index 2388ef04694..00000000000 --- a/local-cli/generator/promptSync.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -// Simplified version of: -// https://github.com/0x00A/prompt-sync/blob/master/index.js - -'use strict'; - -var fs = require('fs'); -var term = 13; // carriage return - -function create() { - return prompt; - - function prompt(ask, value, opts) { - var insert = 0; - opts = opts || {}; - - if (Object(ask) === ask) { - opts = ask; - ask = opts.ask; - } else if (Object(value) === value) { - opts = value; - value = opts.value; - } - ask = ask || ''; - var echo = opts.echo; - var masked = 'echo' in opts; - - var fd = - process.platform === 'win32' - ? process.stdin.fd - : fs.openSync('/dev/tty', 'rs'); - - var wasRaw = process.stdin.isRaw; - if (!wasRaw) { - process.stdin.setRawMode(true); - } - - var buf = Buffer.alloc(3); - var str = '', - character, - read; - - if (ask) { - process.stdout.write(ask); - } - - while (true) { - read = fs.readSync(fd, buf, 0, 3); - if (read > 1) { - // received a control sequence - if (buf.toString()) { - str = str + buf.toString(); - str = str.replace(/\0/g, ''); - insert = str.length; - process.stdout.write('\u001b[2K\u001b[0G' + ask + str); - process.stdout.write('\u001b[' + (insert + ask.length + 1) + 'G'); - buf = Buffer.alloc(3); - } - continue; // any other 3 character sequence is ignored - } - - // if it is not a control character seq, assume only one character is read - character = buf[read - 1]; - - // catch a ^C and return null - if (character === 3) { - process.stdout.write('^C\n'); - fs.closeSync(fd); - process.exit(130); - process.stdin.setRawMode(wasRaw); - return null; - } - - // catch the terminating character - if (character === term) { - fs.closeSync(fd); - break; - } - - if ( - character === 127 || - (process.platform === 'win32' && character === 8) - ) { - //backspace - if (!insert) { - continue; - } - str = str.slice(0, insert - 1) + str.slice(insert); - insert--; - process.stdout.write('\u001b[2D'); - } else { - if (character < 32 || character > 126) { - continue; - } - str = - str.slice(0, insert) + - String.fromCharCode(character) + - str.slice(insert); - insert++; - } - - if (masked) { - process.stdout.write( - '\u001b[2K\u001b[0G' + ask + Array(str.length + 1).join(echo), - ); - } else { - process.stdout.write('\u001b[s'); - if (insert === str.length) { - process.stdout.write('\u001b[2K\u001b[0G' + ask + str); - } else { - if (ask) { - process.stdout.write('\u001b[2K\u001b[0G' + ask + str); - } else { - process.stdout.write( - '\u001b[2K\u001b[0G' + - str + - '\u001b[' + - (str.length - insert) + - 'D', - ); - } - } - process.stdout.write('\u001b[u'); - process.stdout.write('\u001b[1C'); - } - } - - process.stdout.write('\n'); - - process.stdin.setRawMode(wasRaw); - - return str || value || ''; - } -} - -module.exports = create; diff --git a/local-cli/generator/templates.js b/local-cli/generator/templates.js deleted file mode 100644 index 54a09613b2b..00000000000 --- a/local-cli/generator/templates.js +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const copyProjectTemplateAndReplace = require('./copyProjectTemplateAndReplace'); -const execSync = require('child_process').execSync; -const fs = require('fs'); -const path = require('path'); - -/** - * @param destPath Create the new project at this path. - * @param newProjectName For example 'AwesomeApp'. - * @param template Template to use, for example 'navigation'. - * @param yarnVersion Version of yarn available on the system, or null if - * yarn is not available. For example '0.18.1'. - */ -function createProjectFromTemplate( - destPath, - newProjectName, - template, - yarnVersion, -) { - // Expand the basic 'HelloWorld' template - copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - 'local-cli', - 'templates', - 'HelloWorld', - ), - destPath, - newProjectName, - ); - - if (template === undefined) { - // No specific template, use just the HelloWorld template above - return; - } - - // Keep the files from the 'HelloWorld' template, and overwrite some of them - // with the specified project template. - // The 'HelloWorld' template contains the native files (these are used by - // all templates) and every other template only contains additional JS code. - // Reason: - // This way we don't have to duplicate the native files in every template. - // If we duplicated them we'd make RN larger and risk that people would - // forget to maintain all the copies so they would go out of sync. - createFromRemoteTemplate(template, destPath, newProjectName, yarnVersion); -} - -/** - * The following formats are supported for the template: - * - 'demo' -> Fetch the package react-native-template-demo from npm - * - git://..., http://..., file://... or any other URL supported by npm - */ -function createFromRemoteTemplate( - template, - destPath, - newProjectName, - yarnVersion, -) { - let installPackage; - let templateName; - if (template.includes('://')) { - // URL, e.g. git://, file:// - installPackage = template; - templateName = template.substr(template.lastIndexOf('/') + 1); - } else { - // e.g 'demo' - installPackage = 'react-native-template-' + template; - templateName = installPackage; - } - - // Check if the template exists - console.log(`Fetching template ${installPackage}...`); - try { - if (yarnVersion) { - execSync(`yarn add ${installPackage} --ignore-scripts`, { - stdio: 'inherit', - }); - } else { - execSync( - `npm install ${installPackage} --save --save-exact --ignore-scripts`, - {stdio: 'inherit'}, - ); - } - const templatePath = path.resolve('node_modules', templateName); - copyProjectTemplateAndReplace(templatePath, destPath, newProjectName, { - // Every template contains a dummy package.json file included - // only for publishing the template to npm. - // We want to ignore this dummy file, otherwise it would overwrite - // our project's package.json file. - ignorePaths: [ - 'package.json', - 'dependencies.json', - 'devDependencies.json', - ], - }); - installTemplateDependencies(templatePath, yarnVersion); - installTemplateDevDependencies(templatePath, yarnVersion); - } finally { - // Clean up the temp files - try { - if (yarnVersion) { - execSync(`yarn remove ${templateName} --ignore-scripts`); - } else { - execSync(`npm uninstall ${templateName} --ignore-scripts`); - } - } catch (err) { - // Not critical but we still want people to know and report - // if this the clean up fails. - console.warn( - `Failed to clean up template temp files in node_modules/${templateName}. ` + - 'This is not a critical error, you can work on your app.', - ); - } - } -} - -function installTemplateDependencies(templatePath, yarnVersion) { - // dependencies.json is a special file that lists additional dependencies - // that are required by this template - const dependenciesJsonPath = path.resolve(templatePath, 'dependencies.json'); - console.log('Adding dependencies for the project...'); - if (!fs.existsSync(dependenciesJsonPath)) { - console.log('No additional dependencies.'); - return; - } - - let dependencies; - try { - dependencies = JSON.parse(fs.readFileSync(dependenciesJsonPath)); - } catch (err) { - throw new Error( - "Could not parse the template's dependencies.json: " + err.message, - ); - } - for (let depName in dependencies) { - const depVersion = dependencies[depName]; - const depToInstall = depName + '@' + depVersion; - console.log('Adding ' + depToInstall + '...'); - if (yarnVersion) { - execSync(`yarn add ${depToInstall}`, {stdio: 'inherit'}); - } else { - execSync(`npm install ${depToInstall} --save --save-exact`, { - stdio: 'inherit', - }); - } - } - console.log("Linking native dependencies into the project's build files..."); - execSync('react-native link', {stdio: 'inherit'}); -} - -function installTemplateDevDependencies(templatePath, yarnVersion) { - // devDependencies.json is a special file that lists additional develop dependencies - // that are required by this template - const devDependenciesJsonPath = path.resolve( - templatePath, - 'devDependencies.json', - ); - console.log('Adding develop dependencies for the project...'); - if (!fs.existsSync(devDependenciesJsonPath)) { - console.log('No additional develop dependencies.'); - return; - } - - let dependencies; - try { - dependencies = JSON.parse(fs.readFileSync(devDependenciesJsonPath)); - } catch (err) { - throw new Error( - "Could not parse the template's devDependencies.json: " + err.message, - ); - } - for (let depName in dependencies) { - const depVersion = dependencies[depName]; - const depToInstall = depName + '@' + depVersion; - console.log('Adding ' + depToInstall + '...'); - if (yarnVersion) { - execSync(`yarn add ${depToInstall} -D`, {stdio: 'inherit'}); - } else { - execSync(`npm install ${depToInstall} --save-dev --save-exact`, { - stdio: 'inherit', - }); - } - } -} - -module.exports = { - createProjectFromTemplate, -}; diff --git a/local-cli/info/info.js b/local-cli/info/info.js deleted file mode 100644 index 9f09de587c8..00000000000 --- a/local-cli/info/info.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const envinfo = require('envinfo'); - -const info = function() { - const args = Array.prototype.slice.call(arguments)[2]; - - try { - envinfo - .run( - { - System: ['OS', 'CPU', 'Memory', 'Shell'], - Binaries: ['Node', 'Yarn', 'npm', 'Watchman'], - IDEs: ['Xcode', 'Android Studio'], - SDKs: ['iOS SDK', 'Android SDK'], - npmPackages: - (typeof args.packages === 'string' && - !args.packages.includes('*')) || - !args.packages - ? ['react', 'react-native'].concat( - (args.packages || '').split(','), - ) - : args.packages, - npmGlobalPackages: '*react-native*', - }, - { - clipboard: !!args.clipboard, - title: 'React Native Environment Info', - }, - ) - .then(console.log) - .catch(err => { - console.log('Error: unable to print environment info'); - console.log(err); - }); - } catch (err) { - console.log('Error: unable to print environment info'); - console.log(err); - } -}; - -module.exports = { - name: 'info', - description: 'Get relevant version info about OS, toolchain and libraries', - options: [ - { - command: '--packages [string]', - description: - 'Which packages from your package.json to include, in addition to the default React Native and React versions.', - }, - { - command: '--clipboard [boolean]', - description: - 'Automagically copy the environment report output to the clipboard', - }, - ], - examples: [ - { - desc: 'Get standard version info', - cmd: 'react-native info', - }, - { - desc: 'Get standard version info & specified package versions', - cmd: 'react-native info --packages jest,eslint', - }, - { - desc: 'Get standard version info & globbed package versions', - cmd: 'react-native info --packages "*react*"', - }, - { - desc: 'Get standard version info & all package versions', - cmd: 'react-native info --packages', - }, - ], - func: info, -}; diff --git a/local-cli/init/init.js b/local-cli/init/init.js deleted file mode 100644 index cbb18953343..00000000000 --- a/local-cli/init/init.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const {createProjectFromTemplate} = require('../generator/templates'); -const execSync = require('child_process').execSync; -const fs = require('fs'); -const minimist = require('minimist'); -const path = require('path'); -const printRunInstructions = require('../generator/printRunInstructions'); -const process = require('process'); -const yarn = require('../util/yarn'); - -/** - * Creates the template for a React Native project given the provided - * parameters: - * @param projectDir Templates will be copied here. - * @param argsOrName Project name or full list of custom arguments - * for the generator. - * @param options Command line options passed from the react-native-cli directly. - * E.g. `{ version: '0.43.0', template: 'navigation' }` - */ -function init(projectDir, argsOrName) { - const args = Array.isArray(argsOrName) - ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose'] - : [argsOrName].concat(process.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp' - - // args array is e.g. ['AwesomeApp', '--verbose', '--template', 'navigation'] - if (!args || args.length === 0) { - console.error('react-native init requires a project name.'); - return; - } - - const newProjectName = args[0]; - const options = minimist(args); - - console.log('Setting up new React Native app in ' + projectDir); - generateProject(projectDir, newProjectName, options); -} - -/** - * Generates a new React Native project based on the template. - * @param Absolute path at which the project folder should be created. - * @param options Command line arguments parsed by minimist. - */ -function generateProject(destinationRoot, newProjectName, options) { - var reactNativePackageJson = require('../../package.json'); - var {peerDependencies} = reactNativePackageJson; - if (!peerDependencies) { - console.error( - "Missing React peer dependency in React Native's package.json. Aborting.", - ); - return; - } - - var reactVersion = peerDependencies.react; - if (!reactVersion) { - console.error( - "Missing React peer dependency in React Native's package.json. Aborting.", - ); - return; - } - - const yarnVersion = - !options.npm && - yarn.getYarnVersionIfAvailable() && - yarn.isGlobalCliUsingYarn(destinationRoot); - - createProjectFromTemplate( - destinationRoot, - newProjectName, - options.template, - yarnVersion, - ); - - if (yarnVersion) { - console.log('Adding React...'); - execSync(`yarn add react@${reactVersion}`, {stdio: 'inherit'}); - } else { - console.log('Installing React...'); - execSync(`npm install react@${reactVersion} --save --save-exact`, { - stdio: 'inherit', - }); - } - if (!options['skip-jest']) { - const jestDeps = `jest babel-jest metro-react-native-babel-preset react-test-renderer@${reactVersion}`; - if (yarnVersion) { - console.log('Adding Jest...'); - execSync(`yarn add ${jestDeps} --dev --exact`, {stdio: 'inherit'}); - } else { - console.log('Installing Jest...'); - execSync(`npm install ${jestDeps} --save-dev --save-exact`, { - stdio: 'inherit', - }); - } - addJestToPackageJson(destinationRoot); - } - printRunInstructions(destinationRoot, newProjectName); -} - -/** - * Add Jest-related stuff to package.json, which was created by the react-native-cli. - */ -function addJestToPackageJson(destinationRoot) { - var packageJSONPath = path.join(destinationRoot, 'package.json'); - var packageJSON = JSON.parse(fs.readFileSync(packageJSONPath)); - - packageJSON.scripts.test = 'jest'; - packageJSON.jest = { - preset: 'react-native', - }; - fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 2)); -} - -module.exports = init; diff --git a/local-cli/install/install.js b/local-cli/install/install.js deleted file mode 100644 index b15a3e6d50f..00000000000 --- a/local-cli/install/install.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const spawnSync = require('child_process').spawnSync; -const log = require('npmlog'); -const PackageManager = require('../util/PackageManager'); -const spawnOpts = { - stdio: 'inherit', - stdin: 'inherit', -}; - -log.heading = 'rnpm-install'; - -function install(args, config) { - const name = args[0]; - - let res = PackageManager.add(name); - - if (res.status) { - process.exit(res.status); - } - - res = spawnSync('react-native', ['link', name], spawnOpts); - - if (res.status) { - process.exit(res.status); - } - - log.info(`Module ${name} has been successfully installed & linked`); -} - -module.exports = { - func: install, - description: 'install and link native dependencies', - name: 'install ', -}; diff --git a/local-cli/install/uninstall.js b/local-cli/install/uninstall.js deleted file mode 100644 index 09639622047..00000000000 --- a/local-cli/install/uninstall.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const spawnSync = require('child_process').spawnSync; -const log = require('npmlog'); -const PackageManager = require('../util/PackageManager'); -const spawnOpts = { - stdio: 'inherit', - stdin: 'inherit', -}; - -log.heading = 'rnpm-install'; - -function uninstall(args, config) { - const name = args[0]; - - var res = spawnSync('react-native', ['unlink', name], spawnOpts); - - if (res.status) { - process.exit(res.status); - } - - res = PackageManager.remove(name); - - if (res.status) { - process.exit(res.status); - } - - log.info(`Module ${name} has been successfully uninstalled & unlinked`); -} - -module.exports = { - func: uninstall, - description: 'uninstall and unlink native dependencies', - name: 'uninstall ', -}; diff --git a/local-cli/library/library.js b/local-cli/library/library.js deleted file mode 100644 index 23a82a1ee20..00000000000 --- a/local-cli/library/library.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const copyAndReplace = require('../util/copyAndReplace'); -const fs = require('fs'); -const isValidPackageName = require('../util/isValidPackageName'); -const path = require('path'); -const walk = require('../util/walk'); - -/** - * Creates a new native library with the given name - */ -function library(argv, config, args) { - if (!isValidPackageName(args.name)) { - return Promise.reject( - args.name + - ' is not a valid name for a project. Please use a valid ' + - 'identifier name (alphanumeric).', - ); - } - - const root = process.cwd(); - const libraries = path.resolve(root, 'Libraries'); - const libraryDest = path.resolve(libraries, args.name); - const source = path.resolve( - 'node_modules', - 'react-native', - 'Libraries', - 'Sample', - ); - - if (!fs.existsSync(libraries)) { - fs.mkdirSync(libraries); - } - - if (fs.existsSync(libraryDest)) { - return Promise.reject( - new Error(`Library already exists in ${libraryDest}`), - ); - } - - walk(source).forEach(f => { - if ( - f.indexOf('project.xcworkspace') !== -1 || - f.indexOf('.xcodeproj/xcuserdata') !== -1 - ) { - return; - } - - const dest = path.relative( - source, - f.replace(/Sample/g, args.name).replace(/^_/, '.'), - ); - copyAndReplace(path.resolve(source, f), path.resolve(libraryDest, dest), { - Sample: args.name, - }); - }); - - console.log('Created library in', libraryDest); - console.log('Next Steps:'); - console.log(' Link your library in Xcode:'); - console.log( - ' https://facebook.github.io/react-native/docs/' + - 'linking-libraries-ios.html#content\n', - ); -} - -module.exports = { - name: 'new-library', - func: library, - description: 'generates a native library bridge', - options: [ - { - command: '--name ', - description: 'name of the library to generate', - default: null, - }, - ], -}; diff --git a/local-cli/link/__fixtures__/Info.plist b/local-cli/link/__fixtures__/Info.plist deleted file mode 100644 index b2e7b96ea03..00000000000 --- a/local-cli/link/__fixtures__/Info.plist +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/local-cli/link/__fixtures__/android/0.17/MainActivity.java b/local-cli/link/__fixtures__/android/0.17/MainActivity.java deleted file mode 100644 index d0794b72b8e..00000000000 --- a/local-cli/link/__fixtures__/android/0.17/MainActivity.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.basic; - -import android.app.Activity; -import android.os.Bundle; -import android.view.KeyEvent; - -import com.facebook.react.LifecycleState; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactRootView; -import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { - - private ReactInstanceManager mReactInstanceManager; - private ReactRootView mReactRootView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mReactRootView = new ReactRootView(this); - - mReactInstanceManager = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setBundleAssetName("index.android.bundle") - .setJSMainModuleName("index.android") - .addPackage(new MainReactPackage()) - .setUseDeveloperSupport(BuildConfig.DEBUG) - .setInitialLifecycleState(LifecycleState.RESUMED) - .build(); - - mReactRootView.startReactApplication(mReactInstanceManager, "Basic", null); - - setContentView(mReactRootView); - } - - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { - mReactInstanceManager.showDevOptionsDialog(); - return true; - } - return super.onKeyUp(keyCode, event); - } - - @Override - public void onBackPressed() { - if (mReactInstanceManager != null) { - mReactInstanceManager.onBackPressed(); - } else { - super.onBackPressed(); - } - } - - @Override - public void invokeDefaultOnBackPressed() { - super.onBackPressed(); - } - - @Override - protected void onPause() { - super.onPause(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onPause(); - } - } - - @Override - protected void onResume() { - super.onResume(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onResume(this, this); - } - } -} diff --git a/local-cli/link/__fixtures__/android/0.17/patchedMainActivity.java b/local-cli/link/__fixtures__/android/0.17/patchedMainActivity.java deleted file mode 100644 index 17c2b278d5b..00000000000 --- a/local-cli/link/__fixtures__/android/0.17/patchedMainActivity.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.basic; - -import android.app.Activity; -import com.oblador.vectoricons.VectorIconsPackage; -import android.os.Bundle; -import android.view.KeyEvent; - -import com.facebook.react.LifecycleState; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactRootView; -import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { - - private ReactInstanceManager mReactInstanceManager; - private ReactRootView mReactRootView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mReactRootView = new ReactRootView(this); - - mReactInstanceManager = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setBundleAssetName("index.android.bundle") - .setJSMainModuleName("index.android") - .addPackage(new MainReactPackage()) - .addPackage(new VectorIconsPackage()) - .setUseDeveloperSupport(BuildConfig.DEBUG) - .setInitialLifecycleState(LifecycleState.RESUMED) - .build(); - - mReactRootView.startReactApplication(mReactInstanceManager, "Basic", null); - - setContentView(mReactRootView); - } - - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { - mReactInstanceManager.showDevOptionsDialog(); - return true; - } - return super.onKeyUp(keyCode, event); - } - - @Override - public void onBackPressed() { - if (mReactInstanceManager != null) { - mReactInstanceManager.onBackPressed(); - } else { - super.onBackPressed(); - } - } - - @Override - public void invokeDefaultOnBackPressed() { - super.onBackPressed(); - } - - @Override - protected void onPause() { - super.onPause(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onPause(); - } - } - - @Override - protected void onResume() { - super.onResume(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onResume(this, this); - } - } -} diff --git a/local-cli/link/__fixtures__/android/0.18/MainActivity.java b/local-cli/link/__fixtures__/android/0.18/MainActivity.java deleted file mode 100644 index c630627442c..00000000000 --- a/local-cli/link/__fixtures__/android/0.18/MainActivity.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.testrn; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage()); - } -} diff --git a/local-cli/link/__fixtures__/android/0.18/patchedMainActivity.java b/local-cli/link/__fixtures__/android/0.18/patchedMainActivity.java deleted file mode 100644 index b099735c418..00000000000 --- a/local-cli/link/__fixtures__/android/0.18/patchedMainActivity.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.testrn; - -import com.facebook.react.ReactActivity; -import com.oblador.vectoricons.VectorIconsPackage; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new VectorIconsPackage()); - } -} diff --git a/local-cli/link/__fixtures__/android/0.20/MainActivity.java b/local-cli/link/__fixtures__/android/0.20/MainActivity.java deleted file mode 100644 index 642f4259c1e..00000000000 --- a/local-cli/link/__fixtures__/android/0.20/MainActivity.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.myawesomeproject; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); - } -} diff --git a/local-cli/link/__fixtures__/android/build.gradle b/local-cli/link/__fixtures__/android/build.gradle deleted file mode 100644 index f206d053ecd..00000000000 --- a/local-cli/link/__fixtures__/android/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:27.1.1" - implementation "com.facebook.react:react-native:+" -} diff --git a/local-cli/link/__fixtures__/android/patchedBuild.gradle b/local-cli/link/__fixtures__/android/patchedBuild.gradle deleted file mode 100644 index f5cb4a24a8c..00000000000 --- a/local-cli/link/__fixtures__/android/patchedBuild.gradle +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -dependencies { - implementation project(':test') - implementation(project(':test2')) { - exclude(group: 'org.unwanted', module: 'test10') - } - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:27.1.1" - implementation "com.facebook.react:react-native:+" -} diff --git a/local-cli/link/__fixtures__/android/patchedSettings.gradle b/local-cli/link/__fixtures__/android/patchedSettings.gradle deleted file mode 100644 index 2b311263ad8..00000000000 --- a/local-cli/link/__fixtures__/android/patchedSettings.gradle +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -rootProject.name = 'TestRN' - -include ':app' -include ':test' -project(':test').projectDir = new File(rootProject.projectDir, '../node_modules/test/android') diff --git a/local-cli/link/__fixtures__/android/settings.gradle b/local-cli/link/__fixtures__/android/settings.gradle deleted file mode 100644 index 5bb3d945cc1..00000000000 --- a/local-cli/link/__fixtures__/android/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -rootProject.name = 'TestRN' - -include ':app' diff --git a/local-cli/link/__fixtures__/linearGradient.pbxproj b/local-cli/link/__fixtures__/linearGradient.pbxproj deleted file mode 100644 index ca87c2e43e9..00000000000 --- a/local-cli/link/__fixtures__/linearGradient.pbxproj +++ /dev/null @@ -1,258 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - BBD49E3F1AC8DEF000610F8E /* BVLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = BBD49E3A1AC8DEF000610F8E /* BVLinearGradient.m */; }; - BBD49E401AC8DEF000610F8E /* BVLinearGradientManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BBD49E3C1AC8DEF000610F8E /* BVLinearGradientManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBVLinearGradient.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BBD49E391AC8DEF000610F8E /* BVLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVLinearGradient.h; sourceTree = ""; }; - BBD49E3A1AC8DEF000610F8E /* BVLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVLinearGradient.m; sourceTree = ""; }; - BBD49E3B1AC8DEF000610F8E /* BVLinearGradientManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVLinearGradientManager.h; sourceTree = ""; }; - BBD49E3C1AC8DEF000610F8E /* BVLinearGradientManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVLinearGradientManager.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libBVLinearGradient.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - BBD49E391AC8DEF000610F8E /* BVLinearGradient.h */, - BBD49E3A1AC8DEF000610F8E /* BVLinearGradient.m */, - BBD49E3B1AC8DEF000610F8E /* BVLinearGradientManager.h */, - BBD49E3C1AC8DEF000610F8E /* BVLinearGradientManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* BVLinearGradient */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "BVLinearGradient" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = BVLinearGradient; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libBVLinearGradient.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "BVLinearGradient" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* BVLinearGradient */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BBD49E3F1AC8DEF000610F8E /* BVLinearGradient.m in Sources */, - BBD49E401AC8DEF000610F8E /* BVLinearGradientManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../React/**", - "$(SRCROOT)/../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = BVLinearGradient; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../React/**", - "$(SRCROOT)/../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = BVLinearGradient; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "BVLinearGradient" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "BVLinearGradient" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/local-cli/link/__fixtures__/pods/PodfileSimple b/local-cli/link/__fixtures__/pods/PodfileSimple deleted file mode 100644 index 3e42c25278e..00000000000 --- a/local-cli/link/__fixtures__/pods/PodfileSimple +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' - -target 'Testing' do - pod 'TestPod', '~> 3.1' - - # test should point to this line -end diff --git a/local-cli/link/__fixtures__/pods/PodfileWithFunction b/local-cli/link/__fixtures__/pods/PodfileWithFunction deleted file mode 100644 index 13b70fb0a90..00000000000 --- a/local-cli/link/__fixtures__/pods/PodfileWithFunction +++ /dev/null @@ -1,30 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' - -target 'none' do - pod 'React', - :path => "../node_modules/react-native", - :subspecs => [ - "Core", - "ART", - "RCTActionSheet", - "RCTAnimation", - "RCTCameraRoll", - "RCTGeolocation", - "RCTImage", - "RCTNetwork", - "RCTText", - "RCTVibration", - "RCTWebSocket", - "DevSupport", - "BatchedBridge" - ] - - pod 'Yoga', - :path => "../node_modules/react-native/ReactCommon/yoga" - - # test should point to this line - post_install do |installer| - - end -end diff --git a/local-cli/link/__fixtures__/pods/PodfileWithMarkers b/local-cli/link/__fixtures__/pods/PodfileWithMarkers deleted file mode 100644 index bf27d33689b..00000000000 --- a/local-cli/link/__fixtures__/pods/PodfileWithMarkers +++ /dev/null @@ -1,34 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -# platform :ios, '9.0' - -target 'None' do - # Uncomment the next line if you're using Swift or would like to use dynamic frameworks - # use_frameworks! - # Your 'node_modules' directory is probably in the root of your project, # but if not, adjust the `:path` accordingly - pod 'React', :path => '../node_modules/react-native', :subspecs => [ - 'Core', - 'RCTText', - 'RCTNetwork', - 'BatchedBridge', - 'RCTImage', - 'RCTWebSocket', # needed for debugging - # Add any other subspecs you want to use in your project - ] - - # Add new pods below this line - - # test should point to this line - target 'NoneTests' do - inherit! :search_paths - # Pods for testing - end -end - -target 'Second' do - - target 'NoneUITests' do - inherit! :search_paths - # Add new pods below this line - end - -end \ No newline at end of file diff --git a/local-cli/link/__fixtures__/pods/PodfileWithTarget b/local-cli/link/__fixtures__/pods/PodfileWithTarget deleted file mode 100644 index 5887ababea7..00000000000 --- a/local-cli/link/__fixtures__/pods/PodfileWithTarget +++ /dev/null @@ -1,32 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -# platform :ios, '9.0' - -target 'None' do - # Uncomment the next line if you're using Swift or would like to use dynamic frameworks - # use_frameworks! - # Your 'node_modules' directory is probably in the root of your project, # but if not, adjust the `:path` accordingly - pod 'React', :path => '../node_modules/react-native', :subspecs => [ - 'Core', - 'RCTText', - 'RCTNetwork', - 'BatchedBridge', - 'RCTImage', - 'RCTWebSocket', # needed for debugging - # Add any other subspecs you want to use in your project - ] - - # Explicitly include Yoga if you are using RN >= 0.42.0 - pod "Yoga", :path => "../node_modules/react-native/ReactCommon/yoga" - - # test should point to this line - target 'NoneTests' do - inherit! :search_paths - # Pods for testing - end - - target 'NoneUITests' do - inherit! :search_paths - # Pods for testing - end - -end \ No newline at end of file diff --git a/local-cli/link/__fixtures__/project.pbxproj b/local-cli/link/__fixtures__/project.pbxproj deleted file mode 100644 index 428aa40c9ca..00000000000 --- a/local-cli/link/__fixtures__/project.pbxproj +++ /dev/null @@ -1,1011 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* BasicTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* BasicTests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = Basic; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; - remoteInfo = "RCTImage-tvOS"; - }; - 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28471D9B043800D4039D; - remoteInfo = "RCTLinking-tvOS"; - }; - 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28541D9B044C00D4039D; - remoteInfo = "RCTNetwork-tvOS"; - }; - 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28611D9B046600D4039D; - remoteInfo = "RCTSettings-tvOS"; - }; - 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A287B1D9B048500D4039D; - remoteInfo = "RCTText-tvOS"; - }; - 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28881D9B049200D4039D; - remoteInfo = "RCTWebSocket-tvOS"; - }; - 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "React-tvOS"; - }; - 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C059A1DE3340900C268FA; - remoteInfo = yoga; - }; - 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C06751DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; - remoteInfo = jschelpers; - }; - 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; - remoteInfo = "jschelpers-tvOS"; - }; - 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* BasicTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BasicTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* BasicTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BasicTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* Basic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Basic.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Basic/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Basic/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Basic/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Basic/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Basic/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* BasicTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* BasicTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = BasicTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* Basic */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = Basic; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - 3DAD3EA31DF850E9000B6D8A /* libReact.a */, - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, - ); - name = Products; - sourceTree = ""; - }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { - isa = PBXGroup; - children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - AD9196DA1CABA83E000E8D91 /* NestedGroup */, - 13B07FAE1A68108700A75B9A /* Basic */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* BasicTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* Basic.app */, - 00E356EE1AD99517003FC87E /* BasicTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - AD9196DA1CABA83E000E8D91 /* NestedGroup */ = { - isa = PBXGroup; - children = ( - AD9196DB1CABA844000E8D91 /* Libraries */, - ); - name = NestedGroup; - sourceTree = ""; - }; - AD9196DB1CABA844000E8D91 /* Libraries */ = { - isa = PBXGroup; - children = ( - ); - name = Libraries; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* BasicTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "BasicTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = BasicTests; - productName = BasicTests; - productReference = 00E356EE1AD99517003FC87E /* BasicTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* Basic */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Basic" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Basic; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* Basic.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Basic" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; - ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* Basic */, - 00E356ED1AD99517003FC87E /* BasicTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTImage-tvOS.a"; - remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-tvOS.a"; - remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTNetwork-tvOS.a"; - remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-tvOS.a"; - remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTText-tvOS.a"; - remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTWebSocket-tvOS.a"; - remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; - remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* BasicTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* Basic */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = Basic; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = BasicTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - INFOPLIST_FILE = BasicTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - INFOPLIST_FILE = Basic/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = Basic; - VERSIONING_SYSTEM = "apple-generic"; - HEADER_SEARCH_PATHS = "$(inherited)"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - INFOPLIST_FILE = Basic/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = Basic; - VERSIONING_SYSTEM = "apple-generic"; - HEADER_SEARCH_PATHS = "$(inherited)"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "BasicTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Basic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Basic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/local-cli/link/__tests__/android/applyPatch-test.js b/local-cli/link/__tests__/android/applyPatch-test.js deleted file mode 100644 index aea686d084d..00000000000 --- a/local-cli/link/__tests__/android/applyPatch-test.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const applyParams = require('../../android/patches/applyParams'); - -describe('applyParams', () => { - it('apply params to the string', () => { - expect(applyParams('${foo}', {foo: 'foo'}, 'react-native')).toEqual( - 'getResources().getString(R.string.reactNative_foo)', - ); - }); - - it('use null if no params provided', () => { - expect(applyParams('${foo}', {}, 'react-native')).toEqual('null'); - }); -}); diff --git a/local-cli/link/__tests__/android/isInstalled-test.js b/local-cli/link/__tests__/android/isInstalled-test.js deleted file mode 100644 index 28bc43f11fb..00000000000 --- a/local-cli/link/__tests__/android/isInstalled-test.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const isInstalled = require('../../android/isInstalled'); - -const projectConfig = { - buildGradlePath: path.join( - __dirname, - '../../__fixtures__/android/patchedBuild.gradle', - ), -}; - -describe('android::isInstalled', () => { - it('should return true when project is already in build.gradle', () => { - expect(isInstalled(projectConfig, 'test')).toBeTruthy(); - expect(isInstalled(projectConfig, 'test2')).toBeTruthy(); - }); - - it('should return false when project is not in build.gradle', () => - expect(isInstalled(projectConfig, 'test3')).toBeFalsy()); -}); diff --git a/local-cli/link/__tests__/android/makeBuildPatch-test.js b/local-cli/link/__tests__/android/makeBuildPatch-test.js deleted file mode 100644 index e630f766434..00000000000 --- a/local-cli/link/__tests__/android/makeBuildPatch-test.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const makeBuildPatch = require('../../android/patches/makeBuildPatch'); -const normalizeProjectName = require('../../android/patches/normalizeProjectName'); - -const name = 'test'; -const scopedName = '@scoped/test'; -const normalizedScopedName = normalizeProjectName('@scoped/test'); - -describe('makeBuildPatch', () => { - it('should build a patch function', () => { - expect(Object.prototype.toString(makeBuildPatch(name))).toBe( - '[object Object]', - ); - }); - - it('should make a correct patch', () => { - const {patch} = makeBuildPatch(name); - expect(patch).toBe(` implementation project(':${name}')\n`); - }); - - it('should make a correct install check pattern', () => { - const {installPattern} = makeBuildPatch(name); - const match = `/\\s{4}(implementation)(\\(|\\s)(project)\\(\\':${name}\\'\\)(\\)|\\s)/`; - expect(installPattern.toString()).toBe(match); - }); -}); - -describe('makeBuildPatchWithScopedPackage', () => { - it('should make a correct patch', () => { - const {patch} = makeBuildPatch(scopedName); - expect(patch).toBe( - ` implementation project(':${normalizedScopedName}')\n`, - ); - }); - - it('should make a correct install check pattern', () => { - const {installPattern} = makeBuildPatch(scopedName); - const match = `/\\s{4}(implementation)(\\(|\\s)(project)\\(\\':${normalizedScopedName}\\'\\)(\\)|\\s)/`; - expect(installPattern.toString()).toBe(match); - }); -}); diff --git a/local-cli/link/__tests__/android/makeImportPatch-test.js b/local-cli/link/__tests__/android/makeImportPatch-test.js deleted file mode 100644 index 8a5d32358f1..00000000000 --- a/local-cli/link/__tests__/android/makeImportPatch-test.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const makeImportPatch = require('../../android/patches/makeImportPatch'); - -const packageImportPath = 'import some.example.project'; - -describe('makeImportPatch', () => { - it('should build a patch', () => { - expect(Object.prototype.toString(makeImportPatch(packageImportPath))).toBe( - '[object Object]', - ); - }); - - it('MainActivity contains a correct import patch', () => { - const {patch} = makeImportPatch(packageImportPath); - - expect(patch).toBe('\n' + packageImportPath); - }); -}); diff --git a/local-cli/link/__tests__/android/makePackagePatch-test.js b/local-cli/link/__tests__/android/makePackagePatch-test.js deleted file mode 100644 index 6dada45081f..00000000000 --- a/local-cli/link/__tests__/android/makePackagePatch-test.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const makePackagePatch = require('../../android/patches/makePackagePatch'); -const applyParams = require('../../android/patches/applyParams'); - -const packageInstance = "new SomeLibrary(${foo}, ${bar}, 'something')"; -const name = 'some-library'; -const params = { - foo: 'foo', - bar: 'bar', -}; - -describe('makePackagePatch@0.20', () => { - it('should build a patch', () => { - const packagePatch = makePackagePatch(packageInstance, params, name); - expect(Object.prototype.toString(packagePatch)).toBe('[object Object]'); - }); - - it('MainActivity contains a correct 0.20 import patch', () => { - const {patch} = makePackagePatch(packageInstance, params, name); - const processedInstance = applyParams(packageInstance, params, name); - - expect(patch).toBe(',\n ' + processedInstance); - }); -}); diff --git a/local-cli/link/__tests__/android/makeSettingsPatch-test.js b/local-cli/link/__tests__/android/makeSettingsPatch-test.js deleted file mode 100644 index 6df7b0dd969..00000000000 --- a/local-cli/link/__tests__/android/makeSettingsPatch-test.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const makeSettingsPatch = require('../../android/patches/makeSettingsPatch'); -const normalizeProjectName = require('../../android/patches/normalizeProjectName'); - -const name = 'test'; -const scopedName = '@scoped/test'; -const normalizedScopedName = normalizeProjectName('@scoped/test'); -const projectConfig = { - sourceDir: '/home/project/android/app', - settingsGradlePath: '/home/project/android/settings.gradle', -}; -const dependencyConfig = { - sourceDir: `/home/project/node_modules/${name}/android`, -}; -const scopedDependencyConfig = { - sourceDir: `/home/project/node_modules/${scopedName}/android`, -}; - -describe('makeSettingsPatch', () => { - it('should build a patch function', () => { - expect( - Object.prototype.toString( - makeSettingsPatch(name, dependencyConfig, projectConfig), - ), - ).toBe('[object Object]'); - }); - - it('should make a correct patch', () => { - const projectDir = path.relative( - path.dirname(projectConfig.settingsGradlePath), - dependencyConfig.sourceDir, - ); - - const {patch} = makeSettingsPatch(name, dependencyConfig, projectConfig); - - expect(patch).toBe( - `include ':${name}'\n` + - `project(':${name}').projectDir = ` + - `new File(rootProject.projectDir, '${projectDir}')\n`, - ); - }); -}); - -describe('makeSettingsPatchWithScopedPackage', () => { - it('should build a patch function', () => { - expect( - Object.prototype.toString( - makeSettingsPatch(scopedName, scopedDependencyConfig, projectConfig), - ), - ).toBe('[object Object]'); - }); - - it('should make a correct patch', () => { - const projectDir = path.relative( - path.dirname(projectConfig.settingsGradlePath), - scopedDependencyConfig.sourceDir, - ); - - const {patch} = makeSettingsPatch( - scopedName, - scopedDependencyConfig, - projectConfig, - ); - - expect(patch).toBe( - `include ':${normalizedScopedName}'\n` + - `project(':${normalizedScopedName}').projectDir = ` + - `new File(rootProject.projectDir, '${projectDir}')\n`, - ); - }); -}); diff --git a/local-cli/link/__tests__/android/makeStringsPatch-test.js b/local-cli/link/__tests__/android/makeStringsPatch-test.js deleted file mode 100644 index 4ea28164032..00000000000 --- a/local-cli/link/__tests__/android/makeStringsPatch-test.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const makeStringsPatch = require('../../android/patches/makeStringsPatch'); - -describe('makeStringsPatch', () => { - it('should export a patch with element', () => { - const params = { - keyA: 'valueA', - }; - - expect(makeStringsPatch(params, 'module').patch).toContain( - 'valueA', - ); - }); - - it('should export an empty patch if no params given', () => { - expect(makeStringsPatch({}, 'module').patch).toBe(''); - }); -}); diff --git a/local-cli/link/__tests__/android/normalizeProjectName-test.js b/local-cli/link/__tests__/android/normalizeProjectName-test.js deleted file mode 100644 index 93f425fd22a..00000000000 --- a/local-cli/link/__tests__/android/normalizeProjectName-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const normalizeProjectName = require('../../android/patches/normalizeProjectName'); - -const name = 'test'; -const scopedName = '@scoped/test'; - -describe('normalizeProjectName', () => { - it('should replace slashes with underscores', () => { - expect(normalizeProjectName(name)).toBe('test'); - expect(normalizeProjectName(scopedName)).toBe('@scoped_test'); - }); -}); diff --git a/local-cli/link/__tests__/getDependencyConfig-test.js b/local-cli/link/__tests__/getDependencyConfig-test.js deleted file mode 100644 index 1e3813d067b..00000000000 --- a/local-cli/link/__tests__/getDependencyConfig-test.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const getDependencyConfig = require('../getDependencyConfig'); - -describe('getDependencyConfig', () => { - it("should return an array of dependencies' rnpm config", () => { - const config = { - getDependencyConfig: jest.fn(), - }; - - expect(Array.isArray(getDependencyConfig(config, ['abcd']))).toBeTruthy(); - expect(config.getDependencyConfig.mock.calls.length).toEqual(1); - }); - - it('should filter out invalid react-native projects', () => { - const config = { - getDependencyConfig: jest.fn().mockImplementation(() => { - throw new Error('Cannot require'); - }), - }; - - expect(getDependencyConfig(config, ['abcd'])).toEqual([]); - }); -}); diff --git a/local-cli/link/__tests__/getProjectDependencies-test.js b/local-cli/link/__tests__/getProjectDependencies-test.js deleted file mode 100644 index 2437e1cee3e..00000000000 --- a/local-cli/link/__tests__/getProjectDependencies-test.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - * @format - */ - -'use strict'; - -const getProjectDependencies = require('../getProjectDependencies'); -const path = require('path'); - -const CWD = path.resolve(__dirname, '../../..'); - -describe('getProjectDependencies', () => { - beforeEach(() => { - jest.resetModules(); - }); - it('should return an array of project dependencies', () => { - jest.setMock(path.join(CWD, './package.json'), { - dependencies: {lodash: '^6.0.0', 'react-native': '^16.0.0'}, - }); - - expect(getProjectDependencies(CWD)).toEqual(['lodash']); - }); - - it('should return an empty array when no dependencies set', () => { - jest.setMock(path.join(CWD, './package.json'), {}); - expect(getProjectDependencies(CWD)).toEqual([]); - }); -}); diff --git a/local-cli/link/__tests__/groupFilesByType-test.js b/local-cli/link/__tests__/groupFilesByType-test.js deleted file mode 100644 index 173857927aa..00000000000 --- a/local-cli/link/__tests__/groupFilesByType-test.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const groupFilesByType = require('../groupFilesByType'); - -describe('groupFilesByType', () => { - it('should group files by its type', () => { - const fonts = ['fonts/a.ttf', 'fonts/b.ttf']; - const images = ['images/a.jpg', 'images/c.jpeg']; - - const groupedFiles = groupFilesByType(fonts.concat(images)); - - expect(groupedFiles.font).toEqual(fonts); - expect(groupedFiles.image).toEqual(images); - }); -}); diff --git a/local-cli/link/__tests__/ios/addFileToProject-test.js b/local-cli/link/__tests__/ios/addFileToProject-test.js deleted file mode 100644 index 47605e5366e..00000000000 --- a/local-cli/link/__tests__/ios/addFileToProject-test.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const addFileToProject = require('../../ios/addFileToProject'); -const _ = require('lodash'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::addFileToProject', () => { - beforeEach(() => { - project.parseSync(); - }); - - xit('should add file to a project', () => { - expect( - _.includes( - Object.keys(project.pbxFileReferenceSection()), - addFileToProject(project, '../../__fixtures__/linearGradient.pbxproj') - .fileRef, - ), - ).toBeTruthy(); - }); -}); diff --git a/local-cli/link/__tests__/ios/addProjectToLibraries-test.js b/local-cli/link/__tests__/ios/addProjectToLibraries-test.js deleted file mode 100644 index 9a921c21787..00000000000 --- a/local-cli/link/__tests__/ios/addProjectToLibraries-test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const PbxFile = require('xcode/lib/pbxFile'); -const addProjectToLibraries = require('../../ios/addProjectToLibraries'); -const last = require('lodash').last; - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::addProjectToLibraries', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should append file to Libraries group', () => { - const file = new PbxFile('fakePath'); - const libraries = project.pbxGroupByName('Libraries'); - - addProjectToLibraries(libraries, file); - - const child = last(libraries.children); - - expect(child.comment).toBe(file.basename); - }); -}); diff --git a/local-cli/link/__tests__/ios/addSharedLibraries-test.js b/local-cli/link/__tests__/ios/addSharedLibraries-test.js deleted file mode 100644 index c4a262015c0..00000000000 --- a/local-cli/link/__tests__/ios/addSharedLibraries-test.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const addSharedLibraries = require('../../ios/addSharedLibraries'); -const getGroup = require('../../ios/getGroup'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::addSharedLibraries', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should automatically create Frameworks group', () => { - expect(getGroup(project, 'Frameworks')).toBeNull(); - addSharedLibraries(project, ['libz.tbd']); - expect(getGroup(project, 'Frameworks')).not.toBeNull(); - }); - - it('should add shared libraries to project', () => { - addSharedLibraries(project, ['libz.tbd']); - - const frameworksGroup = getGroup(project, 'Frameworks'); - expect(frameworksGroup.children.length).toEqual(1); - expect(frameworksGroup.children[0].comment).toEqual('libz.tbd'); - - addSharedLibraries(project, ['MessageUI.framework']); - expect(frameworksGroup.children.length).toEqual(2); - }); - - it('should not add duplicate libraries to project', () => { - addSharedLibraries(project, ['libz.tbd']); - addSharedLibraries(project, ['libz.tbd']); - - const frameworksGroup = getGroup(project, 'Frameworks'); - expect(frameworksGroup.children.length).toEqual(1); - }); -}); diff --git a/local-cli/link/__tests__/ios/createGroup-test.js b/local-cli/link/__tests__/ios/createGroup-test.js deleted file mode 100644 index 6100b92d02a..00000000000 --- a/local-cli/link/__tests__/ios/createGroup-test.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const createGroup = require('../../ios/createGroup'); -const getGroup = require('../../ios/getGroup'); -const last = require('lodash').last; - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::createGroup', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should create a group with given name', () => { - const createdGroup = createGroup(project, 'Resources'); - expect(createdGroup.name).toBe('Resources'); - }); - - it('should attach group to main project group', () => { - const createdGroup = createGroup(project, 'Resources'); - const mainGroup = getGroup(project); - - expect(last(mainGroup.children).comment).toBe(createdGroup.name); - }); - - it('should create a nested group with given path', () => { - const createdGroup = createGroup(project, 'NewGroup/NewNestedGroup'); - const outerGroup = getGroup(project, 'NewGroup'); - - expect(last(outerGroup.children).comment).toBe(createdGroup.name); - }); - - it('should-not create already created groups', () => { - const createdGroup = createGroup(project, 'Libraries/NewNestedGroup'); - const outerGroup = getGroup(project, 'Libraries'); - const mainGroup = getGroup(project); - - expect( - mainGroup.children.filter(group => group.comment === 'Libraries').length, - ).toBe(1); - expect(last(outerGroup.children).comment).toBe(createdGroup.name); - }); -}); diff --git a/local-cli/link/__tests__/ios/getBuildProperty-test.js b/local-cli/link/__tests__/ios/getBuildProperty-test.js deleted file mode 100644 index ff5c622ebab..00000000000 --- a/local-cli/link/__tests__/ios/getBuildProperty-test.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const getBuildProperty = require('../../ios/getBuildProperty'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::getBuildProperty', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return build property from main target', () => { - const plistPath = getBuildProperty(project, 'INFOPLIST_FILE'); - expect(plistPath).toEqual('Basic/Info.plist'); - }); -}); diff --git a/local-cli/link/__tests__/ios/getGroup-test.js b/local-cli/link/__tests__/ios/getGroup-test.js deleted file mode 100644 index a08434d263c..00000000000 --- a/local-cli/link/__tests__/ios/getGroup-test.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const getGroup = require('../../ios/getGroup'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::getGroup', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return a top-level group', () => { - const group = getGroup(project, 'Libraries'); - expect(group.children.length > 0).toBeTruthy(); - expect(group.name).toBe('Libraries'); - }); - - it('should return nested group when specified', () => { - const group = getGroup(project, 'NestedGroup/Libraries'); - expect(group.children.length).toBe(0); // our test nested Libraries is empty - expect(group.name).toBe('Libraries'); - }); - - it('should return null when no group found', () => { - const group = getGroup(project, 'I-Dont-Exist'); - expect(group).toBeNull(); - }); - - it('should return top-level group when name not specified', () => { - const mainGroupId = project.getFirstProject().firstProject.mainGroup; - const mainGroup = project.getPBXGroupByKey(mainGroupId); - const group = getGroup(project); - expect(group).toEqual(mainGroup); - }); -}); diff --git a/local-cli/link/__tests__/ios/getHeaderSearchPath-test.js b/local-cli/link/__tests__/ios/getHeaderSearchPath-test.js deleted file mode 100644 index 5518346074d..00000000000 --- a/local-cli/link/__tests__/ios/getHeaderSearchPath-test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const getHeaderSearchPath = require('../../ios/getHeaderSearchPath'); -const path = require('path'); - -const SRC_DIR = path.join('react-native-project', 'ios'); - -describe('ios::getHeaderSearchPath', () => { - /** - * See https://github.com/Microsoft/react-native-code-push - */ - it('should return correct path when all headers are in root folder', () => { - const files = [ - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'Gradient.h', - ), - path.join('react-native-project', 'node_modules', 'package', 'Manager.h'), - ]; - - const searchPath = getHeaderSearchPath(SRC_DIR, files); - - expect(searchPath).toBe( - `"${['$(SRCROOT)', '..', 'node_modules', 'package'].join(path.sep)}"`, - ); - }); - - /** - * See https://github.com/facebook/react-native/tree/master/React - */ - it('should return correct path when headers are in multiple folders', () => { - const files = [ - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'src', - 'folderA', - 'Gradient.h', - ), - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'src', - 'folderB', - 'Manager.h', - ), - ]; - - const searchPath = getHeaderSearchPath(SRC_DIR, files); - - expect(searchPath).toBe( - `"${['$(SRCROOT)', '..', 'node_modules', 'package', 'src'].join( - path.sep, - )}/**"`, - ); - }); - - /** - * This is just to make sure the above two does not collide with each other - */ - it('should return correct path when headers are in root and nested folders', () => { - const files = [ - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'src', - 'folderA', - 'Gradient.h', - ), - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'src', - 'folderB', - 'Manager.h', - ), - path.join( - 'react-native-project', - 'node_modules', - 'package', - 'src', - 'Manager.h', - ), - ]; - - const searchPath = getHeaderSearchPath(SRC_DIR, files); - - expect(searchPath).toBe( - `"${['$(SRCROOT)', '..', 'node_modules', 'package', 'src'].join( - path.sep, - )}/**"`, - ); - }); -}); diff --git a/local-cli/link/__tests__/ios/getHeadersInFolder-test.js b/local-cli/link/__tests__/ios/getHeadersInFolder-test.js deleted file mode 100644 index d590d6c7360..00000000000 --- a/local-cli/link/__tests__/ios/getHeadersInFolder-test.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const getHeadersInFolder = require('../../ios/getHeadersInFolder'); - -describe('ios::getHeadersInFolder', () => { - xit('should return an array of all headers in given folder', () => { - jest.setMock({ - 'FileA.h': '', - 'FileB.h': '', - }); - - const foundHeaders = getHeadersInFolder(process.cwd()); - - expect(foundHeaders.length).toBe(2); - - getHeadersInFolder(process.cwd()).forEach(headerPath => { - expect(headerPath).to.contain(process.cwd()); - }); - }); - - xit('should ignore all headers in Pods, Examples & node_modules', () => { - jest.setMock({ - 'FileA.h': '', - 'FileB.h': '', - Pods: { - 'FileC.h': '', - }, - Examples: { - 'FileD.h': '', - }, - node_modules: { - 'FileE.h': '', - }, - }); - - expect(getHeadersInFolder(process.cwd()).length).to.equals(2); - }); -}); diff --git a/local-cli/link/__tests__/ios/getPlist-test.js b/local-cli/link/__tests__/ios/getPlist-test.js deleted file mode 100644 index f229af7a4e3..00000000000 --- a/local-cli/link/__tests__/ios/getPlist-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const getPlist = require('../../ios/getPlist'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::getPlist', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return null when `.plist` file missing', () => { - const plistPath = getPlist(project, process.cwd()); - expect(plistPath).toBeNull(); - }); - - // @todo - Happy scenario -}); diff --git a/local-cli/link/__tests__/ios/getPlistPath-test.js b/local-cli/link/__tests__/ios/getPlistPath-test.js deleted file mode 100644 index ae2de5914f1..00000000000 --- a/local-cli/link/__tests__/ios/getPlistPath-test.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const getPlistPath = require('../../ios/getPlistPath'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::getPlistPath', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return path without Xcode $(SRCROOT)', () => { - const plistPath = getPlistPath(project, '/'); - expect(plistPath).toBe(path.normalize('/Basic/Info.plist')); - }); -}); diff --git a/local-cli/link/__tests__/ios/getTargets-test.js b/local-cli/link/__tests__/ios/getTargets-test.js deleted file mode 100644 index 0f1142b5efa..00000000000 --- a/local-cli/link/__tests__/ios/getTargets-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const getTargets = require('../../ios/getTargets'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::getTargets', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return an array of project targets', () => { - const targets = getTargets(project); - expect(targets.length).toBe(2); - expect(targets[0].name).toContain('Basic.app'); - expect(targets[1].name).toContain('BasicTests.xctest'); - }); -}); diff --git a/local-cli/link/__tests__/ios/hasLibraryImported-test.js b/local-cli/link/__tests__/ios/hasLibraryImported-test.js deleted file mode 100644 index b36fbd78d6c..00000000000 --- a/local-cli/link/__tests__/ios/hasLibraryImported-test.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const hasLibraryImported = require('../../ios/hasLibraryImported'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::hasLibraryImported', () => { - beforeEach(() => { - project.parseSync(); - }); - - it('should return true if project has been already imported', () => { - const libraries = project.pbxGroupByName('Libraries'); - expect(hasLibraryImported(libraries, 'React.xcodeproj')).toBeTruthy(); - }); - - it('should return false if project is not imported', () => { - const libraries = project.pbxGroupByName('Libraries'); - expect(hasLibraryImported(libraries, 'ACME.xcodeproj')).toBeFalsy(); - }); -}); diff --git a/local-cli/link/__tests__/ios/isInstalled-test.js b/local-cli/link/__tests__/ios/isInstalled-test.js deleted file mode 100644 index 5998c2e5184..00000000000 --- a/local-cli/link/__tests__/ios/isInstalled-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const isInstalled = require('../../ios/isInstalled'); - -const baseProjectConfig = { - pbxprojPath: path.join(__dirname, '../../__fixtures__/project.pbxproj'), - libraryFolder: 'Libraries', -}; - -describe('ios::isInstalled', () => { - it('should return true when .xcodeproj in Libraries', () => { - const dependencyConfig = {projectName: 'React.xcodeproj'}; - expect(isInstalled(baseProjectConfig, dependencyConfig)).toBeTruthy(); - }); - - it('should return false when .xcodeproj not in Libraries', () => { - const dependencyConfig = {projectName: 'Missing.xcodeproj'}; - expect(isInstalled(baseProjectConfig, dependencyConfig)).toBeFalsy(); - }); - - it('should return false when `LibraryFolder` is missing', () => { - const dependencyConfig = {projectName: 'React.xcodeproj'}; - const projectConfig = Object.assign({}, baseProjectConfig, { - libraryFolder: 'Missing', - }); - expect(isInstalled(projectConfig, dependencyConfig)).toBeFalsy(); - }); -}); diff --git a/local-cli/link/__tests__/ios/mapHeaderSearchPaths-test.js b/local-cli/link/__tests__/ios/mapHeaderSearchPaths-test.js deleted file mode 100644 index 0be5740c2c9..00000000000 --- a/local-cli/link/__tests__/ios/mapHeaderSearchPaths-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const mapHeaderSearchPaths = require('../../ios/mapHeaderSearchPaths'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::mapHeaderSearchPaths', () => { - beforeEach(() => { - project.parseSync(); - }); - - /** - * Based on the fixtures, our assumption is that this function - * has to be executed two times. - */ - it('should be called twice', () => { - const callback = jest.fn(); - mapHeaderSearchPaths(project, callback); - - expect(callback.mock.calls.length).toBe(2); - }); - - it('calls the function with an array of paths, given a project with one', () => { - const callback = jest.fn(); - mapHeaderSearchPaths(project, callback); - - const paths = callback.mock.calls[0][0]; - - expect(paths instanceof Array).toBe(true); - expect(paths.length).toBe(1); - expect(paths[0]).toBe('"$(inherited)"'); - }); -}); diff --git a/local-cli/link/__tests__/ios/removeProjectFromLibraries-test.js b/local-cli/link/__tests__/ios/removeProjectFromLibraries-test.js deleted file mode 100644 index 1abf072a1ff..00000000000 --- a/local-cli/link/__tests__/ios/removeProjectFromLibraries-test.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const PbxFile = require('xcode/lib/pbxFile'); -const addProjectToLibraries = require('../../ios/addProjectToLibraries'); -const removeProjectFromLibraries = require('../../ios/removeProjectFromLibraries'); -const last = require('lodash').last; -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::removeProjectFromLibraries', () => { - beforeEach(() => { - project.parseSync(); - - addProjectToLibraries( - project.pbxGroupByName('Libraries'), - new PbxFile('fakePath'), - ); - }); - - it('should remove file from Libraries group', () => { - const file = new PbxFile('fakePath'); - const libraries = project.pbxGroupByName('Libraries'); - - removeProjectFromLibraries(libraries, file); - - const child = last(libraries.children); - - expect(child.comment).not.toBe(file.basename); - }); -}); diff --git a/local-cli/link/__tests__/ios/removeProjectFromProject-test.js b/local-cli/link/__tests__/ios/removeProjectFromProject-test.js deleted file mode 100644 index 257e9f0e7fd..00000000000 --- a/local-cli/link/__tests__/ios/removeProjectFromProject-test.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const pbxFile = require('xcode/lib/pbxFile'); -const addFileToProject = require('../../ios/addFileToProject'); -const removeProjectFromProject = require('../../ios/removeProjectFromProject'); -const path = require('path'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); -const filePath = '../../__fixtures__/linearGradient.pbxproj'; - -describe('ios::addFileToProject', () => { - beforeEach(() => { - project.parseSync(); - addFileToProject(project, filePath); - }); - - it('should return removed file', () => { - expect( - removeProjectFromProject(project, filePath) instanceof pbxFile, - ).toBeTruthy(); - }); - - it('should remove file from a project', () => { - const file = removeProjectFromProject(project, filePath); - expect(project.pbxFileReferenceSection()[file.fileRef]).not.toBeDefined(); - }); - - xit('should remove file from PBXContainerProxy', () => { - // todo(mike): add in .xcodeproj after Xcode modifications so we can test extra - // removals later. - }); -}); diff --git a/local-cli/link/__tests__/ios/removeSharedLibrary-test.js b/local-cli/link/__tests__/ios/removeSharedLibrary-test.js deleted file mode 100644 index 5f983e551e0..00000000000 --- a/local-cli/link/__tests__/ios/removeSharedLibrary-test.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const xcode = require('xcode'); -const path = require('path'); -const addSharedLibraries = require('../../ios/addSharedLibraries'); -const removeSharedLibraries = require('../../ios/removeSharedLibraries'); -const getGroup = require('../../ios/getGroup'); - -const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), -); - -describe('ios::removeSharedLibraries', () => { - beforeEach(() => { - project.parseSync(); - addSharedLibraries(project, ['libc++.tbd', 'libz.tbd']); - }); - - it('should remove only the specified shared library', () => { - removeSharedLibraries(project, ['libc++.tbd']); - - const frameworksGroup = getGroup(project, 'Frameworks'); - expect(frameworksGroup.children.length).toEqual(1); - expect(frameworksGroup.children[0].comment).toEqual('libz.tbd'); - }); - - it('should ignore missing shared libraries', () => { - removeSharedLibraries(project, ['libxml2.tbd']); - - const frameworksGroup = getGroup(project, 'Frameworks'); - expect(frameworksGroup.children.length).toEqual(2); - }); -}); diff --git a/local-cli/link/__tests__/ios/writePlist-test.js b/local-cli/link/__tests__/ios/writePlist-test.js deleted file mode 100644 index d4008a96626..00000000000 --- a/local-cli/link/__tests__/ios/writePlist-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.mock('path'); -jest.mock('fs'); - -let plistPath = null; -jest.mock('../../ios/getPlistPath', () => () => plistPath); - -const {readFileSync} = jest.requireActual('fs'); -const fs = require('fs'); - -const xcode = require('xcode'); -const writePlist = require('../../ios/writePlist'); - -const realPath = jest.requireActual('path'); -const projectPath = realPath.join( - __dirname, - '../../__fixtures__/project.pbxproj', -); -const infoPlistPath = realPath.join(__dirname, '../../__fixtures__/Info.plist'); - -fs.readFileSync = jest.fn(() => readFileSync(projectPath).toString()); - -const {writeFileSync} = fs; -fs.writeFileSync = jest.fn(writeFileSync); - -const project = xcode.project('/Basic/project.pbxproj'); - -const plist = { - CFBundleDevelopmentRegion: 'en', - UISupportedInterfaceOrientations: ['UIInterfaceOrientationPortrait'], -}; - -describe('ios::writePlist', () => { - beforeEach(() => { - project.parseSync(); - fs.writeFileSync.mockReset(); - }); - - it('should write a `.plist` file', () => { - plistPath = '/Basic/Info.plist'; - writePlist(project, '/', plist); - const infoPlist = readFileSync(infoPlistPath).toString(); - expect(fs.writeFileSync).toHaveBeenCalledWith(plistPath, infoPlist); - }); - - it('when plistPath is null it should return null', () => { - plistPath = null; - expect(writePlist(project, '/', plist)).toBeNull(); - expect(fs.writeFileSync).not.toHaveBeenCalled(); - }); -}); diff --git a/local-cli/link/__tests__/link-test.js b/local-cli/link/__tests__/link-test.js deleted file mode 100644 index cab9a24c40d..00000000000 --- a/local-cli/link/__tests__/link-test.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const log = require('npmlog'); -jest.setMock('chalk', {grey: str => str}); - -describe('link', () => { - beforeEach(() => { - jest.resetModules(); - delete require.cache[require.resolve('../link')]; - log.level = 'silent'; - }); - - it('should reject when run in a folder without package.json', done => { - const config = { - getProjectConfig: () => { - throw new Error('No package.json found'); - }, - }; - - const link = require('../link').func; - link([], config).catch(() => done()); - }); - - it('should accept a name of a dependency to link', done => { - const config = { - getPlatformConfig: () => ({ios: {}, android: {}}), - getProjectConfig: () => ({assets: []}), - getDependencyConfig: jest - .fn() - .mockReturnValue({assets: [], commands: {}}), - }; - - const link = require('../link').func; - link(['react-native-gradient'], config).then(() => { - expect(config.getDependencyConfig.mock.calls[0]).toEqual([ - 'react-native-gradient', - ]); - done(); - }); - }); - - it('should accept the name of a dependency with a scope / tag', async () => { - const config = { - getPlatformConfig: () => ({ios: {}, android: {}}), - getProjectConfig: () => ({assets: []}), - getDependencyConfig: jest - .fn() - .mockReturnValue({assets: [], commands: {}}), - }; - - const link = require('../link').func; - await link(['@scope/something@latest'], config); - expect(config.getDependencyConfig.mock.calls[0]).toEqual([ - '@scope/something', - ]); - }); - - it('should register native module when android/ios projects are present', done => { - const registerNativeModule = jest.fn(); - const dependencyConfig = {android: {}, ios: {}, assets: [], commands: {}}; - const androidLinkConfig = require('../android'); - const iosLinkConfig = require('../ios'); - const config = { - getPlatformConfig: () => ({ - ios: {linkConfig: iosLinkConfig}, - android: {linkConfig: androidLinkConfig}, - }), - getProjectConfig: () => ({android: {}, ios: {}, assets: []}), - getDependencyConfig: jest.fn().mockReturnValue(dependencyConfig), - }; - - jest.setMock('../android/isInstalled.js', jest.fn().mockReturnValue(false)); - - jest.setMock('../android/registerNativeModule.js', registerNativeModule); - - jest.setMock('../ios/isInstalled.js', jest.fn().mockReturnValue(false)); - - jest.setMock('../ios/registerNativeModule.js', registerNativeModule); - - const link = require('../link').func; - - link(['react-native-blur'], config).then(() => { - expect(registerNativeModule.mock.calls.length).toBe(2); - done(); - }); - }); - - it('should not register modules when they are already installed', done => { - const registerNativeModule = jest.fn(); - const dependencyConfig = {ios: {}, android: {}, assets: [], commands: {}}; - const config = { - getPlatformConfig: () => ({ios: {}, android: {}}), - getProjectConfig: () => ({ios: {}, android: {}, assets: []}), - getDependencyConfig: jest.fn().mockReturnValue(dependencyConfig), - }; - - jest.setMock('../ios/isInstalled.js', jest.fn().mockReturnValue(true)); - - jest.setMock('../android/isInstalled.js', jest.fn().mockReturnValue(true)); - - jest.setMock('../ios/registerNativeModule.js', registerNativeModule); - - jest.setMock('../android/registerNativeModule.js', registerNativeModule); - - const link = require('../link').func; - - link(['react-native-blur'], config).then(() => { - expect(registerNativeModule.mock.calls.length).toEqual(0); - done(); - }); - }); - - it('should register native modules for plugins', done => { - const registerNativeModule = jest.fn(); - const dependencyConfig = { - ios: {}, - android: {}, - test: {}, - assets: [], - commands: {}, - }; - const linkPluginConfig = { - isInstalled: () => false, - register: registerNativeModule, - }; - const config = { - getPlatformConfig: () => ({ - ios: {}, - android: {}, - test: {linkConfig: () => linkPluginConfig}, - }), - getProjectConfig: () => ({ios: {}, android: {}, test: {}, assets: []}), - getDependencyConfig: jest.fn().mockReturnValue(dependencyConfig), - }; - - jest.setMock('../ios/isInstalled.js', jest.fn().mockReturnValue(true)); - - jest.setMock('../android/isInstalled.js', jest.fn().mockReturnValue(true)); - - const link = require('../link').func; - - link(['react-native-blur'], config).then(() => { - expect(registerNativeModule.mock.calls.length).toBe(1); - done(); - }); - }); - - it('should not register native modules for plugins when already installed', done => { - const registerNativeModule = jest.fn(); - const dependencyConfig = { - ios: {}, - android: {}, - test: {}, - assets: [], - commands: {}, - }; - const linkPluginConfig = { - isInstalled: () => true, - register: registerNativeModule, - }; - const config = { - getPlatformConfig: () => ({ - ios: {}, - android: {}, - test: {linkConfig: () => linkPluginConfig}, - }), - getProjectConfig: () => ({ios: {}, android: {}, test: {}, assets: []}), - getDependencyConfig: jest.fn().mockReturnValue(dependencyConfig), - }; - - jest.setMock('../ios/isInstalled.js', jest.fn().mockReturnValue(true)); - - jest.setMock('../android/isInstalled.js', jest.fn().mockReturnValue(true)); - - const link = require('../link').func; - - link(['react-native-blur'], config).then(() => { - expect(registerNativeModule.mock.calls.length).toEqual(0); - done(); - }); - }); - - it('should run prelink and postlink commands at the appropriate times', async () => { - const registerNativeModule = jest.fn(); - const prelink = jest.fn().mockImplementation(cb => cb()); - const postlink = jest.fn().mockImplementation(cb => cb()); - - jest.setMock('../ios/registerNativeModule.js', registerNativeModule); - - jest.setMock('../ios/isInstalled.js', jest.fn().mockReturnValue(false)); - - const linkConfig = require('../ios'); - const config = { - getPlatformConfig: () => ({ios: {linkConfig: linkConfig}}), - getProjectConfig: () => ({ios: {}, assets: []}), - getDependencyConfig: jest.fn().mockReturnValue({ - ios: {}, - assets: [], - commands: {prelink, postlink}, - }), - }; - - const link = require('../link').func; - await link(['react-native-blur'], config); - - expect(prelink.mock.invocationCallOrder[0]).toBeLessThan( - registerNativeModule.mock.invocationCallOrder[0], - ); - expect(postlink.mock.invocationCallOrder[0]).toBeGreaterThan( - registerNativeModule.mock.invocationCallOrder[0], - ); - }); - - it('should copy assets from both project and dependencies projects', done => { - const dependencyAssets = ['Fonts/Font.ttf']; - const dependencyConfig = {assets: dependencyAssets, ios: {}, commands: {}}; - const projectAssets = ['Fonts/FontC.ttf']; - const copyAssets = jest.fn(); - - jest.setMock('../ios/copyAssets.js', copyAssets); - - const linkConfig = require('../ios'); - const config = { - getPlatformConfig: () => ({ios: {linkConfig: linkConfig}}), - getProjectConfig: () => ({ios: {}, assets: projectAssets}), - getDependencyConfig: jest.fn().mockReturnValue(dependencyConfig), - }; - - const link = require('../link').func; - - link(['react-native-blur'], config).then(() => { - expect(copyAssets.mock.calls.length).toBe(1); - expect(copyAssets.mock.calls[0][0]).toEqual( - projectAssets.concat(dependencyAssets), - ); - done(); - }); - }); -}); diff --git a/local-cli/link/__tests__/pods/findLineToAddPod-test.js b/local-cli/link/__tests__/pods/findLineToAddPod-test.js deleted file mode 100644 index d27b341dd45..00000000000 --- a/local-cli/link/__tests__/pods/findLineToAddPod-test.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const findLineToAddPod = require('../../pods/findLineToAddPod'); -const readPodfile = require('../../pods/readPodfile'); - -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); -const LINE_AFTER_TARGET_IN_TEST_PODFILE = 4; - -describe('pods::findLineToAddPod', () => { - it('returns null if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); - expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toBeNull(); - }); - - it('returns correct line number for Simple Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); - expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toEqual({line: 7, indentation: 2}); - }); - - it('returns correct line number for Podfile with target', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileWithTarget')); - expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toEqual({line: 21, indentation: 2}); - }); - - it('returns correct line number for Podfile with function', () => { - const podfile = readPodfile( - path.join(PODFILES_PATH, 'PodfileWithFunction'), - ); - expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toEqual({line: 26, indentation: 2}); - }); -}); diff --git a/local-cli/link/__tests__/pods/findMarkedLinesInPodfile-test.js b/local-cli/link/__tests__/pods/findMarkedLinesInPodfile-test.js deleted file mode 100644 index 2c9d8decd53..00000000000 --- a/local-cli/link/__tests__/pods/findMarkedLinesInPodfile-test.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const readPodfile = require('../../pods/readPodfile'); -const findMarkedLinesInPodfile = require('../../pods/findMarkedLinesInPodfile'); - -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); -const LINE_AFTER_TARGET_IN_TEST_PODFILE = 4; - -describe('pods::findMarkedLinesInPodfile', () => { - it('returns empty array if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); - expect(findMarkedLinesInPodfile(podfile)).toEqual([]); - }); - - it('returns empty array for Simple Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); - expect( - findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toEqual([]); - }); - - it('returns correct line numbers for Podfile with marker', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileWithMarkers')); - const expectedObject = [ - {line: 18, indentation: 2}, - {line: 31, indentation: 4}, - ]; - expect( - findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), - ).toEqual(expectedObject); - }); -}); diff --git a/local-cli/link/__tests__/pods/findPodTargetLine-test.js b/local-cli/link/__tests__/pods/findPodTargetLine-test.js deleted file mode 100644 index 6b7b360e0e5..00000000000 --- a/local-cli/link/__tests__/pods/findPodTargetLine-test.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const findPodTargetLine = require('../../pods/findPodTargetLine'); -const readPodfile = require('../../pods/readPodfile'); - -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); - -describe('pods::findPodTargetLine', () => { - it('returns null if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); - expect(findPodTargetLine(podfile, 'name')).toBeNull(); - }); - - it('returns null if there is not matching project name', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); - expect(findPodTargetLine(podfile, 'invalidName')).toBeNull(); - }); - - it('returns null if there is not matching project name', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); - expect(findPodTargetLine(podfile, 'Testing')).toBe(4); - }); -}); diff --git a/local-cli/link/__tests__/pods/isInstalled-test.js b/local-cli/link/__tests__/pods/isInstalled-test.js deleted file mode 100644 index dbf4845749c..00000000000 --- a/local-cli/link/__tests__/pods/isInstalled-test.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const isInstalled = require('../../pods/isInstalled'); - -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); - -describe('pods::isInstalled', () => { - it('returns false if pod is missing', () => { - const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; - const podspecName = {podspec: 'NotExisting'}; - expect(isInstalled(project, podspecName)).toBe(false); - }); - - it('returns true for existing pod with version number', () => { - const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; - const podspecName = {podspec: 'TestPod'}; - expect(isInstalled(project, podspecName)).toBe(true); - }); - - it('returns true for existing pod with path', () => { - const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithTarget')}; - const podspecName = {podspec: 'Yoga'}; - expect(isInstalled(project, podspecName)).toBe(true); - }); - - it('returns true for existing pod with multiline definition', () => { - const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithFunction')}; - const podspecName = {podspec: 'React'}; - expect(isInstalled(project, podspecName)).toBe(true); - }); -}); diff --git a/local-cli/link/__tests__/pods/removePodEntry-test.js b/local-cli/link/__tests__/pods/removePodEntry-test.js deleted file mode 100644 index 83106805c61..00000000000 --- a/local-cli/link/__tests__/pods/removePodEntry-test.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const path = require('path'); -const removePodEntry = require('../../pods/removePodEntry'); -const readPodfile = require('../../pods/readPodfile'); - -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); - -describe('pods::removePodEntry', () => { - it('should remove one line from Podfile with TestPod', () => { - const {podfileContent, podLinesCount} = readTestPodFile('PodfileSimple'); - const podFileWithRemoved = removePodEntry(podfileContent, 'TestPod'); - const newLineCount = podFileWithRemoved.split('\n').length; - expect(newLineCount).toBe(podLinesCount - 1); - }); - - it('should remove one line from Podfile with Yoga', () => { - const {podfileContent, podLinesCount} = readTestPodFile( - 'PodfileWithTarget', - ); - const podFileWithRemoved = removePodEntry(podfileContent, 'Yoga'); - const newLineCount = podFileWithRemoved.split('\n').length; - expect(newLineCount).toBe(podLinesCount - 1); - }); - - it('should remove whole reference to React pod from Podfile', () => { - const {podfileContent, podLinesCount} = readTestPodFile( - 'PodfileWithTarget', - ); - const podFileWithRemoved = removePodEntry(podfileContent, 'React'); - const newLineCount = podFileWithRemoved.split('\n').length; - expect(newLineCount).toBe(podLinesCount - 9); - }); -}); - -function readTestPodFile(fileName) { - const podfileLines = readPodfile(path.join(PODFILES_PATH, fileName)); - return { - podfileContent: podfileLines.join('\n'), - podLinesCount: podfileLines.length, - }; -} diff --git a/local-cli/link/__tests__/promiseWaterfall-test.js b/local-cli/link/__tests__/promiseWaterfall-test.js deleted file mode 100644 index 3507ce991df..00000000000 --- a/local-cli/link/__tests__/promiseWaterfall-test.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -const promiseWaterfall = require('../promiseWaterfall'); - -describe('promiseWaterfall', () => { - it('should run promises in a sequence', async () => { - const tasks = [jest.fn(), jest.fn()]; - - await promiseWaterfall(tasks); - - // Check that tasks[0] is executed before tasks[1]. - expect(tasks[0].mock.invocationCallOrder[0]).toBeLessThan( - tasks[1].mock.invocationCallOrder[0], - ); - }); - - it('should resolve with last promise value', async () => { - const tasks = [jest.fn().mockReturnValue(1), jest.fn().mockReturnValue(2)]; - - expect(await promiseWaterfall(tasks)).toEqual(2); - }); - - it('should stop the sequence when one of promises is rejected', done => { - const error = new Error(); - const tasks = [ - jest.fn().mockImplementation(() => { - throw error; - }), - jest.fn().mockReturnValue(2), - ]; - - promiseWaterfall(tasks).catch(err => { - expect(err).toEqual(error); - expect(tasks[1].mock.calls.length).toEqual(0); - done(); - }); - }); -}); diff --git a/local-cli/link/android/copyAssets.js b/local-cli/link/android/copyAssets.js deleted file mode 100644 index 4b58f46fb86..00000000000 --- a/local-cli/link/android/copyAssets.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs-extra'); -const path = require('path'); -const groupFilesByType = require('../groupFilesByType'); - -/** - * Copies each file from an array of assets provided to targetPath directory - * - * For now, the only types of files that are handled are: - * - Fonts (otf, ttf) - copied to targetPath/fonts under original name - */ -module.exports = function copyAssetsAndroid(files, project) { - const assets = groupFilesByType(files); - - (assets.font || []).forEach(asset => - fs.copySync( - asset, - path.join(project.assetsPath, 'fonts', path.basename(asset)), - ), - ); -}; diff --git a/local-cli/link/android/fs.js b/local-cli/link/android/fs.js deleted file mode 100644 index a7cf3d029a5..00000000000 --- a/local-cli/link/android/fs.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs-extra'); - -exports.readFile = file => () => fs.readFileSync(file, 'utf8'); - -exports.writeFile = (file, content) => - content - ? fs.writeFileSync(file, content, 'utf8') - : c => fs.writeFileSync(file, c, 'utf8'); diff --git a/local-cli/link/android/index.js b/local-cli/link/android/index.js deleted file mode 100644 index d8b8f5addbc..00000000000 --- a/local-cli/link/android/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function() { - return { - isInstalled: require('./isInstalled'), - register: require('./registerNativeModule'), - unregister: require('./unregisterNativeModule'), - copyAssets: require('./copyAssets'), - unlinkAssets: require('./unlinkAssets'), - }; -}; diff --git a/local-cli/link/android/isInstalled.js b/local-cli/link/android/isInstalled.js deleted file mode 100644 index 24f07788702..00000000000 --- a/local-cli/link/android/isInstalled.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs'); -const makeBuildPatch = require('./patches/makeBuildPatch'); - -module.exports = function isInstalled(config, name) { - const buildGradle = fs.readFileSync(config.buildGradlePath); - return makeBuildPatch(name).installPattern.test(buildGradle); -}; diff --git a/local-cli/link/android/patches/applyParams.js b/local-cli/link/android/patches/applyParams.js deleted file mode 100644 index 11b66bef280..00000000000 --- a/local-cli/link/android/patches/applyParams.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const toCamelCase = require('lodash').camelCase; - -module.exports = function applyParams(str, params, prefix) { - return str.replace(/\$\{(\w+)\}/g, (pattern, param) => { - const name = toCamelCase(prefix) + '_' + param; - - return params[param] ? `getResources().getString(R.string.${name})` : null; - }); -}; diff --git a/local-cli/link/android/patches/applyPatch.js b/local-cli/link/android/patches/applyPatch.js deleted file mode 100644 index fd17c80b263..00000000000 --- a/local-cli/link/android/patches/applyPatch.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs'); - -module.exports = function applyPatch(file, patch) { - fs.writeFileSync( - file, - fs - .readFileSync(file, 'utf8') - .replace(patch.pattern, match => `${match}${patch.patch}`), - ); -}; diff --git a/local-cli/link/android/patches/makeBuildPatch.js b/local-cli/link/android/patches/makeBuildPatch.js deleted file mode 100644 index db8feb5a895..00000000000 --- a/local-cli/link/android/patches/makeBuildPatch.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const normalizeProjectName = require('./normalizeProjectName'); - -module.exports = function makeBuildPatch(name) { - const normalizedProjectName = normalizeProjectName(name); - const installPattern = new RegExp( - `\\s{4}(implementation)(\\(|\\s)(project)\\(\\\':${normalizedProjectName}\\\'\\)(\\)|\\s)`, - ); - - return { - installPattern, - pattern: /[^ \t]dependencies {(\r\n|\n)/, - patch: ` implementation project(':${normalizedProjectName}')\n`, - }; -}; diff --git a/local-cli/link/android/patches/makeImportPatch.js b/local-cli/link/android/patches/makeImportPatch.js deleted file mode 100644 index 983f2a4e036..00000000000 --- a/local-cli/link/android/patches/makeImportPatch.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function makeImportPatch(packageImportPath) { - return { - pattern: 'import com.facebook.react.ReactApplication;', - patch: '\n' + packageImportPath, - }; -}; diff --git a/local-cli/link/android/patches/makePackagePatch.js b/local-cli/link/android/patches/makePackagePatch.js deleted file mode 100644 index a4791ef5b48..00000000000 --- a/local-cli/link/android/patches/makePackagePatch.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const applyParams = require('./applyParams'); - -module.exports = function makePackagePatch(packageInstance, params, prefix) { - const processedInstance = applyParams(packageInstance, params, prefix); - - return { - pattern: 'new MainReactPackage()', - patch: ',\n ' + processedInstance, - }; -}; diff --git a/local-cli/link/android/patches/makeSettingsPatch.js b/local-cli/link/android/patches/makeSettingsPatch.js deleted file mode 100644 index a6bf7ca2bb3..00000000000 --- a/local-cli/link/android/patches/makeSettingsPatch.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const path = require('path'); -const normalizeProjectName = require('./normalizeProjectName'); - -module.exports = function makeSettingsPatch( - name, - androidConfig, - projectConfig, -) { - var projectDir = path.relative( - path.dirname(projectConfig.settingsGradlePath), - androidConfig.sourceDir, - ); - const normalizedProjectName = normalizeProjectName(name); - - return { - pattern: '\n', - patch: - `include ':${normalizedProjectName}'\n` + - `project(':${normalizedProjectName}').projectDir = ` + - `new File(rootProject.projectDir, '${projectDir}')\n`, - }; -}; diff --git a/local-cli/link/android/patches/makeStringsPatch.js b/local-cli/link/android/patches/makeStringsPatch.js deleted file mode 100644 index efda88671e6..00000000000 --- a/local-cli/link/android/patches/makeStringsPatch.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const toCamelCase = require('lodash').camelCase; - -module.exports = function makeStringsPatch(params, prefix) { - const values = Object.keys(params).map(param => { - const name = toCamelCase(prefix) + '_' + param; - return ( - ' ' + - `${params[param]}` - ); - }); - - const patch = values.length > 0 ? values.join('\n') + '\n' : ''; - - return { - pattern: '\n', - patch, - }; -}; diff --git a/local-cli/link/android/patches/normalizeProjectName.js b/local-cli/link/android/patches/normalizeProjectName.js deleted file mode 100644 index bdf457d74b9..00000000000 --- a/local-cli/link/android/patches/normalizeProjectName.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function normalizeProjectName(name) { - return name.replace(/\//g, '_'); -}; diff --git a/local-cli/link/android/patches/revokePatch.js b/local-cli/link/android/patches/revokePatch.js deleted file mode 100644 index 070972e424e..00000000000 --- a/local-cli/link/android/patches/revokePatch.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs'); - -module.exports = function revokePatch(file, patch) { - fs.writeFileSync( - file, - fs.readFileSync(file, 'utf8').replace(patch.patch, ''), - ); -}; diff --git a/local-cli/link/android/registerNativeModule.js b/local-cli/link/android/registerNativeModule.js deleted file mode 100644 index 67ddfc7eb97..00000000000 --- a/local-cli/link/android/registerNativeModule.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const applyPatch = require('./patches/applyPatch'); -const makeStringsPatch = require('./patches/makeStringsPatch'); -const makeSettingsPatch = require('./patches/makeSettingsPatch'); -const makeBuildPatch = require('./patches/makeBuildPatch'); -const makeImportPatch = require('./patches/makeImportPatch'); -const makePackagePatch = require('./patches/makePackagePatch'); - -module.exports = function registerNativeAndroidModule( - name, - androidConfig, - params, - projectConfig, -) { - const buildPatch = makeBuildPatch(name); - - applyPatch( - projectConfig.settingsGradlePath, - makeSettingsPatch(name, androidConfig, projectConfig), - ); - - applyPatch(projectConfig.buildGradlePath, buildPatch); - applyPatch(projectConfig.stringsPath, makeStringsPatch(params, name)); - - applyPatch( - projectConfig.mainFilePath, - makePackagePatch(androidConfig.packageInstance, params, name), - ); - - applyPatch( - projectConfig.mainFilePath, - makeImportPatch(androidConfig.packageImportPath), - ); -}; diff --git a/local-cli/link/android/unlinkAssets.js b/local-cli/link/android/unlinkAssets.js deleted file mode 100644 index fc6f7db3913..00000000000 --- a/local-cli/link/android/unlinkAssets.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs-extra'); -const path = require('path'); -const groupFilesByType = require('../groupFilesByType'); - -/** - * Copies each file from an array of assets provided to targetPath directory - * - * For now, the only types of files that are handled are: - * - Fonts (otf, ttf) - copied to targetPath/fonts under original name - */ -module.exports = function unlinkAssetsAndroid(files, project) { - const assets = groupFilesByType(files); - - (assets.font || []).forEach(file => { - const filePath = path.join( - project.assetsPath, - 'fonts', - path.basename(file), - ); - if (fs.existsSync(filePath)) { - fs.unlinkSync(filePath); - } - }); -}; diff --git a/local-cli/link/android/unregisterNativeModule.js b/local-cli/link/android/unregisterNativeModule.js deleted file mode 100644 index 27aa977a3c4..00000000000 --- a/local-cli/link/android/unregisterNativeModule.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs'); -const toCamelCase = require('lodash').camelCase; - -const revokePatch = require('./patches/revokePatch'); -const makeSettingsPatch = require('./patches/makeSettingsPatch'); -const makeBuildPatch = require('./patches/makeBuildPatch'); -const makeStringsPatch = require('./patches/makeStringsPatch'); -const makeImportPatch = require('./patches/makeImportPatch'); -const makePackagePatch = require('./patches/makePackagePatch'); - -module.exports = function unregisterNativeAndroidModule( - name, - androidConfig, - projectConfig, -) { - const buildPatch = makeBuildPatch(name); - const strings = fs.readFileSync(projectConfig.stringsPath, 'utf8'); - var params = {}; - - strings.replace( - /moduleConfig="true" name="(\w+)">(.*) { - params[param.slice(toCamelCase(name).length + 1)] = value; - }, - ); - - revokePatch( - projectConfig.settingsGradlePath, - makeSettingsPatch(name, androidConfig, projectConfig), - ); - - revokePatch(projectConfig.buildGradlePath, buildPatch); - revokePatch(projectConfig.stringsPath, makeStringsPatch(params, name)); - - revokePatch( - projectConfig.mainFilePath, - makePackagePatch(androidConfig.packageInstance, params, name), - ); - - revokePatch( - projectConfig.mainFilePath, - makeImportPatch(androidConfig.packageImportPath), - ); -}; diff --git a/local-cli/link/commandStub.js b/local-cli/link/commandStub.js deleted file mode 100644 index 332acf7f203..00000000000 --- a/local-cli/link/commandStub.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = cb => cb(); diff --git a/local-cli/link/getDependencyConfig.js b/local-cli/link/getDependencyConfig.js deleted file mode 100644 index fcecae2efb5..00000000000 --- a/local-cli/link/getDependencyConfig.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of dependencies - it returns their RNPM config - * if they were valid. - */ -module.exports = function getDependencyConfig(config, deps) { - return deps.reduce((acc, name) => { - try { - return acc.concat({ - config: config.getDependencyConfig(name), - name, - }); - } catch (err) { - console.log(err); - return acc; - } - }, []); -}; diff --git a/local-cli/link/getProjectDependencies.js b/local-cli/link/getProjectDependencies.js deleted file mode 100644 index 0cb1165c02d..00000000000 --- a/local-cli/link/getProjectDependencies.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const path = require('path'); - -/** - * Returns an array of dependencies that should be linked/checked. - */ -module.exports = function getProjectDependencies(cwd) { - const pjson = require(path.join(cwd || process.cwd(), './package.json')); - return Object.keys(pjson.dependencies || {}).filter( - name => name !== 'react-native', - ); -}; diff --git a/local-cli/link/groupFilesByType.js b/local-cli/link/groupFilesByType.js deleted file mode 100644 index d35e8e59e30..00000000000 --- a/local-cli/link/groupFilesByType.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const groupBy = require('lodash').groupBy; -const mime = require('mime'); - -/** - * Since there are no officially registered MIME types - * for ttf/otf yet http://www.iana.org/assignments/media-types/media-types.xhtml, - * we define two non-standard ones for the sake of parsing - */ -mime.define({ - 'font/opentype': ['otf'], - 'font/truetype': ['ttf'], -}); - -/** - * Given an array of files, it groups it by it's type. - * Type of the file is inferred from it's mimetype based on the extension - * file ends up with. The returned value is an object with properties that - * correspond to the first part of the mimetype, e.g. images will be grouped - * under `image` key since the mimetype for them is `image/jpg` etc. - * - * Example: - * Given an array ['fonts/a.ttf', 'images/b.jpg'], - * the returned object will be: {font: ['fonts/a.ttf'], image: ['images/b.jpg']} - */ -module.exports = function groupFilesByType(assets) { - return groupBy(assets, type => mime.lookup(type).split('/')[0]); -}; diff --git a/local-cli/link/ios/addFileToProject.js b/local-cli/link/ios/addFileToProject.js deleted file mode 100644 index a534399667b..00000000000 --- a/local-cli/link/ios/addFileToProject.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const PbxFile = require('xcode/lib/pbxFile'); - -/** - * Given xcodeproj and filePath, it creates new file - * from path provided, adds it to the project - * and returns newly created instance of a file - */ -module.exports = function addFileToProject(project, filePath) { - const file = new PbxFile(filePath); - file.uuid = project.generateUuid(); - file.fileRef = project.generateUuid(); - project.addToPbxFileReferenceSection(file); - return file; -}; diff --git a/local-cli/link/ios/addProjectToLibraries.js b/local-cli/link/ios/addProjectToLibraries.js deleted file mode 100644 index 269f30d726a..00000000000 --- a/local-cli/link/ios/addProjectToLibraries.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of xcodeproj libraries and pbxFile, - * it appends it to that group - * - * Important: That function mutates `libraries` and it's not pure. - * It's mainly due to limitations of `xcode` library. - */ -module.exports = function addProjectToLibraries(libraries, file) { - return libraries.children.push({ - value: file.fileRef, - comment: file.basename, - }); -}; diff --git a/local-cli/link/ios/addSharedLibraries.js b/local-cli/link/ios/addSharedLibraries.js deleted file mode 100644 index c8050689dcc..00000000000 --- a/local-cli/link/ios/addSharedLibraries.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const createGroupWithMessage = require('./createGroupWithMessage'); - -module.exports = function addSharedLibraries(project, libraries) { - if (!libraries.length) { - return; - } - - // Create a Frameworks group if necessary. - createGroupWithMessage(project, 'Frameworks'); - - const target = project.getFirstTarget().uuid; - - for (var name of libraries) { - project.addFramework(name, {target}); - } -}; diff --git a/local-cli/link/ios/addToHeaderSearchPaths.js b/local-cli/link/ios/addToHeaderSearchPaths.js deleted file mode 100644 index e3cd6db2f95..00000000000 --- a/local-cli/link/ios/addToHeaderSearchPaths.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const mapHeaderSearchPaths = require('./mapHeaderSearchPaths'); - -module.exports = function addToHeaderSearchPaths(project, path) { - mapHeaderSearchPaths(project, searchPaths => searchPaths.concat(path)); -}; diff --git a/local-cli/link/ios/common/isInstalled.js b/local-cli/link/ios/common/isInstalled.js deleted file mode 100644 index 3e5542fe13f..00000000000 --- a/local-cli/link/ios/common/isInstalled.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const isInstalledIOS = require('../isInstalled'); -const isInstalledPods = require('../../pods/isInstalled'); - -module.exports = function isInstalled(projectConfig, name, dependencyConfig) { - return ( - isInstalledIOS(projectConfig, dependencyConfig) || - isInstalledPods(projectConfig, dependencyConfig) - ); -}; diff --git a/local-cli/link/ios/common/registerNativeModule.js b/local-cli/link/ios/common/registerNativeModule.js deleted file mode 100644 index 8a86e688753..00000000000 --- a/local-cli/link/ios/common/registerNativeModule.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const registerDependencyIOS = require('../registerNativeModule'); -const registerDependencyPods = require('../../pods/registerNativeModule'); - -module.exports = function registerNativeModule( - name, - dependencyConfig, - params, - projectConfig, -) { - if (projectConfig.podfile && dependencyConfig.podspec) { - registerDependencyPods(name, dependencyConfig, projectConfig); - } else { - registerDependencyIOS(dependencyConfig, projectConfig); - } -}; diff --git a/local-cli/link/ios/common/unregisterNativeModule.js b/local-cli/link/ios/common/unregisterNativeModule.js deleted file mode 100644 index 69d25ea5918..00000000000 --- a/local-cli/link/ios/common/unregisterNativeModule.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const compact = require('lodash').compact; -const isInstalledIOS = require('../isInstalled'); -const isInstalledPods = require('../../pods/isInstalled'); -const unregisterDependencyIOS = require('../unregisterNativeModule'); -const unregisterDependencyPods = require('../../pods/unregisterNativeModule'); - -module.exports = function unregisterNativeModule( - name, - dependencyConfig, - projectConfig, - otherDependencies, -) { - const isIosInstalled = isInstalledIOS(projectConfig, dependencyConfig); - const isPodInstalled = isInstalledPods(projectConfig, dependencyConfig); - if (isIosInstalled) { - const iOSDependencies = compact(otherDependencies.map(d => d.config.ios)); - unregisterDependencyIOS(dependencyConfig, projectConfig, iOSDependencies); - } else if (isPodInstalled) { - unregisterDependencyPods(dependencyConfig, projectConfig); - } -}; diff --git a/local-cli/link/ios/copyAssets.js b/local-cli/link/ios/copyAssets.js deleted file mode 100644 index 314b68b60d8..00000000000 --- a/local-cli/link/ios/copyAssets.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs-extra'); -const path = require('path'); -const xcode = require('xcode'); -const groupFilesByType = require('../groupFilesByType'); -const createGroupWithMessage = require('./createGroupWithMessage'); -const getPlist = require('./getPlist'); -const writePlist = require('./writePlist'); - -/** - * This function works in a similar manner to its Android version, - * except it does not copy fonts but creates Xcode Group references - */ -module.exports = function linkAssetsIOS(files, projectConfig) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); - const assets = groupFilesByType(files); - const plist = getPlist(project, projectConfig.sourceDir); - - createGroupWithMessage(project, 'Resources'); - - function addResourceFile(f) { - return (f || []) - .map(asset => - project.addResourceFile(path.relative(projectConfig.sourceDir, asset), { - target: project.getFirstTarget().uuid, - }), - ) - .filter(file => file) // xcode returns false if file is already there - .map(file => file.basename); - } - - addResourceFile(assets.image); - - const fonts = addResourceFile(assets.font); - - const existingFonts = plist.UIAppFonts || []; - const allFonts = [...existingFonts, ...fonts]; - plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing - - fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); - - writePlist(project, projectConfig.sourceDir, plist); -}; diff --git a/local-cli/link/ios/createGroup.js b/local-cli/link/ios/createGroup.js deleted file mode 100644 index 473bb4ccd34..00000000000 --- a/local-cli/link/ios/createGroup.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const getGroup = require('./getGroup'); - -const hasGroup = (pbxGroup, name) => - pbxGroup.children.find(group => group.comment === name); - -/** - * Given project and path of the group, it deeply creates a given group - * making all outer groups if necessary - * - * Returns newly created group - */ -module.exports = function createGroup(project, path) { - return path.split('/').reduce((group, name) => { - if (!hasGroup(group, name)) { - const uuid = project.pbxCreateGroup(name, '""'); - - group.children.push({ - value: uuid, - comment: name, - }); - } - - return project.pbxGroupByName(name); - }, getGroup(project)); -}; diff --git a/local-cli/link/ios/createGroupWithMessage.js b/local-cli/link/ios/createGroupWithMessage.js deleted file mode 100644 index c353d915929..00000000000 --- a/local-cli/link/ios/createGroupWithMessage.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const log = require('npmlog'); - -const createGroup = require('./createGroup'); -const getGroup = require('./getGroup'); - -/** - * Given project and path of the group, it checks if a group exists at that path, - * and deeply creates a group for that path if its does not already exist. - * - * Returns the existing or newly created group - */ -module.exports = function createGroupWithMessage(project, path) { - var group = getGroup(project, path); - - if (!group) { - group = createGroup(project, path); - - log.warn( - 'ERRGROUP', - `Group '${path}' does not exist in your Xcode project. We have created it automatically for you.`, - ); - } - - return group; -}; diff --git a/local-cli/link/ios/getBuildProperty.js b/local-cli/link/ios/getBuildProperty.js deleted file mode 100644 index bf0291a2d5c..00000000000 --- a/local-cli/link/ios/getBuildProperty.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Gets build property from the main target build section - * - * It differs from the project.getBuildProperty exposed by xcode in the way that: - * - it only checks for build property in the main target `Debug` section - * - `xcode` library iterates over all build sections and because it misses - * an early return when property is found, it will return undefined/wrong value - * when there's another build section typically after the one you want to access - * without the property defined (e.g. CocoaPods sections appended to project - * miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765 - */ -module.exports = function getBuildProperty(project, prop) { - const target = project.getFirstTarget().firstTarget; - const config = project.pbxXCConfigurationList()[ - target.buildConfigurationList - ]; - const buildSection = project.pbxXCBuildConfigurationSection()[ - config.buildConfigurations[0].value - ]; - - return buildSection.buildSettings[prop]; -}; diff --git a/local-cli/link/ios/getGroup.js b/local-cli/link/ios/getGroup.js deleted file mode 100644 index c53e731d96f..00000000000 --- a/local-cli/link/ios/getGroup.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const getFirstProject = project => project.getFirstProject().firstProject; - -const findGroup = (groups, name) => - groups.children.find(group => group.comment === name); - -/** - * Returns group from .xcodeproj if one exists, null otherwise - * - * Unlike node-xcode `pbxGroupByName` - it does not return `first-matching` - * group if multiple groups with the same name exist - * - * If path is not provided, it returns top-level group - */ -module.exports = function getGroup(project, path) { - const firstProject = getFirstProject(project); - - let groups = project.getPBXGroupByKey(firstProject.mainGroup); - - if (!path) { - return groups; - } - - for (var name of path.split('/')) { - var foundGroup = findGroup(groups, name); - - if (foundGroup) { - groups = project.getPBXGroupByKey(foundGroup.value); - } else { - groups = null; - break; - } - } - - return groups; -}; diff --git a/local-cli/link/ios/getHeaderSearchPath.js b/local-cli/link/ios/getHeaderSearchPath.js deleted file mode 100644 index bd1b5f5c5e8..00000000000 --- a/local-cli/link/ios/getHeaderSearchPath.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const path = require('path'); -const union = require('lodash').union; -const last = require('lodash').last; - -/** - * Given an array of directories, it returns the one that contains - * all the other directories in a given array inside it. - * - * Example: - * Given an array of directories: ['/Users/Kureev/a', '/Users/Kureev/b'] - * the returned folder is `/Users/Kureev` - * - * Check `getHeaderSearchPath.spec.js` for more use-cases. - */ -const getOuterDirectory = directories => - directories.reduce((topDir, currentDir) => { - const currentFolders = currentDir.split(path.sep); - const topMostFolders = topDir.split(path.sep); - - if ( - currentFolders.length === topMostFolders.length && - last(currentFolders) !== last(topMostFolders) - ) { - return currentFolders.slice(0, -1).join(path.sep); - } - - return currentFolders.length < topMostFolders.length ? currentDir : topDir; - }); - -/** - * Given an array of headers it returns search path so Xcode can resolve - * headers when referenced like below: - * ``` - * #import "CodePush.h" - * ``` - * If all files are located in one directory (directories.length === 1), - * we simply return a relative path to that location. - * - * Otherwise, we loop through them all to find the outer one that contains - * all the headers inside. That location is then returned with /** appended at - * the end so Xcode marks that location as `recursive` and will look inside - * every folder of it to locate correct headers. - */ -module.exports = function getHeaderSearchPath(sourceDir, headers) { - const directories = union(headers.map(path.dirname)); - - return directories.length === 1 - ? `"$(SRCROOT)${path.sep}${path.relative(sourceDir, directories[0])}"` - : `"$(SRCROOT)${path.sep}${path.relative( - sourceDir, - getOuterDirectory(directories), - )}/**"`; -}; diff --git a/local-cli/link/ios/getHeadersInFolder.js b/local-cli/link/ios/getHeadersInFolder.js deleted file mode 100644 index 562cac9a549..00000000000 --- a/local-cli/link/ios/getHeadersInFolder.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const glob = require('glob'); -const path = require('path'); - -const GLOB_EXCLUDE_PATTERN = [ - 'node_modules/**', - 'Pods/**', - 'Examples/**', - 'examples/**', -]; - -/** - * Given folder, it returns an array of all header files - * inside it, ignoring node_modules and examples - */ -module.exports = function getHeadersInFolder(folder) { - return glob - .sync('**/*.h', { - cwd: folder, - nodir: true, - ignore: GLOB_EXCLUDE_PATTERN, - }) - .map(file => path.join(folder, file)); -}; diff --git a/local-cli/link/ios/getPlist.js b/local-cli/link/ios/getPlist.js deleted file mode 100644 index 61d0b51256d..00000000000 --- a/local-cli/link/ios/getPlist.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const plistParser = require('plist'); -const getPlistPath = require('./getPlistPath'); -const fs = require('fs'); - -/** - * Returns Info.plist located in the iOS project - * - * Returns `null` if INFOPLIST_FILE is not specified. - */ -module.exports = function getPlist(project, sourceDir) { - const plistPath = getPlistPath(project, sourceDir); - - if (!plistPath || !fs.existsSync(plistPath)) { - return null; - } - - return plistParser.parse(fs.readFileSync(plistPath, 'utf-8')); -}; diff --git a/local-cli/link/ios/getPlistPath.js b/local-cli/link/ios/getPlistPath.js deleted file mode 100644 index f8d570b9f21..00000000000 --- a/local-cli/link/ios/getPlistPath.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const path = require('path'); -const getBuildProperty = require('./getBuildProperty'); - -module.exports = function getPlistPath(project, sourceDir) { - const plistFile = getBuildProperty(project, 'INFOPLIST_FILE'); - - if (!plistFile) { - return null; - } - - return path.join( - sourceDir, - plistFile.replace(/"/g, '').replace('$(SRCROOT)', ''), - ); -}; diff --git a/local-cli/link/ios/getTargets.js b/local-cli/link/ios/getTargets.js deleted file mode 100644 index 15f958598e6..00000000000 --- a/local-cli/link/ios/getTargets.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given xcodeproj it returns list of targets - */ -module.exports = function getTargets(project) { - let targets = project.getFirstProject().firstProject.targets; - let nativeTargetSection = project.pbxNativeTargetSection(); - return targets.map(function(target) { - let key = target.value; - let configurationListId = project.pbxNativeTargetSection()[key] - .buildConfigurationList; - let configurationList = project.pbxXCConfigurationList()[ - configurationListId - ]; - let buildConfigurationId = configurationList.buildConfigurations[0].value; - let buildConfiguration = project.pbxXCBuildConfigurationSection()[ - buildConfigurationId - ]; - return { - uuid: key, - target: nativeTargetSection[key], - name: nativeTargetSection[key].productReference_comment, - isTVOS: - (buildConfiguration.buildSettings.SDKROOT && - buildConfiguration.buildSettings.SDKROOT.indexOf('appletv') !== -1) || - false, - }; - }); -}; diff --git a/local-cli/link/ios/hasLibraryImported.js b/local-cli/link/ios/hasLibraryImported.js deleted file mode 100644 index 62805eb3a50..00000000000 --- a/local-cli/link/ios/hasLibraryImported.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of libraries already imported and packageName that will be - * added, returns true or false depending on whether the library is already linked - * or not - */ -module.exports = function hasLibraryImported(libraries, packageName) { - return ( - libraries.children.filter(library => library.comment === packageName) - .length > 0 - ); -}; diff --git a/local-cli/link/ios/index.js b/local-cli/link/ios/index.js deleted file mode 100644 index aa31fd2ba11..00000000000 --- a/local-cli/link/ios/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function() { - return { - isInstalled: require('./common/isInstalled'), - register: require('./common/registerNativeModule'), - unregister: require('./common/unregisterNativeModule'), - copyAssets: require('./copyAssets'), - unlinkAssets: require('./unlinkAssets'), - }; -}; diff --git a/local-cli/link/ios/isInstalled.js b/local-cli/link/ios/isInstalled.js deleted file mode 100644 index 07cfb12543b..00000000000 --- a/local-cli/link/ios/isInstalled.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const xcode = require('xcode'); -const getGroup = require('./getGroup'); -const hasLibraryImported = require('./hasLibraryImported'); - -/** - * Returns true if `xcodeproj` specified by dependencyConfig is present - * in a top level `libraryFolder` - */ -module.exports = function isInstalled(projectConfig, dependencyConfig) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); - const libraries = getGroup(project, projectConfig.libraryFolder); - - if (!libraries) { - return false; - } - - return hasLibraryImported(libraries, dependencyConfig.projectName); -}; diff --git a/local-cli/link/ios/mapHeaderSearchPaths.js b/local-cli/link/ios/mapHeaderSearchPaths.js deleted file mode 100644 index 2754602d4ce..00000000000 --- a/local-cli/link/ios/mapHeaderSearchPaths.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given Xcode project and path, iterate over all build configurations - * and execute func with HEADER_SEARCH_PATHS from current section - * - * We cannot use builtin addToHeaderSearchPaths method since react-native init does not - * use $(TARGET_NAME) for PRODUCT_NAME, but sets it manually so that method will skip - * that target. - * - * To workaround that issue and make it more bullet-proof for different names, - * we iterate over all configurations and look for `lc++` linker flag to detect - * React Native target. - * - * Important: That function mutates `buildSettings` and it's not pure thus you should - * not rely on its return value - */ -const defaultHeaderPaths = ['"$(inherited)"']; - -module.exports = function headerSearchPathIter(project, func) { - const config = project.pbxXCBuildConfigurationSection(); - - Object.keys(config) - .filter(ref => ref.indexOf('_comment') === -1) - .forEach(ref => { - const buildSettings = config[ref].buildSettings; - const shouldVisitBuildSettings = - (Array.isArray(buildSettings.OTHER_LDFLAGS) - ? buildSettings.OTHER_LDFLAGS - : [] - ).indexOf('"-lc++"') >= 0; - - if (shouldVisitBuildSettings) { - const searchPaths = buildSettings.HEADER_SEARCH_PATHS - ? [].concat(buildSettings.HEADER_SEARCH_PATHS) - : defaultHeaderPaths; - - buildSettings.HEADER_SEARCH_PATHS = func(searchPaths); - } - }); -}; diff --git a/local-cli/link/ios/registerNativeModule.js b/local-cli/link/ios/registerNativeModule.js deleted file mode 100644 index b68230ce31e..00000000000 --- a/local-cli/link/ios/registerNativeModule.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const xcode = require('xcode'); -const fs = require('fs'); -const path = require('path'); - -const addToHeaderSearchPaths = require('./addToHeaderSearchPaths'); -const getHeadersInFolder = require('./getHeadersInFolder'); -const getHeaderSearchPath = require('./getHeaderSearchPath'); -const getTargets = require('./getTargets'); -const createGroupWithMessage = require('./createGroupWithMessage'); -const addFileToProject = require('./addFileToProject'); -const addProjectToLibraries = require('./addProjectToLibraries'); -const addSharedLibraries = require('./addSharedLibraries'); -const isEmpty = require('lodash').isEmpty; - -/** - * Register native module IOS adds given dependency to project by adding - * its xcodeproj to project libraries as well as attaching static library - * to the first target (the main one) - * - * If library is already linked, this action is a no-op. - */ -module.exports = function registerNativeModuleIOS( - dependencyConfig, - projectConfig, -) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); - const dependencyProject = xcode - .project(dependencyConfig.pbxprojPath) - .parseSync(); - - const libraries = createGroupWithMessage( - project, - projectConfig.libraryFolder, - ); - const file = addFileToProject( - project, - path.relative(projectConfig.sourceDir, dependencyConfig.projectPath), - ); - - const targets = getTargets(project); - - addProjectToLibraries(libraries, file); - - getTargets(dependencyProject).forEach(product => { - var i; - if (!product.isTVOS) { - for (i = 0; i < targets.length; i++) { - if (!targets[i].isTVOS) { - project.addStaticLibrary(product.name, { - target: targets[i].uuid, - }); - } - } - } - - if (product.isTVOS) { - for (i = 0; i < targets.length; i++) { - if (targets[i].isTVOS) { - project.addStaticLibrary(product.name, { - target: targets[i].uuid, - }); - } - } - } - }); - - addSharedLibraries(project, dependencyConfig.sharedLibraries); - - const headers = getHeadersInFolder(dependencyConfig.folder); - if (!isEmpty(headers)) { - addToHeaderSearchPaths( - project, - getHeaderSearchPath(projectConfig.sourceDir, headers), - ); - } - - fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); -}; diff --git a/local-cli/link/ios/removeFromHeaderSearchPaths.js b/local-cli/link/ios/removeFromHeaderSearchPaths.js deleted file mode 100644 index e7fc30fa1e8..00000000000 --- a/local-cli/link/ios/removeFromHeaderSearchPaths.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const mapHeaderSearchPaths = require('./mapHeaderSearchPaths'); - -/** - * Given Xcode project and absolute path, it makes sure there are no headers referring to it - */ -module.exports = function addToHeaderSearchPaths(project, path) { - mapHeaderSearchPaths(project, searchPaths => - searchPaths.filter(searchPath => searchPath !== path), - ); -}; diff --git a/local-cli/link/ios/removeFromPbxItemContainerProxySection.js b/local-cli/link/ios/removeFromPbxItemContainerProxySection.js deleted file mode 100644 index b2277ce8824..00000000000 --- a/local-cli/link/ios/removeFromPbxItemContainerProxySection.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * For all files that are created and referenced from another `.xcodeproj` - - * a new PBXItemContainerProxy is created that contains `containerPortal` value - * which equals to xcodeproj file.uuid from PBXFileReference section. - */ -module.exports = function removeFromPbxItemContainerProxySection( - project, - file, -) { - const section = project.hash.project.objects.PBXContainerItemProxy; - - for (var key of Object.keys(section)) { - if (section[key].containerPortal === file.uuid) { - delete section[key]; - } - } - - return; -}; diff --git a/local-cli/link/ios/removeFromPbxReferenceProxySection.js b/local-cli/link/ios/removeFromPbxReferenceProxySection.js deleted file mode 100644 index 52f8056a5f4..00000000000 --- a/local-cli/link/ios/removeFromPbxReferenceProxySection.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Every file added to the project from another project is attached to - * `PBXItemContainerProxy` through `PBXReferenceProxy`. - */ -module.exports = function removeFromPbxReferenceProxySection(project, file) { - const section = project.hash.project.objects.PBXReferenceProxy; - - for (var key of Object.keys(section)) { - if (section[key].path === file.basename) { - delete section[key]; - } - } - - return; -}; diff --git a/local-cli/link/ios/removeFromProjectReferences.js b/local-cli/link/ios/removeFromProjectReferences.js deleted file mode 100644 index 8a776bf7206..00000000000 --- a/local-cli/link/ios/removeFromProjectReferences.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * For each file (.xcodeproj), there's an entry in `projectReferences` created - * that has two entries - `ProjectRef` - reference to a file.uuid and - * `ProductGroup` - uuid of a Products group. - * - * When projectReference is found - it's deleted and the removed value is returned - * so that ProductGroup in PBXGroup section can be removed as well. - * - * Otherwise returns null - */ -module.exports = function removeFromProjectReferences(project, file) { - const firstProject = project.getFirstProject().firstProject; - - const projectRef = firstProject.projectReferences.find( - item => item.ProjectRef === file.uuid, - ); - - if (!projectRef) { - return null; - } - - firstProject.projectReferences.splice( - firstProject.projectReferences.indexOf(projectRef), - 1, - ); - - return projectRef; -}; diff --git a/local-cli/link/ios/removeFromStaticLibraries.js b/local-cli/link/ios/removeFromStaticLibraries.js deleted file mode 100644 index 7beaf880446..00000000000 --- a/local-cli/link/ios/removeFromStaticLibraries.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const PbxFile = require('xcode/lib/pbxFile'); -const removeFromPbxReferenceProxySection = require('./removeFromPbxReferenceProxySection'); - -/** - * Removes file from static libraries - * - * Similar to `node-xcode` addStaticLibrary - */ -module.exports = function removeFromStaticLibraries(project, path, opts) { - const file = new PbxFile(path); - - file.target = opts ? opts.target : undefined; - - project.removeFromPbxFileReferenceSection(file); - project.removeFromPbxBuildFileSection(file); - project.removeFromPbxFrameworksBuildPhase(file); - project.removeFromLibrarySearchPaths(file); - removeFromPbxReferenceProxySection(project, file); - - return file; -}; diff --git a/local-cli/link/ios/removeProductGroup.js b/local-cli/link/ios/removeProductGroup.js deleted file mode 100644 index f012ff25c0c..00000000000 --- a/local-cli/link/ios/removeProductGroup.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function removeProductGroup(project, productGroupId) { - const section = project.hash.project.objects.PBXGroup; - - for (var key of Object.keys(section)) { - if (key === productGroupId) { - delete section[key]; - } - } - - return; -}; diff --git a/local-cli/link/ios/removeProjectFromLibraries.js b/local-cli/link/ios/removeProjectFromLibraries.js deleted file mode 100644 index 0402d777a32..00000000000 --- a/local-cli/link/ios/removeProjectFromLibraries.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of xcodeproj libraries and pbxFile, - * it removes it from that group by comparing basenames - * - * Important: That function mutates `libraries` and it's not pure. - * It's mainly due to limitations of `xcode` library. - */ -module.exports = function removeProjectFromLibraries(libraries, file) { - libraries.children = libraries.children.filter( - library => library.comment !== file.basename, - ); -}; diff --git a/local-cli/link/ios/removeProjectFromProject.js b/local-cli/link/ios/removeProjectFromProject.js deleted file mode 100644 index fbae783f4ee..00000000000 --- a/local-cli/link/ios/removeProjectFromProject.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const PbxFile = require('xcode/lib/pbxFile'); -const removeFromPbxItemContainerProxySection = require('./removeFromPbxItemContainerProxySection'); -const removeFromProjectReferences = require('./removeFromProjectReferences'); -const removeProductGroup = require('./removeProductGroup'); - -/** - * Given xcodeproj and filePath, it creates new file - * from path provided and removes it. That operation is required since - * underlying method requires PbxFile instance to be passed (it does not - * have to have uuid or fileRef defined since it will do equality check - * by path) - * - * Returns removed file (that one will have UUID) - */ -module.exports = function removeProjectFromProject(project, filePath) { - const file = project.removeFromPbxFileReferenceSection(new PbxFile(filePath)); - const projectRef = removeFromProjectReferences(project, file); - - if (projectRef) { - removeProductGroup(project, projectRef.ProductGroup); - } - - removeFromPbxItemContainerProxySection(project, file); - - return file; -}; diff --git a/local-cli/link/ios/removeSharedLibraries.js b/local-cli/link/ios/removeSharedLibraries.js deleted file mode 100644 index 1a34b7c1afa..00000000000 --- a/local-cli/link/ios/removeSharedLibraries.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = function removeSharedLibraries(project, libraries) { - if (!libraries.length) { - return; - } - - const target = project.getFirstTarget().uuid; - - for (var name of libraries) { - project.removeFramework(name, {target}); - } -}; diff --git a/local-cli/link/ios/unlinkAssets.js b/local-cli/link/ios/unlinkAssets.js deleted file mode 100644 index 1df299fdda8..00000000000 --- a/local-cli/link/ios/unlinkAssets.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const fs = require('fs-extra'); -const path = require('path'); -const xcode = require('xcode'); -const log = require('npmlog'); -const groupFilesByType = require('../groupFilesByType'); -const getPlist = require('./getPlist'); -const writePlist = require('./writePlist'); -const difference = require('lodash').difference; - -/** - * Unlinks assets from iOS project. Removes references for fonts from `Info.plist` - * fonts provided by application and from `Resources` group - */ -module.exports = function unlinkAssetsIOS(files, projectConfig) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); - const assets = groupFilesByType(files); - const plist = getPlist(project, projectConfig.sourceDir); - - if (!plist) { - return log.error( - 'ERRPLIST', - "Could not locate Info.plist file. Check if your project has 'INFOPLIST_FILE' set properly", - ); - } - - if (!project.pbxGroupByName('Resources')) { - return log.error( - 'ERRGROUP', - "Group 'Resources' does not exist in your Xcode project. There is nothing to unlink.", - ); - } - - const removeResourceFile = function(f) { - (f || []) - .map(asset => - project.removeResourceFile( - path.relative(projectConfig.sourceDir, asset), - {target: project.getFirstTarget().uuid}, - ), - ) - .map(file => file.basename); - }; - - removeResourceFile(assets.image); - - const fonts = removeResourceFile(assets.font); - - plist.UIAppFonts = difference(plist.UIAppFonts || [], fonts); - - fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); - - writePlist(project, projectConfig.sourceDir, plist); -}; diff --git a/local-cli/link/ios/unregisterNativeModule.js b/local-cli/link/ios/unregisterNativeModule.js deleted file mode 100644 index c9b83a880d4..00000000000 --- a/local-cli/link/ios/unregisterNativeModule.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const xcode = require('xcode'); -const path = require('path'); -const fs = require('fs'); -const difference = require('lodash').difference; -const isEmpty = require('lodash').isEmpty; - -const getGroup = require('./getGroup'); -const getTargets = require('./getTargets'); -const getHeadersInFolder = require('./getHeadersInFolder'); -const getHeaderSearchPath = require('./getHeaderSearchPath'); -const removeProjectFromProject = require('./removeProjectFromProject'); -const removeProjectFromLibraries = require('./removeProjectFromLibraries'); -const removeFromStaticLibraries = require('./removeFromStaticLibraries'); -const removeFromHeaderSearchPaths = require('./removeFromHeaderSearchPaths'); -const removeSharedLibraries = require('./removeSharedLibraries'); - -/** - * Unregister native module IOS - * - * If library is already unlinked, this action is a no-op. - */ -module.exports = function unregisterNativeModule( - dependencyConfig, - projectConfig, - iOSDependencies, -) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); - const dependencyProject = xcode - .project(dependencyConfig.pbxprojPath) - .parseSync(); - - const libraries = getGroup(project, projectConfig.libraryFolder); - - const file = removeProjectFromProject( - project, - path.relative(projectConfig.sourceDir, dependencyConfig.projectPath), - ); - - removeProjectFromLibraries(libraries, file); - - getTargets(dependencyProject).forEach(target => { - removeFromStaticLibraries(project, target.name, { - target: project.getFirstTarget().uuid, - }); - }); - - const sharedLibraries = difference( - dependencyConfig.sharedLibraries, - iOSDependencies.reduce( - (libs, dependency) => libs.concat(dependency.sharedLibraries), - projectConfig.sharedLibraries, - ), - ); - - removeSharedLibraries(project, sharedLibraries); - - const headers = getHeadersInFolder(dependencyConfig.folder); - if (!isEmpty(headers)) { - removeFromHeaderSearchPaths( - project, - getHeaderSearchPath(projectConfig.sourceDir, headers), - ); - } - - fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); -}; diff --git a/local-cli/link/ios/writePlist.js b/local-cli/link/ios/writePlist.js deleted file mode 100644 index 009de34e26f..00000000000 --- a/local-cli/link/ios/writePlist.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const plistParser = require('plist'); -const getPlistPath = require('./getPlistPath'); -const fs = require('fs'); - -/** - * Writes to Info.plist located in the iOS project - * - * Returns `null` if INFOPLIST_FILE is not specified or file is non-existent. - */ -module.exports = function writePlist(project, sourceDir, plist) { - const plistPath = getPlistPath(project, sourceDir); - - if (!plistPath) { - return null; - } - - // We start with an offset of -1, because Xcode maintains a custom - // indentation of the plist. - // Ref: https://github.com/facebook/react-native/issues/11668 - return fs.writeFileSync( - plistPath, - plistParser.build(plist, {indent: '\t', offset: -1}) + '\n', - ); -}; diff --git a/local-cli/link/link.js b/local-cli/link/link.js deleted file mode 100644 index 752e75e2294..00000000000 --- a/local-cli/link/link.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const log = require('npmlog'); -const path = require('path'); -const uniqBy = require('lodash').uniqBy; -const flatten = require('lodash').flatten; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const chalk = require('chalk'); - -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const isEmpty = require('lodash').isEmpty; -const promiseWaterfall = require('./promiseWaterfall'); -const getProjectDependencies = require('./getProjectDependencies'); -const getDependencyConfig = require('./getDependencyConfig'); -const pollParams = require('./pollParams'); -const commandStub = require('./commandStub'); -const promisify = require('./promisify'); -const findReactNativeScripts = require('../util/findReactNativeScripts'); - -import type {RNConfig} from '../core'; - -log.heading = 'rnpm-link'; - -const dedupeAssets = assets => uniqBy(assets, asset => path.basename(asset)); - -const linkDependency = async (platforms, project, dependency) => { - const params = await pollParams(dependency.config.params); - - Object.keys(platforms || {}).forEach(platform => { - if (!project[platform] || !dependency.config[platform]) { - return null; - } - - const linkConfig = - platforms[platform] && - platforms[platform].linkConfig && - platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.isInstalled || !linkConfig.register) { - return null; - } - - const isInstalled = linkConfig.isInstalled( - project[platform], - dependency.name, - dependency.config[platform], - ); - - if (isInstalled) { - log.info( - chalk.grey( - `Platform '${platform}' module ${dependency.name} is already linked`, - ), - ); - return null; - } - - log.info(`Linking ${dependency.name} ${platform} dependency`); - - linkConfig.register( - dependency.name, - dependency.config[platform], - params, - project[platform], - ); - - log.info( - `Platform '${platform}' module ${ - dependency.name - } has been successfully linked`, - ); - }); -}; - -const linkAssets = (platforms, project, assets) => { - if (isEmpty(assets)) { - return; - } - - Object.keys(platforms || {}).forEach(platform => { - const linkConfig = - platforms[platform] && - platforms[platform].linkConfig && - platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.copyAssets) { - return; - } - - log.info(`Linking assets to ${platform} project`); - linkConfig.copyAssets(assets, project[platform]); - }); - - log.info('Assets have been successfully linked to your project'); -}; - -/** - * Updates project and links all dependencies to it. - * - * @param args If optional argument [packageName] is provided, - * only that package is processed. - * @param config CLI config, see local-cli/core/index.js - */ -function link(args: Array, config: RNConfig) { - let project; - let platforms; - try { - project = config.getProjectConfig(); - platforms = config.getPlatformConfig(); - } catch (err) { - log.error( - 'ERRPACKAGEJSON', - 'No package found. Are you sure this is a React Native project?', - ); - return Promise.reject(err); - } - - const hasProjectConfig = Object.keys(platforms).reduce( - (acc, key) => acc || key in project, - false, - ); - if (!hasProjectConfig && findReactNativeScripts()) { - throw new Error( - '`react-native link` can not be used in Create React Native App projects. ' + - 'If you need to include a library that relies on custom native code, ' + - 'you might have to eject first. ' + - 'See https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md ' + - 'for more information.', - ); - } - - let packageName = args[0]; - // Trim the version / tag out of the package name (eg. package@latest) - if (packageName !== undefined) { - packageName = packageName.replace(/^(.+?)(@.+?)$/gi, '$1'); - } - - const dependencies = getDependencyConfig( - config, - packageName ? [packageName] : getProjectDependencies(), - ); - - const assets = dedupeAssets( - dependencies.reduce( - (acc, dependency) => acc.concat(dependency.config.assets), - project.assets, - ), - ); - - const tasks = flatten( - dependencies.map(dependency => [ - () => promisify(dependency.config.commands.prelink || commandStub), - () => linkDependency(platforms, project, dependency), - () => promisify(dependency.config.commands.postlink || commandStub), - ]), - ); - - tasks.push(() => linkAssets(platforms, project, assets)); - - return promiseWaterfall(tasks).catch(err => { - log.error( - `Something went wrong while linking. Error: ${err.message} \n` + - 'Please file an issue here: https://github.com/facebook/react-native/issues', - ); - throw err; - }); -} - -module.exports = { - func: link, - description: 'links all native dependencies (updates native build files)', - name: 'link [packageName]', -}; diff --git a/local-cli/link/pods/addPodEntry.js b/local-cli/link/pods/addPodEntry.js deleted file mode 100644 index e89716eb60d..00000000000 --- a/local-cli/link/pods/addPodEntry.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = function addPodEntry( - podLines, - linesToAddEntry, - podName, - nodePath, -) { - const newEntry = `pod '${podName}', :path => '../node_modules/${nodePath}'\n`; - - if (!linesToAddEntry) { - return; - } else if (Array.isArray(linesToAddEntry)) { - linesToAddEntry.map(({line, indentation}, idx) => - podLines.splice(line + idx, 0, getLineToAdd(newEntry, indentation)), - ); - } else { - const {line, indentation} = linesToAddEntry; - podLines.splice(line, 0, getLineToAdd(newEntry, indentation)); - } -}; - -function getLineToAdd(newEntry, indentation) { - const spaces = Array(indentation + 1).join(' '); - return spaces + newEntry; -} diff --git a/local-cli/link/pods/findLineToAddPod.js b/local-cli/link/pods/findLineToAddPod.js deleted file mode 100644 index d6902838ea3..00000000000 --- a/local-cli/link/pods/findLineToAddPod.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = function findLineToAddPod(podLines, firstTargetLine) { - // match line with new target: target 'project_name' do (most likely target inside podfile main target) - const nextTarget = /target (\'|\")\w+(\'|\") do/g; - // match line that has only 'end' (if we don't catch new target or function, this would mean this is end of current target) - const endOfCurrentTarget = /^\s*end\s*$/g; - // match function definition, like: post_install do |installer| (some Podfiles have function defined inside main target - const functionDefinition = /^\s*[a-z_]+\s+do(\s+\|[a-z]+\|)?/g; - - for (let i = firstTargetLine, len = podLines.length; i < len; i++) { - const matchNextConstruct = - podLines[i].match(nextTarget) || podLines[i].match(functionDefinition); - const matchEnd = podLines[i].match(endOfCurrentTarget); - - if (matchNextConstruct || matchEnd) { - const firstNonSpaceCharacter = podLines[i].search(/\S/); - return { - indentation: firstNonSpaceCharacter + (matchEnd ? 2 : 0), - line: i, - }; - } - } - return null; -}; diff --git a/local-cli/link/pods/findMarkedLinesInPodfile.js b/local-cli/link/pods/findMarkedLinesInPodfile.js deleted file mode 100644 index 5df1c33ac2b..00000000000 --- a/local-cli/link/pods/findMarkedLinesInPodfile.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; -const MARKER_TEXT = '# Add new pods below this line'; - -module.exports = function findMarkedLinesInPodfile(podLines) { - const result = []; - for (let i = 0, len = podLines.length; i < len; i++) { - if (podLines[i].includes(MARKER_TEXT)) { - result.push({line: i + 1, indentation: podLines[i].indexOf('#')}); - } - } - return result; -}; diff --git a/local-cli/link/pods/findPodTargetLine.js b/local-cli/link/pods/findPodTargetLine.js deleted file mode 100644 index 22070f8ddf8..00000000000 --- a/local-cli/link/pods/findPodTargetLine.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = function findPodTargetLine(podLines, projectName) { - const targetName = projectName.replace('.xcodeproj', ''); - //match first target definition in file: target 'target_name' do - const targetRegex = new RegExp( - 'target (\'|")' + targetName + '(\'|") do', - 'g', - ); - for (let i = 0, len = podLines.length; i < len; i++) { - const match = podLines[i].match(targetRegex); - if (match) { - return i + 1; - } - } - return null; -}; diff --git a/local-cli/link/pods/isInstalled.js b/local-cli/link/pods/isInstalled.js deleted file mode 100644 index d7602d14dda..00000000000 --- a/local-cli/link/pods/isInstalled.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const readPodfile = require('./readPodfile'); - -module.exports = function isInstalled(iOSProject, dependencyConfig) { - if (!iOSProject.podfile) { - return false; - } - // match line with pod declaration: pod 'dependencyPodName' (other possible parameters of pod are ignored) - const dependencyRegExp = new RegExp( - 'pod\\s+(\'|")' + dependencyConfig.podspec + '(\'|")', - 'g', - ); - const podLines = readPodfile(iOSProject.podfile); - for (let i = 0, len = podLines.length; i < len; i++) { - const match = podLines[i].match(dependencyRegExp); - if (match) { - return true; - } - } - return false; -}; diff --git a/local-cli/link/pods/readPodfile.js b/local-cli/link/pods/readPodfile.js deleted file mode 100644 index 281a0a0e496..00000000000 --- a/local-cli/link/pods/readPodfile.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); - -module.exports = function readPodfile(podfilePath) { - const podContent = fs.readFileSync(podfilePath, 'utf8'); - return podContent.split(/\r?\n/g); -}; diff --git a/local-cli/link/pods/registerNativeModule.js b/local-cli/link/pods/registerNativeModule.js deleted file mode 100644 index f8e757b2708..00000000000 --- a/local-cli/link/pods/registerNativeModule.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const readPodfile = require('./readPodfile'); -const findPodTargetLine = require('./findPodTargetLine'); -const findLineToAddPod = require('./findLineToAddPod'); -const findMarkedLinesInPodfile = require('./findMarkedLinesInPodfile'); -const addPodEntry = require('./addPodEntry'); -const savePodFile = require('./savePodFile'); - -module.exports = function registerNativeModulePods( - name, - dependencyConfig, - iOSProject, -) { - const podLines = readPodfile(iOSProject.podfile); - const linesToAddEntry = getLinesToAddEntry(podLines, iOSProject); - addPodEntry(podLines, linesToAddEntry, dependencyConfig.podspec, name); - savePodFile(iOSProject.podfile, podLines); -}; - -function getLinesToAddEntry(podLines, {projectName}) { - const linesToAddPodWithMarker = findMarkedLinesInPodfile(podLines); - if (linesToAddPodWithMarker.length > 0) { - return linesToAddPodWithMarker; - } else { - const firstTargetLined = findPodTargetLine(podLines, projectName); - return findLineToAddPod(podLines, firstTargetLined); - } -} diff --git a/local-cli/link/pods/removePodEntry.js b/local-cli/link/pods/removePodEntry.js deleted file mode 100644 index 02ef4746f81..00000000000 --- a/local-cli/link/pods/removePodEntry.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = function removePodEntry(podfileContent, podName) { - // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1'] - const podRegex = new RegExp( - '\\n( |\\t)*pod\\s+("|\')' + - podName + - '("|\')(,\\s*(:[a-z]+\\s*=>)?\\s*(("|\').*?("|\')|\\[[\\s\\S]*?\\]))*\\n', - 'g', - ); - return podfileContent.replace(podRegex, '\n'); -}; diff --git a/local-cli/link/pods/savePodFile.js b/local-cli/link/pods/savePodFile.js deleted file mode 100644 index 640bb646f88..00000000000 --- a/local-cli/link/pods/savePodFile.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); - -module.exports = function savePodFile(podfilePath, podLines) { - const newPodfile = podLines.join('\n'); - fs.writeFileSync(podfilePath, newPodfile); -}; diff --git a/local-cli/link/pods/unregisterNativeModule.js b/local-cli/link/pods/unregisterNativeModule.js deleted file mode 100644 index 048e3e8de7e..00000000000 --- a/local-cli/link/pods/unregisterNativeModule.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const removePodEntry = require('./removePodEntry'); - -/** - * Unregister native module IOS with CocoaPods - */ -module.exports = function unregisterNativeModule(dependencyConfig, iOSProject) { - const podContent = fs.readFileSync(iOSProject.podfile, 'utf8'); - const removed = removePodEntry(podContent, dependencyConfig.podspec); - fs.writeFileSync(iOSProject.podfile, removed); -}; diff --git a/local-cli/link/pollParams.js b/local-cli/link/pollParams.js deleted file mode 100644 index 6cf23020d46..00000000000 --- a/local-cli/link/pollParams.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -var inquirer = require('inquirer'); - -module.exports = questions => - new Promise((resolve, reject) => { - if (!questions) { - return resolve({}); - } - - inquirer.prompt(questions).then(resolve, reject); - }); diff --git a/local-cli/link/promiseWaterfall.js b/local-cli/link/promiseWaterfall.js deleted file mode 100644 index 0a2ddac88ce..00000000000 --- a/local-cli/link/promiseWaterfall.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of promise creators, executes them in a sequence. - * - * If any of the promises in the chain fails, all subsequent promises - * will be skipped - * - * Returns the value last promise from a sequence resolved - */ -module.exports = function promiseWaterfall(tasks) { - return tasks.reduce( - (prevTaskPromise, task) => prevTaskPromise.then(task), - Promise.resolve(), - ); -}; diff --git a/local-cli/link/promisify.js b/local-cli/link/promisify.js deleted file mode 100644 index 2605bf95e12..00000000000 --- a/local-cli/link/promisify.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = func => - new Promise((resolve, reject) => - func((err, res) => (err ? reject(err) : resolve(res))), - ); diff --git a/local-cli/link/unlink.js b/local-cli/link/unlink.js deleted file mode 100644 index 48ed5f192c0..00000000000 --- a/local-cli/link/unlink.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const log = require('npmlog'); - -const getProjectDependencies = require('./getProjectDependencies'); -const getDependencyConfig = require('./getDependencyConfig'); -const difference = require('lodash').difference; -const filter = require('lodash').filter; -const flatten = require('lodash').flatten; -const isEmpty = require('lodash').isEmpty; -const promiseWaterfall = require('./promiseWaterfall'); -const commandStub = require('./commandStub'); -const promisify = require('./promisify'); - -log.heading = 'rnpm-link'; - -const unlinkDependency = ( - platforms, - project, - dependency, - packageName, - otherDependencies, -) => { - Object.keys(platforms || {}).forEach(platform => { - if (!project[platform] || !dependency[platform]) { - return; - } - - const linkConfig = - platforms[platform] && - platforms[platform].linkConfig && - platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.isInstalled || !linkConfig.unregister) { - return; - } - - const isInstalled = linkConfig.isInstalled( - project[platform], - packageName, - dependency[platform], - ); - - if (!isInstalled) { - log.info(`Platform '${platform}' module ${packageName} is not installed`); - return; - } - - log.info(`Unlinking ${packageName} ${platform} dependency`); - - linkConfig.unregister( - packageName, - dependency[platform], - project[platform], - otherDependencies, - ); - - log.info( - `Platform '${platform}' module ${ - dependency.name - } has been successfully unlinked`, - ); - }); -}; - -/** - * Updates project and unlink specific dependency - * - * If optional argument [packageName] is provided, it's the only one - * that's checked - */ -function unlink(args, config) { - const packageName = args[0]; - - let platforms; - let project; - let dependency; - - try { - platforms = config.getPlatformConfig(); - project = config.getProjectConfig(); - } catch (err) { - log.error( - 'ERRPACKAGEJSON', - "No package found. Are you sure it's a React Native project?", - ); - return Promise.reject(err); - } - - try { - dependency = config.getDependencyConfig(packageName); - } catch (err) { - log.warn( - 'ERRINVALIDPROJ', - `Project ${packageName} is not a react-native library`, - ); - return Promise.reject(err); - } - - const allDependencies = getDependencyConfig(config, getProjectDependencies()); - const otherDependencies = filter( - allDependencies, - d => d.name !== packageName, - ); - - const tasks = [ - () => promisify(dependency.commands.preunlink || commandStub), - () => - unlinkDependency( - platforms, - project, - dependency, - packageName, - otherDependencies, - ), - () => promisify(dependency.commands.postunlink || commandStub), - ]; - - return promiseWaterfall(tasks) - .then(() => { - // @todo move all these to `tasks` array, just like in - // link - const assets = difference( - dependency.assets, - flatten(allDependencies, d => d.assets), - ); - - if (isEmpty(assets)) { - return Promise.resolve(); - } - - Object.keys(platforms || {}).forEach(platform => { - const linkConfig = - platforms[platform] && - platforms[platform].linkConfig && - platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.unlinkAssets) { - return; - } - - log.info(`Unlinking assets from ${platform} project`); - linkConfig.unlinkAssets(assets, project[platform]); - }); - - log.info( - `${packageName} assets has been successfully unlinked from your project`, - ); - }) - .catch(err => { - log.error( - `It seems something went wrong while unlinking. Error: ${err.message}`, - ); - throw err; - }); -} - -module.exports = { - func: unlink, - description: 'unlink native dependency', - name: 'unlink ', -}; diff --git a/local-cli/logAndroid/logAndroid.js b/local-cli/logAndroid/logAndroid.js deleted file mode 100644 index 322bc8eae44..00000000000 --- a/local-cli/logAndroid/logAndroid.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const chalk = require('chalk'); -const child_process = require('child_process'); - -/** - * Starts adb logcat - */ -function logAndroid() { - return new Promise((resolve, reject) => { - _logAndroid(resolve, reject); - }); -} - -function _logAndroid() { - try { - const adbPath = process.env.ANDROID_HOME - ? process.env.ANDROID_HOME + '/platform-tools/adb' - : 'adb'; - - const adbArgs = ['logcat', '*:S', 'ReactNative:V', 'ReactNativeJS:V']; - - console.log( - chalk.bold(`Starting the logger (${adbPath} ${adbArgs.join(' ')})...`), - ); - - const log = child_process.spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); - - if (log.error !== null) { - throw log.error; - } - } catch (e) { - console.log( - chalk.red('adb invocation failed. Do you have adb in your PATH?'), - ); - return Promise.reject(); - } -} - -module.exports = { - name: 'log-android', - description: 'starts adb logcat', - func: logAndroid, -}; diff --git a/local-cli/logIOS/logIOS.js b/local-cli/logIOS/logIOS.js deleted file mode 100644 index 9d9aa68faf4..00000000000 --- a/local-cli/logIOS/logIOS.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const chalk = require('chalk'); -const child_process = require('child_process'); -const os = require('os'); -const path = require('path'); - -/** - * Starts iOS device syslog tail - */ -function logIOS() { - return new Promise((resolve, reject) => { - _logIOS(resolve, reject); - }); -} - -function _logIOS() { - let rawDevices; - - try { - rawDevices = child_process.execFileSync( - 'xcrun', - ['simctl', 'list', 'devices', '--json'], - {encoding: 'utf8'}, - ); - } catch (e) { - console.log( - chalk.red( - 'xcrun invocation failed. Please check that Xcode is installed.', - ), - ); - return Promise.reject(e); - } - - const {devices} = JSON.parse(rawDevices); - - const device = _findAvailableDevice(devices); - if (device === undefined) { - console.log(chalk.red('No active iOS device found')); - return Promise.reject(); - } - - return tailDeviceLogs(device.udid); -} - -function _findAvailableDevice(devices) { - for (const key of Object.keys(devices)) { - for (const device of devices[key]) { - if (device.availability === '(available)' && device.state === 'Booted') { - return device; - } - } - } -} - -function tailDeviceLogs(udid) { - const logDir = path.join( - os.homedir(), - 'Library', - 'Logs', - 'CoreSimulator', - udid, - 'asl', - ); - - const log = child_process.spawnSync( - 'syslog', - ['-w', '-F', 'std', '-d', logDir], - {stdio: 'inherit'}, - ); - - if (log.error !== null) { - console.log(chalk.red('syslog invocation failed.')); - return Promise.reject(log.error); - } -} - -module.exports = { - name: 'log-ios', - description: 'starts iOS device syslog tail', - func: logIOS, -}; diff --git a/local-cli/runAndroid/adb.js b/local-cli/runAndroid/adb.js deleted file mode 100644 index 7846a4724d9..00000000000 --- a/local-cli/runAndroid/adb.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -const child_process = require('child_process'); - -/** - * Parses the output of the 'adb devices' command - */ -function parseDevicesResult(result: string): Array { - if (!result) { - return []; - } - - const devices = []; - const lines = result.trim().split(/\r?\n/); - - for (let i = 0; i < lines.length; i++) { - let words = lines[i].split(/[ ,\t]+/).filter(w => w !== ''); - - if (words[1] === 'device') { - devices.push(words[0]); - } - } - return devices; -} - -/** - * Executes the commands needed to get a list of devices from ADB - */ -function getDevices(): Array { - try { - const devicesResult = child_process.execSync('adb devices'); - return parseDevicesResult(devicesResult.toString()); - } catch (e) { - return []; - } -} - -module.exports = { - parseDevicesResult: parseDevicesResult, - getDevices: getDevices, -}; diff --git a/local-cli/runAndroid/runAndroid.js b/local-cli/runAndroid/runAndroid.js deleted file mode 100644 index f94caa2661b..00000000000 --- a/local-cli/runAndroid/runAndroid.js +++ /dev/null @@ -1,491 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const adb = require('./adb'); -const chalk = require('chalk'); -const child_process = require('child_process'); -const fs = require('fs'); -const isPackagerRunning = require('../util/isPackagerRunning'); -const findReactNativeScripts = require('../util/findReactNativeScripts'); -const isString = require('lodash/isString'); -const path = require('path'); -const Promise = require('promise'); - -// Verifies this is an Android project -function checkAndroid(root) { - return fs.existsSync(path.join(root, 'android/gradlew')); -} - -/** - * Starts the app on a connected Android emulator or device. - */ -function runAndroid(argv, config, args) { - if (!checkAndroid(args.root)) { - const reactNativeScriptsPath = findReactNativeScripts(); - if (reactNativeScriptsPath) { - child_process.spawnSync( - reactNativeScriptsPath, - ['android'].concat(process.argv.slice(1)), - {stdio: 'inherit'}, - ); - } else { - console.log( - chalk.red( - 'Android project not found. Maybe run react-native android first?', - ), - ); - } - return; - } - - if (!args.packager) { - return buildAndRun(args); - } - - return isPackagerRunning(args.port).then(result => { - if (result === 'running') { - console.log(chalk.bold('JS server already running.')); - } else if (result === 'unrecognized') { - console.warn( - chalk.yellow('JS server not recognized, continuing with build...'), - ); - } else { - // result == 'not_running' - console.log(chalk.bold('Starting JS server...')); - startServerInNewWindow(args.port, args.terminal); - } - return buildAndRun(args); - }); -} - -function getAdbPath() { - return process.env.ANDROID_HOME - ? process.env.ANDROID_HOME + '/platform-tools/adb' - : 'adb'; -} - -// Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager -function tryRunAdbReverse(packagerPort, device) { - try { - const adbPath = getAdbPath(); - const adbArgs = ['reverse', `tcp:${packagerPort}`, `tcp:${packagerPort}`]; - - // If a device is specified then tell adb to use it - if (device) { - adbArgs.unshift('-s', device); - } - - console.log(chalk.bold(`Running ${adbPath} ${adbArgs.join(' ')}`)); - - child_process.execFileSync(adbPath, adbArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - console.log(chalk.yellow(`Could not run adb reverse: ${e.message}`)); - } -} - -function getPackageNameWithSuffix(appId, appIdSuffix, packageName) { - if (appId) { - return appId; - } else if (appIdSuffix) { - return packageName + '.' + appIdSuffix; - } - - return packageName; -} - -// Builds the app and runs it on a connected emulator / device. -function buildAndRun(args) { - process.chdir(path.join(args.root, 'android')); - const cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew'; - - const packageName = fs - .readFileSync(`${args.appFolder}/src/main/AndroidManifest.xml`, 'utf8') - .match(/package="(.+?)"/)[1]; - - const packageNameWithSuffix = getPackageNameWithSuffix( - args.appId, - args.appIdSuffix, - packageName, - ); - - const adbPath = getAdbPath(); - if (args.deviceId) { - if (isString(args.deviceId)) { - return runOnSpecificDevice( - args, - cmd, - packageNameWithSuffix, - packageName, - adbPath, - ); - } else { - console.log(chalk.red('Argument missing for parameter --deviceId')); - } - } else { - return runOnAllDevices( - args, - cmd, - packageNameWithSuffix, - packageName, - adbPath, - ); - } -} - -function runOnSpecificDevice( - args, - gradlew, - packageNameWithSuffix, - packageName, - adbPath, -) { - let devices = adb.getDevices(); - if (devices && devices.length > 0) { - if (devices.indexOf(args.deviceId) !== -1) { - buildApk(gradlew); - installAndLaunchOnDevice( - args, - args.deviceId, - packageNameWithSuffix, - packageName, - adbPath, - ); - } else { - console.log( - 'Could not find device with the id: "' + args.deviceId + '".', - ); - console.log('Choose one of the following:'); - console.log(devices); - } - } else { - console.log('No Android devices connected.'); - } -} - -function buildApk(gradlew) { - try { - console.log(chalk.bold('Building the app...')); - - // using '-x lint' in order to ignore linting errors while building the apk - child_process.execFileSync(gradlew, ['build', '-x', 'lint'], { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - console.log( - chalk.red('Could not build the app, read the error above for details.\n'), - ); - } -} - -function tryInstallAppOnDevice(args, device) { - try { - const pathToApk = `${args.appFolder}/build/outputs/apk/${ - args.appFolder - }-debug.apk`; - const adbPath = getAdbPath(); - const adbArgs = ['-s', device, 'install', pathToApk]; - console.log( - chalk.bold( - `Installing the app on the device (cd android && adb -s ${device} install ${pathToApk}`, - ), - ); - child_process.execFileSync(adbPath, adbArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - console.log(e.message); - console.log( - chalk.red( - 'Could not install the app on the device, read the error above for details.\n', - ), - ); - } -} - -function tryLaunchAppOnDevice( - device, - packageNameWithSuffix, - packageName, - adbPath, - mainActivity, -) { - try { - const adbArgs = [ - '-s', - device, - 'shell', - 'am', - 'start', - '-n', - packageNameWithSuffix + '/' + packageName + '.' + mainActivity, - ]; - console.log( - chalk.bold( - `Starting the app on ${device} (${adbPath} ${adbArgs.join(' ')})...`, - ), - ); - child_process.spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); - } catch (e) { - console.log( - chalk.red('adb invocation failed. Do you have adb in your PATH?'), - ); - } -} - -function installAndLaunchOnDevice( - args, - selectedDevice, - packageNameWithSuffix, - packageName, - adbPath, -) { - tryRunAdbReverse(args.port, selectedDevice); - tryInstallAppOnDevice(args, selectedDevice); - tryLaunchAppOnDevice( - selectedDevice, - packageNameWithSuffix, - packageName, - adbPath, - args.mainActivity, - ); -} - -function runOnAllDevices( - args, - cmd, - packageNameWithSuffix, - packageName, - adbPath, -) { - try { - const gradleArgs = []; - if (args.variant) { - gradleArgs.push( - 'install' + args.variant[0].toUpperCase() + args.variant.slice(1), - ); - } else if (args.flavor) { - console.warn( - chalk.yellow('--flavor has been deprecated. Use --variant instead'), - ); - gradleArgs.push( - 'install' + args.flavor[0].toUpperCase() + args.flavor.slice(1), - ); - } else { - gradleArgs.push('installDebug'); - } - - if (args.installDebug) { - gradleArgs.push(args.installDebug); - } - - console.log( - chalk.bold( - `Building and installing the app on the device (cd android && ${cmd} ${gradleArgs.join( - ' ', - )})...`, - ), - ); - - child_process.execFileSync(cmd, gradleArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - console.log( - chalk.red( - 'Could not install the app on the device, read the error above for details.\n' + - 'Make sure you have an Android emulator running or a device connected and have\n' + - 'set up your Android development environment:\n' + - 'https://facebook.github.io/react-native/docs/getting-started.html', - ), - ); - // stderr is automatically piped from the gradle process, so the user - // should see the error already, there is no need to do - // `console.log(e.stderr)` - return Promise.reject(e); - } - const devices = adb.getDevices(); - if (devices && devices.length > 0) { - devices.forEach(device => { - tryRunAdbReverse(args.port, device); - tryLaunchAppOnDevice( - device, - packageNameWithSuffix, - packageName, - adbPath, - args.mainActivity, - ); - }); - } else { - try { - // If we cannot execute based on adb devices output, fall back to - // shell am start - const fallbackAdbArgs = [ - 'shell', - 'am', - 'start', - '-n', - packageNameWithSuffix + '/' + packageName + '.MainActivity', - ]; - console.log( - chalk.bold( - `Starting the app (${adbPath} ${fallbackAdbArgs.join(' ')}...`, - ), - ); - child_process.spawnSync(adbPath, fallbackAdbArgs, {stdio: 'inherit'}); - } catch (e) { - console.log( - chalk.red('adb invocation failed. Do you have adb in your PATH?'), - ); - // stderr is automatically piped from the gradle process, so the user - // should see the error already, there is no need to do - // `console.log(e.stderr)` - return Promise.reject(e); - } - } -} - -function startServerInNewWindow(port, terminal = process.env.REACT_TERMINAL) { - // set up OS-specific filenames and commands - const isWindows = /^win/.test(process.platform); - const scriptFile = isWindows - ? 'launchPackager.bat' - : 'launchPackager.command'; - const packagerEnvFilename = isWindows ? '.packager.bat' : '.packager.env'; - const portExportContent = isWindows - ? `set RCT_METRO_PORT=${port}` - : `export RCT_METRO_PORT=${port}`; - - // set up the launchpackager.(command|bat) file - const scriptsDir = path.resolve(__dirname, '..', '..', 'scripts'); - const launchPackagerScript = path.resolve(scriptsDir, scriptFile); - const procConfig = {cwd: scriptsDir}; - - // set up the .packager.(env|bat) file to ensure the packager starts on the right port - const packagerEnvFile = path.join( - __dirname, - '..', - '..', - 'scripts', - packagerEnvFilename, - ); - - // ensure we overwrite file by passing the 'w' flag - fs.writeFileSync(packagerEnvFile, portExportContent, { - encoding: 'utf8', - flag: 'w', - }); - - if (process.platform === 'darwin') { - if (terminal) { - return child_process.spawnSync( - 'open', - ['-a', terminal, launchPackagerScript], - procConfig, - ); - } - return child_process.spawnSync('open', [launchPackagerScript], procConfig); - } else if (process.platform === 'linux') { - if (terminal) { - procConfig.detached = true; - return child_process.spawn( - terminal, - ['-e', 'sh ' + launchPackagerScript], - procConfig, - ); - } - // By default, the child shell process will be attached to the parent - procConfig.detached = false; - return child_process.spawn('sh', [launchPackagerScript], procConfig); - } else if (/^win/.test(process.platform)) { - procConfig.detached = true; - procConfig.stdio = 'ignore'; - return child_process.spawn( - 'cmd.exe', - ['/C', launchPackagerScript], - procConfig, - ); - } else { - console.log( - chalk.red( - `Cannot start the packager. Unknown platform ${process.platform}`, - ), - ); - } -} - -module.exports = { - name: 'run-android', - description: - 'builds your app and starts it on a connected Android emulator or device', - func: runAndroid, - options: [ - { - command: '--install-debug', - }, - { - command: '--root [string]', - description: - 'Override the root directory for the android build (which contains the android directory)', - default: '', - }, - { - command: '--flavor [string]', - description: '--flavor has been deprecated. Use --variant instead', - }, - { - command: '--variant [string]', - }, - { - command: '--appFolder [string]', - description: - 'Specify a different application folder name for the android source.', - default: 'app', - }, - { - command: '--appId [string]', - description: 'Specify an applicationId to launch after build.', - default: '', - }, - { - command: '--appIdSuffix [string]', - description: 'Specify an applicationIdSuffix to launch after build.', - default: '', - }, - { - command: '--main-activity [string]', - description: 'Name of the activity to start', - default: 'MainActivity', - }, - { - command: '--deviceId [string]', - description: - 'builds your app and starts it on a specific device/simulator with the ' + - 'given device id (listed by running "adb devices" on the command line).', - }, - { - command: '--no-packager', - description: 'Do not launch packager while building', - }, - { - command: '--port [number]', - default: process.env.RCT_METRO_PORT || 8081, - parse: (val: string) => Number(val), - }, - { - command: '--terminal [string]', - description: - 'Launches the Metro Bundler in a new window using the specified terminal path.', - default: '', - }, - ], -}; diff --git a/local-cli/runIOS/__tests__/findMatchingSimulator-test.js b/local-cli/runIOS/__tests__/findMatchingSimulator-test.js deleted file mode 100644 index 8b9a19552a4..00000000000 --- a/local-cli/runIOS/__tests__/findMatchingSimulator-test.js +++ /dev/null @@ -1,717 +0,0 @@ -/** - * /** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.dontMock('../findMatchingSimulator'); - -const findMatchingSimulator = require('../findMatchingSimulator'); - -describe('findMatchingSimulator', () => { - it('should find simulator', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - }, - }, - 'iPhone 6', - ), - ).toEqual({ - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - name: 'iPhone 6', - booted: false, - version: 'iOS 9.2', - }); - }); - - it('should find simulator with new xcrun format', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 12.1': [ - { - state: 'Shutdown', - isAvailable: 'YES', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - { - state: 'Shutdown', - isAvailable: 'YES', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - isAvailable: 'YES', - name: 'iPhone XS Max', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - availabilityError: '', - }, - { - state: 'Shutdown', - isAvailable: 'YES', - name: 'iPad Air', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - availabilityError: '', - }, - { - state: 'Shutdown', - isAvailable: 'YES', - name: 'iPad (5th generation)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - availabilityError: '', - }, - ], - }, - }, - 'iPhone 6', - ), - ).toEqual({ - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - name: 'iPhone 6', - booted: false, - version: 'iOS 12.1', - }); - }); - - it('should return null if no simulators available', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - }, - }, - 'iPhone 6', - ), - ).toEqual(null); - }); - - it('should return null if an odd input', () => { - expect(findMatchingSimulator('random string input', 'iPhone 6')).toEqual( - null, - ); - }); - - it('should return the first simulator in list if none is defined', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - }, - }, - null, - ), - ).toEqual({ - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - name: 'iPhone 5', - booted: false, - version: 'iOS 9.2', - }); - }); - - it('should return the first simulator in list if none is defined', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - 'iOS 10.0': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 7', - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - }, - ], - }, - }, - null, - ), - ).toEqual({ - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - name: 'iPhone 5', - booted: false, - version: 'iOS 9.2', - }); - }); - - it('should return the booted simulator in list if none is defined', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - }, - }, - null, - ), - ).toEqual({ - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - name: 'iPhone 6s', - booted: true, - version: 'iOS 9.2', - }); - }); - - it('should return the defined simulator in list even if another device is booted', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - }, - }, - 'iPhone 6', - ), - ).toEqual({ - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - name: 'iPhone 6', - booted: false, - version: 'iOS 9.2', - }); - }); - - it('should return the booted simulator in list if none is defined (multi ios versions)', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - 'iOS 10.0': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 7', - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - }, - ], - }, - }, - null, - ), - ).toEqual({ - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - name: 'iPhone 7', - booted: true, - version: 'iOS 10.0', - }); - }); - - it('should return the defined simulator in list even if another device is booted (multi ios versions)', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - 'iOS 10.0': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 7', - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - }, - ], - }, - }, - 'iPhone 6s', - ), - ).toEqual({ - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - name: 'iPhone 6s', - booted: false, - version: 'iOS 9.2', - }); - }); - - it('should return the simulator with the specified version (multi ios versions)', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - 'iOS 10.0': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 7', - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - }, - ], - }, - }, - 'iPhone 6s (10.0)', - ), - ).toEqual({ - udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', - name: 'iPhone 6s', - booted: false, - version: 'iOS 10.0', - }); - }); - - it('should return null if the version is specified and no device with the exact version exists (multi ios versions)', () => { - expect( - findMatchingSimulator( - { - devices: { - 'iOS 9.2': [ - { - state: 'Shutdown', - availability: '(unavailable, runtime profile not found)', - name: 'iPhone 4s', - udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 5', - udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6s', - udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', - }, - ], - 'iOS 10.0': [ - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6', - udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'iPhone 6 (Plus)', - udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', - }, - { - state: 'Booted', - availability: '(available)', - name: 'iPhone 7', - udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', - }, - ], - }, - }, - 'iPhone 6s (10.0)', - ), - ).toEqual(null); - }); - - it('should return AppleTV devices if in the list', () => { - expect( - findMatchingSimulator( - { - devices: { - 'tvOS 11.2': [ - { - state: 'Booted', - availability: '(available)', - name: 'Apple TV', - udid: '816C30EA-38EA-41AC-BFDA-96FB632D522E', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'Apple TV 4K', - udid: 'BCBB7E4B-D872-4D61-BC61-7C9805551075', - }, - { - state: 'Shutdown', - availability: '(available)', - name: 'Apple TV 4K (at 1080p)', - udid: '1DE12308-1C14-4F0F-991E-A3ADC41BDFFC', - }, - ], - }, - }, - 'Apple TV', - ), - ).toEqual({ - udid: '816C30EA-38EA-41AC-BFDA-96FB632D522E', - name: 'Apple TV', - booted: true, - version: 'tvOS 11.2', - }); - }); -}); diff --git a/local-cli/runIOS/__tests__/findXcodeProject-test.js b/local-cli/runIOS/__tests__/findXcodeProject-test.js deleted file mode 100644 index 8071d728f5a..00000000000 --- a/local-cli/runIOS/__tests__/findXcodeProject-test.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.dontMock('../findXcodeProject'); - -const findXcodeProject = require('../findXcodeProject'); - -describe('findXcodeProject', () => { - it('should find *.xcodeproj file', () => { - expect( - findXcodeProject([ - '.DS_Store', - 'AwesomeApp', - 'AwesomeApp.xcodeproj', - 'AwesomeAppTests', - 'PodFile', - 'Podfile.lock', - 'Pods', - ]), - ).toEqual({ - name: 'AwesomeApp.xcodeproj', - isWorkspace: false, - }); - }); - - it('should prefer *.xcworkspace', () => { - expect( - findXcodeProject([ - '.DS_Store', - 'AwesomeApp', - 'AwesomeApp.xcodeproj', - 'AwesomeApp.xcworkspace', - 'AwesomeAppTests', - 'PodFile', - 'Podfile.lock', - 'Pods', - ]), - ).toEqual({ - name: 'AwesomeApp.xcworkspace', - isWorkspace: true, - }); - }); - - it('should return null if nothing found', () => { - expect( - findXcodeProject([ - '.DS_Store', - 'AwesomeApp', - 'AwesomeAppTests', - 'PodFile', - 'Podfile.lock', - 'Pods', - ]), - ).toEqual(null); - }); -}); diff --git a/local-cli/runIOS/__tests__/parseIOSDevicesList-test.js b/local-cli/runIOS/__tests__/parseIOSDevicesList-test.js deleted file mode 100644 index 8914b593739..00000000000 --- a/local-cli/runIOS/__tests__/parseIOSDevicesList-test.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -jest.dontMock('../parseIOSDevicesList'); -var parseIOSDevicesList = require('../parseIOSDevicesList'); - -describe('parseIOSDevicesList', () => { - it('parses typical output', () => { - var devices = parseIOSDevicesList( - [ - 'Known Devices:', - 'Maxs MacBook Pro [11111111-1111-1111-1111-111111111111]', - "Max's iPhone (9.2) [11111111111111111111aaaaaaaaaaaaaaaaaaaa]", - 'iPad 2 (9.3) [07538CE4-675B-4EDA-90F2-3DD3CD93309D] (Simulator)', - 'iPad Air (9.3) [0745F6D1-6DC5-4427-B9A6-6FBA327ED65A] (Simulator)', - 'iPhone 6s (9.3) [3DBE4ECF-9A86-469E-921B-EE0F9C9AB8F4] (Simulator)', - 'Known Templates:', - 'Activity Monitor', - 'Blank', - 'System Usage', - 'Zombies', - ].join('\n'), - ); - - expect(devices).toEqual([ - { - name: "Max's iPhone", - udid: '11111111111111111111aaaaaaaaaaaaaaaaaaaa', - version: '9.2', - }, - ]); - }); - - it('ignores garbage', () => { - expect(parseIOSDevicesList('Something went terribly wrong (-42)')).toEqual( - [], - ); - }); -}); diff --git a/local-cli/runIOS/findMatchingSimulator.js b/local-cli/runIOS/findMatchingSimulator.js deleted file mode 100644 index 30e2156d421..00000000000 --- a/local-cli/runIOS/findMatchingSimulator.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -/** - * Takes in a parsed simulator list and a desired name, and returns an object with the matching simulator. The desired - * name can optionally include the iOS version in between parenthesis after the device name. Ex: "iPhone 6 (9.2)" in - * which case it'll attempt to find a simulator with the exact version specified. - * - * If the simulatorString argument is null, we'll go into default mode and return the currently booted simulator, or if - * none is booted, it will be the first in the list. - * - * @param Object simulators a parsed list from `xcrun simctl list --json devices` command - * @param String|null simulatorString the string with the name of desired simulator. If null, it will use the currently - * booted simulator, or if none are booted, the first in the list. - * @returns {Object} {udid, name, version} - */ -function findMatchingSimulator(simulators, simulatorString) { - if (!simulators.devices) { - return null; - } - const devices = simulators.devices; - - const parsedSimulatorName = simulatorString - ? simulatorString.match(/(.*)? (?:\((.*)?\))?/) - : []; - if (parsedSimulatorName[2] !== undefined) { - var simulatorVersion = parsedSimulatorName[2]; - var simulatorName = parsedSimulatorName[1]; - } else { - simulatorName = simulatorString; - } - - var match; - for (let version in devices) { - // Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc) - if (!version.startsWith('iOS') && !version.startsWith('tvOS')) { - continue; - } - if (simulatorVersion && !version.endsWith(simulatorVersion)) { - continue; - } - for (let i in devices[version]) { - let simulator = devices[version][i]; - // Skipping non-available simulator - if ( - simulator.availability !== '(available)' && - simulator.isAvailable !== 'YES' - ) { - continue; - } - let booted = simulator.state === 'Booted'; - if (booted && simulatorName === null) { - return { - udid: simulator.udid, - name: simulator.name, - booted, - version, - }; - } - if (simulator.name === simulatorName && !match) { - match = { - udid: simulator.udid, - name: simulator.name, - booted, - version, - }; - } - // Keeps track of the first available simulator for use if we can't find one above. - if (simulatorName === null && !match) { - match = { - udid: simulator.udid, - name: simulator.name, - booted, - version, - }; - } - } - } - if (match) { - return match; - } - return null; -} - -module.exports = findMatchingSimulator; diff --git a/local-cli/runIOS/findXcodeProject.js b/local-cli/runIOS/findXcodeProject.js deleted file mode 100644 index 318f11ec849..00000000000 --- a/local-cli/runIOS/findXcodeProject.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const path = require('path'); - -type ProjectInfo = { - name: string, - isWorkspace: boolean, -}; - -function findXcodeProject(files: Array): ?ProjectInfo { - const sortedFiles = files.sort(); - for (let i = sortedFiles.length - 1; i >= 0; i--) { - const fileName = files[i]; - const ext = path.extname(fileName); - - if (ext === '.xcworkspace') { - return { - name: fileName, - isWorkspace: true, - }; - } - if (ext === '.xcodeproj') { - return { - name: fileName, - isWorkspace: false, - }; - } - } - - return null; -} - -module.exports = findXcodeProject; diff --git a/local-cli/runIOS/parseIOSDevicesList.js b/local-cli/runIOS/parseIOSDevicesList.js deleted file mode 100644 index 0209c796b39..00000000000 --- a/local-cli/runIOS/parseIOSDevicesList.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -type IOSDeviceInfo = { - name: string, - udid: string, - version: string, -}; - -/** - * Parses the output of `xcrun simctl list devices` command - */ -function parseIOSDevicesList(text: string): Array { - const devices = []; - text.split('\n').forEach(line => { - const device = line.match(/(.*?) \((.*?)\) \[(.*?)\]/); - const noSimulator = line.match(/(.*?) \((.*?)\) \[(.*?)\] \((.*?)\)/); - if (device != null && noSimulator == null) { - var name = device[1]; - var version = device[2]; - var udid = device[3]; - devices.push({udid, name, version}); - } - }); - - return devices; -} - -module.exports = parseIOSDevicesList; diff --git a/local-cli/runIOS/runIOS.js b/local-cli/runIOS/runIOS.js deleted file mode 100644 index a7ecf7d6ddc..00000000000 --- a/local-cli/runIOS/runIOS.js +++ /dev/null @@ -1,455 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const child_process = require('child_process'); -const fs = require('fs'); -const path = require('path'); -const findXcodeProject = require('./findXcodeProject'); -const findReactNativeScripts = require('../util/findReactNativeScripts'); -const parseIOSDevicesList = require('./parseIOSDevicesList'); -const findMatchingSimulator = require('./findMatchingSimulator'); -const getBuildPath = function(configuration = 'Debug', appName, isDevice) { - let device; - - if (isDevice) { - device = 'iphoneos'; - } else if (appName.toLowerCase().includes('tvos')) { - device = 'appletvsimulator'; - } else { - device = 'iphonesimulator'; - } - - return `build/Build/Products/${configuration}-${device}/${appName}.app`; -}; -const xcprettyAvailable = function() { - try { - child_process.execSync('xcpretty --version', { - stdio: [0, 'pipe', 'ignore'], - }); - } catch (error) { - return false; - } - return true; -}; - -function runIOS(argv, config, args) { - if (!fs.existsSync(args.projectPath)) { - const reactNativeScriptsPath = findReactNativeScripts(); - if (reactNativeScriptsPath) { - child_process.spawnSync( - reactNativeScriptsPath, - ['ios'].concat(process.argv.slice(1)), - {stdio: 'inherit'}, - ); - return; - } else { - throw new Error( - 'iOS project folder not found. Are you sure this is a React Native project?', - ); - } - } - process.chdir(args.projectPath); - const xcodeProject = findXcodeProject(fs.readdirSync('.')); - if (!xcodeProject) { - throw new Error('Could not find Xcode project files in ios folder'); - } - - const inferredSchemeName = path.basename( - xcodeProject.name, - path.extname(xcodeProject.name), - ); - const scheme = args.scheme || inferredSchemeName; - console.log( - `Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${ - xcodeProject.name - }`, - ); - const devices = parseIOSDevicesList( - child_process.execFileSync('xcrun', ['instruments', '-s'], { - encoding: 'utf8', - }), - ); - if (args.device) { - const selectedDevice = matchingDevice(devices, args.device); - if (selectedDevice) { - return runOnDevice( - selectedDevice, - scheme, - xcodeProject, - args.configuration, - args.packager, - args.verbose, - args.port, - ); - } else { - if (devices && devices.length > 0) { - console.log( - 'Could not find device with the name: "' + args.device + '".', - ); - console.log('Choose one of the following:'); - printFoundDevices(devices); - } else { - console.log('No iOS devices connected.'); - } - } - } else if (args.udid) { - return runOnDeviceByUdid(args, scheme, xcodeProject, devices); - } else { - return runOnSimulator(xcodeProject, args, scheme); - } -} - -function runOnDeviceByUdid(args, scheme, xcodeProject, devices) { - const selectedDevice = matchingDeviceByUdid(devices, args.udid); - if (selectedDevice) { - return runOnDevice( - selectedDevice, - scheme, - xcodeProject, - args.configuration, - args.packager, - args.verbose, - args.port, - ); - } else { - if (devices && devices.length > 0) { - console.log('Could not find device with the udid: "' + args.udid + '".'); - console.log('Choose one of the following:'); - printFoundDevices(devices); - } else { - console.log('No iOS devices connected.'); - } - } -} - -function runOnSimulator(xcodeProject, args, scheme) { - return new Promise(resolve => { - try { - var simulators = JSON.parse( - child_process.execFileSync( - 'xcrun', - ['simctl', 'list', '--json', 'devices'], - {encoding: 'utf8'}, - ), - ); - } catch (e) { - throw new Error('Could not parse the simulator list output'); - } - - const selectedSimulator = findMatchingSimulator(simulators, args.simulator); - if (!selectedSimulator) { - throw new Error(`Could not find ${args.simulator} simulator`); - } - - /** - * Booting simulator through `xcrun simctl boot` will boot it in the `headless` mode - * (running in the background). - * - * In order for user to see the app and the simulator itself, we have to make sure - * that the Simulator.app is running. - * - * We also pass it `-CurrentDeviceUDID` so that when we launch it for the first time, - * it will not boot the "default" device, but the one we set. If the app is already running, - * this flag has no effect. - */ - const activeDeveloperDir = child_process - .execFileSync('xcode-select', ['-p'], {encoding: 'utf8'}) - .trim(); - child_process.execFileSync('open', [ - `${activeDeveloperDir}/Applications/Simulator.app`, - '--args', - '-CurrentDeviceUDID', - selectedSimulator.udid, - ]); - - if (!selectedSimulator.booted) { - const simulatorFullName = formattedDeviceName(selectedSimulator); - console.log(`Launching ${simulatorFullName}...`); - try { - child_process.spawnSync('xcrun', [ - 'instruments', - '-w', - selectedSimulator.udid, - ]); - } catch (e) { - // instruments always fail with 255 because it expects more arguments, - // but we want it to only launch the simulator - } - } - - buildProject( - xcodeProject, - selectedSimulator.udid, - scheme, - args.configuration, - args.packager, - args.verbose, - args.port, - ).then(appName => resolve({udid: selectedSimulator.udid, appName})); - }).then(({udid, appName}) => { - if (!appName) { - appName = scheme; - } - let appPath = getBuildPath(args.configuration, appName); - console.log(`Installing ${appPath}`); - child_process.spawnSync('xcrun', ['simctl', 'install', udid, appPath], { - stdio: 'inherit', - }); - - const bundleID = child_process - .execFileSync( - '/usr/libexec/PlistBuddy', - ['-c', 'Print:CFBundleIdentifier', path.join(appPath, 'Info.plist')], - {encoding: 'utf8'}, - ) - .trim(); - - console.log(`Launching ${bundleID}`); - child_process.spawnSync('xcrun', ['simctl', 'launch', udid, bundleID], { - stdio: 'inherit', - }); - }); -} - -function runOnDevice( - selectedDevice, - scheme, - xcodeProject, - configuration, - launchPackager, - verbose, - port, -) { - return buildProject( - xcodeProject, - selectedDevice.udid, - scheme, - configuration, - launchPackager, - verbose, - port, - ).then(appName => { - if (!appName) { - appName = scheme; - } - const iosDeployInstallArgs = [ - '--bundle', - getBuildPath(configuration, appName, true), - '--id', - selectedDevice.udid, - '--justlaunch', - ]; - console.log( - `installing and launching your app on ${selectedDevice.name}...`, - ); - const iosDeployOutput = child_process.spawnSync( - 'ios-deploy', - iosDeployInstallArgs, - {encoding: 'utf8'}, - ); - if (iosDeployOutput.error) { - console.log(''); - console.log('** INSTALLATION FAILED **'); - console.log('Make sure you have ios-deploy installed globally.'); - console.log('(e.g "npm install -g ios-deploy")'); - } else { - console.log('** INSTALLATION SUCCEEDED **'); - } - }); -} - -function buildProject( - xcodeProject, - udid, - scheme, - configuration = 'Debug', - launchPackager = false, - verbose, - port, -) { - return new Promise((resolve, reject) => { - var xcodebuildArgs = [ - xcodeProject.isWorkspace ? '-workspace' : '-project', - xcodeProject.name, - '-configuration', - configuration, - '-scheme', - scheme, - '-destination', - `id=${udid}`, - '-derivedDataPath', - 'build', - ]; - console.log(`Building using "xcodebuild ${xcodebuildArgs.join(' ')}"`); - let xcpretty; - if (!verbose) { - xcpretty = - xcprettyAvailable() && - child_process.spawn('xcpretty', [], { - stdio: ['pipe', process.stdout, process.stderr], - }); - } - const buildProcess = child_process.spawn( - 'xcodebuild', - xcodebuildArgs, - getProcessOptions(launchPackager, port), - ); - let buildOutput = ''; - buildProcess.stdout.on('data', function(data) { - buildOutput += data.toString(); - if (xcpretty) { - xcpretty.stdin.write(data); - } else { - console.log(data.toString()); - } - }); - buildProcess.stderr.on('data', function(data) { - console.error(data.toString()); - }); - buildProcess.on('close', function(code) { - if (xcpretty) { - xcpretty.stdin.end(); - } - //FULL_PRODUCT_NAME is the actual file name of the app, which actually comes from the Product Name in the build config, which does not necessary match a scheme name, example output line: export FULL_PRODUCT_NAME="Super App Dev.app" - let productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec( - buildOutput, - ); - if ( - productNameMatch && - productNameMatch.length && - productNameMatch.length > 1 - ) { - return resolve(productNameMatch[1]); //0 is the full match, 1 is the app name - } - return buildProcess.error ? reject(buildProcess.error) : resolve(); - }); - }); -} - -function matchingDevice(devices, deviceName) { - if (deviceName === true && devices.length === 1) { - console.log( - `Using first available device ${ - devices[0].name - } due to lack of name supplied.`, - ); - return devices[0]; - } - for (let i = devices.length - 1; i >= 0; i--) { - if ( - devices[i].name === deviceName || - formattedDeviceName(devices[i]) === deviceName - ) { - return devices[i]; - } - } -} - -function matchingDeviceByUdid(devices, udid) { - for (let i = devices.length - 1; i >= 0; i--) { - if (devices[i].udid === udid) { - return devices[i]; - } - } -} - -function formattedDeviceName(simulator) { - return `${simulator.name} (${simulator.version})`; -} - -function printFoundDevices(devices) { - for (let i = devices.length - 1; i >= 0; i--) { - console.log(devices[i].name + ' Udid: ' + devices[i].udid); - } -} - -function getProcessOptions(launchPackager, port) { - if (launchPackager) { - return { - env: {...process.env, RCT_METRO_PORT: port}, - }; - } - - return { - env: {...process.env, RCT_NO_LAUNCH_PACKAGER: true}, - }; -} - -module.exports = { - name: 'run-ios', - description: 'builds your app and starts it on iOS simulator', - func: runIOS, - examples: [ - { - desc: 'Run on a different simulator, e.g. iPhone 5', - cmd: 'react-native run-ios --simulator "iPhone 5"', - }, - { - desc: 'Pass a non-standard location of iOS directory', - cmd: 'react-native run-ios --project-path "./app/ios"', - }, - { - desc: "Run on a connected device, e.g. Max's iPhone", - cmd: 'react-native run-ios --device "Max\'s iPhone"', - }, - { - desc: 'Run on the AppleTV simulator', - cmd: - 'react-native run-ios --simulator "Apple TV" --scheme "helloworld-tvOS"', - }, - ], - options: [ - { - command: '--simulator [string]', - description: - 'Explicitly set simulator to use. Optionally include iOS version between' + - 'parenthesis at the end to match an exact version: "iPhone 6 (10.0)"', - default: 'iPhone X', - }, - { - command: '--configuration [string]', - description: 'Explicitly set the scheme configuration to use', - }, - { - command: '--scheme [string]', - description: 'Explicitly set Xcode scheme to use', - }, - { - command: '--project-path [string]', - description: - 'Path relative to project root where the Xcode project ' + - "(.xcodeproj) lives. The default is 'ios'.", - default: 'ios', - }, - { - command: '--device [string]', - description: - 'Explicitly set device to use by name. The value is not required if you have a single device connected.', - }, - { - command: '--udid [string]', - description: 'Explicitly set device to use by udid', - }, - { - command: '--no-packager', - description: 'Do not launch packager while building', - }, - { - command: '--verbose', - description: 'Do not use xcpretty even if installed', - }, - { - command: '--port [number]', - default: process.env.RCT_METRO_PORT || 8081, - parse: (val: string) => Number(val), - }, - ], -}; diff --git a/local-cli/server/checkNodeVersion.js b/local-cli/server/checkNodeVersion.js deleted file mode 100644 index 1f73a1e38fb..00000000000 --- a/local-cli/server/checkNodeVersion.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * Be mindful that this script may be run by legacy NodeJS runtimes. Keep this - * script ES5 compatible (e.g. do not insert the `@format` pragma here which - * may introduce non-ES5 compatible syntax.) - * - */ - -'use strict'; - -var chalk = require('chalk'); -var formatBanner = require('metro-core/src/formatBanner'); -var semver = require('semver'); - -module.exports = function() { - if (!semver.satisfies(process.version, '>=8.3')) { - var engine = semver.satisfies(process.version, '<1') ? 'Node' : 'io.js'; - - var message = - 'You are currently running ' + - engine + - ' ' + - process.version + - '.\n' + - '\n' + - 'React Native runs on Node 8.3 or newer. There are several ways to ' + - 'upgrade Node.js depending on your preference.\n' + - '\n' + - 'nvm: nvm install 8.3 --reinstall-packages-from=node\n' + - 'Homebrew: brew update && brew upgrade node\n' + - 'Installer: download from https://nodejs.org/\n'; - console.log( - formatBanner(message, { - chalkFunction: chalk.green, - marginLeft: 1, - marginRight: 1, - paddingBottom: 1, - }) - ); - process.exit(1); - } -}; diff --git a/local-cli/server/middleware/MiddlewareManager.js b/local-cli/server/middleware/MiddlewareManager.js deleted file mode 100644 index 50c8a59f077..00000000000 --- a/local-cli/server/middleware/MiddlewareManager.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @strict - * @flow - */ - -const compression = require('compression'); -const connect = require('connect'); -const errorhandler = require('errorhandler'); -const path = require('path'); -const serveStatic = require('serve-static'); -const WebSocketServer = require('ws').Server; - -const indexPageMiddleware = require('./indexPage'); -const copyToClipBoardMiddleware = require('./copyToClipBoardMiddleware'); -const getSecurityHeadersMiddleware = require('./getSecurityHeadersMiddleware'); -const loadRawBodyMiddleware = require('./loadRawBodyMiddleware'); -const openStackFrameInEditorMiddleware = require('./openStackFrameInEditorMiddleware'); -const statusPageMiddleware = require('./statusPageMiddleware'); -const systraceProfileMiddleware = require('./systraceProfileMiddleware'); -const getDevToolsMiddleware = require('./getDevToolsMiddleware'); - -type Options = { - +watchFolders: $ReadOnlyArray, - +host?: string, -} - -type WebSocketProxy = { - server: WebSocketServer, - isChromeConnected: () => boolean, -}; - -type Connect = $Call; - -module.exports = class MiddlewareManager { - app: Connect; - options: Options; - - constructor(options: Options) { - const debuggerUIFolder = path.join(__dirname, '..', 'util', 'debugger-ui'); - - this.options = options; - this.app = connect() - .use(getSecurityHeadersMiddleware) - .use(loadRawBodyMiddleware) - .use(compression()) - .use('/debugger-ui', serveStatic(debuggerUIFolder)) - .use(openStackFrameInEditorMiddleware(this.options)) - .use(copyToClipBoardMiddleware) - .use(statusPageMiddleware) - .use(systraceProfileMiddleware) - .use(indexPageMiddleware) - .use(errorhandler()); - } - - serveStatic = (folder: string) => { - this.app.use(serveStatic(folder)); - }; - - getConnectInstance = () => this.app; - - attachDevToolsSocket = (socket: WebSocketProxy) => { - this.app.use( - getDevToolsMiddleware(this.options, () => socket.isChromeConnected()), - ); - }; -}; diff --git a/local-cli/server/middleware/copyToClipBoardMiddleware.js b/local-cli/server/middleware/copyToClipBoardMiddleware.js deleted file mode 100644 index 69a3171f958..00000000000 --- a/local-cli/server/middleware/copyToClipBoardMiddleware.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const copyToClipBoard = require('../util/copyToClipBoard'); -var chalk = require('chalk'); - -/** - * Handle the request from JS to copy contents onto host system clipboard. - * This is only supported on Mac for now. - */ -module.exports = function(req, res, next) { - if (req.url === '/copy-to-clipboard') { - var ret = copyToClipBoard(req.rawBody); - if (!ret) { - console.warn(chalk.red('Copy button is not supported on this platform!')); - } - res.end('OK'); - } else { - next(); - } -}; diff --git a/local-cli/server/middleware/getDevToolsMiddleware.js b/local-cli/server/middleware/getDevToolsMiddleware.js deleted file mode 100644 index f03fd0bbcec..00000000000 --- a/local-cli/server/middleware/getDevToolsMiddleware.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ -'use strict'; - -const launchChrome = require('../util/launchChrome'); - -const {exec} = require('child_process'); - -function launchChromeDevTools(host, args = '') { - var debuggerURL = 'http://' + host + '/debugger-ui' + args; - console.log('Launching Dev Tools...'); - launchChrome(debuggerURL); -} - -function escapePath(pathname) { - // " Can escape paths with spaces in OS X, Windows, and *nix - return '"' + pathname + '"'; -} - -function launchDevTools({host, watchFolders}, isChromeConnected) { - // Explicit config always wins - var customDebugger = process.env.REACT_DEBUGGER; - if (customDebugger) { - var folders = watchFolders.map(escapePath).join(' '); - var command = customDebugger + ' ' + folders; - console.log('Starting custom debugger by executing: ' + command); - exec(command, function(error, stdout, stderr) { - if (error !== null) { - console.log('Error while starting custom debugger: ' + error); - } - }); - } else if (!isChromeConnected()) { - // Dev tools are not yet open; we need to open a session - launchChromeDevTools(host); - } -} - -module.exports = function(options, isChromeConnected) { - return function(req, res, next) { - var host = req.headers.host; - if (req.url === '/launch-safari-devtools') { - // TODO: remove `console.log` and dev tools binary - console.log( - 'We removed support for Safari dev-tools. ' + - 'If you still need this, please let us know.', - ); - } else if (req.url === '/launch-chrome-devtools') { - // TODO: Remove this case in the future - console.log( - 'The method /launch-chrome-devtools is deprecated. You are ' + - ' probably using an application created with an older CLI with the ' + - ' packager of a newer CLI. Please upgrade your application: ' + - 'https://facebook.github.io/react-native/docs/upgrading.html', - ); - launchDevTools(options, isChromeConnected); - res.end('OK'); - } else if (req.url === '/launch-js-devtools') { - launchDevTools({...options, host}, isChromeConnected); - res.end('OK'); - } else { - next(); - } - }; -}; diff --git a/local-cli/server/middleware/getSecurityHeadersMiddleware.js b/local-cli/server/middleware/getSecurityHeadersMiddleware.js deleted file mode 100644 index d3bad6bf951..00000000000 --- a/local-cli/server/middleware/getSecurityHeadersMiddleware.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @strict - * @format - */ - -module.exports = function(req, res, next) { - const address = req.client.server.address(); - - // Block any cross origin request. - if ( - req.headers.origin && - req.headers.origin !== `http://localhost:${address.port}` - ) { - next(new Error('Unauthorized')); - return; - } - - // Block MIME-type sniffing. - res.setHeader('X-Content-Type-Options', 'nosniff'); - - next(); -}; diff --git a/local-cli/server/middleware/index.html b/local-cli/server/middleware/index.html deleted file mode 100644 index fdf6bf41809..00000000000 --- a/local-cli/server/middleware/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - React Native - - -

React Native packager is running.

-

Visit documentation

- - diff --git a/local-cli/server/middleware/indexPage.js b/local-cli/server/middleware/indexPage.js deleted file mode 100644 index ee6fc61ad6d..00000000000 --- a/local-cli/server/middleware/indexPage.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -module.exports = function(req, res, next) { - if (req.url === '/') { - res.end(fs.readFileSync(path.join(__dirname, 'index.html'))); - } else { - next(); - } -}; diff --git a/local-cli/server/middleware/loadRawBodyMiddleware.js b/local-cli/server/middleware/loadRawBodyMiddleware.js deleted file mode 100644 index 553f0412925..00000000000 --- a/local-cli/server/middleware/loadRawBodyMiddleware.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports = function(req, res, next) { - req.rawBody = ''; - req.setEncoding('utf8'); - - req.on('data', function(chunk) { - req.rawBody += chunk; - }); - - req.on('end', function() { - next(); - }); -}; diff --git a/local-cli/server/middleware/openStackFrameInEditorMiddleware.js b/local-cli/server/middleware/openStackFrameInEditorMiddleware.js deleted file mode 100644 index 36cc69ba0d9..00000000000 --- a/local-cli/server/middleware/openStackFrameInEditorMiddleware.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const launchEditor = require('../util/launchEditor'); - -module.exports = function({watchFolders}) { - return function(req, res, next) { - if (req.url === '/open-stack-frame') { - const frame = JSON.parse(req.rawBody); - launchEditor(frame.file, frame.lineNumber, watchFolders); - res.end('OK'); - } else { - next(); - } - }; -}; diff --git a/local-cli/server/middleware/statusPageMiddleware.js b/local-cli/server/middleware/statusPageMiddleware.js deleted file mode 100644 index b08539d57d6..00000000000 --- a/local-cli/server/middleware/statusPageMiddleware.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -/** - * Status page so that anyone who needs to can verify that the packager is - * running on 8081 and not another program / service. - */ -module.exports = function(req, res, next) { - if (req.url === '/status') { - res.end('packager-status:running'); - } else { - next(); - } -}; diff --git a/local-cli/server/middleware/systraceProfileMiddleware.js b/local-cli/server/middleware/systraceProfileMiddleware.js deleted file mode 100644 index c66d6f7beaa..00000000000 --- a/local-cli/server/middleware/systraceProfileMiddleware.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); - -module.exports = function(req, res, next) { - if (req.url !== '/systrace') { - next(); - return; - } - - console.log('Dumping profile information...'); - var dumpName = '/tmp/dump_' + Date.now() + '.json'; - fs.writeFileSync(dumpName, req.rawBody); - var response = - 'Your profile was saved at:\n' + - dumpName + - '\n\n' + - 'On Google Chrome navigate to chrome://tracing and then click on "load" ' + - 'to load and visualise your profile.\n\n' + - 'This message is also printed to your console by the packager so you can copy it :)'; - console.log(response); - res.end(response); -}; diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js deleted file mode 100644 index b11bced5bd7..00000000000 --- a/local-cli/server/runServer.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -require('../../setupBabel')(); - -const Metro = require('metro'); - -const {Terminal} = require('metro-core'); - -const messageSocket = require('./util/messageSocket'); -const morgan = require('morgan'); -const path = require('path'); -const webSocketProxy = require('./util/webSocketProxy'); -const MiddlewareManager = require('./middleware/MiddlewareManager'); - -import type {ConfigT} from 'metro-config/src/configTypes.flow'; - -export type Args = {| - +assetExts: $ReadOnlyArray, - +cert: string, - +customLogReporterPath?: string, - +host: string, - +https: boolean, - +maxWorkers: number, - +key: string, - +nonPersistent: boolean, - +platforms: $ReadOnlyArray, - +port: number, - +projectRoot: string, - +providesModuleNodeModules: Array, - +resetCache: boolean, - +sourceExts: $ReadOnlyArray, - +transformer?: string, - +verbose: boolean, - +watchFolders: $ReadOnlyArray, -|}; - -async function runServer(args: Args, config: ConfigT) { - const terminal = new Terminal(process.stdout); - const ReporterImpl = getReporterImpl(args.customLogReporterPath || null); - const reporter = new ReporterImpl(terminal); - const middlewareManager = new MiddlewareManager(args); - - middlewareManager.getConnectInstance().use(morgan('combined')); - - args.watchFolders.forEach(middlewareManager.serveStatic); - - // $FlowFixMe Metro configuration is immutable. - config.maxWorkers = args.maxWorkers; - // $FlowFixMe Metro configuration is immutable. - config.server.port = args.port; - // $FlowFixMe Metro configuration is immutable. - config.reporter = reporter; - // $FlowFixMe Metro configuration is immutable. - config.resetCache = args.resetCache; - // $FlowFixMe Metro configuration is immutable. - config.projectRoot = args.projectRoot; - // $FlowFixMe Metro configuration is immutable. - config.watchFolders = args.watchFolders.slice(0); - // $FlowFixMe Metro configuration is immutable. - config.server.enhanceMiddleware = middleware => - middlewareManager.getConnectInstance().use(middleware); - - if (args.sourceExts !== config.resolver.sourceExts) { - // $FlowFixMe Metro configuration is immutable. - config.resolver.sourceExts = args.sourceExts.concat( - config.resolver.sourceExts, - ); - } - - const serverInstance = await Metro.runServer(config, { - host: args.host, - secure: args.https, - secureCert: args.cert, - secureKey: args.key, - hmrEnabled: true, - }); - - const wsProxy = webSocketProxy.attachToServer( - serverInstance, - '/debugger-proxy', - ); - const ms = messageSocket.attachToServer(serverInstance, '/message'); - middlewareManager.attachDevToolsSocket(wsProxy); - middlewareManager.attachDevToolsSocket(ms); - - // In Node 8, the default keep-alive for an HTTP connection is 5 seconds. In - // early versions of Node 8, this was implemented in a buggy way which caused - // some HTTP responses (like those containing large JS bundles) to be - // terminated early. - // - // As a workaround, arbitrarily increase the keep-alive from 5 to 30 seconds, - // which should be enough to send even the largest of JS bundles. - // - // For more info: https://github.com/nodejs/node/issues/13391 - // - serverInstance.keepAliveTimeout = 30000; -} - -function getReporterImpl(customLogReporterPath: ?string) { - if (customLogReporterPath == null) { - return require('metro/src/lib/TerminalReporter'); - } - try { - // First we let require resolve it, so we can require packages in node_modules - // as expected. eg: require('my-package/reporter'); - /* $FlowFixMe: can't type dynamic require */ - return require(customLogReporterPath); - } catch (e) { - if (e.code !== 'MODULE_NOT_FOUND') { - throw e; - } - // If that doesn't work, then we next try relative to the cwd, eg: - // require('./reporter'); - /* $FlowFixMe: can't type dynamic require */ - return require(path.resolve(customLogReporterPath)); - } -} - -module.exports = runServer; diff --git a/local-cli/server/server.js b/local-cli/server/server.js deleted file mode 100644 index f7ded732ff1..00000000000 --- a/local-cli/server/server.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const runServer = require('./runServer'); - -import type {RNConfig} from '../core'; -import type {ConfigT} from 'metro-config/src/configTypes.flow'; -import type {Args as RunServerArgs} from './runServer'; - -/** - * Starts the React Native Packager Server. - */ -function server(argv: mixed, config: RNConfig, args: RunServerArgs) { - /* $FlowFixMe(site=react_native_fb) ConfigT shouldn't be extendable. */ - const configT: ConfigT = config; - runServer(args, configT); -} - -module.exports = { - name: 'start', - func: server, - description: 'starts the webserver', - options: [ - { - command: '--port [number]', - parse: (val: string) => Number(val), - default: (config: ConfigT) => config.server.port, - }, - { - command: '--host [string]', - default: '', - }, - { - command: '--projectRoot [string]', - description: 'Specify the main project root', - default: (config: ConfigT) => config.projectRoot, - }, - { - command: '--watchFolders [list]', - description: - 'Specify any additional folders to be added to the watch list', - parse: (val: string) => val.split(','), - default: (config: ConfigT) => config.watchFolders, - }, - { - command: '--assetExts [list]', - description: - 'Specify any additional asset extensions to be used by the packager', - parse: (val: string) => val.split(','), - default: (config: ConfigT) => config.resolver.assetExts, - }, - { - command: '--sourceExts [list]', - description: - 'Specify any additional source extensions to be used by the packager', - parse: (val: string) => val.split(','), - default: (config: ConfigT) => config.resolver.sourceExts, - }, - { - command: '--platforms [list]', - description: - 'Specify any additional platforms to be used by the packager', - parse: (val: string) => val.split(','), - default: (config: ConfigT) => config.resolver.platforms, - }, - { - command: '--providesModuleNodeModules [list]', - description: - 'Specify any npm packages that import dependencies with providesModule', - parse: (val: string) => val.split(','), - default: (config: ConfigT) => config.resolver.providesModuleNodeModules, - }, - { - command: '--max-workers [number]', - description: - 'Specifies the maximum number of workers the worker-pool ' + - 'will spawn for transforming files. This defaults to the number of the ' + - 'cores available on your machine.', - default: (config: ConfigT) => config.maxWorkers, - parse: (workers: string) => Number(workers), - }, - { - command: '--skipflow', - description: 'Disable flow checks', - }, - { - command: '--nonPersistent', - description: 'Disable file watcher', - }, - { - command: '--transformer [string]', - description: 'Specify a custom transformer to be used', - }, - { - command: '--reset-cache, --resetCache', - description: 'Removes cached files', - }, - { - command: '--custom-log-reporter-path, --customLogReporterPath [string]', - description: - 'Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter', - }, - { - command: '--verbose', - description: 'Enables logging', - }, - { - command: '--https', - description: 'Enables https connections to the server', - }, - { - command: '--key [path]', - description: 'Path to custom SSL key', - }, - { - command: '--cert [path]', - description: 'Path to custom SSL cert', - }, - ], -}; diff --git a/local-cli/server/util/copyToClipBoard.js b/local-cli/server/util/copyToClipBoard.js deleted file mode 100644 index e6b1bd7a18f..00000000000 --- a/local-cli/server/util/copyToClipBoard.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -var child_process = require('child_process'); -var spawn = child_process.spawn; -var path = require('path'); -var fs = require('fs'); - -const xsel = path.join(__dirname, 'external/xsel'); -fs.chmodSync(xsel, '0755'); -/** - * Copy the content to host system clipboard. - */ -function copyToClipBoard(content) { - switch (process.platform) { - case 'darwin': - var child = spawn('pbcopy', []); - child.stdin.end(Buffer.from(content, 'utf8')); - return true; - case 'win32': - var child = spawn('clip', []); - child.stdin.end(Buffer.from(content, 'utf8')); - return true; - case 'linux': - var child = spawn(xsel, ['--clipboard', '--input']); - child.stdin.end(Buffer.from(content, 'utf8')); - return true; - default: - return false; - } -} - -module.exports = copyToClipBoard; diff --git a/local-cli/server/util/debugger-ui/DeltaPatcher.js b/local-cli/server/util/debugger-ui/DeltaPatcher.js deleted file mode 100644 index ed950295f6c..00000000000 --- a/local-cli/server/util/debugger-ui/DeltaPatcher.js +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * This file is a copy of the reference `DeltaPatcher`, located in - * metro. The reason to not reuse that file is that in this context - * we cannot have flow annotations or CJS syntax (since this file is directly) - * injected into a static HTML page. - * - * TODO: Find a simple and lightweight way to compile `DeltaPatcher` to avoid - * having this duplicated file. - */ -(function(global) { - 'use strict'; - - /** - * This is a reference client for the Delta Bundler: it maintains cached the - * last patched bundle delta and it's capable of applying new Deltas received - * from the Bundler. - */ - class DeltaPatcher { - constructor() { - this._lastBundle = { - revisionId: undefined, - pre: '', - post: '', - modules: new Map(), - }; - this._initialized = false; - this._lastNumModifiedFiles = 0; - this._lastModifiedDate = new Date(); - } - - static get(id) { - let deltaPatcher = this._deltaPatchers.get(id); - - if (!deltaPatcher) { - deltaPatcher = new DeltaPatcher(); - this._deltaPatchers.set(id, deltaPatcher); - } - - return deltaPatcher; - } - - /** - * Applies a Delta Bundle to the current bundle. - */ - applyDelta(bundle) { - // Make sure that the first received bundle is a base. - if (!this._initialized && !bundle.base) { - throw new Error( - 'DeltaPatcher should receive a base Bundle when being initialized', - ); - } - - this._initialized = true; - - // Reset the current bundle when we receive a base bundle. - if (bundle.base) { - this._lastNumModifiedFiles = bundle.modules.length; - - this._lastBundle = { - revisionId: bundle.revisionId, - pre: bundle.pre, - post: bundle.post, - modules: new Map(bundle.modules), - }; - } else { - // TODO T37123645 The former case is deprecated, but necessary in order to - // support older versions of the Metro bundler. - const modules = bundle.modules - ? bundle.modules - : bundle.added.concat(bundle.modified); - - this._lastNumModifiedFiles = modules.length + bundle.deleted.length; - - this._lastBundle.revisionId = bundle.revisionId; - - for (const [key, value] of modules) { - this._lastBundle.modules.set(key, value); - } - - for (const id of bundle.deleted) { - this._lastBundle.modules.delete(id); - } - } - - if (this._lastNumModifiedFiles > 0) { - this._lastModifiedDate = new Date(); - } - - return this; - } - - getLastRevisionId() { - return this._lastBundle.revisionId; - } - - /** - * Returns the number of modified files in the last received Delta. This is - * currently used to populate the `X-Metro-Files-Changed-Count` HTTP header - * when metro serves the whole JS bundle, and can potentially be removed once - * we only send the actual deltas to clients. - */ - getLastNumModifiedFiles() { - return this._lastNumModifiedFiles; - } - - getLastModifiedDate() { - return this._lastModifiedDate; - } - - getAllModules() { - return [].concat( - [this._lastBundle.pre], - Array.from(this._lastBundle.modules.values()), - [this._lastBundle.post], - ); - } - } - - DeltaPatcher._deltaPatchers = new Map(); - - global.DeltaPatcher = DeltaPatcher; -})(window); diff --git a/local-cli/server/util/debugger-ui/__tests__/DeltaPatcher-test.js b/local-cli/server/util/debugger-ui/__tests__/DeltaPatcher-test.js deleted file mode 100644 index 2bd9db3396d..00000000000 --- a/local-cli/server/util/debugger-ui/__tests__/DeltaPatcher-test.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -'use strict'; - -describe('DeltaPatcher', () => { - const window = (global.window = {}); - require('../DeltaPatcher'); - - it('should initialize to an empty bundle', () => { - global.Date = jest.fn(); - const dp = new window.DeltaPatcher(); - expect(dp.getLastRevisionId()).toBe(undefined); - expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); - expect(dp.getLastNumModifiedFiles()).toBe(0); - // Empty pre and post. - expect(dp.getAllModules()).toEqual(['', '']); - }); - - it('should expect a base bundle at initialization', () => { - const dp = new window.DeltaPatcher(); - expect(() => { - dp.applyDelta({ - base: false, - revisionId: 'hello', - modules: [], - deleted: [], - }); - }).toThrow(); - }); - - it('should accept a base bundle at initialization', () => { - const dp = new window.DeltaPatcher(); - global.Date = jest.fn(); - dp.applyDelta({ - base: true, - revisionId: 'rev0', - pre: 'pre0', - post: 'post0', - modules: [[0, '__d(0);']], - }); - expect(dp.getLastRevisionId()).toBe('rev0'); - expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); - expect(dp.getLastNumModifiedFiles()).toBe(1); - expect(dp.getAllModules()).toEqual(['pre0', '__d(0);', 'post0']); - }); - - it('should accept a delta bundle after a base bundle', () => { - const dp = new window.DeltaPatcher(); - dp.applyDelta({ - base: true, - revisionId: 'rev0', - pre: 'pre0', - post: 'post0', - modules: [[0, '__d(0);'], [1, '__d(1);'], [2, '__d(2);']], - }); - global.Date = jest.fn(); - dp.applyDelta({ - base: false, - revisionId: 'rev1', - modules: [[1, '__d(1.1);'], [3, '__d(3);']], - deleted: [0], - }); - expect(dp.getLastRevisionId()).toBe('rev1'); - expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); - expect(dp.getLastNumModifiedFiles()).toBe(3); - expect(dp.getAllModules()).toEqual([ - 'pre0', - '__d(1.1);', - '__d(2);', - '__d(3);', - 'post0', - ]); - }); - - it('should accept a base bundle after initialization', () => { - const dp = new window.DeltaPatcher(); - dp.applyDelta({ - base: true, - revisionId: 'rev0', - pre: 'pre0', - post: 'post0', - modules: [[0, '__d(0);'], [1, '__d(1);'], [2, '__d(2);']], - }); - dp.applyDelta({ - base: false, - revisionId: 'rev1', - modules: [[1, '__d(1.1);'], [3, '__d(3);']], - deleted: [0], - }); - global.Date = jest.fn(); - dp.applyDelta({ - base: true, - revisionId: 'rev2', - pre: 'pre2', - post: 'post2', - modules: [[4, '__d(4);'], [5, '__d(5);']], - }); - expect(dp.getLastRevisionId()).toBe('rev2'); - expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); - expect(dp.getLastNumModifiedFiles()).toBe(2); - expect(dp.getAllModules()).toEqual(['pre2', '__d(4);', '__d(5);', 'post2']); - }); -}); diff --git a/local-cli/server/util/debugger-ui/debuggerWorker.js b/local-cli/server/util/debugger-ui/debuggerWorker.js deleted file mode 100644 index 070d753b712..00000000000 --- a/local-cli/server/util/debugger-ui/debuggerWorker.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/* global __fbBatchedBridge, self, importScripts, postMessage, onmessage: true */ -/* eslint no-unused-vars: 0 */ - -'use strict'; - -onmessage = (function() { - var visibilityState; - var showVisibilityWarning = (function() { - var hasWarned = false; - return function() { - // Wait until `YellowBox` gets initialized before displaying the warning. - if (hasWarned || console.warn.toString().includes('[native code]')) { - return; - } - hasWarned = true; - console.warn( - 'Remote debugger is in a background tab which may cause apps to ' + - 'perform slowly. Fix this by foregrounding the tab (or opening it in ' + - 'a separate window).', - ); - }; - })(); - - var messageHandlers = { - executeApplicationScript: function(message, sendReply) { - for (var key in message.inject) { - self[key] = JSON.parse(message.inject[key]); - } - var error; - try { - importScripts(message.url); - } catch (err) { - error = err.message; - } - sendReply(null /* result */, error); - }, - setDebuggerVisibility: function(message) { - visibilityState = message.visibilityState; - }, - }; - - return function(message) { - if (visibilityState === 'hidden') { - showVisibilityWarning(); - } - - var object = message.data; - - var sendReply = function(result, error) { - postMessage({replyID: object.id, result: result, error: error}); - }; - - var handler = messageHandlers[object.method]; - if (handler) { - // Special cased handlers - handler(object, sendReply); - } else { - // Other methods get called on the bridge - var returnValue = [[], [], [], 0]; - var error; - try { - if (typeof __fbBatchedBridge === 'object') { - returnValue = __fbBatchedBridge[object.method].apply( - null, - object.arguments, - ); - } else { - error = 'Failed to call function, __fbBatchedBridge is undefined'; - } - } catch (err) { - error = err.message; - } finally { - sendReply(JSON.stringify(returnValue), error); - } - } - }; -})(); diff --git a/local-cli/server/util/debugger-ui/deltaUrlToBlobUrl.js b/local-cli/server/util/debugger-ui/deltaUrlToBlobUrl.js deleted file mode 100644 index c5aff0f545e..00000000000 --- a/local-cli/server/util/debugger-ui/deltaUrlToBlobUrl.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -/* global Blob, URL: true */ - -(function(global) { - 'use strict'; - - let cachedBundleUrls = new Map(); - - /** - * Converts the passed delta URL into an URL object containing already the - * whole JS bundle Blob. - */ - async function deltaUrlToBlobUrl(deltaUrl) { - const client = global.DeltaPatcher.get(deltaUrl); - - const revisionId = client.getLastRevisionId() - ? `&revisionId=${client.getLastRevisionId()}` - : ''; - - const data = await fetch(deltaUrl + revisionId); - const bundle = await data.json(); - - const deltaPatcher = client.applyDelta(bundle); - - let cachedBundle = cachedBundleUrls.get(deltaUrl); - - // If nothing changed, avoid recreating a bundle blob by reusing the - // previous one. - if ( - deltaPatcher.getLastNumModifiedFiles() === 0 && - cachedBundle != null && - cachedBundle !== '' - ) { - return cachedBundle; - } - - // Clean up the previous bundle URL to not leak memory. - if (cachedBundle != null && cachedBundle !== '') { - URL.revokeObjectURL(cachedBundle); - } - - // To make Source Maps work correctly, we need to add a newline between - // modules. - const blobContent = deltaPatcher - .getAllModules() - .map(module => module + '\n'); - - // Build the blob with the whole JS bundle. - const blob = new Blob(blobContent, { - type: 'application/javascript', - }); - - const bundleContents = URL.createObjectURL(blob); - cachedBundleUrls.set(deltaUrl, bundleContents); - - return bundleContents; - } - - global.deltaUrlToBlobUrl = deltaUrlToBlobUrl; -})(window || {}); diff --git a/local-cli/server/util/debugger-ui/index.html b/local-cli/server/util/debugger-ui/index.html deleted file mode 100644 index 320b4828993..00000000000 --- a/local-cli/server/util/debugger-ui/index.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - -React Native Debugger - - - - - - -
- - -

- React Native JS code runs as a web worker inside this tab. -

-

Press ⌘⌥I to open Developer Tools. Enable Pause On Caught Exceptions for a better debugging experience.

-

You may also install the standalone version of React Developer Tools to inspect the React component hierarchy, their props, and state.

-

Status: Loading...

-
- - - diff --git a/local-cli/server/util/external/xsel b/local-cli/server/util/external/xsel deleted file mode 100755 index a6b2fd3d5937e605e3f3fdb3c9634bad8aa5816f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 129416 zcmeFadt6l2`aiz+4B!kZL#8!&$(>?BiGrzNNzHK4je(M)kvBjtLLm?gie*Lu<(!eS zyLGH%r<c9yTQB^LzbXuixwY{iE>( z>v^8F)^l6Wde&u+o9nW2rr1uTdsQWdA-QO;6EDp6<^ zi666_$AHZ8gwf3`9cass9X}EHNwpDU>0uErhYCzl%+i$3lJdGf9s`u+{91{crJ`tp zz<$(KSt(GIMG`Q|WGaKtYEz)mkLt0X+vw*u+MDG;GRDU&P5a1>Klz4z`8E$Q;vN=C zruf}e8se3_Pkp6?*DaO})-Co3z$_ySdErtvQ!Yh6VV{BjZ$+%p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%Y+&DQ_pnCmZs9wQ2?@nQ5P%Ht{yEYq9kF`0h$B6ef5c^(fry>aK=|KrJ1OE+w1A zsBkHPBqKfDvj-u$pw)VU{cM(ETH%omrQ#Gl4x>_3=6~ZK&kr!NoNk)sdHpzq{BJWOsFdGG_^j}YTvOKR_cg(Z#c^%nw zN&nqUaql+S&+FT_ooa>dgDl(6=`h_z@xN@6=XLPKr&+;K$V>YHt6S+t`;_(ZdigZu zw}6q;m-+uV95i=fug?-`mgn{S&LuXU?FD;eKZn04N*JtN9$@4ykxkoAg3dw5wIep#_(Q%aW zM@UxJU6$v46N@4LGW^H&o9*X%a6qKb`zzkMog(OBej93p8UF=EG}|BT!`NdbI=Ny% z0n0IcOUU!Qb?06yz;;4BX3sAvLhIuEr}vH;)-K3z;f~UvN_B!VX(!{g{ap-zviwSc zYhHaZJq7X>ZT!z7{d5B|cPz*7IS%;;A@A>JPD`cy#SZy7XIRcJbH@oaQht>~{;PUp z0bL)*a{%H|zB#-O^3s1FxX8*6oW-1$TD0N6t&nf!Qfjx}kU-ZLKh+w;@{HPj2pnqA zh2OWFUGHK4=_JB+ry;G>{jXd3KqM%F#vg6Xg1FzJHwMtPACsXM(tVl!xZZQM)ctEx Q`Y-&Qm48BXz%u>+1%L4+cmMzZ diff --git a/local-cli/server/util/jsPackagerClient.js b/local-cli/server/util/jsPackagerClient.js deleted file mode 100644 index 08e6516f5aa..00000000000 --- a/local-cli/server/util/jsPackagerClient.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const WebSocket = require('ws'); - -const parseMessage = require('./messageSocket').parseMessage; - -const PROTOCOL_VERSION = 2; -const TARGET_SERVER = 'server'; - -function getMessageId() { - return `${Date.now()}:${Math.random()}`; -} - -class JsPackagerClient { - constructor(url) { - this.ws = new WebSocket(url); - this.msgCallbacks = new Map(); - - this.openPromise = new Promise((resolve, reject) => { - this.ws.on('error', error => reject(error)); - this.ws.on('open', resolve); - }); - - this.ws.on('message', (data, flags) => { - const message = parseMessage(data, flags.binary); - const msgCallback = this.msgCallbacks.get(message.id); - if (message === undefined || message.id === undefined) { - // gracefully ignore wrong messages or broadcasts - } else if (msgCallback === undefined) { - console.warn(`Response with non-existing message id: '${message.id}'`); - } else { - if (message.error === undefined) { - msgCallback.resolve(message.result); - } else { - msgCallback.reject(message.error); - } - } - }); - } - - sendRequest(method, target, params) { - return this.openPromise.then( - () => - new Promise((resolve, reject) => { - const messageId = getMessageId(); - this.msgCallbacks.set(messageId, {resolve: resolve, reject: reject}); - this.ws.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - target: target, - method: method, - id: messageId, - params: params, - }), - error => { - if (error !== undefined) { - this.msgCallbacks.delete(messageId); - reject(error); - } - }, - ); - }), - ); - } - - sendNotification(method, target, params) { - return this.openPromise.then( - () => - new Promise((resolve, reject) => { - this.ws.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - target: target, - method: method, - params: params, - }), - error => { - if (error !== undefined) { - reject(error); - } else { - resolve(); - } - }, - ); - }), - ); - } - - sendBroadcast(method, params) { - return this.sendNotification(method, undefined, params); - } - - getPeers() { - return new Promise((resolve, reject) => { - this.sendRequest('getpeers', TARGET_SERVER, undefined).then(response => { - if (!response instanceof Map) { - reject( - 'Results received from server are of wrong format:\n' + - JSON.stringify(response), - ); - } else { - resolve(response); - } - }, reject); - }); - } - - getId() { - return this.sendRequest('getid', TARGET_SERVER, undefined); - } -} - -module.exports = JsPackagerClient; diff --git a/local-cli/server/util/launchChrome.js b/local-cli/server/util/launchChrome.js deleted file mode 100644 index 854ae20c80b..00000000000 --- a/local-cli/server/util/launchChrome.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const opn = require('opn'); -const execSync = require('child_process').execSync; - -function commandExistsUnixSync(commandName, callback) { - try { - var stdout = execSync( - 'command -v ' + - commandName + - ' 2>/dev/null' + - " && { echo >&1 '" + - commandName + - " found'; exit 0; }", - ); - return !!stdout; - } catch (error) { - return false; - } -} - -function getChromeAppName(): string { - switch (process.platform) { - case 'darwin': - return 'google chrome'; - case 'win32': - return 'chrome'; - case 'linux': - if (commandExistsUnixSync('google-chrome')) { - return 'google-chrome'; - } else if (commandExistsUnixSync('chromium-browser')) { - return 'chromium-browser'; - } else { - return 'chromium'; - } - default: - return 'google-chrome'; - } -} - -function launchChrome(url: string) { - opn(url, {app: [getChromeAppName()]}, function(err) { - if (err) { - console.error('Google Chrome exited with error:', err); - } - }); -} - -module.exports = launchChrome; diff --git a/local-cli/server/util/launchEditor.js b/local-cli/server/util/launchEditor.js deleted file mode 100644 index ac965b08531..00000000000 --- a/local-cli/server/util/launchEditor.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -var chalk = require('chalk'); -var fs = require('fs'); -var path = require('path'); -var child_process = require('child_process'); -const isAbsolutePath = require('absolute-path'); -const shellQuote = require('shell-quote'); - -function isTerminalEditor(editor) { - switch (editor) { - case 'vim': - case 'emacs': - case 'nano': - return true; - } - return false; -} - -// Map from full process name to binary that starts the process -// We can't just re-use full process name, because it will spawn a new instance -// of the app every time -var COMMON_EDITORS = { - '/Applications/Atom.app/Contents/MacOS/Atom': 'atom', - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta', - '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea': 'idea', - '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': - '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', - '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': - '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl', - '/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code', - '/Applications/WebStorm.app/Contents/MacOS/webstorm': 'webstorm', -}; - -// Transpiled version of: /^[\p{L}0-9/.\-_\\]+$/u -// Non-transpiled version requires support for Unicode property regex. Allows -// alphanumeric characters, periods, dashes, slashes, and underscores. -const WINDOWS_FILE_NAME_WHITELIST = /^(?:[\x2D-9A-Z\\_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])+$/; - -function addWorkspaceToArgumentsIfExists(args, workspace) { - if (workspace) { - args.unshift(workspace); - } - return args; -} - -function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { - switch (path.basename(editor)) { - case 'vim': - case 'mvim': - return [fileName, '+' + lineNumber]; - case 'atom': - case 'Atom': - case 'Atom Beta': - case 'subl': - case 'sublime': - case 'webstorm': - case 'wstorm': - case 'appcode': - case 'charm': - case 'idea': - return [fileName + ':' + lineNumber]; - case 'joe': - case 'emacs': - case 'emacsclient': - return ['+' + lineNumber, fileName]; - case 'rmate': - case 'mate': - case 'mine': - return ['--line', lineNumber, fileName]; - case 'code': - return addWorkspaceToArgumentsIfExists( - ['-g', fileName + ':' + lineNumber], - workspace, - ); - } - - // For all others, drop the lineNumber until we have - // a mapping above, since providing the lineNumber incorrectly - // can result in errors or confusing behavior. - return [fileName]; -} - -function guessEditor() { - // Explicit config always wins - if (process.env.REACT_EDITOR) { - return shellQuote.parse(process.env.REACT_EDITOR); - } - - // Using `ps x` on OSX we can find out which editor is currently running. - // Potentially we could use similar technique for Windows and Linux - if (process.platform === 'darwin') { - try { - var output = child_process.execSync('ps x').toString(); - var processNames = Object.keys(COMMON_EDITORS); - for (var i = 0; i < processNames.length; i++) { - var processName = processNames[i]; - if (output.indexOf(processName) !== -1) { - return [COMMON_EDITORS[processName]]; - } - } - } catch (error) { - // Ignore... - } - } - - // Last resort, use old skool env vars - if (process.env.VISUAL) { - return [process.env.VISUAL]; - } else if (process.env.EDITOR) { - return [process.env.EDITOR]; - } - - return [null]; -} - -function printInstructions(title) { - console.log( - [ - '', - chalk.bgBlue.white.bold(' ' + title + ' '), - ' When you see Red Box with stack trace, you can click any ', - ' stack frame to jump to the source file. The packager will launch your ', - ' editor of choice. It will first look at REACT_EDITOR environment ', - ' variable, then at EDITOR. To set it up, you can add something like ', - ' export REACT_EDITOR=atom to your ~/.bashrc or ~/.zshrc depending on ', - ' which shell you use.', - '', - ].join('\n'), - ); -} - -function transformToAbsolutePathIfNeeded(pathName) { - if (!isAbsolutePath(pathName)) { - pathName = path.resolve(process.cwd(), pathName); - } - return pathName; -} - -function findRootForFile(projectRoots, fileName) { - fileName = transformToAbsolutePathIfNeeded(fileName); - return projectRoots.find(root => { - root = transformToAbsolutePathIfNeeded(root); - return fileName.startsWith(root + path.sep); - }); -} - -var _childProcess = null; -function launchEditor(fileName, lineNumber, projectRoots) { - if (!fs.existsSync(fileName)) { - return; - } - - // Sanitize lineNumber to prevent malicious use on win32 - // via: https://github.com/nodejs/node/blob/c3bb4b1aa5e907d489619fb43d233c3336bfc03d/lib/child_process.js#L333 - if (lineNumber && isNaN(lineNumber)) { - return; - } - - let [editor, ...args] = guessEditor(); - if (!editor) { - printInstructions('PRO TIP'); - return; - } - - var workspace = findRootForFile(projectRoots, fileName); - if (lineNumber) { - args = args.concat( - getArgumentsForLineNumber(editor, fileName, lineNumber, workspace), - ); - } else { - args.push(fileName); - } - - // cmd.exe on Windows is vulnerable to RCE attacks given a file name of the - // form "C:\Users\myusername\Downloads\& curl 172.21.93.52". Use a whitelist - // to validate user-provided file names. This doesn't cover the entire range - // of valid file names but should cover almost all of them in practice. - if ( - process.platform === 'win32' && - !WINDOWS_FILE_NAME_WHITELIST.test(fileName.trim()) - ) { - console.log(); - console.log( - chalk.red( - 'Could not open ' + path.basename(fileName) + ' in the editor.', - ), - ); - console.log(); - console.log( - 'When running on Windows, file names are checked against a whitelist ' + - 'to protect against remote code execution attacks. File names may ' + - 'consist only of alphanumeric characters (all languages), periods, ' + - 'dashes, slashes, and underscores.', - ); - console.log(); - return; - } - - console.log( - 'Opening ' + chalk.underline(fileName) + ' with ' + chalk.bold(editor), - ); - - if (_childProcess && isTerminalEditor(editor)) { - // There's an existing editor process already and it's attached - // to the terminal, so go kill it. Otherwise two separate editor - // instances attach to the stdin/stdout which gets confusing. - _childProcess.kill('SIGKILL'); - } - - if (process.platform === 'win32') { - // On Windows, launch the editor in a shell because spawn can only - // launch .exe files. - _childProcess = child_process.spawn( - 'cmd.exe', - ['/C', editor].concat(args), - {stdio: 'inherit'}, - ); - } else { - _childProcess = child_process.spawn(editor, args, {stdio: 'inherit'}); - } - _childProcess.on('exit', function(errorCode) { - _childProcess = null; - - if (errorCode) { - console.log(chalk.red('Your editor exited with an error!')); - printInstructions('Keep these instructions in mind:'); - } - }); - - _childProcess.on('error', function(error) { - console.log(chalk.red(error.message)); - printInstructions('How to fix:'); - }); -} - -module.exports = launchEditor; diff --git a/local-cli/server/util/messageSocket.js b/local-cli/server/util/messageSocket.js deleted file mode 100644 index a151f7916ba..00000000000 --- a/local-cli/server/util/messageSocket.js +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const url = require('url'); -const WebSocketServer = require('ws').Server; -const PROTOCOL_VERSION = 2; -const notifier = require('node-notifier'); - -function parseMessage(data, binary) { - if (binary) { - console.error('Expected text message, got binary!'); - return undefined; - } - try { - const message = JSON.parse(data); - if (message.version === PROTOCOL_VERSION) { - return message; - } - console.error( - 'Received message had wrong protocol version: ' + message.version, - ); - } catch (e) { - console.error('Failed to parse the message as JSON:\n' + data); - } - return undefined; -} - -function isBroadcast(message) { - return ( - typeof message.method === 'string' && - message.id === undefined && - message.target === undefined - ); -} - -function isRequest(message) { - return ( - typeof message.method === 'string' && typeof message.target === 'string' - ); -} - -function isResponse(message) { - return ( - typeof message.id === 'object' && - typeof message.id.requestId !== undefined && - typeof message.id.clientId === 'string' && - (message.result !== undefined || message.error !== undefined) - ); -} - -function attachToServer(server, path) { - const wss = new WebSocketServer({ - server: server, - path: path, - }); - const clients = new Map(); - let nextClientId = 0; - - function getClientWs(clientId) { - const clientWs = clients.get(clientId); - if (clientWs === undefined) { - throw `could not find id "${clientId}" while forwarding request`; - } - return clientWs; - } - - function handleSendBroadcast(broadcasterId, message) { - const forwarded = { - version: PROTOCOL_VERSION, - method: message.method, - params: message.params, - }; - if (clients.size === 0) { - notifier.notify({ - title: 'React Native: No apps connected', - message: - `Sending '${message.method}' to all React Native apps ` + - 'failed. Make sure your app is running in the simulator ' + - 'or on a phone connected via USB.', - }); - } - for (const [otherId, otherWs] of clients) { - if (otherId !== broadcasterId) { - try { - otherWs.send(JSON.stringify(forwarded)); - } catch (e) { - console.error( - `Failed to send broadcast to client: '${otherId}' ` + - `due to:\n ${e.toString()}`, - ); - } - } - } - } - - wss.on('connection', function(clientWs) { - const clientId = `client#${nextClientId++}`; - - function handleCaughtError(message, error) { - const errorMessage = { - id: message.id, - method: message.method, - target: message.target, - error: message.error === undefined ? 'undefined' : 'defined', - params: message.params === undefined ? 'undefined' : 'defined', - result: message.result === undefined ? 'undefined' : 'defined', - }; - - if (message.id === undefined) { - console.error( - `Handling message from ${clientId} failed with:\n${error}\n` + - `message:\n${JSON.stringify(errorMessage)}`, - ); - } else { - try { - clientWs.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - error: error, - id: message.id, - }), - ); - } catch (e) { - console.error( - `Failed to reply to ${clientId} with error:\n${error}` + - `\nmessage:\n${JSON.stringify(errorMessage)}` + - `\ndue to error: ${e.toString()}`, - ); - } - } - } - - function handleServerRequest(message) { - let result = null; - switch (message.method) { - case 'getid': - result = clientId; - break; - case 'getpeers': - result = {}; - clients.forEach((otherWs, otherId) => { - if (clientId !== otherId) { - result[otherId] = url.parse(otherWs.upgradeReq.url, true).query; - } - }); - break; - default: - throw `unknown method: ${message.method}`; - } - - clientWs.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - result: result, - id: message.id, - }), - ); - } - - function forwardRequest(message) { - getClientWs(message.target).send( - JSON.stringify({ - version: PROTOCOL_VERSION, - method: message.method, - params: message.params, - id: - message.id === undefined - ? undefined - : {requestId: message.id, clientId: clientId}, - }), - ); - } - - function forwardResponse(message) { - getClientWs(message.id.clientId).send( - JSON.stringify({ - version: PROTOCOL_VERSION, - result: message.result, - error: message.error, - id: message.id.requestId, - }), - ); - } - - clients.set(clientId, clientWs); - clientWs.onclose = clientWs.onerror = () => { - clientWs.onmessage = null; - clients.delete(clientId); - }; - clientWs.onmessage = event => { - const message = parseMessage(event.data, event.binary); - if (message === undefined) { - console.error('Received message not matching protocol'); - return; - } - - try { - if (isBroadcast(message)) { - handleSendBroadcast(clientId, message); - } else if (isRequest(message)) { - if (message.target === 'server') { - handleServerRequest(message); - } else { - forwardRequest(message); - } - } else if (isResponse(message)) { - forwardResponse(message); - } else { - throw 'Invalid message, did not match the protocol'; - } - } catch (e) { - handleCaughtError(message, e.toString()); - } - }; - }); - - return { - broadcast: (method, params) => { - handleSendBroadcast(null, {method: method, params: params}); - }, - }; -} - -module.exports = { - attachToServer: attachToServer, - parseMessage: parseMessage, -}; diff --git a/local-cli/server/util/webSocketProxy.js b/local-cli/server/util/webSocketProxy.js deleted file mode 100644 index 097a5de5300..00000000000 --- a/local-cli/server/util/webSocketProxy.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -function attachToServer(server, path) { - var WebSocketServer = require('ws').Server; - var wss = new WebSocketServer({ - server: server, - path: path, - }); - var debuggerSocket, clientSocket; - - function send(dest, message) { - if (!dest) { - return; - } - - try { - dest.send(message); - } catch (e) { - console.warn(e); - // Sometimes this call throws 'not opened' - } - } - - wss.on('connection', function(ws) { - const {url} = ws.upgradeReq; - - if (url.indexOf('role=debugger') > -1) { - if (debuggerSocket) { - ws.close(1011, 'Another debugger is already connected'); - return; - } - debuggerSocket = ws; - debuggerSocket.onerror = debuggerSocket.onclose = () => { - debuggerSocket = null; - if (clientSocket) { - clientSocket.close(1011, 'Debugger was disconnected'); - } - }; - debuggerSocket.onmessage = ({data}) => send(clientSocket, data); - } else if (url.indexOf('role=client') > -1) { - if (clientSocket) { - clientSocket.onerror = clientSocket.onclose = clientSocket.onmessage = null; - clientSocket.close(1011, 'Another client connected'); - } - clientSocket = ws; - clientSocket.onerror = clientSocket.onclose = () => { - clientSocket = null; - send(debuggerSocket, JSON.stringify({method: '$disconnected'})); - }; - clientSocket.onmessage = ({data}) => send(debuggerSocket, data); - } else { - ws.close(1011, 'Missing role param'); - } - }); - - return { - server: wss, - isChromeConnected: function() { - return !!debuggerSocket; - }, - }; -} - -module.exports = { - attachToServer: attachToServer, -}; diff --git a/local-cli/setup_env.bat b/local-cli/setup_env.bat deleted file mode 100755 index 68318546b76..00000000000 --- a/local-cli/setup_env.bat +++ /dev/null @@ -1,4 +0,0 @@ -:: Copyright (c) Facebook, Inc. and its affiliates. -:: -:: This source code is licensed under the MIT license found in the -:: LICENSE file in the root directory of this source tree. diff --git a/local-cli/setup_env.sh b/local-cli/setup_env.sh deleted file mode 100755 index eaf58104896..00000000000 --- a/local-cli/setup_env.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# 2048 is the max for non root users on Mac -ulimit -n 2048 diff --git a/local-cli/upgrade/upgrade.js b/local-cli/upgrade/upgrade.js deleted file mode 100644 index 202afe52cf4..00000000000 --- a/local-cli/upgrade/upgrade.js +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const chalk = require('chalk'); -const copyProjectTemplateAndReplace = require('../generator/copyProjectTemplateAndReplace'); -const fs = require('fs'); -const path = require('path'); -const semver = require('semver'); - -/** - * Migrate application to a new version of React Native. - * See http://facebook.github.io/react-native/docs/upgrading.html - * - * IMPORTANT: Assumes the cwd() is the project directory. - * The code here must only be invoked via the CLI: - * $ cd MyAwesomeApp - * $ react-native upgrade - */ -function validateAndUpgrade() { - const projectDir = process.cwd(); - - const packageJSON = JSON.parse( - fs.readFileSync(path.resolve(projectDir, 'package.json'), 'utf8'), - ); - - warn( - 'You should consider using the new upgrade tool based on Git. It ' + - 'makes upgrades easier by resolving most conflicts automatically.\n' + - 'To use it:\n' + - '- Go back to the old version of React Native\n' + - '- Run "npm install -g react-native-git-upgrade"\n' + - '- Run "react-native-git-upgrade"\n' + - 'See https://facebook.github.io/react-native/docs/upgrading.html', - ); - - const projectName = packageJSON.name; - if (!projectName) { - warn( - 'Your project needs to have a name, declared in package.json, ' + - 'such as "name": "AwesomeApp". Please add a project name. Aborting.', - ); - return; - } - - const version = packageJSON.dependencies['react-native']; - if (!version) { - warn( - 'Your "package.json" file doesn\'t seem to declare "react-native" as ' + - 'a dependency. Nothing to upgrade. Aborting.', - ); - return; - } - - if (version === 'latest' || version === '*') { - warn( - 'Some major releases introduce breaking changes.\n' + - 'Please use a caret version number in your "package.json" file \n' + - 'to avoid breakage. Use e.g. react-native: ^0.38.0. Aborting.', - ); - return; - } - - const installed = JSON.parse( - fs.readFileSync( - path.resolve(projectDir, 'node_modules/react-native/package.json'), - 'utf8', - ), - ); - - if (!semver.satisfies(installed.version, version)) { - warn( - 'react-native version in "package.json" doesn\'t match ' + - 'the installed version in "node_modules".\n' + - 'Try running "npm install" to fix this. Aborting.', - ); - return; - } - - const v = version.replace(/^(~|\^|=)/, '').replace(/x/i, '0'); - - if (!semver.valid(v)) { - warn( - "A valid version number for 'react-native' is not specified in your " + - "'package.json' file. Aborting.", - ); - return; - } - - console.log( - 'Upgrading project to react-native v' + - installed.version + - '\n' + - 'Check out the release notes and breaking changes: ' + - 'https://github.com/facebook/react-native/releases/tag/v' + - semver.major(v) + - '.' + - semver.minor(v) + - '.0', - ); - - // >= v0.21.0, we require react to be a peer dependency - if (semver.gte(v, '0.21.0') && !packageJSON.dependencies.react) { - warn( - 'Your "package.json" file doesn\'t seem to have "react" as a dependency.\n' + - '"react" was changed from a dependency to a peer dependency in react-native v0.21.0.\n' + - 'Therefore, it\'s necessary to include "react" in your project\'s dependencies.\n' + - 'Please run "npm install --save react", then re-run "react-native upgrade".\n', - ); - return; - } - - if (semver.satisfies(v, '~0.26.0')) { - warn( - 'React Native 0.26 introduced some breaking changes to the native files on iOS. You can\n' + - 'perform them manually by checking the release notes or use "rnpm" ' + - 'to do it automatically.\n' + - 'Just run:\n' + - '"npm install -g rnpm && npm install rnpm-plugin-upgrade@0.26 --save-dev", ' + - 'then run "rnpm upgrade".', - ); - } - - return new Promise(resolve => { - upgradeProjectFiles(projectDir, projectName); - console.log( - 'Successfully upgraded this project to react-native v' + - installed.version, - ); - resolve(); - }); -} - -/** - * Once all checks passed, upgrade the project files. - */ -function upgradeProjectFiles(projectDir, projectName) { - // Just overwrite - copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - 'local-cli', - 'templates', - 'HelloWorld', - ), - projectDir, - projectName, - {upgrade: true}, - ); -} - -function warn(message) { - console.warn(chalk.yellow(message)); -} - -const upgradeCommand = { - name: 'upgrade', - description: - "upgrade your app's template files to the latest version; run this after " + - 'updating the react-native version in your package.json and running npm install', - func: validateAndUpgrade, -}; - -module.exports = upgradeCommand; diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js deleted file mode 100644 index f3ae068937b..00000000000 --- a/local-cli/util/Config.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ -'use strict'; - -const findSymlinkedModules = require('./findSymlinkedModules'); -const getPolyfills = require('../../rn-get-polyfills'); -const path = require('path'); - -const {createBlacklist} = require('metro'); -const {loadConfig} = require('metro-config'); - -/** - * Configuration file of the CLI. - */ -import type {ConfigT} from 'metro-config/src/configTypes.flow'; - -function getProjectRoot() { - if ( - __dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli[\/\\]util$/) - ) { - // Packager is running from node_modules. - // This is the default case for all projects created using 'react-native init'. - return path.resolve(__dirname, '../../../..'); - } else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) { - // React Native was installed using CocoaPods. - return path.resolve(__dirname, '../../../..'); - } - return path.resolve(__dirname, '../..'); -} - -const resolveSymlinksForRoots = roots => - roots.reduce( - /* $FlowFixMe(>=0.70.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.70 was deployed. To see the error delete this - * comment and run Flow. */ - (arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)), - [...roots], - ); - -const getWatchFolders = () => { - const root = process.env.REACT_NATIVE_APP_ROOT; - if (root) { - return resolveSymlinksForRoots([path.resolve(root)]); - } - return []; -}; - -const getBlacklistRE = () => { - return createBlacklist([/.*\/__fixtures__\/.*/]); -}; - -/** - * Module capable of getting the configuration out of a given file. - * - * The function will return all the default configuration, as specified by the - * `DEFAULT` param overriden by those found on `rn-cli.config.js` files, if any. If no - * default config is provided and no configuration can be found in the directory - * hierarchy, an error will be thrown. - */ -const Config = { - DEFAULT: { - resolver: { - resolverMainFields: ['react-native', 'browser', 'main'], - blacklistRE: getBlacklistRE(), - }, - serializer: { - getModulesRunBeforeMainModule: () => [ - require.resolve('../../Libraries/Core/InitializeCore'), - ], - getPolyfills, - }, - server: { - port: process.env.RCT_METRO_PORT || 8081, - }, - transformer: { - babelTransformerPath: require.resolve('metro/src/reactNativeTransformer'), - }, - watchFolders: getWatchFolders(), - }, - - async load(configFile: ?string): Promise { - const argv = {cwd: getProjectRoot()}; - - return await loadConfig( - configFile ? {...argv, config: configFile} : argv, - this.DEFAULT, - ); - }, -}; - -module.exports = Config; diff --git a/local-cli/util/PackageManager.js b/local-cli/util/PackageManager.js deleted file mode 100644 index fe0783ec758..00000000000 --- a/local-cli/util/PackageManager.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const spawnSync = require('child_process').spawnSync; -const yarn = require('../util/yarn'); -const spawnOpts = { - stdio: 'inherit', - stdin: 'inherit', -}; - -/** - * Execute npm or yarn command - * - * @param {String} yarnCommand Yarn command to be executed eg. yarn add package - * @param {String} npmCommand Npm command to be executed eg. npm install package - * @return {object} spawnSync's result object - */ -function callYarnOrNpm(yarnCommand, npmCommand) { - let command; - - const projectDir = process.cwd(); - const isYarnAvailable = - yarn.getYarnVersionIfAvailable() && yarn.isGlobalCliUsingYarn(projectDir); - - if (isYarnAvailable) { - command = yarnCommand; - } else { - command = npmCommand; - } - - const args = command.split(' '); - const cmd = args.shift(); - - const res = spawnSync(cmd, args, spawnOpts); - - return res; -} - -/** - * Install package into project using npm or yarn if available - * @param {[type]} packageName Package to be installed - * @return {[type]} spawnSync's result object - */ -function add(packageName) { - return callYarnOrNpm( - `yarn add ${packageName}`, - `npm install ${packageName} --save`, - ); -} - -/** - * Uninstall package from project using npm or yarn if available - * @param {[type]} packageName Package to be uninstalled - * @return {Object} spawnSync's result object - */ -function remove(packageName) { - return callYarnOrNpm( - `yarn remove ${packageName}`, - `npm uninstall --save ${packageName}`, - ); -} - -module.exports = { - add: add, - remove: remove, -}; diff --git a/local-cli/util/__mocks__/log.js b/local-cli/util/__mocks__/log.js deleted file mode 100644 index 330cae48f76..00000000000 --- a/local-cli/util/__mocks__/log.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -module.exports.out = () => jest.fn(); -module.exports.err = () => jest.fn(); diff --git a/local-cli/util/__tests__/findSymlinkedModules-test.js b/local-cli/util/__tests__/findSymlinkedModules-test.js deleted file mode 100644 index fbdfd7463fc..00000000000 --- a/local-cli/util/__tests__/findSymlinkedModules-test.js +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -jest.mock('path'); -jest.mock('fs'); - -const fs = require('fs'); -const findSymlinkedModules = require('../findSymlinkedModules'); - -describe('findSymlinksForProjectRoot', () => { - it('correctly finds normal module symlinks', () => { - fs.__setMockFilesystem({ - root: { - projectA: { - 'package.json': JSON.stringify({ - name: 'projectA', - main: 'main.js', - }), - node_modules: { - depFoo: { - 'package.json': JSON.stringify({ - name: 'depFoo', - main: 'main.js', - }), - }, - projectB: { - SYMLINK: '/root/projectB', - }, - }, - }, - projectB: { - 'package.json': JSON.stringify({ - name: 'projectB', - main: 'main.js', - }), - node_modules: { - depBar: { - 'package.json': JSON.stringify({ - name: 'depBar', - main: 'main.js', - }), - }, - }, - }, - }, - }); - - const symlinkedModules = findSymlinkedModules('/root/projectA', []); - expect(symlinkedModules).toEqual(['/root/projectB']); - }); - - it('correctly finds scoped module symlinks', () => { - fs.__setMockFilesystem({ - root: { - projectA: { - 'package.json': JSON.stringify({ - name: 'projectA', - main: 'main.js', - }), - node_modules: { - depFoo: { - 'package.json': JSON.stringify({ - name: 'depFoo', - main: 'main.js', - }), - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - projectB: { - SYMLINK: '/root/projectB', - }, - }, - }, - projectB: { - 'package.json': JSON.stringify({ - name: 'projectB', - main: 'main.js', - }), - node_modules: { - depBar: { - 'package.json': JSON.stringify({ - name: 'depBar', - main: 'main.js', - }), - }, - }, - }, - '@scoped': { - projectC: { - 'package.json': JSON.stringify({ - name: '@scoped/projectC', - main: 'main.js', - }), - }, - }, - }, - }); - - const symlinkedModules = findSymlinkedModules('/root/projectA', []); - expect(symlinkedModules).toEqual([ - '/root/@scoped/projectC', - '/root/projectB', - ]); - }); - - it('correctly finds module symlinks within other module symlinks', () => { - fs.__setMockFilesystem({ - root: { - projectA: { - 'package.json': JSON.stringify({ - name: 'projectA', - main: 'main.js', - }), - node_modules: { - depFoo: { - 'package.json': JSON.stringify({ - name: 'depFoo', - main: 'main.js', - }), - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - projectB: { - SYMLINK: '/root/projectB', - }, - }, - }, - projectB: { - 'package.json': JSON.stringify({ - name: 'projectB', - main: 'main.js', - }), - node_modules: { - depBar: { - 'package.json': JSON.stringify({ - name: 'depBar', - main: 'main.js', - }), - }, - projectD: { - SYMLINK: '/root/projectD', - }, - }, - }, - '@scoped': { - projectC: { - 'package.json': JSON.stringify({ - name: '@scoped/projectC', - main: 'main.js', - }), - }, - }, - projectD: { - 'package.json': JSON.stringify({ - name: 'projectD', - main: 'main.js', - }), - }, - }, - }); - - const symlinkedModules = findSymlinkedModules('/root/projectA', []); - expect(symlinkedModules).toEqual([ - '/root/@scoped/projectC', - '/root/projectB', - '/root/projectD', - ]); - }); - - it('correctly handles duplicate symlink paths', () => { - // projectA -> - // -> projectC - // -> projectB -> projectC - // Final list should only contain projectC once - fs.__setMockFilesystem({ - root: { - projectA: { - 'package.json': JSON.stringify({ - name: 'projectA', - main: 'main.js', - }), - node_modules: { - depFoo: { - 'package.json': JSON.stringify({ - name: 'depFoo', - main: 'main.js', - }), - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - projectB: { - SYMLINK: '/root/projectB', - }, - }, - }, - projectB: { - 'package.json': JSON.stringify({ - name: 'projectB', - main: 'main.js', - }), - node_modules: { - depBar: { - 'package.json': JSON.stringify({ - name: 'depBar', - main: 'main.js', - }), - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - }, - }, - '@scoped': { - projectC: { - 'package.json': JSON.stringify({ - name: '@scoped/projectC', - main: 'main.js', - }), - }, - }, - }, - }); - - const symlinkedModules = findSymlinkedModules('/root/projectA', []); - expect(symlinkedModules).toEqual([ - '/root/@scoped/projectC', - '/root/projectB', - ]); - }); - - it('correctly handles symlink recursion', () => { - // projectA -> - // -> projectC -> projectD -> projectA - // -> projectB -> projectC -> projectA - // -> projectD -> projectC -> projectA - // Should not infinite loop, should not contain projectA - fs.__setMockFilesystem({ - root: { - projectA: { - 'package.json': JSON.stringify({ - name: 'projectA', - main: 'main.js', - }), - node_modules: { - depFoo: { - 'package.json': JSON.stringify({ - name: 'depFoo', - main: 'main.js', - }), - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - projectB: { - SYMLINK: '/root/projectB', - }, - }, - }, - projectB: { - 'package.json': JSON.stringify({ - name: 'projectB', - main: 'main.js', - }), - node_modules: { - depBar: { - 'package.json': JSON.stringify({ - name: 'depBar', - main: 'main.js', - }), - }, - projectD: { - SYMLINK: '/root/projectD', - }, - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - }, - }, - '@scoped': { - projectC: { - 'package.json': JSON.stringify({ - name: '@scoped/projectC', - main: 'main.js', - }), - node_modules: { - projectA: { - SYMLINK: '/root/projectA', - }, - projectD: { - SYMLINK: '/root/projectD', - }, - projectE: { - SYMLINK: '/root/projectE', - }, - }, - }, - }, - projectD: { - 'package.json': JSON.stringify({ - name: 'projectD', - main: 'main.js', - }), - node_modules: { - '@scoped': { - projectC: { - SYMLINK: '/root/@scoped/projectC', - }, - }, - projectE: { - SYMLINK: '/root/projectE', - }, - }, - }, - projectE: { - 'package.json': JSON.stringify({ - name: 'projectD', - main: 'main.js', - }), - }, - }, - }); - - const symlinkedModules = findSymlinkedModules('/root/projectA'); - expect(symlinkedModules).toEqual([ - '/root/@scoped/projectC', - '/root/projectB', - '/root/projectD', - '/root/projectE', - ]); - }); -}); diff --git a/local-cli/util/assertRequiredOptions.js b/local-cli/util/assertRequiredOptions.js deleted file mode 100644 index 379ad1fc165..00000000000 --- a/local-cli/util/assertRequiredOptions.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const {Option} = require('commander'); -const {camelCase} = require('lodash'); - -// Commander.js has a 2 years old open issue to support <...> syntax -// for options. Until that gets merged, we run the checks manually -// https://github.com/tj/commander.js/issues/230 -module.exports = function assertRequiredOptions(options, passedOptions) { - options.forEach(opt => { - const option = new Option(opt.command); - - if (!option.required) { - return; - } - - const name = camelCase(option.long); - - if (!passedOptions[name]) { - // Provide commander.js like error message - throw new Error(`error: option '${option.long}' missing`); - } - }); -}; diff --git a/local-cli/util/copyAndReplace.js b/local-cli/util/copyAndReplace.js deleted file mode 100644 index d0d4eb15a4a..00000000000 --- a/local-cli/util/copyAndReplace.js +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -// Binary files, don't process these (avoid decoding as utf8) -const binaryExtensions = ['.png', '.jar']; - -/** - * Copy a file to given destination, replacing parts of its contents. - * @param srcPath Path to a file to be copied. - * @param destPath Destination path. - * @param replacements: e.g. {'TextToBeReplaced': 'Replacement'} - * @param contentChangedCallback - * Used when upgrading projects. Based on if file contents would change - * when being replaced, allows the caller to specify whether the file - * should be replaced or not. - * If null, files will be overwritten. - * Function(path, 'identical' | 'changed' | 'new') => 'keep' | 'overwrite' - */ -function copyAndReplace( - srcPath, - destPath, - replacements, - contentChangedCallback, -) { - if (fs.lstatSync(srcPath).isDirectory()) { - if (!fs.existsSync(destPath)) { - fs.mkdirSync(destPath); - } - // Not recursive - return; - } - - const extension = path.extname(srcPath); - if (binaryExtensions.indexOf(extension) !== -1) { - // Binary file - let shouldOverwrite = 'overwrite'; - if (contentChangedCallback) { - const newContentBuffer = fs.readFileSync(srcPath); - let contentChanged = 'identical'; - try { - const origContentBuffer = fs.readFileSync(destPath); - if (Buffer.compare(origContentBuffer, newContentBuffer) !== 0) { - contentChanged = 'changed'; - } - } catch (err) { - if (err.code === 'ENOENT') { - contentChanged = 'new'; - } else { - throw err; - } - } - shouldOverwrite = contentChangedCallback(destPath, contentChanged); - } - if (shouldOverwrite === 'overwrite') { - copyBinaryFile(srcPath, destPath, err => { - if (err) { - throw err; - } - }); - } - } else { - // Text file - const srcPermissions = fs.statSync(srcPath).mode; - let content = fs.readFileSync(srcPath, 'utf8'); - Object.keys(replacements).forEach( - regex => - (content = content.replace( - new RegExp(regex, 'g'), - replacements[regex], - )), - ); - - let shouldOverwrite = 'overwrite'; - if (contentChangedCallback) { - // Check if contents changed and ask to overwrite - let contentChanged = 'identical'; - try { - const origContent = fs.readFileSync(destPath, 'utf8'); - if (content !== origContent) { - //console.log('Content changed: ' + destPath); - contentChanged = 'changed'; - } - } catch (err) { - if (err.code === 'ENOENT') { - contentChanged = 'new'; - } else { - throw err; - } - } - shouldOverwrite = contentChangedCallback(destPath, contentChanged); - } - if (shouldOverwrite === 'overwrite') { - fs.writeFileSync(destPath, content, { - encoding: 'utf8', - mode: srcPermissions, - }); - } - } -} - -/** - * Same as 'cp' on Unix. Don't do any replacements. - */ -function copyBinaryFile(srcPath, destPath, cb) { - let cbCalled = false; - const srcPermissions = fs.statSync(srcPath).mode; - const readStream = fs.createReadStream(srcPath); - readStream.on('error', function(err) { - done(err); - }); - const writeStream = fs.createWriteStream(destPath, { - mode: srcPermissions, - }); - writeStream.on('error', function(err) { - done(err); - }); - writeStream.on('close', function(ex) { - done(); - }); - readStream.pipe(writeStream); - function done(err) { - if (!cbCalled) { - cb(err); - cbCalled = true; - } - } -} - -module.exports = copyAndReplace; diff --git a/local-cli/util/findReactNativeScripts.js b/local-cli/util/findReactNativeScripts.js deleted file mode 100644 index 5d43e29482d..00000000000 --- a/local-cli/util/findReactNativeScripts.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const path = require('path'); -const fs = require('fs'); - -function findReactNativeScripts(): ?string { - const executablePath = path.resolve( - 'node_modules', - '.bin', - 'react-native-scripts', - ); - if (fs.existsSync(executablePath)) { - return executablePath; - } - return null; -} - -module.exports = findReactNativeScripts; diff --git a/local-cli/util/findSymlinkedModules.js b/local-cli/util/findSymlinkedModules.js deleted file mode 100644 index d7e5d30f447..00000000000 --- a/local-cli/util/findSymlinkedModules.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -const path = require('path'); -const fs = require('fs'); - -/** - * Find symlinked modules inside "node_modules." - * - * Naively, we could just perform a depth-first search of all folders in - * node_modules, recursing when we find a symlink. - * - * We can be smarter than this due to our knowledge of how npm/Yarn lays out - * "node_modules" / how tools that build on top of npm/Yarn (such as Lerna) - * install dependencies. - * - * Starting from a given root node_modules folder, this algorithm will look at - * both the top level descendants of the node_modules folder or second level - * descendants of folders that start with "@" (which indicates a scoped - * package). If any of those folders is a symlink, it will recurse into the - * link, and perform the same search in the linked folder. - * - * The end result should be a list of all resolved module symlinks for a given - * root. - */ -module.exports = function findSymlinkedModules( - projectRoot: string, - ignoredRoots?: Array = [], -) { - const timeStart = Date.now(); - const nodeModuleRoot = path.join(projectRoot, 'node_modules'); - const resolvedSymlinks = findModuleSymlinks(nodeModuleRoot, [ - ...ignoredRoots, - projectRoot, - ]); - const timeEnd = Date.now(); - - console.log( - `Scanning folders for symlinks in ${nodeModuleRoot} (${timeEnd - - timeStart}ms)`, - ); - - return resolvedSymlinks; -}; - -function findModuleSymlinks( - modulesPath: string, - ignoredPaths: Array = [], -): Array { - if (!fs.existsSync(modulesPath)) { - return []; - } - - // Find module symlinks - const moduleFolders = fs.readdirSync(modulesPath); - const symlinks = moduleFolders.reduce((links, folderName) => { - const folderPath = path.join(modulesPath, folderName); - const maybeSymlinkPaths = []; - if (folderName.startsWith('@')) { - const scopedModuleFolders = fs.readdirSync(folderPath); - maybeSymlinkPaths.push( - ...scopedModuleFolders.map(name => path.join(folderPath, name)), - ); - } else { - maybeSymlinkPaths.push(folderPath); - } - return links.concat(resolveSymlinkPaths(maybeSymlinkPaths, ignoredPaths)); - }, []); - - // For any symlinks found, look in _that_ modules node_modules directory - // and find any symlinked modules - const nestedSymlinks = symlinks.reduce( - (links, symlinkPath) => - links.concat( - // We ignore any found symlinks or anything from the ignored list, - // to prevent infinite recursion - findModuleSymlinks(path.join(symlinkPath, 'node_modules'), [ - ...ignoredPaths, - ...symlinks, - ]), - ), - [], - ); - - return [...new Set([...symlinks, ...nestedSymlinks])]; -} - -function resolveSymlinkPaths(maybeSymlinkPaths, ignoredPaths) { - return maybeSymlinkPaths.reduce((links, maybeSymlinkPath) => { - if (fs.lstatSync(maybeSymlinkPath).isSymbolicLink()) { - const resolved = path.resolve( - path.dirname(maybeSymlinkPath), - fs.readlinkSync(maybeSymlinkPath), - ); - if (ignoredPaths.indexOf(resolved) === -1 && fs.existsSync(resolved)) { - links.push(resolved); - } - } - return links; - }, []); -} diff --git a/local-cli/util/findSymlinksPaths.js b/local-cli/util/findSymlinksPaths.js deleted file mode 100644 index 5efa20e886b..00000000000 --- a/local-cli/util/findSymlinksPaths.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const path = require('path'); -const fs = require('fs'); - -/** - * Find and resolve symlinks in `lookupFolder`. - * Ignore any descendants of the paths in `ignoredRoots`. - */ -module.exports = function findSymlinksPaths(lookupFolder, ignoredRoots) { - const timeStart = Date.now(); - const folders = fs.readdirSync(lookupFolder); - - const resolvedSymlinks = []; - folders.forEach(folder => { - const visited = []; - - let symlink = path.resolve(lookupFolder, folder); - while (fs.lstatSync(symlink).isSymbolicLink()) { - const index = visited.indexOf(symlink); - if (index !== -1) { - throw Error( - 'Infinite symlink recursion detected:\n ' + - visited.slice(index).join('\n '), - ); - } - - visited.push(symlink); - symlink = path.resolve(path.dirname(symlink), fs.readlinkSync(symlink)); - } - - if (visited.length && !rootExists(ignoredRoots, symlink)) { - resolvedSymlinks.push(symlink); - } - }); - - const timeEnd = Date.now(); - console.log( - `Scanning ${ - folders.length - } folders for symlinks in ${lookupFolder} (${timeEnd - timeStart}ms)`, - ); - - return resolvedSymlinks; -}; - -function rootExists(roots, child) { - return roots.some(root => isDescendant(root, child)); -} - -function isDescendant(root, child) { - return root === child || child.startsWith(root + path.sep); -} diff --git a/local-cli/util/isPackagerRunning.js b/local-cli/util/isPackagerRunning.js deleted file mode 100644 index f8c33e584c5..00000000000 --- a/local-cli/util/isPackagerRunning.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fetch = require('node-fetch'); - -/** - * Indicates whether or not the packager is running. It returns a promise that - * when fulfilled can returns one out of these possible values: - * - `running`: the packager is running - * - `not_running`: the packager nor any process is running on the expected - * port. - * - `unrecognized`: one other process is running on the port we expect the - * packager to be running. - */ -function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || 8081) { - return fetch(`http://localhost:${packagerPort}/status`).then( - res => - res - .text() - .then( - body => - body === 'packager-status:running' ? 'running' : 'unrecognized', - ), - () => 'not_running', - ); -} - -module.exports = isPackagerRunning; diff --git a/local-cli/util/isValidPackageName.js b/local-cli/util/isValidPackageName.js deleted file mode 100644 index 45a02319cea..00000000000 --- a/local-cli/util/isValidPackageName.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -function isValidPackageName(name) { - return name.match(/^[$A-Z_][0-9A-Z_$]*$/i); -} - -module.exports = isValidPackageName; diff --git a/local-cli/util/log.js b/local-cli/util/log.js deleted file mode 100644 index e74d74f18a0..00000000000 --- a/local-cli/util/log.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -var _enabled = true; - -function disable() { - _enabled = false; -} - -function log(stream, module) { - return function() { - if (!_enabled) { - return; - } - const message = Array.prototype.slice.call(arguments).join(' '); - stream.write(module + ': ' + message + '\n'); - }; -} - -module.exports.out = log.bind(null, process.stdout); -module.exports.err = log.bind(null, process.stderr); -module.exports.disable = disable; diff --git a/local-cli/util/parseCommandLine.js b/local-cli/util/parseCommandLine.js deleted file mode 100644 index e0d58308a12..00000000000 --- a/local-cli/util/parseCommandLine.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * Wrapper on-top of `optimist` in order to properly support boolean flags - * and have a slightly less awkward API. - * - * Usage example: - * var argv = parseCommandLine([{ - * command: 'web', - * description: 'Run in a web browser instead of iOS', - * default: true - * }]) - * - * NOTE: This file is used internally at Facebook and not in `local-cli` itself. - * No changes should be made to this file without prior discussion with FB team. - * - * @format - */ - -'use strict'; - -var optimistModule = require('optimist'); - -function parseCommandLine(config, args) { - var optimist = new optimistModule(); - args = args || process.argv; - // optimist default API requires you to write the command name three time - // This is a small wrapper to accept an object instead - for (var i = 0; i < config.length; ++i) { - if (config[i].type === 'string') { - optimist.string(config[i].command); - } else { - optimist.boolean(config[i].command); - } - - optimist - .default(config[i].command, config[i].default) - .describe(config[i].command, config[i].description); - - if (config[i].required) { - optimist.demand(config[i].command); - } - } - var argv = optimist.parse(args); - - // optimist doesn't have support for --dev=false, instead it returns 'false' - for (var i = 0; i < config.length; ++i) { - var command = config[i].command; - if (argv[command] === undefined) { - argv[command] = config[i].default; - } - if (argv[command] === 'true') { - argv[command] = true; - } - if (argv[command] === 'false') { - argv[command] = false; - } - if (config[i].type === 'string') { - // According to https://github.com/substack/node-optimist#numbers, - // every argument that looks like a number should be converted to one. - var strValue = argv[command]; - var numValue = strValue ? Number(strValue) : undefined; - if (typeof numValue === 'number' && !isNaN(numValue)) { - argv[command] = numValue; - } - } - } - - // Show --help - if (argv.help || argv.h) { - optimist.showHelp(); - process.exit(); - } - - return argv; -} - -module.exports = parseCommandLine; diff --git a/local-cli/util/walk.js b/local-cli/util/walk.js deleted file mode 100644 index b7658dbb874..00000000000 --- a/local-cli/util/walk.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -function walk(current) { - if (!fs.lstatSync(current).isDirectory()) { - return [current]; - } - - const files = fs.readdirSync(current).map(child => { - child = path.join(current, child); - return walk(child); - }); - return [].concat.apply([current], files); -} - -module.exports = walk; diff --git a/local-cli/util/yarn.js b/local-cli/util/yarn.js deleted file mode 100644 index b5f73bee629..00000000000 --- a/local-cli/util/yarn.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const execSync = require('child_process').execSync; -const fs = require('fs'); -const path = require('path'); -const semver = require('semver'); - -/** - * Use Yarn if available, it's much faster than the npm client. - * Return the version of yarn installed on the system, null if yarn is not available. - */ -function getYarnVersionIfAvailable() { - let yarnVersion; - try { - // execSync returns a Buffer -> convert to string - yarnVersion = ( - execSync('yarn --version', { - stdio: [0, 'pipe', 'ignore'], - }).toString() || '' - ).trim(); - } catch (error) { - return null; - } - // yarn < 0.16 has a 'missing manifest' bug - try { - if (semver.gte(yarnVersion, '0.16.0')) { - return yarnVersion; - } else { - return null; - } - } catch (error) { - console.error('Cannot parse yarn version: ' + yarnVersion); - return null; - } -} - -/** - * Check that 'react-native init' itself used yarn to install React Native. - * When using an old global react-native-cli@1.0.0 (or older), we don't want - * to install React Native with npm, and React + Jest with yarn. - * Let's be safe and not mix yarn and npm in a single project. - * @param projectDir e.g. /Users/martin/AwesomeApp - */ -function isGlobalCliUsingYarn(projectDir) { - return fs.existsSync(path.join(projectDir, 'yarn.lock')); -} - -module.exports = { - getYarnVersionIfAvailable: getYarnVersionIfAvailable, - isGlobalCliUsingYarn: isGlobalCliUsingYarn, -}; diff --git a/local-cli/wrong-react-native.js b/local-cli/wrong-react-native.js deleted file mode 100755 index 9f7790784fa..00000000000 --- a/local-cli/wrong-react-native.js +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env node - -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const isWindows = process.platform === 'win32'; - -var installedGlobally; -if (isWindows) { - const fs = require('fs'); - const path = require('path'); - // On Windows, assume we are installed globally if we can't find a package.json above node_modules. - installedGlobally = !fs.existsSync( - path.join(__dirname, '../../../package.json'), - ); -} else { - // On non-windows, assume we are installed globally if we are called from outside of the node_mobules/.bin/react-native executable. - var script = process.argv[1]; - installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1; -} - -if (installedGlobally) { - const chalk = require('chalk'); - - console.error( - [ - chalk.red( - 'Looks like you installed react-native globally, maybe you meant react-native-cli?', - ), - chalk.red('To fix the issue, run:'), - 'npm uninstall -g react-native', - 'npm install -g react-native-cli', - ].join('\n'), - ); - process.exit(1); -} else { - require('./cli').run(); -}