From 8ef2a97c2f3f3bf092203769ac3dfe1db48b4857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 5 Mar 2019 16:58:46 +0100 Subject: [PATCH] chore: simplify cli structure and common tools (#201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: --------- Cleaning up the `packages/cli` structure. This might be pretty disruptive to already open PRs :D. - Renamed `core` -> `tools` - Moved `util` to `tools` - Flatten-out `server/util` - Create `commands` dir and put all commands there ``` packages/cli/src ├── bin.js ├── cliEntry.js ├── commands │   ├── bundle │   ├── dependencies │   ├── eject │   ├── index.js │   ├── info │   ├── init │   ├── install │   ├── library │   ├── link │   ├── logAndroid │   ├── logIOS │   ├── runAndroid │   ├── runIOS │   ├── server │   └── upgrade ├── index.js └── tools ├── ... ``` Fixes https://github.com/react-native-community/react-native-cli/issues/49 Test Plan: ---------- CI green --- packages/cli/src/__mocks__/beeper.js | 13 ---- packages/cli/src/cliEntry.js | 12 +-- .../{ => commands}/bundle/__mocks__/sign.js | 0 .../filterPlatformAssetScales-test.js | 0 .../__tests__/getAssetDestPathAndroid-test.js | 0 .../__tests__/getAssetDestPathIOS-test.js | 0 .../{ => commands}/bundle/assetPathUtils.js | 0 .../src/{ => commands}/bundle/buildBundle.js | 6 +- .../cli/src/{ => commands}/bundle/bundle.js | 0 .../bundle/bundleCommandLineArgs.js | 0 .../bundle/filterPlatformAssetScales.js | 0 .../bundle/getAssetDestPathAndroid.js | 0 .../bundle/getAssetDestPathIOS.js | 0 .../src/{ => commands}/bundle/ramBundle.js | 0 .../src/{ => commands}/bundle/saveAssets.js | 2 +- .../dependencies/dependencies.js | 0 .../cli/src/{ => commands}/eject/eject.js | 4 +- .../getCommands.js => commands/index.js} | 72 ++++++++++-------- packages/cli/src/{ => commands}/info/info.js | 2 +- packages/cli/src/{ => commands}/init/init.js | 8 +- .../cli/src/{ => commands}/install/install.js | 6 +- .../src/{ => commands}/install/uninstall.js | 6 +- .../cli/src/{ => commands}/library/library.js | 8 +- .../link/__fixtures__/Info.plist | 0 .../android/0.17/MainActivity.java | 0 .../android/0.17/patchedMainActivity.java | 0 .../android/0.18/MainActivity.java | 0 .../android/0.18/patchedMainActivity.java | 0 .../android/0.20/MainActivity.java | 0 .../link/__fixtures__/android/build.gradle | 0 .../__fixtures__/android/patchedBuild.gradle | 0 .../android/patchedSettings.gradle | 0 .../link/__fixtures__/android/settings.gradle | 0 .../link/__fixtures__/linearGradient.pbxproj | 0 .../link/__fixtures__/pods/PodfileSimple | 0 .../__fixtures__/pods/PodfileWithFunction | 0 .../link/__fixtures__/pods/PodfileWithMarkers | 0 .../link/__fixtures__/pods/PodfileWithTarget | 0 .../link/__fixtures__/project.pbxproj | 0 .../getDependencyConfig-test.js.snap | 0 .../link/__tests__/android/applyPatch-test.js | 0 .../__tests__/android/isInstalled-test.js | 0 .../__tests__/android/makeBuildPatch-test.js | 0 .../__tests__/android/makeImportPatch-test.js | 0 .../android/makePackagePatch-test.js | 0 .../android/makeSettingsPatch-test.js | 0 .../android/makeStringsPatch-test.js | 0 .../android/normalizeProjectName-test.js | 0 .../__tests__/getDependencyConfig-test.js | 2 +- .../__tests__/getProjectDependencies-test.js | 0 .../link/__tests__/groupFilesByType-test.js | 0 .../__tests__/ios/addFileToProject-test.js | 0 .../ios/addProjectToLibraries-test.js | 0 .../__tests__/ios/addSharedLibraries-test.js | 0 .../link/__tests__/ios/createGroup-test.js | 0 .../__tests__/ios/getBuildProperty-test.js | 0 .../link/__tests__/ios/getGroup-test.js | 0 .../__tests__/ios/getHeaderSearchPath-test.js | 0 .../__tests__/ios/getHeadersInFolder-test.js | 0 .../link/__tests__/ios/getPlist-test.js | 0 .../link/__tests__/ios/getPlistPath-test.js | 0 .../link/__tests__/ios/getTargets-test.js | 0 .../__tests__/ios/hasLibraryImported-test.js | 0 .../link/__tests__/ios/isInstalled-test.js | 0 .../ios/mapHeaderSearchPaths-test.js | 0 .../ios/removeProjectFromLibraries-test.js | 0 .../ios/removeProjectFromProject-test.js | 0 .../__tests__/ios/removeSharedLibrary-test.js | 0 .../link/__tests__/ios/writePlist-test.js | 0 .../link/__tests__/link-test.js | 12 +-- .../__tests__/pods/findLineToAddPod-test.js | 0 .../pods/findMarkedLinesInPodfile-test.js | 0 .../__tests__/pods/findPodTargetLine-test.js | 0 .../link/__tests__/pods/isInstalled-test.js | 0 .../__tests__/pods/removePodEntry-test.js | 0 .../link/__tests__/promiseWaterfall-test.js | 0 .../{ => commands}/link/android/copyAssets.js | 0 .../cli/src/{ => commands}/link/android/fs.js | 0 .../src/{ => commands}/link/android/index.js | 0 .../link/android/isInstalled.js | 0 .../link/android/patches/applyParams.js | 0 .../link/android/patches/applyPatch.js | 0 .../link/android/patches/makeBuildPatch.js | 0 .../link/android/patches/makeImportPatch.js | 0 .../link/android/patches/makePackagePatch.js | 0 .../link/android/patches/makeSettingsPatch.js | 0 .../link/android/patches/makeStringsPatch.js | 0 .../android/patches/normalizeProjectName.js | 0 .../link/android/patches/revokePatch.js | 0 .../link/android/registerNativeModule.js | 0 .../link/android/unlinkAssets.js | 0 .../link/android/unregisterNativeModule.js | 0 .../src/{ => commands}/link/commandStub.js | 0 .../link/getDependencyConfig.js | 10 +-- .../{ => commands}/link/getProjectConfig.js | 8 +- .../link/getProjectDependencies.js | 0 .../{ => commands}/link/groupFilesByType.js | 0 .../link/ios/addFileToProject.js | 0 .../link/ios/addProjectToLibraries.js | 0 .../link/ios/addSharedLibraries.js | 0 .../link/ios/addToHeaderSearchPaths.js | 0 .../link/ios/common/isInstalled.js | 0 .../link/ios/common/registerNativeModule.js | 0 .../link/ios/common/unregisterNativeModule.js | 0 .../src/{ => commands}/link/ios/copyAssets.js | 0 .../{ => commands}/link/ios/createGroup.js | 0 .../link/ios/createGroupWithMessage.js | 2 +- .../link/ios/getBuildProperty.js | 0 .../src/{ => commands}/link/ios/getGroup.js | 0 .../link/ios/getHeaderSearchPath.js | 0 .../link/ios/getHeadersInFolder.js | 0 .../src/{ => commands}/link/ios/getPlist.js | 0 .../{ => commands}/link/ios/getPlistPath.js | 0 .../src/{ => commands}/link/ios/getTargets.js | 0 .../link/ios/hasLibraryImported.js | 0 .../cli/src/{ => commands}/link/ios/index.js | 0 .../{ => commands}/link/ios/isInstalled.js | 0 .../link/ios/mapHeaderSearchPaths.js | 0 .../link/ios/registerNativeModule.js | 0 .../link/ios/removeFromHeaderSearchPaths.js | 0 .../removeFromPbxItemContainerProxySection.js | 0 .../ios/removeFromPbxReferenceProxySection.js | 0 .../link/ios/removeFromProjectReferences.js | 0 .../link/ios/removeFromStaticLibraries.js | 0 .../link/ios/removeProductGroup.js | 0 .../link/ios/removeProjectFromLibraries.js | 0 .../link/ios/removeProjectFromProject.js | 0 .../link/ios/removeSharedLibraries.js | 0 .../{ => commands}/link/ios/unlinkAssets.js | 2 +- .../link/ios/unregisterNativeModule.js | 0 .../src/{ => commands}/link/ios/writePlist.js | 0 packages/cli/src/{ => commands}/link/link.js | 8 +- .../cli/src/{ => commands}/link/linkAll.js | 10 ++- .../cli/src/{ => commands}/link/linkAssets.js | 4 +- .../src/{ => commands}/link/linkDependency.js | 6 +- .../{ => commands}/link/pods/addPodEntry.js | 0 .../link/pods/findLineToAddPod.js | 0 .../link/pods/findMarkedLinesInPodfile.js | 0 .../link/pods/findPodTargetLine.js | 0 .../{ => commands}/link/pods/isInstalled.js | 0 .../{ => commands}/link/pods/readPodfile.js | 0 .../link/pods/registerNativeModule.js | 0 .../link/pods/removePodEntry.js | 0 .../{ => commands}/link/pods/savePodFile.js | 0 .../link/pods/unregisterNativeModule.js | 0 .../cli/src/{ => commands}/link/pollParams.js | 0 .../{ => commands}/link/promiseWaterfall.js | 0 .../cli/src/{ => commands}/link/promisify.js | 0 .../cli/src/{ => commands}/link/unlink.js | 6 +- .../{ => commands}/logAndroid/logAndroid.js | 2 +- .../cli/src/{ => commands}/logIOS/logIOS.js | 2 +- .../__tests__/runOnAllDevices.test.js | 0 .../cli/src/{ => commands}/runAndroid/adb.js | 0 .../{ => commands}/runAndroid/getAdbPath.js | 0 .../{ => commands}/runAndroid/runAndroid.js | 6 +- .../runAndroid/runOnAllDevices.js | 2 +- .../runAndroid/tryLaunchAppOnDevice.js | 2 +- .../runAndroid/tryRunAdbReverse.js | 2 +- .../__tests__/findMatchingSimulator-test.js | 0 .../runIOS/__tests__/findXcodeProject-test.js | 0 .../__tests__/parseIOSDevicesList-test.js | 0 .../runIOS/findMatchingSimulator.js | 0 .../{ => commands}/runIOS/findXcodeProject.js | 0 .../runIOS/parseIOSDevicesList.js | 0 .../cli/src/{ => commands}/runIOS/runIOS.js | 6 +- .../server}/copyToClipBoard.js | 0 .../server}/debugger-ui/DeltaPatcher.js | 0 .../__tests__/DeltaPatcher-test.js | 0 .../server}/debugger-ui/debuggerWorker.js | 0 .../server}/debugger-ui/deltaUrlToBlobUrl.js | 0 .../server}/debugger-ui/index.html | 0 .../util => commands/server}/external/xsel | Bin .../server}/jsPackagerClient.js | 2 +- .../util => commands/server}/launchChrome.js | 2 +- .../util => commands/server}/launchEditor.js | 2 +- .../util => commands/server}/messageSocket.js | 2 +- .../server/middleware/MiddlewareManager.js | 0 .../middleware/copyToClipBoardMiddleware.js | 4 +- .../middleware/getDevToolsMiddleware.js | 4 +- .../getSecurityHeadersMiddleware.js | 0 .../server/middleware/index.html | 0 .../server/middleware/indexPage.js | 0 .../middleware/loadRawBodyMiddleware.js | 0 .../openStackFrameInEditorMiddleware.js | 2 +- .../server/middleware/statusPageMiddleware.js | 0 .../middleware/systraceProfileMiddleware.js | 2 +- .../server/middleware/unless.js | 0 .../src/{ => commands}/server/runServer.js | 8 +- .../cli/src/{ => commands}/server/server.js | 0 .../server}/webSocketProxy.js | 2 +- .../__snapshots__/upgrade.test.js.snap | 0 .../upgrade/__tests__/sample.patch | 0 .../upgrade/__tests__/upgrade.test.js | 6 +- .../cli/src/{ => commands}/upgrade/helpers.js | 0 .../{ => commands}/upgrade/legacyUpgrade.js | 6 +- .../cli/src/{ => commands}/upgrade/upgrade.js | 6 +- packages/cli/src/index.js | 2 +- .../cli/src/{util => tools}/PackageManager.js | 0 .../{core => tools}/__fixtures__/android.js | 0 .../{core => tools}/__fixtures__/commands.js | 0 .../__fixtures__/dependencies.js | 0 .../files/AndroidManifest-debug.xml | 0 .../__fixtures__/files/AndroidManifest.xml | 0 .../__fixtures__/files/Main.java | 0 .../__fixtures__/files/ReactPackage.java | 0 .../__fixtures__/files/ReactPackage.kt | 0 .../__fixtures__/files/package.json | 0 .../__fixtures__/files/project.pbxproj | 0 .../src/{core => tools}/__fixtures__/ios.js | 0 .../{core => tools}/__fixtures__/projects.js | 0 .../cli/src/{util => tools}/__mocks__/log.js | 0 .../__tests__/PackageManager-test.js | 0 .../android/findAndroidAppFolder-test.js | 0 .../__tests__/android/findManifest-test.js | 0 .../android/findPackageClassName-test.js | 0 .../android/getDependencyConfig-test.js | 0 .../android/getProjectConfig-test.js | 0 .../__tests__/android/readManifest-test.js | 0 .../__tests__/findAssets-test.js | 0 .../__tests__/findPlugins-test.js | 0 .../__tests__/findSymlinkedModules-test.js | 0 .../__tests__/ios/findPodfilePath-test.js | 0 .../__tests__/ios/findPodspecName-test.js | 0 .../__tests__/ios/findProject-test.js | 0 .../__tests__/ios/getProjectConfig-test.js | 0 .../__tests__/makeCommand-test.js | 0 .../android/findAndroidAppFolder.js | 0 .../{core => tools}/android/findManifest.js | 0 .../android/findPackageClassName.js | 0 .../cli/src/{core => tools}/android/index.js | 2 +- .../{core => tools}/android/readManifest.js | 0 .../{util => tools}/assertRequiredOptions.js | 0 .../cli/src/{util => tools}/copyAndReplace.js | 0 packages/cli/src/{util => tools}/errors.js | 0 .../cli/src/{core => tools}/findPlugins.js | 0 .../{util => tools}/findReactNativeScripts.js | 0 .../{util => tools}/findSymlinkedModules.js | 0 .../copyProjectTemplateAndReplace.js | 6 +- .../generator/printRunInstructions.js | 2 +- .../src/{ => tools}/generator/promptSync.js | 0 .../src/{ => tools}/generator/templates.js | 4 +- packages/cli/src/{core => tools}/getAssets.js | 0 packages/cli/src/{core => tools}/getHooks.js | 0 .../src/{core => tools}/getLegacyConfig.js | 0 .../getPackageConfiguration.js | 0 packages/cli/src/{core => tools}/getParams.js | 0 .../cli/src/{core => tools}/getPlatforms.js | 0 .../cli/src/{util => tools}/gracefulifyFs.js | 0 .../{core => tools}/ios/findPodfilePath.js | 0 .../{core => tools}/ios/findPodspecName.js | 0 .../src/{core => tools}/ios/findProject.js | 0 packages/cli/src/{core => tools}/ios/index.js | 2 +- .../src/{util => tools}/isPackagerRunning.js | 0 .../src/{util => tools}/isValidPackageName.js | 0 .../src/{util => tools}/loadMetroConfig.js | 6 +- packages/cli/src/{util => tools}/logger.js | 0 .../cli/src/{core => tools}/types.flow.js | 0 packages/cli/src/{util => tools}/walk.js | 0 packages/cli/src/{util => tools}/yarn.js | 0 packages/cli/testSetup.js | 2 +- 260 files changed, 153 insertions(+), 152 deletions(-) delete mode 100644 packages/cli/src/__mocks__/beeper.js rename packages/cli/src/{ => commands}/bundle/__mocks__/sign.js (100%) rename packages/cli/src/{ => commands}/bundle/__tests__/filterPlatformAssetScales-test.js (100%) rename packages/cli/src/{ => commands}/bundle/__tests__/getAssetDestPathAndroid-test.js (100%) rename packages/cli/src/{ => commands}/bundle/__tests__/getAssetDestPathIOS-test.js (100%) rename packages/cli/src/{ => commands}/bundle/assetPathUtils.js (100%) rename packages/cli/src/{ => commands}/bundle/buildBundle.js (91%) rename packages/cli/src/{ => commands}/bundle/bundle.js (100%) rename packages/cli/src/{ => commands}/bundle/bundleCommandLineArgs.js (100%) rename packages/cli/src/{ => commands}/bundle/filterPlatformAssetScales.js (100%) rename packages/cli/src/{ => commands}/bundle/getAssetDestPathAndroid.js (100%) rename packages/cli/src/{ => commands}/bundle/getAssetDestPathIOS.js (100%) rename packages/cli/src/{ => commands}/bundle/ramBundle.js (100%) rename packages/cli/src/{ => commands}/bundle/saveAssets.js (98%) rename packages/cli/src/{ => commands}/dependencies/dependencies.js (100%) rename packages/cli/src/{ => commands}/eject/eject.js (95%) rename packages/cli/src/{core/getCommands.js => commands/index.js} (56%) rename packages/cli/src/{ => commands}/info/info.js (98%) rename packages/cli/src/{ => commands}/init/init.js (92%) rename packages/cli/src/{ => commands}/install/install.js (83%) rename packages/cli/src/{ => commands}/install/uninstall.js (82%) rename packages/cli/src/{ => commands}/library/library.js (89%) rename packages/cli/src/{ => commands}/link/__fixtures__/Info.plist (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/0.17/MainActivity.java (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/0.17/patchedMainActivity.java (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/0.18/MainActivity.java (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/0.18/patchedMainActivity.java (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/0.20/MainActivity.java (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/build.gradle (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/patchedBuild.gradle (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/patchedSettings.gradle (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/android/settings.gradle (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/linearGradient.pbxproj (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/pods/PodfileSimple (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/pods/PodfileWithFunction (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/pods/PodfileWithMarkers (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/pods/PodfileWithTarget (100%) rename packages/cli/src/{ => commands}/link/__fixtures__/project.pbxproj (100%) rename packages/cli/src/{ => commands}/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/applyPatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/isInstalled-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/makeBuildPatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/makeImportPatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/makePackagePatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/makeSettingsPatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/makeStringsPatch-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/android/normalizeProjectName-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/getDependencyConfig-test.js (93%) rename packages/cli/src/{ => commands}/link/__tests__/getProjectDependencies-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/groupFilesByType-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/addFileToProject-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/addProjectToLibraries-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/addSharedLibraries-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/createGroup-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getBuildProperty-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getGroup-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getHeaderSearchPath-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getHeadersInFolder-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getPlist-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getPlistPath-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/getTargets-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/hasLibraryImported-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/isInstalled-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/mapHeaderSearchPaths-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/removeProjectFromLibraries-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/removeProjectFromProject-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/removeSharedLibrary-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/ios/writePlist-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/link-test.js (96%) rename packages/cli/src/{ => commands}/link/__tests__/pods/findLineToAddPod-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/pods/findMarkedLinesInPodfile-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/pods/findPodTargetLine-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/pods/isInstalled-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/pods/removePodEntry-test.js (100%) rename packages/cli/src/{ => commands}/link/__tests__/promiseWaterfall-test.js (100%) rename packages/cli/src/{ => commands}/link/android/copyAssets.js (100%) rename packages/cli/src/{ => commands}/link/android/fs.js (100%) rename packages/cli/src/{ => commands}/link/android/index.js (100%) rename packages/cli/src/{ => commands}/link/android/isInstalled.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/applyParams.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/applyPatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/makeBuildPatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/makeImportPatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/makePackagePatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/makeSettingsPatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/makeStringsPatch.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/normalizeProjectName.js (100%) rename packages/cli/src/{ => commands}/link/android/patches/revokePatch.js (100%) rename packages/cli/src/{ => commands}/link/android/registerNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/android/unlinkAssets.js (100%) rename packages/cli/src/{ => commands}/link/android/unregisterNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/commandStub.js (100%) rename packages/cli/src/{ => commands}/link/getDependencyConfig.js (78%) rename packages/cli/src/{ => commands}/link/getProjectConfig.js (73%) rename packages/cli/src/{ => commands}/link/getProjectDependencies.js (100%) rename packages/cli/src/{ => commands}/link/groupFilesByType.js (100%) rename packages/cli/src/{ => commands}/link/ios/addFileToProject.js (100%) rename packages/cli/src/{ => commands}/link/ios/addProjectToLibraries.js (100%) rename packages/cli/src/{ => commands}/link/ios/addSharedLibraries.js (100%) rename packages/cli/src/{ => commands}/link/ios/addToHeaderSearchPaths.js (100%) rename packages/cli/src/{ => commands}/link/ios/common/isInstalled.js (100%) rename packages/cli/src/{ => commands}/link/ios/common/registerNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/ios/common/unregisterNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/ios/copyAssets.js (100%) rename packages/cli/src/{ => commands}/link/ios/createGroup.js (100%) rename packages/cli/src/{ => commands}/link/ios/createGroupWithMessage.js (95%) rename packages/cli/src/{ => commands}/link/ios/getBuildProperty.js (100%) rename packages/cli/src/{ => commands}/link/ios/getGroup.js (100%) rename packages/cli/src/{ => commands}/link/ios/getHeaderSearchPath.js (100%) rename packages/cli/src/{ => commands}/link/ios/getHeadersInFolder.js (100%) rename packages/cli/src/{ => commands}/link/ios/getPlist.js (100%) rename packages/cli/src/{ => commands}/link/ios/getPlistPath.js (100%) rename packages/cli/src/{ => commands}/link/ios/getTargets.js (100%) rename packages/cli/src/{ => commands}/link/ios/hasLibraryImported.js (100%) rename packages/cli/src/{ => commands}/link/ios/index.js (100%) rename packages/cli/src/{ => commands}/link/ios/isInstalled.js (100%) rename packages/cli/src/{ => commands}/link/ios/mapHeaderSearchPaths.js (100%) rename packages/cli/src/{ => commands}/link/ios/registerNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeFromHeaderSearchPaths.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeFromPbxItemContainerProxySection.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeFromPbxReferenceProxySection.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeFromProjectReferences.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeFromStaticLibraries.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeProductGroup.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeProjectFromLibraries.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeProjectFromProject.js (100%) rename packages/cli/src/{ => commands}/link/ios/removeSharedLibraries.js (100%) rename packages/cli/src/{ => commands}/link/ios/unlinkAssets.js (97%) rename packages/cli/src/{ => commands}/link/ios/unregisterNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/ios/writePlist.js (100%) rename packages/cli/src/{ => commands}/link/link.js (93%) rename packages/cli/src/{ => commands}/link/linkAll.js (91%) rename packages/cli/src/{ => commands}/link/linkAssets.js (86%) rename packages/cli/src/{ => commands}/link/linkDependency.js (91%) rename packages/cli/src/{ => commands}/link/pods/addPodEntry.js (100%) rename packages/cli/src/{ => commands}/link/pods/findLineToAddPod.js (100%) rename packages/cli/src/{ => commands}/link/pods/findMarkedLinesInPodfile.js (100%) rename packages/cli/src/{ => commands}/link/pods/findPodTargetLine.js (100%) rename packages/cli/src/{ => commands}/link/pods/isInstalled.js (100%) rename packages/cli/src/{ => commands}/link/pods/readPodfile.js (100%) rename packages/cli/src/{ => commands}/link/pods/registerNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/pods/removePodEntry.js (100%) rename packages/cli/src/{ => commands}/link/pods/savePodFile.js (100%) rename packages/cli/src/{ => commands}/link/pods/unregisterNativeModule.js (100%) rename packages/cli/src/{ => commands}/link/pollParams.js (100%) rename packages/cli/src/{ => commands}/link/promiseWaterfall.js (100%) rename packages/cli/src/{ => commands}/link/promisify.js (100%) rename packages/cli/src/{ => commands}/link/unlink.js (96%) rename packages/cli/src/{ => commands}/logAndroid/logAndroid.js (94%) rename packages/cli/src/{ => commands}/logIOS/logIOS.js (97%) rename packages/cli/src/{ => commands}/runAndroid/__tests__/runOnAllDevices.test.js (100%) rename packages/cli/src/{ => commands}/runAndroid/adb.js (100%) rename packages/cli/src/{ => commands}/runAndroid/getAdbPath.js (100%) rename packages/cli/src/{ => commands}/runAndroid/runAndroid.js (98%) rename packages/cli/src/{ => commands}/runAndroid/runOnAllDevices.js (98%) rename packages/cli/src/{ => commands}/runAndroid/tryLaunchAppOnDevice.js (95%) rename packages/cli/src/{ => commands}/runAndroid/tryRunAdbReverse.js (95%) rename packages/cli/src/{ => commands}/runIOS/__tests__/findMatchingSimulator-test.js (100%) rename packages/cli/src/{ => commands}/runIOS/__tests__/findXcodeProject-test.js (100%) rename packages/cli/src/{ => commands}/runIOS/__tests__/parseIOSDevicesList-test.js (100%) rename packages/cli/src/{ => commands}/runIOS/findMatchingSimulator.js (100%) rename packages/cli/src/{ => commands}/runIOS/findXcodeProject.js (100%) rename packages/cli/src/{ => commands}/runIOS/parseIOSDevicesList.js (100%) rename packages/cli/src/{ => commands}/runIOS/runIOS.js (98%) rename packages/cli/src/{server/util => commands/server}/copyToClipBoard.js (100%) rename packages/cli/src/{server/util => commands/server}/debugger-ui/DeltaPatcher.js (100%) rename packages/cli/src/{server/util => commands/server}/debugger-ui/__tests__/DeltaPatcher-test.js (100%) rename packages/cli/src/{server/util => commands/server}/debugger-ui/debuggerWorker.js (100%) rename packages/cli/src/{server/util => commands/server}/debugger-ui/deltaUrlToBlobUrl.js (100%) rename packages/cli/src/{server/util => commands/server}/debugger-ui/index.html (100%) rename packages/cli/src/{server/util => commands/server}/external/xsel (100%) rename packages/cli/src/{server/util => commands/server}/jsPackagerClient.js (98%) rename packages/cli/src/{server/util => commands/server}/launchChrome.js (96%) rename packages/cli/src/{server/util => commands/server}/launchEditor.js (99%) rename packages/cli/src/{server/util => commands/server}/messageSocket.js (99%) rename packages/cli/src/{ => commands}/server/middleware/MiddlewareManager.js (100%) rename packages/cli/src/{ => commands}/server/middleware/copyToClipBoardMiddleware.js (86%) rename packages/cli/src/{ => commands}/server/middleware/getDevToolsMiddleware.js (95%) rename packages/cli/src/{ => commands}/server/middleware/getSecurityHeadersMiddleware.js (100%) rename packages/cli/src/{ => commands}/server/middleware/index.html (100%) rename packages/cli/src/{ => commands}/server/middleware/indexPage.js (100%) rename packages/cli/src/{ => commands}/server/middleware/loadRawBodyMiddleware.js (100%) rename packages/cli/src/{ => commands}/server/middleware/openStackFrameInEditorMiddleware.js (91%) rename packages/cli/src/{ => commands}/server/middleware/statusPageMiddleware.js (100%) rename packages/cli/src/{ => commands}/server/middleware/systraceProfileMiddleware.js (95%) rename packages/cli/src/{ => commands}/server/middleware/unless.js (100%) rename packages/cli/src/{ => commands}/server/runServer.js (94%) rename packages/cli/src/{ => commands}/server/server.js (100%) rename packages/cli/src/{server/util => commands/server}/webSocketProxy.js (98%) rename packages/cli/src/{ => commands}/upgrade/__tests__/__snapshots__/upgrade.test.js.snap (100%) rename packages/cli/src/{ => commands}/upgrade/__tests__/sample.patch (100%) rename packages/cli/src/{ => commands}/upgrade/__tests__/upgrade.test.js (98%) rename packages/cli/src/{ => commands}/upgrade/helpers.js (100%) rename packages/cli/src/{ => commands}/upgrade/legacyUpgrade.js (95%) rename packages/cli/src/{ => commands}/upgrade/upgrade.js (98%) rename packages/cli/src/{util => tools}/PackageManager.js (100%) rename packages/cli/src/{core => tools}/__fixtures__/android.js (100%) rename packages/cli/src/{core => tools}/__fixtures__/commands.js (100%) rename packages/cli/src/{core => tools}/__fixtures__/dependencies.js (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/AndroidManifest-debug.xml (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/AndroidManifest.xml (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/Main.java (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/ReactPackage.java (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/ReactPackage.kt (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/package.json (100%) rename packages/cli/src/{core => tools}/__fixtures__/files/project.pbxproj (100%) rename packages/cli/src/{core => tools}/__fixtures__/ios.js (100%) rename packages/cli/src/{core => tools}/__fixtures__/projects.js (100%) rename packages/cli/src/{util => tools}/__mocks__/log.js (100%) rename packages/cli/src/{util => tools}/__tests__/PackageManager-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/findAndroidAppFolder-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/findManifest-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/findPackageClassName-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/getDependencyConfig-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/getProjectConfig-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/android/readManifest-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/findAssets-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/findPlugins-test.js (100%) rename packages/cli/src/{util => tools}/__tests__/findSymlinkedModules-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/ios/findPodfilePath-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/ios/findPodspecName-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/ios/findProject-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/ios/getProjectConfig-test.js (100%) rename packages/cli/src/{core => tools}/__tests__/makeCommand-test.js (100%) rename packages/cli/src/{core => tools}/android/findAndroidAppFolder.js (100%) rename packages/cli/src/{core => tools}/android/findManifest.js (100%) rename packages/cli/src/{core => tools}/android/findPackageClassName.js (100%) rename packages/cli/src/{core => tools}/android/index.js (98%) rename packages/cli/src/{core => tools}/android/readManifest.js (100%) rename packages/cli/src/{util => tools}/assertRequiredOptions.js (100%) rename packages/cli/src/{util => tools}/copyAndReplace.js (100%) rename packages/cli/src/{util => tools}/errors.js (100%) rename packages/cli/src/{core => tools}/findPlugins.js (100%) rename packages/cli/src/{util => tools}/findReactNativeScripts.js (100%) rename packages/cli/src/{util => tools}/findSymlinkedModules.js (100%) rename packages/cli/src/{ => tools}/generator/copyProjectTemplateAndReplace.js (97%) rename packages/cli/src/{ => tools}/generator/printRunInstructions.js (96%) rename packages/cli/src/{ => tools}/generator/promptSync.js (100%) rename packages/cli/src/{ => tools}/generator/templates.js (98%) rename packages/cli/src/{core => tools}/getAssets.js (100%) rename packages/cli/src/{core => tools}/getHooks.js (100%) rename packages/cli/src/{core => tools}/getLegacyConfig.js (100%) rename packages/cli/src/{core => tools}/getPackageConfiguration.js (100%) rename packages/cli/src/{core => tools}/getParams.js (100%) rename packages/cli/src/{core => tools}/getPlatforms.js (100%) rename packages/cli/src/{util => tools}/gracefulifyFs.js (100%) rename packages/cli/src/{core => tools}/ios/findPodfilePath.js (100%) rename packages/cli/src/{core => tools}/ios/findPodspecName.js (100%) rename packages/cli/src/{core => tools}/ios/findProject.js (100%) rename packages/cli/src/{core => tools}/ios/index.js (96%) rename packages/cli/src/{util => tools}/isPackagerRunning.js (100%) rename packages/cli/src/{util => tools}/isValidPackageName.js (100%) rename packages/cli/src/{util => tools}/loadMetroConfig.js (93%) rename packages/cli/src/{util => tools}/logger.js (100%) rename packages/cli/src/{core => tools}/types.flow.js (100%) rename packages/cli/src/{util => tools}/walk.js (100%) rename packages/cli/src/{util => tools}/yarn.js (100%) diff --git a/packages/cli/src/__mocks__/beeper.js b/packages/cli/src/__mocks__/beeper.js deleted file mode 100644 index f2d46e51f..000000000 --- a/packages/cli/src/__mocks__/beeper.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 - */ - -// 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 beeper() {}; diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index dc0708893..8e8efe5ca 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -12,12 +12,12 @@ import childProcess from 'child_process'; import commander from 'commander'; import minimist from 'minimist'; import path from 'path'; -import type { CommandT, ContextT } from './core/types.flow'; -import getCommands from './core/getCommands'; -import getLegacyConfig from './core/getLegacyConfig'; -import init from './init/init'; -import assertRequiredOptions from './util/assertRequiredOptions'; -import logger from './util/logger'; +import type { CommandT, ContextT } from './tools/types.flow'; +import getLegacyConfig from './tools/getLegacyConfig'; +import { getCommands } from './commands'; +import init from './commands/init/init'; +import assertRequiredOptions from './tools/assertRequiredOptions'; +import logger from './tools/logger'; import pkg from '../package.json'; commander diff --git a/packages/cli/src/bundle/__mocks__/sign.js b/packages/cli/src/commands/bundle/__mocks__/sign.js similarity index 100% rename from packages/cli/src/bundle/__mocks__/sign.js rename to packages/cli/src/commands/bundle/__mocks__/sign.js diff --git a/packages/cli/src/bundle/__tests__/filterPlatformAssetScales-test.js b/packages/cli/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js similarity index 100% rename from packages/cli/src/bundle/__tests__/filterPlatformAssetScales-test.js rename to packages/cli/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js diff --git a/packages/cli/src/bundle/__tests__/getAssetDestPathAndroid-test.js b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js similarity index 100% rename from packages/cli/src/bundle/__tests__/getAssetDestPathAndroid-test.js rename to packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js diff --git a/packages/cli/src/bundle/__tests__/getAssetDestPathIOS-test.js b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js similarity index 100% rename from packages/cli/src/bundle/__tests__/getAssetDestPathIOS-test.js rename to packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js diff --git a/packages/cli/src/bundle/assetPathUtils.js b/packages/cli/src/commands/bundle/assetPathUtils.js similarity index 100% rename from packages/cli/src/bundle/assetPathUtils.js rename to packages/cli/src/commands/bundle/assetPathUtils.js diff --git a/packages/cli/src/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js similarity index 91% rename from packages/cli/src/bundle/buildBundle.js rename to packages/cli/src/commands/bundle/buildBundle.js index d0a8d0e68..a10dc2457 100644 --- a/packages/cli/src/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -12,10 +12,10 @@ import Server from 'metro/src/Server'; import outputBundle from 'metro/src/shared/output/bundle'; import path from 'path'; import type { CommandLineArgs } from './bundleCommandLineArgs'; -import type { ContextT } from '../core/types.flow'; +import type { ContextT } from '../../tools/types.flow'; import saveAssets from './saveAssets'; -import loadMetroConfig from '../util/loadMetroConfig'; -import logger from '../util/logger'; +import loadMetroConfig from '../../tools/loadMetroConfig'; +import logger from '../../tools/logger'; async function buildBundle( args: CommandLineArgs, diff --git a/packages/cli/src/bundle/bundle.js b/packages/cli/src/commands/bundle/bundle.js similarity index 100% rename from packages/cli/src/bundle/bundle.js rename to packages/cli/src/commands/bundle/bundle.js diff --git a/packages/cli/src/bundle/bundleCommandLineArgs.js b/packages/cli/src/commands/bundle/bundleCommandLineArgs.js similarity index 100% rename from packages/cli/src/bundle/bundleCommandLineArgs.js rename to packages/cli/src/commands/bundle/bundleCommandLineArgs.js diff --git a/packages/cli/src/bundle/filterPlatformAssetScales.js b/packages/cli/src/commands/bundle/filterPlatformAssetScales.js similarity index 100% rename from packages/cli/src/bundle/filterPlatformAssetScales.js rename to packages/cli/src/commands/bundle/filterPlatformAssetScales.js diff --git a/packages/cli/src/bundle/getAssetDestPathAndroid.js b/packages/cli/src/commands/bundle/getAssetDestPathAndroid.js similarity index 100% rename from packages/cli/src/bundle/getAssetDestPathAndroid.js rename to packages/cli/src/commands/bundle/getAssetDestPathAndroid.js diff --git a/packages/cli/src/bundle/getAssetDestPathIOS.js b/packages/cli/src/commands/bundle/getAssetDestPathIOS.js similarity index 100% rename from packages/cli/src/bundle/getAssetDestPathIOS.js rename to packages/cli/src/commands/bundle/getAssetDestPathIOS.js diff --git a/packages/cli/src/bundle/ramBundle.js b/packages/cli/src/commands/bundle/ramBundle.js similarity index 100% rename from packages/cli/src/bundle/ramBundle.js rename to packages/cli/src/commands/bundle/ramBundle.js diff --git a/packages/cli/src/bundle/saveAssets.js b/packages/cli/src/commands/bundle/saveAssets.js similarity index 98% rename from packages/cli/src/bundle/saveAssets.js rename to packages/cli/src/commands/bundle/saveAssets.js index febc21ded..c98bbb315 100644 --- a/packages/cli/src/bundle/saveAssets.js +++ b/packages/cli/src/commands/bundle/saveAssets.js @@ -14,7 +14,7 @@ import fs from 'fs'; import filterPlatformAssetScales from './filterPlatformAssetScales'; import getAssetDestPathAndroid from './getAssetDestPathAndroid'; import getAssetDestPathIOS from './getAssetDestPathIOS'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; function saveAssets(assets, platform, assetsDest) { if (!assetsDest) { diff --git a/packages/cli/src/dependencies/dependencies.js b/packages/cli/src/commands/dependencies/dependencies.js similarity index 100% rename from packages/cli/src/dependencies/dependencies.js rename to packages/cli/src/commands/dependencies/dependencies.js diff --git a/packages/cli/src/eject/eject.js b/packages/cli/src/commands/eject/eject.js similarity index 95% rename from packages/cli/src/eject/eject.js rename to packages/cli/src/commands/eject/eject.js index e38b7b77c..c8c970eb6 100644 --- a/packages/cli/src/eject/eject.js +++ b/packages/cli/src/commands/eject/eject.js @@ -9,8 +9,8 @@ import path from 'path'; import fs from 'fs'; -import copyProjectTemplateAndReplace from '../generator/copyProjectTemplateAndReplace'; -import logger from '../util/logger'; +import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; +import logger from '../../tools/logger'; /** * The eject command re-creates the `android` and `ios` native folders. Because native code can be diff --git a/packages/cli/src/core/getCommands.js b/packages/cli/src/commands/index.js similarity index 56% rename from packages/cli/src/core/getCommands.js rename to packages/cli/src/commands/index.js index 4bb7768ee..bab984b73 100644 --- a/packages/cli/src/core/getCommands.js +++ b/packages/cli/src/commands/index.js @@ -4,27 +4,31 @@ import path from 'path'; -import findPlugins from './findPlugins'; -import logger from '../util/logger'; +import findPlugins from '../tools/findPlugins'; +import logger from '../tools/logger'; -import type { CommandT, ProjectCommandT, LocalCommandT } from './types.flow'; +import type { + CommandT, + ProjectCommandT, + LocalCommandT, +} from '../tools/types.flow'; -import server from '../server/server'; -import runIOS from '../runIOS/runIOS'; -import runAndroid from '../runAndroid/runAndroid'; -import library from '../library/library'; -import bundle from '../bundle/bundle'; -import ramBundle from '../bundle/ramBundle'; -import eject from '../eject/eject'; -import link from '../link/link'; -import unlink from '../link/unlink'; -import install from '../install/install'; -import uninstall from '../install/uninstall'; -import upgrade from '../upgrade/upgrade'; -import logAndroid from '../logAndroid/logAndroid'; -import logIOS from '../logIOS/logIOS'; -import dependencies from '../dependencies/dependencies'; -import info from '../info/info'; +import server from './server/server'; +import runIOS from './runIOS/runIOS'; +import runAndroid from './runAndroid/runAndroid'; +import library from './library/library'; +import bundle from './bundle/bundle'; +import ramBundle from './bundle/ramBundle'; +import eject from './eject/eject'; +import link from './link/link'; +import unlink from './link/unlink'; +import install from './install/install'; +import uninstall from './install/uninstall'; +import upgrade from './upgrade/upgrade'; +import logAndroid from './logAndroid/logAndroid'; +import logIOS from './logIOS/logIOS'; +import dependencies from './dependencies/dependencies'; +import info from './info/info'; /** * List of built-in commands @@ -97,18 +101,20 @@ const loadProjectCommands = (root: string): Array => { /** * Loads all the commands inside a given `root` folder */ -export default (root: string): Array => [ - ...loadLocalCommands, - { - name: 'init', - func: () => { - logger.warn( - [ - 'Looks like a React Native project already exists in the current', - 'folder. Run this command from a different folder or remove node_modules/react-native', - ].join('\n') - ); +export function getCommands(root: string): Array { + return [ + ...loadLocalCommands, + { + name: 'init', + func: () => { + logger.warn( + [ + 'Looks like a React Native project already exists in the current', + 'folder. Run this command from a different folder or remove node_modules/react-native', + ].join('\n') + ); + }, }, - }, - ...loadProjectCommands(root), -]; + ...loadProjectCommands(root), + ]; +} diff --git a/packages/cli/src/info/info.js b/packages/cli/src/commands/info/info.js similarity index 98% rename from packages/cli/src/info/info.js rename to packages/cli/src/commands/info/info.js index a1f0f4d26..9b6bffaca 100644 --- a/packages/cli/src/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -8,7 +8,7 @@ */ import envinfo from 'envinfo'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; const info = function getInfo(argv, ctx, options) { try { diff --git a/packages/cli/src/init/init.js b/packages/cli/src/commands/init/init.js similarity index 92% rename from packages/cli/src/init/init.js rename to packages/cli/src/commands/init/init.js index 3c7a3968b..c904c4d09 100644 --- a/packages/cli/src/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -11,10 +11,10 @@ import fs from 'fs'; import minimist from 'minimist'; import path from 'path'; import process from 'process'; -import printRunInstructions from '../generator/printRunInstructions'; -import { createProjectFromTemplate } from '../generator/templates'; -import PackageManager from '../util/PackageManager'; -import logger from '../util/logger'; +import printRunInstructions from '../../tools/generator/printRunInstructions'; +import { createProjectFromTemplate } from '../../tools/generator/templates'; +import PackageManager from '../../tools/PackageManager'; +import logger from '../../tools/logger'; /** * Creates the template for a React Native project given the provided diff --git a/packages/cli/src/install/install.js b/packages/cli/src/commands/install/install.js similarity index 83% rename from packages/cli/src/install/install.js rename to packages/cli/src/commands/install/install.js index 3c0e41444..ce575841e 100644 --- a/packages/cli/src/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -7,9 +7,9 @@ * @flow */ -import type { ContextT } from '../core/types.flow'; -import logger from '../util/logger'; -import PackageManager from '../util/PackageManager'; +import type { ContextT } from '../../tools/types.flow'; +import logger from '../../tools/logger'; +import PackageManager from '../../tools/PackageManager'; import link from '../link/link'; async function install(args: Array, ctx: ContextT) { diff --git a/packages/cli/src/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js similarity index 82% rename from packages/cli/src/install/uninstall.js rename to packages/cli/src/commands/install/uninstall.js index 196611379..fb10f4754 100644 --- a/packages/cli/src/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -7,9 +7,9 @@ * @flow */ -import type { ContextT } from '../core/types.flow'; -import logger from '../util/logger'; -import PackageManager from '../util/PackageManager'; +import type { ContextT } from '../../tools/types.flow'; +import logger from '../../tools/logger'; +import PackageManager from '../../tools/PackageManager'; import link from '../link/unlink'; async function uninstall(args: Array, ctx: ContextT) { diff --git a/packages/cli/src/library/library.js b/packages/cli/src/commands/library/library.js similarity index 89% rename from packages/cli/src/library/library.js rename to packages/cli/src/commands/library/library.js index 55851567b..f98978f00 100644 --- a/packages/cli/src/library/library.js +++ b/packages/cli/src/commands/library/library.js @@ -9,10 +9,10 @@ import fs from 'fs'; import path from 'path'; -import copyAndReplace from '../util/copyAndReplace'; -import isValidPackageName from '../util/isValidPackageName'; -import walk from '../util/walk'; -import logger from '../util/logger'; +import copyAndReplace from '../../tools/copyAndReplace'; +import isValidPackageName from '../../tools/isValidPackageName'; +import walk from '../../tools/walk'; +import logger from '../../tools/logger'; /** * Creates a new native library with the given name diff --git a/packages/cli/src/link/__fixtures__/Info.plist b/packages/cli/src/commands/link/__fixtures__/Info.plist similarity index 100% rename from packages/cli/src/link/__fixtures__/Info.plist rename to packages/cli/src/commands/link/__fixtures__/Info.plist diff --git a/packages/cli/src/link/__fixtures__/android/0.17/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java similarity index 100% rename from packages/cli/src/link/__fixtures__/android/0.17/MainActivity.java rename to packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java diff --git a/packages/cli/src/link/__fixtures__/android/0.17/patchedMainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java similarity index 100% rename from packages/cli/src/link/__fixtures__/android/0.17/patchedMainActivity.java rename to packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java diff --git a/packages/cli/src/link/__fixtures__/android/0.18/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java similarity index 100% rename from packages/cli/src/link/__fixtures__/android/0.18/MainActivity.java rename to packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java diff --git a/packages/cli/src/link/__fixtures__/android/0.18/patchedMainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java similarity index 100% rename from packages/cli/src/link/__fixtures__/android/0.18/patchedMainActivity.java rename to packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java diff --git a/packages/cli/src/link/__fixtures__/android/0.20/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java similarity index 100% rename from packages/cli/src/link/__fixtures__/android/0.20/MainActivity.java rename to packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java diff --git a/packages/cli/src/link/__fixtures__/android/build.gradle b/packages/cli/src/commands/link/__fixtures__/android/build.gradle similarity index 100% rename from packages/cli/src/link/__fixtures__/android/build.gradle rename to packages/cli/src/commands/link/__fixtures__/android/build.gradle diff --git a/packages/cli/src/link/__fixtures__/android/patchedBuild.gradle b/packages/cli/src/commands/link/__fixtures__/android/patchedBuild.gradle similarity index 100% rename from packages/cli/src/link/__fixtures__/android/patchedBuild.gradle rename to packages/cli/src/commands/link/__fixtures__/android/patchedBuild.gradle diff --git a/packages/cli/src/link/__fixtures__/android/patchedSettings.gradle b/packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle similarity index 100% rename from packages/cli/src/link/__fixtures__/android/patchedSettings.gradle rename to packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle diff --git a/packages/cli/src/link/__fixtures__/android/settings.gradle b/packages/cli/src/commands/link/__fixtures__/android/settings.gradle similarity index 100% rename from packages/cli/src/link/__fixtures__/android/settings.gradle rename to packages/cli/src/commands/link/__fixtures__/android/settings.gradle diff --git a/packages/cli/src/link/__fixtures__/linearGradient.pbxproj b/packages/cli/src/commands/link/__fixtures__/linearGradient.pbxproj similarity index 100% rename from packages/cli/src/link/__fixtures__/linearGradient.pbxproj rename to packages/cli/src/commands/link/__fixtures__/linearGradient.pbxproj diff --git a/packages/cli/src/link/__fixtures__/pods/PodfileSimple b/packages/cli/src/commands/link/__fixtures__/pods/PodfileSimple similarity index 100% rename from packages/cli/src/link/__fixtures__/pods/PodfileSimple rename to packages/cli/src/commands/link/__fixtures__/pods/PodfileSimple diff --git a/packages/cli/src/link/__fixtures__/pods/PodfileWithFunction b/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithFunction similarity index 100% rename from packages/cli/src/link/__fixtures__/pods/PodfileWithFunction rename to packages/cli/src/commands/link/__fixtures__/pods/PodfileWithFunction diff --git a/packages/cli/src/link/__fixtures__/pods/PodfileWithMarkers b/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithMarkers similarity index 100% rename from packages/cli/src/link/__fixtures__/pods/PodfileWithMarkers rename to packages/cli/src/commands/link/__fixtures__/pods/PodfileWithMarkers diff --git a/packages/cli/src/link/__fixtures__/pods/PodfileWithTarget b/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithTarget similarity index 100% rename from packages/cli/src/link/__fixtures__/pods/PodfileWithTarget rename to packages/cli/src/commands/link/__fixtures__/pods/PodfileWithTarget diff --git a/packages/cli/src/link/__fixtures__/project.pbxproj b/packages/cli/src/commands/link/__fixtures__/project.pbxproj similarity index 100% rename from packages/cli/src/link/__fixtures__/project.pbxproj rename to packages/cli/src/commands/link/__fixtures__/project.pbxproj diff --git a/packages/cli/src/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap b/packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap similarity index 100% rename from packages/cli/src/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap rename to packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap diff --git a/packages/cli/src/link/__tests__/android/applyPatch-test.js b/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/applyPatch-test.js rename to packages/cli/src/commands/link/__tests__/android/applyPatch-test.js diff --git a/packages/cli/src/link/__tests__/android/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/isInstalled-test.js rename to packages/cli/src/commands/link/__tests__/android/isInstalled-test.js diff --git a/packages/cli/src/link/__tests__/android/makeBuildPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/makeBuildPatch-test.js rename to packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js diff --git a/packages/cli/src/link/__tests__/android/makeImportPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/makeImportPatch-test.js rename to packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js diff --git a/packages/cli/src/link/__tests__/android/makePackagePatch-test.js b/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/makePackagePatch-test.js rename to packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js diff --git a/packages/cli/src/link/__tests__/android/makeSettingsPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/makeSettingsPatch-test.js rename to packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js diff --git a/packages/cli/src/link/__tests__/android/makeStringsPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/makeStringsPatch-test.js rename to packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js diff --git a/packages/cli/src/link/__tests__/android/normalizeProjectName-test.js b/packages/cli/src/commands/link/__tests__/android/normalizeProjectName-test.js similarity index 100% rename from packages/cli/src/link/__tests__/android/normalizeProjectName-test.js rename to packages/cli/src/commands/link/__tests__/android/normalizeProjectName-test.js diff --git a/packages/cli/src/link/__tests__/getDependencyConfig-test.js b/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js similarity index 93% rename from packages/cli/src/link/__tests__/getDependencyConfig-test.js rename to packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js index 6efc7a1da..26f8eb4c1 100644 --- a/packages/cli/src/link/__tests__/getDependencyConfig-test.js +++ b/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js @@ -17,7 +17,7 @@ const platforms = { }, }; -jest.setMock('../../core/getPackageConfiguration', folder => { +jest.setMock('../../../tools/getPackageConfiguration', folder => { if (folder === '/root/node_modules/abcd') { throw new Error('Cannot require'); } diff --git a/packages/cli/src/link/__tests__/getProjectDependencies-test.js b/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js similarity index 100% rename from packages/cli/src/link/__tests__/getProjectDependencies-test.js rename to packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js diff --git a/packages/cli/src/link/__tests__/groupFilesByType-test.js b/packages/cli/src/commands/link/__tests__/groupFilesByType-test.js similarity index 100% rename from packages/cli/src/link/__tests__/groupFilesByType-test.js rename to packages/cli/src/commands/link/__tests__/groupFilesByType-test.js diff --git a/packages/cli/src/link/__tests__/ios/addFileToProject-test.js b/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/addFileToProject-test.js rename to packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js diff --git a/packages/cli/src/link/__tests__/ios/addProjectToLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/addProjectToLibraries-test.js rename to packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js diff --git a/packages/cli/src/link/__tests__/ios/addSharedLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/addSharedLibraries-test.js rename to packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js diff --git a/packages/cli/src/link/__tests__/ios/createGroup-test.js b/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/createGroup-test.js rename to packages/cli/src/commands/link/__tests__/ios/createGroup-test.js diff --git a/packages/cli/src/link/__tests__/ios/getBuildProperty-test.js b/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getBuildProperty-test.js rename to packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js diff --git a/packages/cli/src/link/__tests__/ios/getGroup-test.js b/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getGroup-test.js rename to packages/cli/src/commands/link/__tests__/ios/getGroup-test.js diff --git a/packages/cli/src/link/__tests__/ios/getHeaderSearchPath-test.js b/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getHeaderSearchPath-test.js rename to packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js diff --git a/packages/cli/src/link/__tests__/ios/getHeadersInFolder-test.js b/packages/cli/src/commands/link/__tests__/ios/getHeadersInFolder-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getHeadersInFolder-test.js rename to packages/cli/src/commands/link/__tests__/ios/getHeadersInFolder-test.js diff --git a/packages/cli/src/link/__tests__/ios/getPlist-test.js b/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getPlist-test.js rename to packages/cli/src/commands/link/__tests__/ios/getPlist-test.js diff --git a/packages/cli/src/link/__tests__/ios/getPlistPath-test.js b/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getPlistPath-test.js rename to packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js diff --git a/packages/cli/src/link/__tests__/ios/getTargets-test.js b/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/getTargets-test.js rename to packages/cli/src/commands/link/__tests__/ios/getTargets-test.js diff --git a/packages/cli/src/link/__tests__/ios/hasLibraryImported-test.js b/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/hasLibraryImported-test.js rename to packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js diff --git a/packages/cli/src/link/__tests__/ios/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/isInstalled-test.js rename to packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js diff --git a/packages/cli/src/link/__tests__/ios/mapHeaderSearchPaths-test.js b/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/mapHeaderSearchPaths-test.js rename to packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js diff --git a/packages/cli/src/link/__tests__/ios/removeProjectFromLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/removeProjectFromLibraries-test.js rename to packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js diff --git a/packages/cli/src/link/__tests__/ios/removeProjectFromProject-test.js b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/removeProjectFromProject-test.js rename to packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js diff --git a/packages/cli/src/link/__tests__/ios/removeSharedLibrary-test.js b/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/removeSharedLibrary-test.js rename to packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js diff --git a/packages/cli/src/link/__tests__/ios/writePlist-test.js b/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js similarity index 100% rename from packages/cli/src/link/__tests__/ios/writePlist-test.js rename to packages/cli/src/commands/link/__tests__/ios/writePlist-test.js diff --git a/packages/cli/src/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js similarity index 96% rename from packages/cli/src/link/__tests__/link-test.js rename to packages/cli/src/commands/link/__tests__/link-test.js index 8e43b777e..d8f2560dc 100644 --- a/packages/cli/src/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -9,7 +9,7 @@ */ jest.mock('chalk', () => ({ grey: str => str })); -jest.mock('../../util/logger'); +jest.mock('../../../tools/logger'); const context = { root: process.cwd(), @@ -145,7 +145,7 @@ describe('link', () => { ); jest.doMock('../ios/registerNativeModule.js', () => jest.fn()); - jest.doMock('../../core/getAssets', () => projectAssets); + jest.doMock('../../../tools/getAssets', () => projectAssets); const copyAssets = jest.fn(); @@ -157,7 +157,7 @@ describe('link', () => { link(['react-native-blur'], context, {}).then(() => { expect(copyAssets.mock.calls).toHaveLength(2); expect(copyAssets.mock.calls[0][0]).toEqual(dependencyAssets); - jest.unmock('../../core/getAssets'); + jest.unmock('../../../tools/getAssets'); done(); }); }); @@ -224,7 +224,7 @@ describe('link', () => { commands: {}, })); - jest.doMock('../../core/getPlatforms', () => { + jest.doMock('../../../tools/getPlatforms', () => { const fn = () => ({ ios: { linkConfig: require('../ios').default }, android: { linkConfig: require('../android').default }, @@ -256,7 +256,7 @@ describe('link', () => { it('should link only for specific platforms if --platforms is used', async () => { jest.doMock('../getProjectDependencies', () => () => ['react-native-maps']); - jest.doMock('../../core/getPackageConfiguration', () => () => ({ + jest.doMock('../../../tools/getPackageConfiguration', () => () => ({ assets: [], })); @@ -273,7 +273,7 @@ describe('link', () => { register: registerIOSNativeModule, }); - jest.doMock('../../core/getPlatforms', () => { + jest.doMock('../../../tools/getPlatforms', () => { const fn = () => ({ android: { linkConfig: genericAndroidLinkConfig }, ios: { linkConfig: genericIOSLinkConfig }, diff --git a/packages/cli/src/link/__tests__/pods/findLineToAddPod-test.js b/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js similarity index 100% rename from packages/cli/src/link/__tests__/pods/findLineToAddPod-test.js rename to packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js diff --git a/packages/cli/src/link/__tests__/pods/findMarkedLinesInPodfile-test.js b/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js similarity index 100% rename from packages/cli/src/link/__tests__/pods/findMarkedLinesInPodfile-test.js rename to packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js diff --git a/packages/cli/src/link/__tests__/pods/findPodTargetLine-test.js b/packages/cli/src/commands/link/__tests__/pods/findPodTargetLine-test.js similarity index 100% rename from packages/cli/src/link/__tests__/pods/findPodTargetLine-test.js rename to packages/cli/src/commands/link/__tests__/pods/findPodTargetLine-test.js diff --git a/packages/cli/src/link/__tests__/pods/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js similarity index 100% rename from packages/cli/src/link/__tests__/pods/isInstalled-test.js rename to packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js diff --git a/packages/cli/src/link/__tests__/pods/removePodEntry-test.js b/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js similarity index 100% rename from packages/cli/src/link/__tests__/pods/removePodEntry-test.js rename to packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js diff --git a/packages/cli/src/link/__tests__/promiseWaterfall-test.js b/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js similarity index 100% rename from packages/cli/src/link/__tests__/promiseWaterfall-test.js rename to packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js diff --git a/packages/cli/src/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js similarity index 100% rename from packages/cli/src/link/android/copyAssets.js rename to packages/cli/src/commands/link/android/copyAssets.js diff --git a/packages/cli/src/link/android/fs.js b/packages/cli/src/commands/link/android/fs.js similarity index 100% rename from packages/cli/src/link/android/fs.js rename to packages/cli/src/commands/link/android/fs.js diff --git a/packages/cli/src/link/android/index.js b/packages/cli/src/commands/link/android/index.js similarity index 100% rename from packages/cli/src/link/android/index.js rename to packages/cli/src/commands/link/android/index.js diff --git a/packages/cli/src/link/android/isInstalled.js b/packages/cli/src/commands/link/android/isInstalled.js similarity index 100% rename from packages/cli/src/link/android/isInstalled.js rename to packages/cli/src/commands/link/android/isInstalled.js diff --git a/packages/cli/src/link/android/patches/applyParams.js b/packages/cli/src/commands/link/android/patches/applyParams.js similarity index 100% rename from packages/cli/src/link/android/patches/applyParams.js rename to packages/cli/src/commands/link/android/patches/applyParams.js diff --git a/packages/cli/src/link/android/patches/applyPatch.js b/packages/cli/src/commands/link/android/patches/applyPatch.js similarity index 100% rename from packages/cli/src/link/android/patches/applyPatch.js rename to packages/cli/src/commands/link/android/patches/applyPatch.js diff --git a/packages/cli/src/link/android/patches/makeBuildPatch.js b/packages/cli/src/commands/link/android/patches/makeBuildPatch.js similarity index 100% rename from packages/cli/src/link/android/patches/makeBuildPatch.js rename to packages/cli/src/commands/link/android/patches/makeBuildPatch.js diff --git a/packages/cli/src/link/android/patches/makeImportPatch.js b/packages/cli/src/commands/link/android/patches/makeImportPatch.js similarity index 100% rename from packages/cli/src/link/android/patches/makeImportPatch.js rename to packages/cli/src/commands/link/android/patches/makeImportPatch.js diff --git a/packages/cli/src/link/android/patches/makePackagePatch.js b/packages/cli/src/commands/link/android/patches/makePackagePatch.js similarity index 100% rename from packages/cli/src/link/android/patches/makePackagePatch.js rename to packages/cli/src/commands/link/android/patches/makePackagePatch.js diff --git a/packages/cli/src/link/android/patches/makeSettingsPatch.js b/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js similarity index 100% rename from packages/cli/src/link/android/patches/makeSettingsPatch.js rename to packages/cli/src/commands/link/android/patches/makeSettingsPatch.js diff --git a/packages/cli/src/link/android/patches/makeStringsPatch.js b/packages/cli/src/commands/link/android/patches/makeStringsPatch.js similarity index 100% rename from packages/cli/src/link/android/patches/makeStringsPatch.js rename to packages/cli/src/commands/link/android/patches/makeStringsPatch.js diff --git a/packages/cli/src/link/android/patches/normalizeProjectName.js b/packages/cli/src/commands/link/android/patches/normalizeProjectName.js similarity index 100% rename from packages/cli/src/link/android/patches/normalizeProjectName.js rename to packages/cli/src/commands/link/android/patches/normalizeProjectName.js diff --git a/packages/cli/src/link/android/patches/revokePatch.js b/packages/cli/src/commands/link/android/patches/revokePatch.js similarity index 100% rename from packages/cli/src/link/android/patches/revokePatch.js rename to packages/cli/src/commands/link/android/patches/revokePatch.js diff --git a/packages/cli/src/link/android/registerNativeModule.js b/packages/cli/src/commands/link/android/registerNativeModule.js similarity index 100% rename from packages/cli/src/link/android/registerNativeModule.js rename to packages/cli/src/commands/link/android/registerNativeModule.js diff --git a/packages/cli/src/link/android/unlinkAssets.js b/packages/cli/src/commands/link/android/unlinkAssets.js similarity index 100% rename from packages/cli/src/link/android/unlinkAssets.js rename to packages/cli/src/commands/link/android/unlinkAssets.js diff --git a/packages/cli/src/link/android/unregisterNativeModule.js b/packages/cli/src/commands/link/android/unregisterNativeModule.js similarity index 100% rename from packages/cli/src/link/android/unregisterNativeModule.js rename to packages/cli/src/commands/link/android/unregisterNativeModule.js diff --git a/packages/cli/src/link/commandStub.js b/packages/cli/src/commands/link/commandStub.js similarity index 100% rename from packages/cli/src/link/commandStub.js rename to packages/cli/src/commands/link/commandStub.js diff --git a/packages/cli/src/link/getDependencyConfig.js b/packages/cli/src/commands/link/getDependencyConfig.js similarity index 78% rename from packages/cli/src/link/getDependencyConfig.js rename to packages/cli/src/commands/link/getDependencyConfig.js index 543ec54a7..0588c4036 100644 --- a/packages/cli/src/link/getDependencyConfig.js +++ b/packages/cli/src/commands/link/getDependencyConfig.js @@ -7,12 +7,12 @@ import type { PlatformsT, ContextT, DependenciesConfig, -} from '../core/types.flow'; +} from '../../tools/types.flow'; -import getPackageConfiguration from '../core/getPackageConfiguration'; -import getParams from '../core/getParams'; -import getHooks from '../core/getHooks'; -import getAssets from '../core/getAssets'; +import getPackageConfiguration from '../../tools/getPackageConfiguration'; +import getParams from '../../tools/getParams'; +import getHooks from '../../tools/getHooks'; +import getAssets from '../../tools/getAssets'; export default function getDependencyConfig( ctx: ContextT, diff --git a/packages/cli/src/link/getProjectConfig.js b/packages/cli/src/commands/link/getProjectConfig.js similarity index 73% rename from packages/cli/src/link/getProjectConfig.js rename to packages/cli/src/commands/link/getProjectConfig.js index 4291ac9d2..b9305b232 100644 --- a/packages/cli/src/link/getProjectConfig.js +++ b/packages/cli/src/commands/link/getProjectConfig.js @@ -2,9 +2,13 @@ * @flow */ -import type { PlatformsT, ContextT, ProjectConfigT } from '../core/types.flow'; +import type { + PlatformsT, + ContextT, + ProjectConfigT, +} from '../../tools/types.flow'; -import getPackageConfiguration from '../core/getPackageConfiguration'; +import getPackageConfiguration from '../../tools/getPackageConfiguration'; export default function getProjectConfig( ctx: ContextT, diff --git a/packages/cli/src/link/getProjectDependencies.js b/packages/cli/src/commands/link/getProjectDependencies.js similarity index 100% rename from packages/cli/src/link/getProjectDependencies.js rename to packages/cli/src/commands/link/getProjectDependencies.js diff --git a/packages/cli/src/link/groupFilesByType.js b/packages/cli/src/commands/link/groupFilesByType.js similarity index 100% rename from packages/cli/src/link/groupFilesByType.js rename to packages/cli/src/commands/link/groupFilesByType.js diff --git a/packages/cli/src/link/ios/addFileToProject.js b/packages/cli/src/commands/link/ios/addFileToProject.js similarity index 100% rename from packages/cli/src/link/ios/addFileToProject.js rename to packages/cli/src/commands/link/ios/addFileToProject.js diff --git a/packages/cli/src/link/ios/addProjectToLibraries.js b/packages/cli/src/commands/link/ios/addProjectToLibraries.js similarity index 100% rename from packages/cli/src/link/ios/addProjectToLibraries.js rename to packages/cli/src/commands/link/ios/addProjectToLibraries.js diff --git a/packages/cli/src/link/ios/addSharedLibraries.js b/packages/cli/src/commands/link/ios/addSharedLibraries.js similarity index 100% rename from packages/cli/src/link/ios/addSharedLibraries.js rename to packages/cli/src/commands/link/ios/addSharedLibraries.js diff --git a/packages/cli/src/link/ios/addToHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js similarity index 100% rename from packages/cli/src/link/ios/addToHeaderSearchPaths.js rename to packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js diff --git a/packages/cli/src/link/ios/common/isInstalled.js b/packages/cli/src/commands/link/ios/common/isInstalled.js similarity index 100% rename from packages/cli/src/link/ios/common/isInstalled.js rename to packages/cli/src/commands/link/ios/common/isInstalled.js diff --git a/packages/cli/src/link/ios/common/registerNativeModule.js b/packages/cli/src/commands/link/ios/common/registerNativeModule.js similarity index 100% rename from packages/cli/src/link/ios/common/registerNativeModule.js rename to packages/cli/src/commands/link/ios/common/registerNativeModule.js diff --git a/packages/cli/src/link/ios/common/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js similarity index 100% rename from packages/cli/src/link/ios/common/unregisterNativeModule.js rename to packages/cli/src/commands/link/ios/common/unregisterNativeModule.js diff --git a/packages/cli/src/link/ios/copyAssets.js b/packages/cli/src/commands/link/ios/copyAssets.js similarity index 100% rename from packages/cli/src/link/ios/copyAssets.js rename to packages/cli/src/commands/link/ios/copyAssets.js diff --git a/packages/cli/src/link/ios/createGroup.js b/packages/cli/src/commands/link/ios/createGroup.js similarity index 100% rename from packages/cli/src/link/ios/createGroup.js rename to packages/cli/src/commands/link/ios/createGroup.js diff --git a/packages/cli/src/link/ios/createGroupWithMessage.js b/packages/cli/src/commands/link/ios/createGroupWithMessage.js similarity index 95% rename from packages/cli/src/link/ios/createGroupWithMessage.js rename to packages/cli/src/commands/link/ios/createGroupWithMessage.js index 12ca80e42..cd2c85bac 100644 --- a/packages/cli/src/link/ios/createGroupWithMessage.js +++ b/packages/cli/src/commands/link/ios/createGroupWithMessage.js @@ -7,7 +7,7 @@ * @format */ -import log from '../../util/logger'; +import log from '../../../tools/logger'; import createGroup from './createGroup'; import getGroup from './getGroup'; diff --git a/packages/cli/src/link/ios/getBuildProperty.js b/packages/cli/src/commands/link/ios/getBuildProperty.js similarity index 100% rename from packages/cli/src/link/ios/getBuildProperty.js rename to packages/cli/src/commands/link/ios/getBuildProperty.js diff --git a/packages/cli/src/link/ios/getGroup.js b/packages/cli/src/commands/link/ios/getGroup.js similarity index 100% rename from packages/cli/src/link/ios/getGroup.js rename to packages/cli/src/commands/link/ios/getGroup.js diff --git a/packages/cli/src/link/ios/getHeaderSearchPath.js b/packages/cli/src/commands/link/ios/getHeaderSearchPath.js similarity index 100% rename from packages/cli/src/link/ios/getHeaderSearchPath.js rename to packages/cli/src/commands/link/ios/getHeaderSearchPath.js diff --git a/packages/cli/src/link/ios/getHeadersInFolder.js b/packages/cli/src/commands/link/ios/getHeadersInFolder.js similarity index 100% rename from packages/cli/src/link/ios/getHeadersInFolder.js rename to packages/cli/src/commands/link/ios/getHeadersInFolder.js diff --git a/packages/cli/src/link/ios/getPlist.js b/packages/cli/src/commands/link/ios/getPlist.js similarity index 100% rename from packages/cli/src/link/ios/getPlist.js rename to packages/cli/src/commands/link/ios/getPlist.js diff --git a/packages/cli/src/link/ios/getPlistPath.js b/packages/cli/src/commands/link/ios/getPlistPath.js similarity index 100% rename from packages/cli/src/link/ios/getPlistPath.js rename to packages/cli/src/commands/link/ios/getPlistPath.js diff --git a/packages/cli/src/link/ios/getTargets.js b/packages/cli/src/commands/link/ios/getTargets.js similarity index 100% rename from packages/cli/src/link/ios/getTargets.js rename to packages/cli/src/commands/link/ios/getTargets.js diff --git a/packages/cli/src/link/ios/hasLibraryImported.js b/packages/cli/src/commands/link/ios/hasLibraryImported.js similarity index 100% rename from packages/cli/src/link/ios/hasLibraryImported.js rename to packages/cli/src/commands/link/ios/hasLibraryImported.js diff --git a/packages/cli/src/link/ios/index.js b/packages/cli/src/commands/link/ios/index.js similarity index 100% rename from packages/cli/src/link/ios/index.js rename to packages/cli/src/commands/link/ios/index.js diff --git a/packages/cli/src/link/ios/isInstalled.js b/packages/cli/src/commands/link/ios/isInstalled.js similarity index 100% rename from packages/cli/src/link/ios/isInstalled.js rename to packages/cli/src/commands/link/ios/isInstalled.js diff --git a/packages/cli/src/link/ios/mapHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js similarity index 100% rename from packages/cli/src/link/ios/mapHeaderSearchPaths.js rename to packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js diff --git a/packages/cli/src/link/ios/registerNativeModule.js b/packages/cli/src/commands/link/ios/registerNativeModule.js similarity index 100% rename from packages/cli/src/link/ios/registerNativeModule.js rename to packages/cli/src/commands/link/ios/registerNativeModule.js diff --git a/packages/cli/src/link/ios/removeFromHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js similarity index 100% rename from packages/cli/src/link/ios/removeFromHeaderSearchPaths.js rename to packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js diff --git a/packages/cli/src/link/ios/removeFromPbxItemContainerProxySection.js b/packages/cli/src/commands/link/ios/removeFromPbxItemContainerProxySection.js similarity index 100% rename from packages/cli/src/link/ios/removeFromPbxItemContainerProxySection.js rename to packages/cli/src/commands/link/ios/removeFromPbxItemContainerProxySection.js diff --git a/packages/cli/src/link/ios/removeFromPbxReferenceProxySection.js b/packages/cli/src/commands/link/ios/removeFromPbxReferenceProxySection.js similarity index 100% rename from packages/cli/src/link/ios/removeFromPbxReferenceProxySection.js rename to packages/cli/src/commands/link/ios/removeFromPbxReferenceProxySection.js diff --git a/packages/cli/src/link/ios/removeFromProjectReferences.js b/packages/cli/src/commands/link/ios/removeFromProjectReferences.js similarity index 100% rename from packages/cli/src/link/ios/removeFromProjectReferences.js rename to packages/cli/src/commands/link/ios/removeFromProjectReferences.js diff --git a/packages/cli/src/link/ios/removeFromStaticLibraries.js b/packages/cli/src/commands/link/ios/removeFromStaticLibraries.js similarity index 100% rename from packages/cli/src/link/ios/removeFromStaticLibraries.js rename to packages/cli/src/commands/link/ios/removeFromStaticLibraries.js diff --git a/packages/cli/src/link/ios/removeProductGroup.js b/packages/cli/src/commands/link/ios/removeProductGroup.js similarity index 100% rename from packages/cli/src/link/ios/removeProductGroup.js rename to packages/cli/src/commands/link/ios/removeProductGroup.js diff --git a/packages/cli/src/link/ios/removeProjectFromLibraries.js b/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js similarity index 100% rename from packages/cli/src/link/ios/removeProjectFromLibraries.js rename to packages/cli/src/commands/link/ios/removeProjectFromLibraries.js diff --git a/packages/cli/src/link/ios/removeProjectFromProject.js b/packages/cli/src/commands/link/ios/removeProjectFromProject.js similarity index 100% rename from packages/cli/src/link/ios/removeProjectFromProject.js rename to packages/cli/src/commands/link/ios/removeProjectFromProject.js diff --git a/packages/cli/src/link/ios/removeSharedLibraries.js b/packages/cli/src/commands/link/ios/removeSharedLibraries.js similarity index 100% rename from packages/cli/src/link/ios/removeSharedLibraries.js rename to packages/cli/src/commands/link/ios/removeSharedLibraries.js diff --git a/packages/cli/src/link/ios/unlinkAssets.js b/packages/cli/src/commands/link/ios/unlinkAssets.js similarity index 97% rename from packages/cli/src/link/ios/unlinkAssets.js rename to packages/cli/src/commands/link/ios/unlinkAssets.js index 373f8b34b..1c6036905 100644 --- a/packages/cli/src/link/ios/unlinkAssets.js +++ b/packages/cli/src/commands/link/ios/unlinkAssets.js @@ -10,7 +10,7 @@ import fs from 'fs-extra'; import path from 'path'; import xcode from 'xcode'; import { difference } from 'lodash'; -import log from '../../util/logger'; +import log from '../../../tools/logger'; import groupFilesByType from '../groupFilesByType'; import getPlist from './getPlist'; diff --git a/packages/cli/src/link/ios/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/unregisterNativeModule.js similarity index 100% rename from packages/cli/src/link/ios/unregisterNativeModule.js rename to packages/cli/src/commands/link/ios/unregisterNativeModule.js diff --git a/packages/cli/src/link/ios/writePlist.js b/packages/cli/src/commands/link/ios/writePlist.js similarity index 100% rename from packages/cli/src/link/ios/writePlist.js rename to packages/cli/src/commands/link/ios/writePlist.js diff --git a/packages/cli/src/link/link.js b/packages/cli/src/commands/link/link.js similarity index 93% rename from packages/cli/src/link/link.js rename to packages/cli/src/commands/link/link.js index 15156e625..6be0b5484 100644 --- a/packages/cli/src/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -8,10 +8,10 @@ */ import { pick } from 'lodash'; -import type { ContextT } from '../core/types.flow'; +import type { ContextT } from '../../tools/types.flow'; import promiseWaterfall from './promiseWaterfall'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; import getDependencyConfig from './getDependencyConfig'; import commandStub from './commandStub'; import promisify from './promisify'; @@ -19,8 +19,8 @@ import getProjectConfig from './getProjectConfig'; import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; -import findReactNativeScripts from '../util/findReactNativeScripts'; -import getPlatforms from '../core/getPlatforms'; +import findReactNativeScripts from '../../tools/findReactNativeScripts'; +import getPlatforms from '../../tools/getPlatforms'; type FlagsType = { platforms?: Array, diff --git a/packages/cli/src/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js similarity index 91% rename from packages/cli/src/link/linkAll.js rename to packages/cli/src/commands/link/linkAll.js index 6a439a66c..4a14d13fd 100644 --- a/packages/cli/src/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -2,9 +2,13 @@ import { uniqBy, flatten } from 'lodash'; import path from 'path'; -import type { ContextT, PlatformsT, ProjectConfigT } from '../core/types.flow'; -import logger from '../util/logger'; -import getAssets from '../core/getAssets'; +import type { + ContextT, + PlatformsT, + ProjectConfigT, +} from '../../tools/types.flow'; +import logger from '../../tools/logger'; +import getAssets from '../../tools/getAssets'; import getProjectDependencies from './getProjectDependencies'; import getDependencyConfig from './getDependencyConfig'; import promiseWaterfall from './promiseWaterfall'; diff --git a/packages/cli/src/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js similarity index 86% rename from packages/cli/src/link/linkAssets.js rename to packages/cli/src/commands/link/linkAssets.js index c29fd6335..6b36c3796 100644 --- a/packages/cli/src/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -1,9 +1,9 @@ // @flow import { isEmpty } from 'lodash'; -import type { PlatformsT, ProjectConfigT } from '../core/types.flow'; +import type { PlatformsT, ProjectConfigT } from '../../tools/types.flow'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; const linkAssets = ( platforms: PlatformsT, diff --git a/packages/cli/src/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js similarity index 91% rename from packages/cli/src/link/linkDependency.js rename to packages/cli/src/commands/link/linkDependency.js index f85aec530..60efb7ac9 100644 --- a/packages/cli/src/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -4,10 +4,10 @@ import type { PlatformsT, ProjectConfigT, DependenciesConfig, -} from '../core/types.flow'; -import logger from '../util/logger'; +} from '../../tools/types.flow'; +import logger from '../../tools/logger'; import pollParams from './pollParams'; -import { getPlatformName } from '../core/getPlatforms'; +import { getPlatformName } from '../../tools/getPlatforms'; const linkDependency = async ( platforms: PlatformsT, diff --git a/packages/cli/src/link/pods/addPodEntry.js b/packages/cli/src/commands/link/pods/addPodEntry.js similarity index 100% rename from packages/cli/src/link/pods/addPodEntry.js rename to packages/cli/src/commands/link/pods/addPodEntry.js diff --git a/packages/cli/src/link/pods/findLineToAddPod.js b/packages/cli/src/commands/link/pods/findLineToAddPod.js similarity index 100% rename from packages/cli/src/link/pods/findLineToAddPod.js rename to packages/cli/src/commands/link/pods/findLineToAddPod.js diff --git a/packages/cli/src/link/pods/findMarkedLinesInPodfile.js b/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js similarity index 100% rename from packages/cli/src/link/pods/findMarkedLinesInPodfile.js rename to packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js diff --git a/packages/cli/src/link/pods/findPodTargetLine.js b/packages/cli/src/commands/link/pods/findPodTargetLine.js similarity index 100% rename from packages/cli/src/link/pods/findPodTargetLine.js rename to packages/cli/src/commands/link/pods/findPodTargetLine.js diff --git a/packages/cli/src/link/pods/isInstalled.js b/packages/cli/src/commands/link/pods/isInstalled.js similarity index 100% rename from packages/cli/src/link/pods/isInstalled.js rename to packages/cli/src/commands/link/pods/isInstalled.js diff --git a/packages/cli/src/link/pods/readPodfile.js b/packages/cli/src/commands/link/pods/readPodfile.js similarity index 100% rename from packages/cli/src/link/pods/readPodfile.js rename to packages/cli/src/commands/link/pods/readPodfile.js diff --git a/packages/cli/src/link/pods/registerNativeModule.js b/packages/cli/src/commands/link/pods/registerNativeModule.js similarity index 100% rename from packages/cli/src/link/pods/registerNativeModule.js rename to packages/cli/src/commands/link/pods/registerNativeModule.js diff --git a/packages/cli/src/link/pods/removePodEntry.js b/packages/cli/src/commands/link/pods/removePodEntry.js similarity index 100% rename from packages/cli/src/link/pods/removePodEntry.js rename to packages/cli/src/commands/link/pods/removePodEntry.js diff --git a/packages/cli/src/link/pods/savePodFile.js b/packages/cli/src/commands/link/pods/savePodFile.js similarity index 100% rename from packages/cli/src/link/pods/savePodFile.js rename to packages/cli/src/commands/link/pods/savePodFile.js diff --git a/packages/cli/src/link/pods/unregisterNativeModule.js b/packages/cli/src/commands/link/pods/unregisterNativeModule.js similarity index 100% rename from packages/cli/src/link/pods/unregisterNativeModule.js rename to packages/cli/src/commands/link/pods/unregisterNativeModule.js diff --git a/packages/cli/src/link/pollParams.js b/packages/cli/src/commands/link/pollParams.js similarity index 100% rename from packages/cli/src/link/pollParams.js rename to packages/cli/src/commands/link/pollParams.js diff --git a/packages/cli/src/link/promiseWaterfall.js b/packages/cli/src/commands/link/promiseWaterfall.js similarity index 100% rename from packages/cli/src/link/promiseWaterfall.js rename to packages/cli/src/commands/link/promiseWaterfall.js diff --git a/packages/cli/src/link/promisify.js b/packages/cli/src/commands/link/promisify.js similarity index 100% rename from packages/cli/src/link/promisify.js rename to packages/cli/src/commands/link/promisify.js diff --git a/packages/cli/src/link/unlink.js b/packages/cli/src/commands/link/unlink.js similarity index 96% rename from packages/cli/src/link/unlink.js rename to packages/cli/src/commands/link/unlink.js index 291d98aa3..219121141 100644 --- a/packages/cli/src/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -8,15 +8,15 @@ */ import { flatten, isEmpty, difference } from 'lodash'; -import type { ContextT } from '../core/types.flow'; -import logger from '../util/logger'; +import type { ContextT } from '../../tools/types.flow'; +import logger from '../../tools/logger'; import getProjectConfig from './getProjectConfig'; import getDependencyConfig from './getDependencyConfig'; import getProjectDependencies from './getProjectDependencies'; import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; import promisify from './promisify'; -import getPlatforms, { getPlatformName } from '../core/getPlatforms'; +import getPlatforms, { getPlatformName } from '../../tools/getPlatforms'; const unlinkDependency = ( platforms, diff --git a/packages/cli/src/logAndroid/logAndroid.js b/packages/cli/src/commands/logAndroid/logAndroid.js similarity index 94% rename from packages/cli/src/logAndroid/logAndroid.js rename to packages/cli/src/commands/logAndroid/logAndroid.js index 104dda5e2..e2d722b63 100644 --- a/packages/cli/src/logAndroid/logAndroid.js +++ b/packages/cli/src/commands/logAndroid/logAndroid.js @@ -6,7 +6,7 @@ */ import { spawnSync } from 'child_process'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; /** * Starts adb logcat diff --git a/packages/cli/src/logIOS/logIOS.js b/packages/cli/src/commands/logIOS/logIOS.js similarity index 97% rename from packages/cli/src/logIOS/logIOS.js rename to packages/cli/src/commands/logIOS/logIOS.js index 525690d62..fb10721c0 100644 --- a/packages/cli/src/logIOS/logIOS.js +++ b/packages/cli/src/commands/logIOS/logIOS.js @@ -10,7 +10,7 @@ import { execFileSync, spawnSync } from 'child_process'; import os from 'os'; import path from 'path'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; function findAvailableDevice(devices) { for (const key of Object.keys(devices)) { diff --git a/packages/cli/src/runAndroid/__tests__/runOnAllDevices.test.js b/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js similarity index 100% rename from packages/cli/src/runAndroid/__tests__/runOnAllDevices.test.js rename to packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js diff --git a/packages/cli/src/runAndroid/adb.js b/packages/cli/src/commands/runAndroid/adb.js similarity index 100% rename from packages/cli/src/runAndroid/adb.js rename to packages/cli/src/commands/runAndroid/adb.js diff --git a/packages/cli/src/runAndroid/getAdbPath.js b/packages/cli/src/commands/runAndroid/getAdbPath.js similarity index 100% rename from packages/cli/src/runAndroid/getAdbPath.js rename to packages/cli/src/commands/runAndroid/getAdbPath.js diff --git a/packages/cli/src/runAndroid/runAndroid.js b/packages/cli/src/commands/runAndroid/runAndroid.js similarity index 98% rename from packages/cli/src/runAndroid/runAndroid.js rename to packages/cli/src/commands/runAndroid/runAndroid.js index 99957619f..a075afe06 100644 --- a/packages/cli/src/runAndroid/runAndroid.js +++ b/packages/cli/src/commands/runAndroid/runAndroid.js @@ -14,15 +14,15 @@ import { spawnSync, spawn, execFileSync } from 'child_process'; import fs from 'fs'; import isString from 'lodash/isString'; -import isPackagerRunning from '../util/isPackagerRunning'; -import type { ContextT } from '../core/types.flow'; +import isPackagerRunning from '../../tools/isPackagerRunning'; +import type { ContextT } from '../../tools/types.flow'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; import getAdbPath from './getAdbPath'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; // Verifies this is an Android project function checkAndroid(root) { diff --git a/packages/cli/src/runAndroid/runOnAllDevices.js b/packages/cli/src/commands/runAndroid/runOnAllDevices.js similarity index 98% rename from packages/cli/src/runAndroid/runOnAllDevices.js rename to packages/cli/src/commands/runAndroid/runOnAllDevices.js index 6afb2307e..48956701c 100644 --- a/packages/cli/src/runAndroid/runOnAllDevices.js +++ b/packages/cli/src/commands/runAndroid/runOnAllDevices.js @@ -10,7 +10,7 @@ /* eslint-disable consistent-return */ import { spawnSync, execFileSync } from 'child_process'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; import adb from './adb'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; diff --git a/packages/cli/src/runAndroid/tryLaunchAppOnDevice.js b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js similarity index 95% rename from packages/cli/src/runAndroid/tryLaunchAppOnDevice.js rename to packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js index 43fa52af6..b8916530f 100644 --- a/packages/cli/src/runAndroid/tryLaunchAppOnDevice.js +++ b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js @@ -8,7 +8,7 @@ */ import { spawnSync } from 'child_process'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; function tryLaunchAppOnDevice( device: string, diff --git a/packages/cli/src/runAndroid/tryRunAdbReverse.js b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js similarity index 95% rename from packages/cli/src/runAndroid/tryRunAdbReverse.js rename to packages/cli/src/commands/runAndroid/tryRunAdbReverse.js index b2a57bbd9..952e7e885 100644 --- a/packages/cli/src/runAndroid/tryRunAdbReverse.js +++ b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js @@ -8,7 +8,7 @@ */ import { execFileSync } from 'child_process'; -import logger from '../util/logger'; +import logger from '../../tools/logger'; import getAdbPath from './getAdbPath'; // Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager diff --git a/packages/cli/src/runIOS/__tests__/findMatchingSimulator-test.js b/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js similarity index 100% rename from packages/cli/src/runIOS/__tests__/findMatchingSimulator-test.js rename to packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js diff --git a/packages/cli/src/runIOS/__tests__/findXcodeProject-test.js b/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js similarity index 100% rename from packages/cli/src/runIOS/__tests__/findXcodeProject-test.js rename to packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js diff --git a/packages/cli/src/runIOS/__tests__/parseIOSDevicesList-test.js b/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js similarity index 100% rename from packages/cli/src/runIOS/__tests__/parseIOSDevicesList-test.js rename to packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js diff --git a/packages/cli/src/runIOS/findMatchingSimulator.js b/packages/cli/src/commands/runIOS/findMatchingSimulator.js similarity index 100% rename from packages/cli/src/runIOS/findMatchingSimulator.js rename to packages/cli/src/commands/runIOS/findMatchingSimulator.js diff --git a/packages/cli/src/runIOS/findXcodeProject.js b/packages/cli/src/commands/runIOS/findXcodeProject.js similarity index 100% rename from packages/cli/src/runIOS/findXcodeProject.js rename to packages/cli/src/commands/runIOS/findXcodeProject.js diff --git a/packages/cli/src/runIOS/parseIOSDevicesList.js b/packages/cli/src/commands/runIOS/parseIOSDevicesList.js similarity index 100% rename from packages/cli/src/runIOS/parseIOSDevicesList.js rename to packages/cli/src/commands/runIOS/parseIOSDevicesList.js diff --git a/packages/cli/src/runIOS/runIOS.js b/packages/cli/src/commands/runIOS/runIOS.js similarity index 98% rename from packages/cli/src/runIOS/runIOS.js rename to packages/cli/src/commands/runIOS/runIOS.js index b925094e9..e2061a452 100644 --- a/packages/cli/src/runIOS/runIOS.js +++ b/packages/cli/src/commands/runIOS/runIOS.js @@ -12,12 +12,12 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; -import type { ContextT } from '../core/types.flow'; +import type { ContextT } from '../../tools/types.flow'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; -import { ProcessError } from '../util/errors'; -import logger from '../util/logger'; +import { ProcessError } from '../../tools/errors'; +import logger from '../../tools/logger'; type FlagsT = { simulator: string, diff --git a/packages/cli/src/server/util/copyToClipBoard.js b/packages/cli/src/commands/server/copyToClipBoard.js similarity index 100% rename from packages/cli/src/server/util/copyToClipBoard.js rename to packages/cli/src/commands/server/copyToClipBoard.js diff --git a/packages/cli/src/server/util/debugger-ui/DeltaPatcher.js b/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js similarity index 100% rename from packages/cli/src/server/util/debugger-ui/DeltaPatcher.js rename to packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js diff --git a/packages/cli/src/server/util/debugger-ui/__tests__/DeltaPatcher-test.js b/packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js similarity index 100% rename from packages/cli/src/server/util/debugger-ui/__tests__/DeltaPatcher-test.js rename to packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js diff --git a/packages/cli/src/server/util/debugger-ui/debuggerWorker.js b/packages/cli/src/commands/server/debugger-ui/debuggerWorker.js similarity index 100% rename from packages/cli/src/server/util/debugger-ui/debuggerWorker.js rename to packages/cli/src/commands/server/debugger-ui/debuggerWorker.js diff --git a/packages/cli/src/server/util/debugger-ui/deltaUrlToBlobUrl.js b/packages/cli/src/commands/server/debugger-ui/deltaUrlToBlobUrl.js similarity index 100% rename from packages/cli/src/server/util/debugger-ui/deltaUrlToBlobUrl.js rename to packages/cli/src/commands/server/debugger-ui/deltaUrlToBlobUrl.js diff --git a/packages/cli/src/server/util/debugger-ui/index.html b/packages/cli/src/commands/server/debugger-ui/index.html similarity index 100% rename from packages/cli/src/server/util/debugger-ui/index.html rename to packages/cli/src/commands/server/debugger-ui/index.html diff --git a/packages/cli/src/server/util/external/xsel b/packages/cli/src/commands/server/external/xsel similarity index 100% rename from packages/cli/src/server/util/external/xsel rename to packages/cli/src/commands/server/external/xsel diff --git a/packages/cli/src/server/util/jsPackagerClient.js b/packages/cli/src/commands/server/jsPackagerClient.js similarity index 98% rename from packages/cli/src/server/util/jsPackagerClient.js rename to packages/cli/src/commands/server/jsPackagerClient.js index ac3586a22..9387a49c4 100644 --- a/packages/cli/src/server/util/jsPackagerClient.js +++ b/packages/cli/src/commands/server/jsPackagerClient.js @@ -8,7 +8,7 @@ */ import WebSocket from 'ws'; -import logger from '../../util/logger'; +import logger from '../../tools/logger'; import MessageSocket from './messageSocket'; const PROTOCOL_VERSION = 2; diff --git a/packages/cli/src/server/util/launchChrome.js b/packages/cli/src/commands/server/launchChrome.js similarity index 96% rename from packages/cli/src/server/util/launchChrome.js rename to packages/cli/src/commands/server/launchChrome.js index e32335837..5dbf1feec 100644 --- a/packages/cli/src/server/util/launchChrome.js +++ b/packages/cli/src/commands/server/launchChrome.js @@ -10,7 +10,7 @@ import opn from 'opn'; import { execSync } from 'child_process'; -import logger from '../../util/logger'; +import logger from '../../tools/logger'; function commandExistsUnixSync(commandName) { try { diff --git a/packages/cli/src/server/util/launchEditor.js b/packages/cli/src/commands/server/launchEditor.js similarity index 99% rename from packages/cli/src/server/util/launchEditor.js rename to packages/cli/src/commands/server/launchEditor.js index 85963a330..7dc85fe02 100644 --- a/packages/cli/src/server/util/launchEditor.js +++ b/packages/cli/src/commands/server/launchEditor.js @@ -12,7 +12,7 @@ import fs from 'fs'; import path from 'path'; import { execSync, spawn } from 'child_process'; import shellQuote from 'shell-quote'; -import logger from '../../util/logger'; +import logger from '../../tools/logger'; function isTerminalEditor(editor) { switch (editor) { diff --git a/packages/cli/src/server/util/messageSocket.js b/packages/cli/src/commands/server/messageSocket.js similarity index 99% rename from packages/cli/src/server/util/messageSocket.js rename to packages/cli/src/commands/server/messageSocket.js index 38d9121fb..def0193eb 100644 --- a/packages/cli/src/server/util/messageSocket.js +++ b/packages/cli/src/commands/server/messageSocket.js @@ -8,7 +8,7 @@ import url from 'url'; import { Server as WebSocketServer } from 'ws'; import notifier from 'node-notifier'; -import logger from '../../util/logger'; +import logger from '../../tools/logger'; const PROTOCOL_VERSION = 2; diff --git a/packages/cli/src/server/middleware/MiddlewareManager.js b/packages/cli/src/commands/server/middleware/MiddlewareManager.js similarity index 100% rename from packages/cli/src/server/middleware/MiddlewareManager.js rename to packages/cli/src/commands/server/middleware/MiddlewareManager.js diff --git a/packages/cli/src/server/middleware/copyToClipBoardMiddleware.js b/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js similarity index 86% rename from packages/cli/src/server/middleware/copyToClipBoardMiddleware.js rename to packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js index 9897af584..882f747dc 100644 --- a/packages/cli/src/server/middleware/copyToClipBoardMiddleware.js +++ b/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js @@ -7,8 +7,8 @@ * @format */ -import copyToClipBoard from '../util/copyToClipBoard'; -import logger from '../../util/logger'; +import copyToClipBoard from '../copyToClipBoard'; +import logger from '../../../tools/logger'; /** * Handle the request from JS to copy contents onto host system clipboard. diff --git a/packages/cli/src/server/middleware/getDevToolsMiddleware.js b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js similarity index 95% rename from packages/cli/src/server/middleware/getDevToolsMiddleware.js rename to packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js index a61597585..4b2b293e2 100644 --- a/packages/cli/src/server/middleware/getDevToolsMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js @@ -6,8 +6,8 @@ * * @format */ -import launchChrome from '../util/launchChrome'; -import logger from '../../util/logger'; +import launchChrome from '../launchChrome'; +import logger from '../../../tools/logger'; function launchChromeDevTools(port, args = '') { const debuggerURL = `http://localhost:${port}/debugger-ui${args}`; diff --git a/packages/cli/src/server/middleware/getSecurityHeadersMiddleware.js b/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js similarity index 100% rename from packages/cli/src/server/middleware/getSecurityHeadersMiddleware.js rename to packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js diff --git a/packages/cli/src/server/middleware/index.html b/packages/cli/src/commands/server/middleware/index.html similarity index 100% rename from packages/cli/src/server/middleware/index.html rename to packages/cli/src/commands/server/middleware/index.html diff --git a/packages/cli/src/server/middleware/indexPage.js b/packages/cli/src/commands/server/middleware/indexPage.js similarity index 100% rename from packages/cli/src/server/middleware/indexPage.js rename to packages/cli/src/commands/server/middleware/indexPage.js diff --git a/packages/cli/src/server/middleware/loadRawBodyMiddleware.js b/packages/cli/src/commands/server/middleware/loadRawBodyMiddleware.js similarity index 100% rename from packages/cli/src/server/middleware/loadRawBodyMiddleware.js rename to packages/cli/src/commands/server/middleware/loadRawBodyMiddleware.js diff --git a/packages/cli/src/server/middleware/openStackFrameInEditorMiddleware.js b/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js similarity index 91% rename from packages/cli/src/server/middleware/openStackFrameInEditorMiddleware.js rename to packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js index 8b36b66fa..8162bb458 100644 --- a/packages/cli/src/server/middleware/openStackFrameInEditorMiddleware.js +++ b/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js @@ -7,7 +7,7 @@ * @format */ -import launchEditor from '../util/launchEditor'; +import launchEditor from '../launchEditor'; export default function getOpenStackFrameInEditorMiddleware({ watchFolders }) { return (req, res, next) => { diff --git a/packages/cli/src/server/middleware/statusPageMiddleware.js b/packages/cli/src/commands/server/middleware/statusPageMiddleware.js similarity index 100% rename from packages/cli/src/server/middleware/statusPageMiddleware.js rename to packages/cli/src/commands/server/middleware/statusPageMiddleware.js diff --git a/packages/cli/src/server/middleware/systraceProfileMiddleware.js b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js similarity index 95% rename from packages/cli/src/server/middleware/systraceProfileMiddleware.js rename to packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js index 3d05991c0..5948ab205 100644 --- a/packages/cli/src/server/middleware/systraceProfileMiddleware.js +++ b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../util/logger'; +import logger from '../../../tools/logger'; export default function systraceProfileMiddleware(req, res, next) { if (req.url !== '/systrace') { diff --git a/packages/cli/src/server/middleware/unless.js b/packages/cli/src/commands/server/middleware/unless.js similarity index 100% rename from packages/cli/src/server/middleware/unless.js rename to packages/cli/src/commands/server/middleware/unless.js diff --git a/packages/cli/src/server/runServer.js b/packages/cli/src/commands/server/runServer.js similarity index 94% rename from packages/cli/src/server/runServer.js rename to packages/cli/src/commands/server/runServer.js index adf6d2a57..f1436ed4a 100644 --- a/packages/cli/src/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -13,12 +13,12 @@ import { Terminal } from 'metro-core'; import morgan from 'morgan'; import path from 'path'; -import type { ContextT } from '../core/types.flow'; -import messageSocket from './util/messageSocket'; -import webSocketProxy from './util/webSocketProxy'; +import type { ContextT } from '../../tools/types.flow'; +import messageSocket from './messageSocket'; +import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; -import loadMetroConfig from '../util/loadMetroConfig'; +import loadMetroConfig from '../../tools/loadMetroConfig'; export type Args = {| assetExts?: string[], diff --git a/packages/cli/src/server/server.js b/packages/cli/src/commands/server/server.js similarity index 100% rename from packages/cli/src/server/server.js rename to packages/cli/src/commands/server/server.js diff --git a/packages/cli/src/server/util/webSocketProxy.js b/packages/cli/src/commands/server/webSocketProxy.js similarity index 98% rename from packages/cli/src/server/util/webSocketProxy.js rename to packages/cli/src/commands/server/webSocketProxy.js index 420c77f3d..4d904022c 100644 --- a/packages/cli/src/server/util/webSocketProxy.js +++ b/packages/cli/src/commands/server/webSocketProxy.js @@ -8,7 +8,7 @@ */ import ws from 'ws'; -import logger from '../../util/logger'; +import logger from '../../tools/logger'; function attachToServer(server, path) { const WebSocketServer = ws.Server; diff --git a/packages/cli/src/upgrade/__tests__/__snapshots__/upgrade.test.js.snap b/packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap similarity index 100% rename from packages/cli/src/upgrade/__tests__/__snapshots__/upgrade.test.js.snap rename to packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap diff --git a/packages/cli/src/upgrade/__tests__/sample.patch b/packages/cli/src/commands/upgrade/__tests__/sample.patch similarity index 100% rename from packages/cli/src/upgrade/__tests__/sample.patch rename to packages/cli/src/commands/upgrade/__tests__/sample.patch diff --git a/packages/cli/src/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js similarity index 98% rename from packages/cli/src/upgrade/__tests__/upgrade.test.js rename to packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 71054941f..5a987a6cb 100644 --- a/packages/cli/src/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -5,7 +5,7 @@ import fs from 'fs'; import snapshotDiff from 'snapshot-diff'; import upgrade from '../upgrade'; import { fetch } from '../helpers'; -import logger from '../../util/logger'; +import logger from '../../../tools/logger'; jest.mock('https'); jest.mock('fs'); @@ -32,7 +32,7 @@ jest.mock( () => ({ name: 'TestApp', dependencies: { 'react-native': '^0.57.8' } }), { virtual: true } ); -jest.mock('../../util/PackageManager', () => +jest.mock('../../../tools/PackageManager', () => jest.fn(() => ({ install: args => { mockPushLog('$ yarn add', ...args); @@ -43,7 +43,7 @@ jest.mock('../helpers', () => ({ ...jest.requireActual('../helpers'), fetch: jest.fn(() => Promise.resolve('patch')), })); -jest.mock('../../util/logger', () => ({ +jest.mock('../../../tools/logger', () => ({ info: jest.fn((...args) => mockPushLog('info', args)), error: jest.fn((...args) => mockPushLog('error', args)), warn: jest.fn((...args) => mockPushLog('warn', args)), diff --git a/packages/cli/src/upgrade/helpers.js b/packages/cli/src/commands/upgrade/helpers.js similarity index 100% rename from packages/cli/src/upgrade/helpers.js rename to packages/cli/src/commands/upgrade/helpers.js diff --git a/packages/cli/src/upgrade/legacyUpgrade.js b/packages/cli/src/commands/upgrade/legacyUpgrade.js similarity index 95% rename from packages/cli/src/upgrade/legacyUpgrade.js rename to packages/cli/src/commands/upgrade/legacyUpgrade.js index cd601b784..64d991234 100644 --- a/packages/cli/src/upgrade/legacyUpgrade.js +++ b/packages/cli/src/commands/upgrade/legacyUpgrade.js @@ -11,9 +11,9 @@ import fs from 'fs'; import path from 'path'; import semver from 'semver'; -import type { ContextT } from '../core/types.flow'; -import logger from '../util/logger'; -import copyProjectTemplateAndReplace from '../generator/copyProjectTemplateAndReplace'; +import type { ContextT } from '../../tools/types.flow'; +import logger from '../../tools/logger'; +import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; /** * Migrate application to a new version of React Native. diff --git a/packages/cli/src/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js similarity index 98% rename from packages/cli/src/upgrade/upgrade.js rename to packages/cli/src/commands/upgrade/upgrade.js index e5f7e863c..00db8441d 100644 --- a/packages/cli/src/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -5,9 +5,9 @@ import fs from 'fs'; import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; -import type { ContextT } from '../core/types.flow'; -import logger from '../util/logger'; -import PackageManager from '../util/PackageManager'; +import type { ContextT } from '../../tools/types.flow'; +import logger from '../../tools/logger'; +import PackageManager from '../../tools/PackageManager'; import { fetch } from './helpers'; import legacyUpgrade from './legacyUpgrade'; diff --git a/packages/cli/src/index.js b/packages/cli/src/index.js index d741fd7e9..58a6737e7 100644 --- a/packages/cli/src/index.js +++ b/packages/cli/src/index.js @@ -8,7 +8,7 @@ */ // gracefulify() has to be called before anything else runs -import './util/gracefulifyFs'; +import './tools/gracefulifyFs'; import cli from './cliEntry'; if (require.main === module) { diff --git a/packages/cli/src/util/PackageManager.js b/packages/cli/src/tools/PackageManager.js similarity index 100% rename from packages/cli/src/util/PackageManager.js rename to packages/cli/src/tools/PackageManager.js diff --git a/packages/cli/src/core/__fixtures__/android.js b/packages/cli/src/tools/__fixtures__/android.js similarity index 100% rename from packages/cli/src/core/__fixtures__/android.js rename to packages/cli/src/tools/__fixtures__/android.js diff --git a/packages/cli/src/core/__fixtures__/commands.js b/packages/cli/src/tools/__fixtures__/commands.js similarity index 100% rename from packages/cli/src/core/__fixtures__/commands.js rename to packages/cli/src/tools/__fixtures__/commands.js diff --git a/packages/cli/src/core/__fixtures__/dependencies.js b/packages/cli/src/tools/__fixtures__/dependencies.js similarity index 100% rename from packages/cli/src/core/__fixtures__/dependencies.js rename to packages/cli/src/tools/__fixtures__/dependencies.js diff --git a/packages/cli/src/core/__fixtures__/files/AndroidManifest-debug.xml b/packages/cli/src/tools/__fixtures__/files/AndroidManifest-debug.xml similarity index 100% rename from packages/cli/src/core/__fixtures__/files/AndroidManifest-debug.xml rename to packages/cli/src/tools/__fixtures__/files/AndroidManifest-debug.xml diff --git a/packages/cli/src/core/__fixtures__/files/AndroidManifest.xml b/packages/cli/src/tools/__fixtures__/files/AndroidManifest.xml similarity index 100% rename from packages/cli/src/core/__fixtures__/files/AndroidManifest.xml rename to packages/cli/src/tools/__fixtures__/files/AndroidManifest.xml diff --git a/packages/cli/src/core/__fixtures__/files/Main.java b/packages/cli/src/tools/__fixtures__/files/Main.java similarity index 100% rename from packages/cli/src/core/__fixtures__/files/Main.java rename to packages/cli/src/tools/__fixtures__/files/Main.java diff --git a/packages/cli/src/core/__fixtures__/files/ReactPackage.java b/packages/cli/src/tools/__fixtures__/files/ReactPackage.java similarity index 100% rename from packages/cli/src/core/__fixtures__/files/ReactPackage.java rename to packages/cli/src/tools/__fixtures__/files/ReactPackage.java diff --git a/packages/cli/src/core/__fixtures__/files/ReactPackage.kt b/packages/cli/src/tools/__fixtures__/files/ReactPackage.kt similarity index 100% rename from packages/cli/src/core/__fixtures__/files/ReactPackage.kt rename to packages/cli/src/tools/__fixtures__/files/ReactPackage.kt diff --git a/packages/cli/src/core/__fixtures__/files/package.json b/packages/cli/src/tools/__fixtures__/files/package.json similarity index 100% rename from packages/cli/src/core/__fixtures__/files/package.json rename to packages/cli/src/tools/__fixtures__/files/package.json diff --git a/packages/cli/src/core/__fixtures__/files/project.pbxproj b/packages/cli/src/tools/__fixtures__/files/project.pbxproj similarity index 100% rename from packages/cli/src/core/__fixtures__/files/project.pbxproj rename to packages/cli/src/tools/__fixtures__/files/project.pbxproj diff --git a/packages/cli/src/core/__fixtures__/ios.js b/packages/cli/src/tools/__fixtures__/ios.js similarity index 100% rename from packages/cli/src/core/__fixtures__/ios.js rename to packages/cli/src/tools/__fixtures__/ios.js diff --git a/packages/cli/src/core/__fixtures__/projects.js b/packages/cli/src/tools/__fixtures__/projects.js similarity index 100% rename from packages/cli/src/core/__fixtures__/projects.js rename to packages/cli/src/tools/__fixtures__/projects.js diff --git a/packages/cli/src/util/__mocks__/log.js b/packages/cli/src/tools/__mocks__/log.js similarity index 100% rename from packages/cli/src/util/__mocks__/log.js rename to packages/cli/src/tools/__mocks__/log.js diff --git a/packages/cli/src/util/__tests__/PackageManager-test.js b/packages/cli/src/tools/__tests__/PackageManager-test.js similarity index 100% rename from packages/cli/src/util/__tests__/PackageManager-test.js rename to packages/cli/src/tools/__tests__/PackageManager-test.js diff --git a/packages/cli/src/core/__tests__/android/findAndroidAppFolder-test.js b/packages/cli/src/tools/__tests__/android/findAndroidAppFolder-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/findAndroidAppFolder-test.js rename to packages/cli/src/tools/__tests__/android/findAndroidAppFolder-test.js diff --git a/packages/cli/src/core/__tests__/android/findManifest-test.js b/packages/cli/src/tools/__tests__/android/findManifest-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/findManifest-test.js rename to packages/cli/src/tools/__tests__/android/findManifest-test.js diff --git a/packages/cli/src/core/__tests__/android/findPackageClassName-test.js b/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/findPackageClassName-test.js rename to packages/cli/src/tools/__tests__/android/findPackageClassName-test.js diff --git a/packages/cli/src/core/__tests__/android/getDependencyConfig-test.js b/packages/cli/src/tools/__tests__/android/getDependencyConfig-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/getDependencyConfig-test.js rename to packages/cli/src/tools/__tests__/android/getDependencyConfig-test.js diff --git a/packages/cli/src/core/__tests__/android/getProjectConfig-test.js b/packages/cli/src/tools/__tests__/android/getProjectConfig-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/getProjectConfig-test.js rename to packages/cli/src/tools/__tests__/android/getProjectConfig-test.js diff --git a/packages/cli/src/core/__tests__/android/readManifest-test.js b/packages/cli/src/tools/__tests__/android/readManifest-test.js similarity index 100% rename from packages/cli/src/core/__tests__/android/readManifest-test.js rename to packages/cli/src/tools/__tests__/android/readManifest-test.js diff --git a/packages/cli/src/core/__tests__/findAssets-test.js b/packages/cli/src/tools/__tests__/findAssets-test.js similarity index 100% rename from packages/cli/src/core/__tests__/findAssets-test.js rename to packages/cli/src/tools/__tests__/findAssets-test.js diff --git a/packages/cli/src/core/__tests__/findPlugins-test.js b/packages/cli/src/tools/__tests__/findPlugins-test.js similarity index 100% rename from packages/cli/src/core/__tests__/findPlugins-test.js rename to packages/cli/src/tools/__tests__/findPlugins-test.js diff --git a/packages/cli/src/util/__tests__/findSymlinkedModules-test.js b/packages/cli/src/tools/__tests__/findSymlinkedModules-test.js similarity index 100% rename from packages/cli/src/util/__tests__/findSymlinkedModules-test.js rename to packages/cli/src/tools/__tests__/findSymlinkedModules-test.js diff --git a/packages/cli/src/core/__tests__/ios/findPodfilePath-test.js b/packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js similarity index 100% rename from packages/cli/src/core/__tests__/ios/findPodfilePath-test.js rename to packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js diff --git a/packages/cli/src/core/__tests__/ios/findPodspecName-test.js b/packages/cli/src/tools/__tests__/ios/findPodspecName-test.js similarity index 100% rename from packages/cli/src/core/__tests__/ios/findPodspecName-test.js rename to packages/cli/src/tools/__tests__/ios/findPodspecName-test.js diff --git a/packages/cli/src/core/__tests__/ios/findProject-test.js b/packages/cli/src/tools/__tests__/ios/findProject-test.js similarity index 100% rename from packages/cli/src/core/__tests__/ios/findProject-test.js rename to packages/cli/src/tools/__tests__/ios/findProject-test.js diff --git a/packages/cli/src/core/__tests__/ios/getProjectConfig-test.js b/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js similarity index 100% rename from packages/cli/src/core/__tests__/ios/getProjectConfig-test.js rename to packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js diff --git a/packages/cli/src/core/__tests__/makeCommand-test.js b/packages/cli/src/tools/__tests__/makeCommand-test.js similarity index 100% rename from packages/cli/src/core/__tests__/makeCommand-test.js rename to packages/cli/src/tools/__tests__/makeCommand-test.js diff --git a/packages/cli/src/core/android/findAndroidAppFolder.js b/packages/cli/src/tools/android/findAndroidAppFolder.js similarity index 100% rename from packages/cli/src/core/android/findAndroidAppFolder.js rename to packages/cli/src/tools/android/findAndroidAppFolder.js diff --git a/packages/cli/src/core/android/findManifest.js b/packages/cli/src/tools/android/findManifest.js similarity index 100% rename from packages/cli/src/core/android/findManifest.js rename to packages/cli/src/tools/android/findManifest.js diff --git a/packages/cli/src/core/android/findPackageClassName.js b/packages/cli/src/tools/android/findPackageClassName.js similarity index 100% rename from packages/cli/src/core/android/findPackageClassName.js rename to packages/cli/src/tools/android/findPackageClassName.js diff --git a/packages/cli/src/core/android/index.js b/packages/cli/src/tools/android/index.js similarity index 98% rename from packages/cli/src/core/android/index.js rename to packages/cli/src/tools/android/index.js index 2cf4387db..631c8b80a 100644 --- a/packages/cli/src/core/android/index.js +++ b/packages/cli/src/tools/android/index.js @@ -12,7 +12,7 @@ import findAndroidAppFolder from './findAndroidAppFolder'; import findManifest from './findManifest'; import findPackageClassName from './findPackageClassName'; import readManifest from './readManifest'; -import linkConfigAndroid from '../../link/android'; +import linkConfigAndroid from '../../commands/link/android'; export const linkConfig = linkConfigAndroid; diff --git a/packages/cli/src/core/android/readManifest.js b/packages/cli/src/tools/android/readManifest.js similarity index 100% rename from packages/cli/src/core/android/readManifest.js rename to packages/cli/src/tools/android/readManifest.js diff --git a/packages/cli/src/util/assertRequiredOptions.js b/packages/cli/src/tools/assertRequiredOptions.js similarity index 100% rename from packages/cli/src/util/assertRequiredOptions.js rename to packages/cli/src/tools/assertRequiredOptions.js diff --git a/packages/cli/src/util/copyAndReplace.js b/packages/cli/src/tools/copyAndReplace.js similarity index 100% rename from packages/cli/src/util/copyAndReplace.js rename to packages/cli/src/tools/copyAndReplace.js diff --git a/packages/cli/src/util/errors.js b/packages/cli/src/tools/errors.js similarity index 100% rename from packages/cli/src/util/errors.js rename to packages/cli/src/tools/errors.js diff --git a/packages/cli/src/core/findPlugins.js b/packages/cli/src/tools/findPlugins.js similarity index 100% rename from packages/cli/src/core/findPlugins.js rename to packages/cli/src/tools/findPlugins.js diff --git a/packages/cli/src/util/findReactNativeScripts.js b/packages/cli/src/tools/findReactNativeScripts.js similarity index 100% rename from packages/cli/src/util/findReactNativeScripts.js rename to packages/cli/src/tools/findReactNativeScripts.js diff --git a/packages/cli/src/util/findSymlinkedModules.js b/packages/cli/src/tools/findSymlinkedModules.js similarity index 100% rename from packages/cli/src/util/findSymlinkedModules.js rename to packages/cli/src/tools/findSymlinkedModules.js diff --git a/packages/cli/src/generator/copyProjectTemplateAndReplace.js b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js similarity index 97% rename from packages/cli/src/generator/copyProjectTemplateAndReplace.js rename to packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js index 830a32ade..5a0362a6e 100644 --- a/packages/cli/src/generator/copyProjectTemplateAndReplace.js +++ b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js @@ -9,10 +9,10 @@ import chalk from 'chalk'; import path from 'path'; -import copyAndReplace from '../util/copyAndReplace'; +import copyAndReplace from '../copyAndReplace'; import promptInitializer from './promptSync'; -import walk from '../util/walk'; -import logger from '../util/logger'; +import walk from '../walk'; +import logger from '../logger'; const prompt = promptInitializer(); diff --git a/packages/cli/src/generator/printRunInstructions.js b/packages/cli/src/tools/generator/printRunInstructions.js similarity index 96% rename from packages/cli/src/generator/printRunInstructions.js rename to packages/cli/src/tools/generator/printRunInstructions.js index 592176b34..fa0ab52c5 100644 --- a/packages/cli/src/generator/printRunInstructions.js +++ b/packages/cli/src/tools/generator/printRunInstructions.js @@ -10,7 +10,7 @@ import path from 'path'; import chalk from 'chalk'; -import logger from '../util/logger'; +import logger from '../logger'; function printRunInstructions(projectDir: string, projectName: string) { const absoluteProjectDir = path.resolve(projectDir); diff --git a/packages/cli/src/generator/promptSync.js b/packages/cli/src/tools/generator/promptSync.js similarity index 100% rename from packages/cli/src/generator/promptSync.js rename to packages/cli/src/tools/generator/promptSync.js diff --git a/packages/cli/src/generator/templates.js b/packages/cli/src/tools/generator/templates.js similarity index 98% rename from packages/cli/src/generator/templates.js rename to packages/cli/src/tools/generator/templates.js index db16cc722..66150c6b4 100644 --- a/packages/cli/src/generator/templates.js +++ b/packages/cli/src/tools/generator/templates.js @@ -12,8 +12,8 @@ import { execSync } from 'child_process'; import fs from 'fs'; import path from 'path'; import copyProjectTemplateAndReplace from './copyProjectTemplateAndReplace'; -import logger from '../util/logger'; -import PackageManager from '../util/PackageManager'; +import logger from '../logger'; +import PackageManager from '../PackageManager'; /** * @param destPath Create the new project at this path. diff --git a/packages/cli/src/core/getAssets.js b/packages/cli/src/tools/getAssets.js similarity index 100% rename from packages/cli/src/core/getAssets.js rename to packages/cli/src/tools/getAssets.js diff --git a/packages/cli/src/core/getHooks.js b/packages/cli/src/tools/getHooks.js similarity index 100% rename from packages/cli/src/core/getHooks.js rename to packages/cli/src/tools/getHooks.js diff --git a/packages/cli/src/core/getLegacyConfig.js b/packages/cli/src/tools/getLegacyConfig.js similarity index 100% rename from packages/cli/src/core/getLegacyConfig.js rename to packages/cli/src/tools/getLegacyConfig.js diff --git a/packages/cli/src/core/getPackageConfiguration.js b/packages/cli/src/tools/getPackageConfiguration.js similarity index 100% rename from packages/cli/src/core/getPackageConfiguration.js rename to packages/cli/src/tools/getPackageConfiguration.js diff --git a/packages/cli/src/core/getParams.js b/packages/cli/src/tools/getParams.js similarity index 100% rename from packages/cli/src/core/getParams.js rename to packages/cli/src/tools/getParams.js diff --git a/packages/cli/src/core/getPlatforms.js b/packages/cli/src/tools/getPlatforms.js similarity index 100% rename from packages/cli/src/core/getPlatforms.js rename to packages/cli/src/tools/getPlatforms.js diff --git a/packages/cli/src/util/gracefulifyFs.js b/packages/cli/src/tools/gracefulifyFs.js similarity index 100% rename from packages/cli/src/util/gracefulifyFs.js rename to packages/cli/src/tools/gracefulifyFs.js diff --git a/packages/cli/src/core/ios/findPodfilePath.js b/packages/cli/src/tools/ios/findPodfilePath.js similarity index 100% rename from packages/cli/src/core/ios/findPodfilePath.js rename to packages/cli/src/tools/ios/findPodfilePath.js diff --git a/packages/cli/src/core/ios/findPodspecName.js b/packages/cli/src/tools/ios/findPodspecName.js similarity index 100% rename from packages/cli/src/core/ios/findPodspecName.js rename to packages/cli/src/tools/ios/findPodspecName.js diff --git a/packages/cli/src/core/ios/findProject.js b/packages/cli/src/tools/ios/findProject.js similarity index 100% rename from packages/cli/src/core/ios/findProject.js rename to packages/cli/src/tools/ios/findProject.js diff --git a/packages/cli/src/core/ios/index.js b/packages/cli/src/tools/ios/index.js similarity index 96% rename from packages/cli/src/core/ios/index.js rename to packages/cli/src/tools/ios/index.js index 37771ffe5..6e0c537c9 100644 --- a/packages/cli/src/core/ios/index.js +++ b/packages/cli/src/tools/ios/index.js @@ -11,7 +11,7 @@ import path from 'path'; import findProject from './findProject'; import findPodfilePath from './findPodfilePath'; import findPodspecName from './findPodspecName'; -import linkConfigIos from '../../link/ios'; +import linkConfigIos from '../../commands/link/ios'; export const linkConfig = linkConfigIos; diff --git a/packages/cli/src/util/isPackagerRunning.js b/packages/cli/src/tools/isPackagerRunning.js similarity index 100% rename from packages/cli/src/util/isPackagerRunning.js rename to packages/cli/src/tools/isPackagerRunning.js diff --git a/packages/cli/src/util/isValidPackageName.js b/packages/cli/src/tools/isValidPackageName.js similarity index 100% rename from packages/cli/src/util/isValidPackageName.js rename to packages/cli/src/tools/isValidPackageName.js diff --git a/packages/cli/src/util/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js similarity index 93% rename from packages/cli/src/util/loadMetroConfig.js rename to packages/cli/src/tools/loadMetroConfig.js index 52f9ad53a..2d79bb173 100644 --- a/packages/cli/src/util/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -5,8 +5,8 @@ import path from 'path'; import { createBlacklist } from 'metro'; import { loadConfig } from 'metro-config'; -import type { ContextT } from '../core/types.flow'; -import findPlugins from '../core/findPlugins'; +import type { ContextT } from './types.flow'; +import findPlugins from './findPlugins'; import findSymlinkedModules from './findSymlinkedModules'; const resolveSymlinksForRoots = roots => @@ -48,7 +48,7 @@ export const getDefaultConfig = (ctx: ContextT) => { serializer: { getModulesRunBeforeMainModule: () => [ require.resolve( - path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore') + path.join(ctx.reactNativePath, 'Libraries/tools/InitializeCore') ), ], getPolyfills: () => diff --git a/packages/cli/src/util/logger.js b/packages/cli/src/tools/logger.js similarity index 100% rename from packages/cli/src/util/logger.js rename to packages/cli/src/tools/logger.js diff --git a/packages/cli/src/core/types.flow.js b/packages/cli/src/tools/types.flow.js similarity index 100% rename from packages/cli/src/core/types.flow.js rename to packages/cli/src/tools/types.flow.js diff --git a/packages/cli/src/util/walk.js b/packages/cli/src/tools/walk.js similarity index 100% rename from packages/cli/src/util/walk.js rename to packages/cli/src/tools/walk.js diff --git a/packages/cli/src/util/yarn.js b/packages/cli/src/tools/yarn.js similarity index 100% rename from packages/cli/src/util/yarn.js rename to packages/cli/src/tools/yarn.js diff --git a/packages/cli/testSetup.js b/packages/cli/testSetup.js index 221013ed9..7a043b8b8 100644 --- a/packages/cli/testSetup.js +++ b/packages/cli/testSetup.js @@ -1,2 +1,2 @@ // @flow -jest.mock('./src/util/logger'); +jest.mock('./src/tools/logger');