From 885f2c28d4e8ed66e334fd7bd0174173b2a394e1 Mon Sep 17 00:00:00 2001 From: Drapich Piotr Date: Tue, 5 Mar 2019 20:52:51 +0100 Subject: [PATCH 001/234] chore: use @react-native-community/eslint-config (#205) Summary: --------- I changed @callstack/eslint-config to @react-native-community/eslint-config and fixed all lint issues. Test Plan: ---------- Green CI --- babel.config.js | 7 +- package.json | 18 +- packages/cli/src/__mocks__/fs.js | 12 +- packages/cli/src/__mocks__/path.js | 2 +- packages/cli/src/cliEntry.js | 24 +- .../__tests__/getAssetDestPathAndroid-test.js | 6 +- .../__tests__/getAssetDestPathIOS-test.js | 6 +- .../cli/src/commands/bundle/assetPathUtils.js | 4 +- .../cli/src/commands/bundle/buildBundle.js | 6 +- packages/cli/src/commands/bundle/bundle.js | 2 +- .../bundle/filterPlatformAssetScales.js | 2 +- .../bundle/getAssetDestPathAndroid.js | 4 +- .../commands/bundle/getAssetDestPathIOS.js | 2 +- packages/cli/src/commands/bundle/ramBundle.js | 2 +- .../cli/src/commands/bundle/saveAssets.js | 2 +- .../src/commands/dependencies/dependencies.js | 6 +- packages/cli/src/commands/eject/eject.js | 21 +- packages/cli/src/commands/index.js | 8 +- packages/cli/src/commands/info/info.js | 4 +- packages/cli/src/commands/init/init.js | 13 +- packages/cli/src/commands/install/install.js | 7 +- .../cli/src/commands/install/uninstall.js | 4 +- packages/cli/src/commands/library/library.js | 6 +- .../link/__tests__/android/applyPatch-test.js | 6 +- .../__tests__/android/isInstalled-test.js | 4 +- .../__tests__/android/makeBuildPatch-test.js | 14 +- .../__tests__/android/makeImportPatch-test.js | 4 +- .../android/makePackagePatch-test.js | 4 +- .../android/makeSettingsPatch-test.js | 12 +- .../android/makeStringsPatch-test.js | 2 +- .../__tests__/getDependencyConfig-test.js | 10 +- .../__tests__/getProjectDependencies-test.js | 2 +- .../__tests__/ios/addFileToProject-test.js | 8 +- .../ios/addProjectToLibraries-test.js | 4 +- .../__tests__/ios/addSharedLibraries-test.js | 2 +- .../link/__tests__/ios/createGroup-test.js | 6 +- .../__tests__/ios/getBuildProperty-test.js | 2 +- .../link/__tests__/ios/getGroup-test.js | 2 +- .../__tests__/ios/getHeaderSearchPath-test.js | 22 +- .../link/__tests__/ios/getPlist-test.js | 2 +- .../link/__tests__/ios/getPlistPath-test.js | 2 +- .../link/__tests__/ios/getTargets-test.js | 2 +- .../__tests__/ios/hasLibraryImported-test.js | 2 +- .../link/__tests__/ios/isInstalled-test.js | 6 +- .../ios/mapHeaderSearchPaths-test.js | 2 +- .../ios/removeProjectFromLibraries-test.js | 6 +- .../ios/removeProjectFromProject-test.js | 4 +- .../__tests__/ios/removeSharedLibrary-test.js | 2 +- .../link/__tests__/ios/writePlist-test.js | 8 +- .../src/commands/link/__tests__/link-test.js | 58 ++- .../__tests__/pods/findLineToAddPod-test.js | 16 +- .../pods/findMarkedLinesInPodfile-test.js | 8 +- .../link/__tests__/pods/isInstalled-test.js | 14 +- .../__tests__/pods/removePodEntry-test.js | 10 +- .../link/__tests__/promiseWaterfall-test.js | 2 +- .../src/commands/link/android/copyAssets.js | 4 +- .../cli/src/commands/link/android/index.js | 2 +- .../link/android/patches/applyParams.js | 2 +- .../link/android/patches/applyPatch.js | 2 +- .../link/android/patches/makeBuildPatch.js | 2 +- .../link/android/patches/makeSettingsPatch.js | 4 +- .../link/android/patches/makeStringsPatch.js | 2 +- .../link/android/patches/revokePatch.js | 2 +- .../link/android/registerNativeModule.js | 8 +- .../src/commands/link/android/unlinkAssets.js | 2 +- .../link/android/unregisterNativeModule.js | 12 +- .../src/commands/link/getDependencyConfig.js | 6 +- .../cli/src/commands/link/getProjectConfig.js | 6 +- .../commands/link/getProjectDependencies.js | 2 +- .../cli/src/commands/link/groupFilesByType.js | 2 +- .../commands/link/ios/addSharedLibraries.js | 2 +- .../link/ios/common/registerNativeModule.js | 2 +- .../link/ios/common/unregisterNativeModule.js | 4 +- .../cli/src/commands/link/ios/copyAssets.js | 2 +- .../link/ios/createGroupWithMessage.js | 2 +- .../commands/link/ios/getHeaderSearchPath.js | 4 +- .../cli/src/commands/link/ios/getPlistPath.js | 2 +- .../cli/src/commands/link/ios/getTargets.js | 2 +- packages/cli/src/commands/link/ios/index.js | 2 +- .../commands/link/ios/mapHeaderSearchPaths.js | 2 +- .../commands/link/ios/registerNativeModule.js | 10 +- .../link/ios/removeFromHeaderSearchPaths.js | 2 +- .../link/ios/removeFromProjectReferences.js | 6 +- .../link/ios/removeProjectFromLibraries.js | 3 +- .../link/ios/removeSharedLibraries.js | 2 +- .../cli/src/commands/link/ios/unlinkAssets.js | 10 +- .../link/ios/unregisterNativeModule.js | 12 +- .../cli/src/commands/link/ios/writePlist.js | 2 +- packages/cli/src/commands/link/link.js | 12 +- packages/cli/src/commands/link/linkAll.js | 16 +- packages/cli/src/commands/link/linkAssets.js | 6 +- .../cli/src/commands/link/linkDependency.js | 14 +- .../cli/src/commands/link/pods/addPodEntry.js | 8 +- .../link/pods/findMarkedLinesInPodfile.js | 2 +- .../cli/src/commands/link/pods/isInstalled.js | 2 +- .../link/pods/registerNativeModule.js | 4 +- .../src/commands/link/pods/removePodEntry.js | 2 +- .../cli/src/commands/link/promiseWaterfall.js | 2 +- packages/cli/src/commands/link/promisify.js | 2 +- packages/cli/src/commands/link/unlink.js | 32 +- .../cli/src/commands/logAndroid/logAndroid.js | 4 +- packages/cli/src/commands/logIOS/logIOS.js | 8 +- .../__tests__/runOnAllDevices.test.js | 4 +- packages/cli/src/commands/runAndroid/adb.js | 6 +- .../cli/src/commands/runAndroid/runAndroid.js | 48 ++- .../commands/runAndroid/runOnAllDevices.js | 26 +- .../runAndroid/tryLaunchAppOnDevice.js | 8 +- .../commands/runAndroid/tryRunAdbReverse.js | 2 +- .../__tests__/findMatchingSimulator-test.js | 50 +-- .../runIOS/__tests__/findXcodeProject-test.js | 6 +- .../__tests__/parseIOSDevicesList-test.js | 4 +- .../commands/runIOS/findMatchingSimulator.js | 9 +- .../commands/runIOS/parseIOSDevicesList.js | 2 +- packages/cli/src/commands/runIOS/runIOS.js | 63 ++-- .../src/commands/server/copyToClipBoard.js | 2 +- .../server/debugger-ui/DeltaPatcher.js | 4 +- .../server/debugger-ui/debuggerWorker.js | 6 +- .../src/commands/server/jsPackagerClient.js | 16 +- .../cli/src/commands/server/launchChrome.js | 6 +- .../cli/src/commands/server/launchEditor.js | 16 +- .../cli/src/commands/server/messageSocket.js | 33 +- .../server/middleware/MiddlewareManager.js | 4 +- .../middleware/getDevToolsMiddleware.js | 8 +- .../openStackFrameInEditorMiddleware.js | 2 +- .../middleware/systraceProfileMiddleware.js | 6 +- packages/cli/src/commands/server/runServer.js | 8 +- .../cli/src/commands/server/webSocketProxy.js | 8 +- .../upgrade/__tests__/upgrade.test.js | 31 +- packages/cli/src/commands/upgrade/helpers.js | 2 +- .../cli/src/commands/upgrade/legacyUpgrade.js | 34 +- packages/cli/src/commands/upgrade/upgrade.js | 70 ++-- packages/cli/src/tools/PackageManager.js | 10 +- .../cli/src/tools/__fixtures__/android.js | 10 +- packages/cli/src/tools/__fixtures__/ios.js | 4 +- .../cli/src/tools/__fixtures__/projects.js | 2 +- .../tools/__tests__/PackageManager-test.js | 36 +- .../android/findPackageClassName-test.js | 6 +- .../src/tools/__tests__/findAssets-test.js | 4 +- .../src/tools/__tests__/findPlugins-test.js | 20 +- .../tools/__tests__/ios/findProject-test.js | 8 +- .../__tests__/ios/getProjectConfig-test.js | 2 +- .../src/tools/__tests__/makeCommand-test.js | 2 +- .../src/tools/android/findPackageClassName.js | 2 +- packages/cli/src/tools/android/index.js | 12 +- .../cli/src/tools/assertRequiredOptions.js | 4 +- packages/cli/src/tools/copyAndReplace.js | 2 +- packages/cli/src/tools/findPlugins.js | 14 +- .../cli/src/tools/findReactNativeScripts.js | 2 +- .../cli/src/tools/findSymlinkedModules.js | 12 +- .../copyProjectTemplateAndReplace.js | 18 +- .../tools/generator/printRunInstructions.js | 4 +- .../cli/src/tools/generator/promptSync.js | 6 +- packages/cli/src/tools/generator/templates.js | 32 +- packages/cli/src/tools/getAssets.js | 4 +- packages/cli/src/tools/getHooks.js | 5 +- packages/cli/src/tools/getLegacyConfig.js | 2 +- .../cli/src/tools/getPackageConfiguration.js | 4 +- packages/cli/src/tools/getPlatforms.js | 6 +- packages/cli/src/tools/ios/findPodspecName.js | 6 +- packages/cli/src/tools/ios/findProject.js | 2 +- packages/cli/src/tools/isPackagerRunning.js | 7 +- packages/cli/src/tools/loadMetroConfig.js | 24 +- packages/cli/src/tools/types.flow.js | 12 +- packages/cli/src/tools/yarn.js | 2 +- packages/global-cli/index.js | 35 +- scripts/build.js | 16 +- scripts/watch.js | 12 +- yarn.lock | 332 ++++++------------ 168 files changed, 820 insertions(+), 1004 deletions(-) diff --git a/babel.config.js b/babel.config.js index 2621b5d72..fd9551e17 100644 --- a/babel.config.js +++ b/babel.config.js @@ -4,7 +4,7 @@ module.exports = { [ require.resolve('@babel/preset-env'), { - targets: { node: 8 }, + targets: {node: 8}, useBuiltIns: 'entry', }, ], @@ -12,9 +12,6 @@ module.exports = { ], plugins: [ require.resolve('@babel/plugin-transform-strict-mode'), - [ - require.resolve('@babel/plugin-transform-modules-commonjs'), - { lazy: true }, - ], + [require.resolve('@babel/plugin-transform-modules-commonjs'), {lazy: true}], ], }; diff --git a/package.json b/package.json index d03f91bc2..4689b5538 100644 --- a/package.json +++ b/package.json @@ -19,32 +19,26 @@ "@babel/plugin-transform-strict-mode": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-flow": "^7.0.0", - "@callstack/eslint-config": "^3.0.2", + "@react-native-community/eslint-config": "^0.0.2", "babel-jest": "^24.0.0", "chalk": "^2.4.2", "eslint": "^5.10.0", - "eslint-plugin-prettier": "^3.0.1", "flow-bin": "^0.94.0", "glob": "^7.1.3", "jest": "^24.0.0", "lerna": "^3.10.6", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", - "prettier": "^1.16.0", "string-length": "^2.0.0" }, "eslintConfig": { - "extends": "@callstack", - "rules": { - "global-require": 0, - "no-console": 0 + "extends": "@react-native-community", + "env": { + "es6": true, + "jest": true, + "node": true } }, - "prettier": { - "proseWrap": "never", - "singleQuote": true, - "trailingComma": "es5" - }, "jest": { "projects": [ "packages/*" diff --git a/packages/cli/src/__mocks__/fs.js b/packages/cli/src/__mocks__/fs.js index f6cde8d67..2220206cf 100644 --- a/packages/cli/src/__mocks__/fs.js +++ b/packages/cli/src/__mocks__/fs.js @@ -14,7 +14,7 @@ let fs; function setMockFilesystem(object, platform) { reset(platform); const root = platform === 'win32' ? 'c:\\' : '/'; - mockDir(root, { ...object }); + mockDir(root, {...object}); return root; } @@ -24,14 +24,14 @@ function mockDir(dirPath, desc) { const entPath = path.join(dirPath, entName); if (typeof ent === 'string' || ent instanceof Buffer) { fs.writeFileSync(entPath, ent); - continue; // eslint-disable-line no-continue + continue; } if (typeof ent !== 'object') { throw new Error(util.format('invalid entity:', ent)); } if (ent.SYMLINK != null) { fs.symlinkSync(ent.SYMLINK, entPath); - continue; // eslint-disable-line no-continue + continue; } fs.mkdirSync(entPath); mockDir(entPath, ent); @@ -41,18 +41,18 @@ function mockDir(dirPath, desc) { function reset(platform) { if (path.mock == null) { throw new Error( - 'to use this "fs" module mock, you must also mock the "path" module' + 'to use this "fs" module mock, you must also mock the "path" module', ); } path.mock.reset(platform); const cwd = () => (platform === 'win32' ? 'c:\\' : '/'); - fs = new MemoryFS({ platform, cwd }); + fs = new MemoryFS({platform, cwd}); Object.assign(mockFs, fs); } const mockFs = {}; mockFs.__setMockFilesystem = setMockFilesystem; -mockFs.mock = { clear: reset }; +mockFs.mock = {clear: reset}; reset('posix'); diff --git a/packages/cli/src/__mocks__/path.js b/packages/cli/src/__mocks__/path.js index 884f26590..b19d3d3b4 100644 --- a/packages/cli/src/__mocks__/path.js +++ b/packages/cli/src/__mocks__/path.js @@ -13,7 +13,7 @@ function reset(platform) { Object.assign(mockPath, jest.requireActual('path')[platform]); } -mockPath.mock = { reset }; +mockPath.mock = {reset}; reset('posix'); diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 8e8efe5ca..90ee8dea5 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -12,9 +12,9 @@ import childProcess from 'child_process'; import commander from 'commander'; import minimist from 'minimist'; import path from 'path'; -import type { CommandT, ContextT } from './tools/types.flow'; +import type {CommandT, ContextT} from './tools/types.flow'; import getLegacyConfig from './tools/getLegacyConfig'; -import { getCommands } from './commands'; +import {getCommands} from './commands'; import init from './commands/init/init'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; @@ -81,8 +81,8 @@ function printUnknownCommand(cmdName) { logger.error(`Unrecognized command "${chalk.bold(cmdName)}".`); logger.info( `Run ${chalk.bold( - '"react-native --help"' - )} to see a list of all available commands.` + '"react-native --help"', + )} to see a list of all available commands.`, ); } else { commander.outputHelp(); @@ -119,8 +119,8 @@ const addCommand = (command: CommandT, ctx: ContextT) => { opt.command, opt.description, opt.parse || defaultOptParser, - opt.default - ) + opt.default, + ), ); // Redefined here to appear in the `--help` section @@ -144,15 +144,15 @@ async function setupAndRun() { const absolutePath = path.join(__dirname, '..', scriptName); try { - childProcess.execFileSync(absolutePath, { stdio: 'pipe' }); + childProcess.execFileSync(absolutePath, {stdio: 'pipe'}); } catch (error) { logger.warn( `Failed to run environment setup script "${scriptName}"\n\n${chalk.red( - error - )}` + error, + )}`, ); logger.info( - `React Native CLI will continue to run if your local environment matches what React Native expects. If it does fail, check out "${absolutePath}" and adjust your environment to match it.` + `React Native CLI will continue to run if your local environment matches what React Native expects. If it does fail, check out "${absolutePath}" and adjust your environment to match it.`, ); } } @@ -177,11 +177,11 @@ async function setupAndRun() { // $FlowIssue: Wrong `require.resolve` type definition require.resolve('react-native/package.json', { paths: [root], - }) + }), ); } catch (_ignored) { throw new Error( - 'Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies.' + 'Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies.', ); } })(); diff --git a/packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js index c169e0a3c..2670f14cd 100644 --- a/packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js +++ b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js @@ -25,7 +25,7 @@ describe('getAssetDestPathAndroid', () => { const expectDestPathForScaleToStartWith = (scale, location) => { if (!getAssetDestPathAndroid(asset, scale).startsWith(location)) { throw new Error( - `asset for scale ${scale} should start with path '${location}'` + `asset for scale ${scale} should start with path '${location}'`, ); } }; @@ -45,7 +45,7 @@ describe('getAssetDestPathAndroid', () => { }; expect(getAssetDestPathAndroid(asset, 1)).toBe( - path.normalize('drawable-mdpi/app_test_icon.png') + path.normalize('drawable-mdpi/app_test_icon.png'), ); }); @@ -67,7 +67,7 @@ describe('getAssetDestPathAndroid', () => { }; expect(getAssetDestPathAndroid(asset, 1)).toBe( - path.normalize('raw/app_test_video.mp4') + path.normalize('raw/app_test_video.mp4'), ); }); }); diff --git a/packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js index 37878875a..7a820b617 100644 --- a/packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js +++ b/packages/cli/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js @@ -23,7 +23,7 @@ describe('getAssetDestPathIOS', () => { }; expect(getAssetDestPathIOS(asset, 1)).toBe( - path.normalize('assets/test/icon.png') + path.normalize('assets/test/icon.png'), ); }); @@ -35,10 +35,10 @@ describe('getAssetDestPathIOS', () => { }; expect(getAssetDestPathIOS(asset, 2)).toBe( - path.normalize('assets/test/icon@2x.png') + path.normalize('assets/test/icon@2x.png'), ); expect(getAssetDestPathIOS(asset, 3)).toBe( - path.normalize('assets/test/icon@3x.png') + path.normalize('assets/test/icon@3x.png'), ); }); }); diff --git a/packages/cli/src/commands/bundle/assetPathUtils.js b/packages/cli/src/commands/bundle/assetPathUtils.js index 7778684de..32334dd72 100644 --- a/packages/cli/src/commands/bundle/assetPathUtils.js +++ b/packages/cli/src/commands/bundle/assetPathUtils.js @@ -56,8 +56,8 @@ function getAndroidResourceFolderName(asset: PackagerAsset, scale: number) { if (!suffix) { throw new Error( `Don't know which android drawable suffix to use for asset: ${JSON.stringify( - asset - )}` + asset, + )}`, ); } const androidFolder = `drawable-${suffix}`; diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index a10dc2457..fc9088354 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -11,8 +11,8 @@ 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 '../../tools/types.flow'; +import type {CommandLineArgs} from './bundleCommandLineArgs'; +import type {ContextT} from '../../tools/types.flow'; import saveAssets from './saveAssets'; import loadMetroConfig from '../../tools/loadMetroConfig'; import logger from '../../tools/logger'; @@ -20,7 +20,7 @@ import logger from '../../tools/logger'; async function buildBundle( args: CommandLineArgs, ctx: ContextT, - output: typeof outputBundle = outputBundle + output: typeof outputBundle = outputBundle, ) { const config = await loadMetroConfig(ctx, { resetCache: args.resetCache, diff --git a/packages/cli/src/commands/bundle/bundle.js b/packages/cli/src/commands/bundle/bundle.js index 5c5788209..dc9790ec5 100644 --- a/packages/cli/src/commands/bundle/bundle.js +++ b/packages/cli/src/commands/bundle/bundle.js @@ -28,4 +28,4 @@ export default { const withOutput = bundleWithOutput; -export { withOutput }; +export {withOutput}; diff --git a/packages/cli/src/commands/bundle/filterPlatformAssetScales.js b/packages/cli/src/commands/bundle/filterPlatformAssetScales.js index c34d6b4cd..94c6bd9fa 100644 --- a/packages/cli/src/commands/bundle/filterPlatformAssetScales.js +++ b/packages/cli/src/commands/bundle/filterPlatformAssetScales.js @@ -14,7 +14,7 @@ const ALLOWED_SCALES = { function filterPlatformAssetScales( platform: string, - scales: $ReadOnlyArray + scales: $ReadOnlyArray, ): $ReadOnlyArray { const whitelist = ALLOWED_SCALES[platform]; if (!whitelist) { diff --git a/packages/cli/src/commands/bundle/getAssetDestPathAndroid.js b/packages/cli/src/commands/bundle/getAssetDestPathAndroid.js index d331b2f19..510d6ab48 100644 --- a/packages/cli/src/commands/bundle/getAssetDestPathAndroid.js +++ b/packages/cli/src/commands/bundle/getAssetDestPathAndroid.js @@ -9,14 +9,14 @@ */ import path from 'path'; -import type { PackagerAsset } from './assetPathUtils'; +import type {PackagerAsset} from './assetPathUtils'; import assetPathUtils from './assetPathUtils'; function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string { const androidFolder = assetPathUtils.getAndroidResourceFolderName( asset, - scale + scale, ); const fileName = assetPathUtils.getAndroidResourceIdentifier(asset); return path.join(androidFolder, `${fileName}.${asset.type}`); diff --git a/packages/cli/src/commands/bundle/getAssetDestPathIOS.js b/packages/cli/src/commands/bundle/getAssetDestPathIOS.js index e8e153d03..cc50c2be1 100644 --- a/packages/cli/src/commands/bundle/getAssetDestPathIOS.js +++ b/packages/cli/src/commands/bundle/getAssetDestPathIOS.js @@ -9,7 +9,7 @@ */ import path from 'path'; -import type { PackagerAsset } from './assetPathUtils'; +import type {PackagerAsset} from './assetPathUtils'; function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string { const suffix = scale === 1 ? '' : `@${scale}x`; diff --git a/packages/cli/src/commands/bundle/ramBundle.js b/packages/cli/src/commands/bundle/ramBundle.js index c4fdbd732..6b5e5a1af 100644 --- a/packages/cli/src/commands/bundle/ramBundle.js +++ b/packages/cli/src/commands/bundle/ramBundle.js @@ -8,7 +8,7 @@ */ import outputUnbundle from 'metro/src/shared/output/RamBundle'; -import { withOutput as bundleWithOutput } from './bundle'; +import {withOutput as bundleWithOutput} from './bundle'; import bundleCommandLineArgs from './bundleCommandLineArgs'; /** diff --git a/packages/cli/src/commands/bundle/saveAssets.js b/packages/cli/src/commands/bundle/saveAssets.js index c98bbb315..257cf111e 100644 --- a/packages/cli/src/commands/bundle/saveAssets.js +++ b/packages/cli/src/commands/bundle/saveAssets.js @@ -28,7 +28,7 @@ function saveAssets(assets, platform, assetsDest) { const filesToCopy = Object.create(null); // Map src -> dest assets.forEach(asset => { const validScales = new Set( - filterPlatformAssetScales(platform, asset.scales) + filterPlatformAssetScales(platform, asset.scales), ); asset.scales.forEach((scale, idx) => { if (!validScales.has(scale)) { diff --git a/packages/cli/src/commands/dependencies/dependencies.js b/packages/cli/src/commands/dependencies/dependencies.js index c7a4e5d46..2004e04e9 100644 --- a/packages/cli/src/commands/dependencies/dependencies.js +++ b/packages/cli/src/commands/dependencies/dependencies.js @@ -18,7 +18,7 @@ async function dependencies(argv, configPromise, args, packagerInstance) { const config = await configPromise; if (!fs.existsSync(rootModuleAbsolutePath)) { return Promise.reject( - new Error(`File ${rootModuleAbsolutePath} does not exist`) + new Error(`File ${rootModuleAbsolutePath} does not exist`), ); } @@ -26,7 +26,7 @@ async function dependencies(argv, configPromise, args, packagerInstance) { const relativePath = path.relative( config.projectRoot, - rootModuleAbsolutePath + rootModuleAbsolutePath, ); const options = { @@ -69,7 +69,7 @@ export default { description: 'lists dependencies', func: util.deprecate( dependencies, - 'dependencies command was moved to metro, and will be removed from cli in next release' + 'dependencies command was moved to metro, and will be removed from cli in next release', ), options: [ { diff --git a/packages/cli/src/commands/eject/eject.js b/packages/cli/src/commands/eject/eject.js index c8c970eb6..c746193fb 100644 --- a/packages/cli/src/commands/eject/eject.js +++ b/packages/cli/src/commands/eject/eject.js @@ -29,7 +29,7 @@ function eject() { if (doesIOSExist && doesAndroidExist) { logger.error( 'Both the iOS and Android folders already exist! Please delete `ios` and/or `android` ' + - 'before ejecting.' + 'before ejecting.', ); process.exit(1); } @@ -41,9 +41,9 @@ function eject() { logger.error( 'Eject requires an `app.json` config file to be located at ' + `${path.resolve( - 'app.json' + 'app.json', )}, and it must at least specify a \`name\` for the project ` + - "name, and a `displayName` for the app's home screen label." + "name, and a `displayName` for the app's home screen label.", ); process.exit(1); } @@ -52,22 +52,21 @@ function eject() { if (!appName) { logger.error( 'App `name` must be defined in the `app.json` config file to define the project name. ' + - 'It must not contain any spaces or dashes.' + 'It must not contain any spaces or dashes.', ); process.exit(1); } - // eslint-disable-next-line prefer-destructuring const displayName = appConfig.displayName; if (!displayName) { logger.error( 'App `displayName` must be defined in the `app.json` config file, to define the label ' + - 'of the app on the home screen.' + 'of the app on the home screen.', ); process.exit(1); } - const templateOptions = { displayName }; + const templateOptions = {displayName}; if (!doesIOSExist) { logger.info('Generating the iOS folder.'); @@ -79,11 +78,11 @@ function eject() { 'cli', 'templates', 'HelloWorld', - 'ios' + 'ios', ), path.resolve('ios'), appName, - templateOptions + templateOptions, ); } @@ -97,11 +96,11 @@ function eject() { 'cli', 'templates', 'HelloWorld', - 'android' + 'android', ), path.resolve('android'), appName, - templateOptions + templateOptions, ); } } diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index bab984b73..b35c831fb 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -85,16 +85,16 @@ const loadProjectCommands = (root: string): Array => { | Array = require(path.join( root, 'node_modules', - pathToCommands + pathToCommands, )); if (Array.isArray(requiredCommands)) { return acc.concat( - requiredCommands.map(requiredCommand => ({ ...requiredCommand, pkg })) + requiredCommands.map(requiredCommand => ({...requiredCommand, pkg})), ); } - return acc.concat({ ...requiredCommands }); + return acc.concat({...requiredCommands}); }, []); }; @@ -111,7 +111,7 @@ export function getCommands(root: string): Array { [ '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') + ].join('\n'), ); }, }, diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index 9b6bffaca..aef9b2e64 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -24,7 +24,7 @@ const info = function getInfo(argv, ctx, options) { !options.packages.includes('*')) || !options.packages ? ['react', 'react-native'].concat( - (options.packages || '').split(',') + (options.packages || '').split(','), ) : options.packages, npmGlobalPackages: '*react-native*', @@ -32,7 +32,7 @@ const info = function getInfo(argv, ctx, options) { { clipboard: !!options.clipboard, title: 'React Native Environment Info', - } + }, ) .then(logger.info) .catch(err => { diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index c904c4d09..97dfedd18 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -12,7 +12,7 @@ import minimist from 'minimist'; import path from 'path'; import process from 'process'; import printRunInstructions from '../../tools/generator/printRunInstructions'; -import { createProjectFromTemplate } from '../../tools/generator/templates'; +import {createProjectFromTemplate} from '../../tools/generator/templates'; import PackageManager from '../../tools/PackageManager'; import logger from '../../tools/logger'; @@ -49,12 +49,11 @@ function init(projectDir, argsOrName) { * @param options Command line arguments parsed by minimist. */ function generateProject(destinationRoot, newProjectName, options) { - // eslint-disable-next-line import/no-unresolved const reactNativePackageJson = require('react-native/package.json'); - const { peerDependencies } = reactNativePackageJson; + const {peerDependencies} = reactNativePackageJson; if (!peerDependencies) { logger.error( - "Missing React peer dependency in React Native's package.json. Aborting." + "Missing React peer dependency in React Native's package.json. Aborting.", ); return; } @@ -62,7 +61,7 @@ function generateProject(destinationRoot, newProjectName, options) { const reactVersion = peerDependencies.react; if (!reactVersion) { logger.error( - "Missing React peer dependency in React Native's package.json. Aborting." + "Missing React peer dependency in React Native's package.json. Aborting.", ); return; } @@ -76,7 +75,7 @@ function generateProject(destinationRoot, newProjectName, options) { destinationRoot, newProjectName, options.template, - destinationRoot + destinationRoot, ); logger.info('Adding required dependencies'); @@ -109,7 +108,7 @@ function addJestToPackageJson(destinationRoot) { }; fs.writeFileSync( packageJSONPath, - `${JSON.stringify(packageJSON, null, 2)}\n` + `${JSON.stringify(packageJSON, null, 2)}\n`, ); } diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index ce575841e..cb514c606 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -7,7 +7,7 @@ * @flow */ -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import PackageManager from '../../tools/PackageManager'; import link from '../link/link'; @@ -16,11 +16,10 @@ async function install(args: Array, ctx: ContextT) { const name = args[0]; logger.info(`Installing "${name}"...`); - new PackageManager({ projectDir: ctx.root }).install([name]); + new PackageManager({projectDir: ctx.root}).install([name]); logger.info(`Linking "${name}"...`); - // eslint-disable-next-line import/no-named-as-default-member - await link.func([name], ctx, { platforms: undefined }); + await link.func([name], ctx, {platforms: undefined}); logger.success(`Successfully installed and linked "${name}"`); } diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index fb10f4754..4300387b1 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -7,7 +7,7 @@ * @flow */ -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import PackageManager from '../../tools/PackageManager'; import link from '../link/unlink'; @@ -19,7 +19,7 @@ async function uninstall(args: Array, ctx: ContextT) { await link.func([name], ctx); logger.info(`Uninstalling "${name}"...`); - new PackageManager({ projectDir: ctx.root }).uninstall([name]); + new PackageManager({projectDir: ctx.root}).uninstall([name]); logger.success(`Successfully uninstalled and unlinked "${name}"`); } diff --git a/packages/cli/src/commands/library/library.js b/packages/cli/src/commands/library/library.js index f98978f00..5a1b13c85 100644 --- a/packages/cli/src/commands/library/library.js +++ b/packages/cli/src/commands/library/library.js @@ -21,7 +21,7 @@ async function library(argv, ctx, args) { if (!isValidPackageName(args.name)) { throw new Error( `${args.name} is not a valid name for a project. Please use a valid ` + - `identifier name (alphanumeric).` + 'identifier name (alphanumeric).', ); } @@ -31,7 +31,7 @@ async function library(argv, ctx, args) { 'node_modules', 'react-native', 'Libraries', - 'Sample' + 'Sample', ); if (!fs.existsSync(libraries)) { @@ -52,7 +52,7 @@ async function library(argv, ctx, args) { const dest = path.relative( source, - f.replace(/Sample/g, args.name).replace(/^_/, '.') + f.replace(/Sample/g, args.name).replace(/^_/, '.'), ); copyAndReplace(path.resolve(source, f), path.resolve(libraryDest, dest), { Sample: args.name, diff --git a/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js b/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js index c298513ae..a088303ff 100644 --- a/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js @@ -5,14 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable no-template-curly-in-string */ - import applyParams from '../../android/patches/applyParams'; describe('applyParams', () => { it('apply params to the string', () => { - expect(applyParams('${foo}', { foo: 'foo' }, 'react-native')).toEqual( - 'getResources().getString(R.string.reactNative_foo)' + expect(applyParams('${foo}', {foo: 'foo'}, 'react-native')).toEqual( + 'getResources().getString(R.string.reactNative_foo)', ); }); diff --git a/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js index fac2114d7..151ed63d9 100644 --- a/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js +++ b/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js @@ -15,7 +15,7 @@ const path = require('path'); const projectConfig = { buildGradlePath: path.join( __dirname, - '../../__fixtures__/android/patchedBuild.gradle' + '../../__fixtures__/android/patchedBuild.gradle', ), }; @@ -37,6 +37,6 @@ describe('android::isInstalled', () => { 'properly detects if %p project is already in build.gradle', (project, isPresent) => { expect(isInstalled(projectConfig, project)).toBe(isPresent); - } + }, ); }); diff --git a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js index fc00ead44..44b5ac3fe 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js @@ -18,33 +18,33 @@ const normalizedScopedName = normalizeProjectName('@scoped/test'); describe('makeBuildPatch', () => { it('should build a patch function', () => { expect(Object.prototype.toString(makeBuildPatch(name))).toBe( - '[object Object]' + '[object Object]', ); }); it('should make a correct patch', () => { - const { patch } = makeBuildPatch(name); + const {patch} = makeBuildPatch(name); expect(patch).toBe(` implementation project(':${name}')\n`); }); it('should make a correct install check pattern', () => { - const { installPattern } = makeBuildPatch(name); + const {installPattern} = makeBuildPatch(name); expect(installPattern.toString()).toEqual(expect.stringContaining(name)); }); }); describe('makeBuildPatchWithScopedPackage', () => { it('should make a correct patch', () => { - const { patch } = makeBuildPatch(scopedName); + const {patch} = makeBuildPatch(scopedName); expect(patch).toBe( - ` implementation project(':${normalizedScopedName}')\n` + ` implementation project(':${normalizedScopedName}')\n`, ); }); it('should make a correct install check pattern', () => { - const { installPattern } = makeBuildPatch(scopedName); + const {installPattern} = makeBuildPatch(scopedName); expect(installPattern.toString()).toEqual( - expect.stringContaining(normalizedScopedName) + expect.stringContaining(normalizedScopedName), ); }); }); diff --git a/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js index 165230c41..13de71114 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js @@ -15,12 +15,12 @@ const packageImportPath = 'import some.example.project'; describe('makeImportPatch', () => { it('should build a patch', () => { expect(Object.prototype.toString(makeImportPatch(packageImportPath))).toBe( - '[object Object]' + '[object Object]', ); }); it('MainActivity contains a correct import patch', () => { - const { patch } = makeImportPatch(packageImportPath); + const {patch} = makeImportPatch(packageImportPath); expect(patch).toBe(`\n${packageImportPath}`); }); diff --git a/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js b/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js index 409f3894c..457426497 100644 --- a/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable no-template-curly-in-string */ - import makePackagePatch from '../../android/patches/makePackagePatch'; import applyParams from '../../android/patches/applyParams'; @@ -24,7 +22,7 @@ describe('makePackagePatch@0.20', () => { }); it('MainActivity contains a correct 0.20 import patch', () => { - const { patch } = makePackagePatch(packageInstance, params, name); + const {patch} = makePackagePatch(packageInstance, params, name); const processedInstance = applyParams(packageInstance, params, name); expect(patch).toBe(`,\n ${processedInstance}`); diff --git a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js index 429076827..2fc77b2fc 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js @@ -22,7 +22,7 @@ describe('makeSettingsPatch with package "test"', () => { it('should build a patch function', () => { expect( - makeSettingsPatch(name, dependencyConfig, projectConfig) + makeSettingsPatch(name, dependencyConfig, projectConfig), ).toMatchObject({ pattern: '\n', patch: expect.any(String), @@ -30,7 +30,7 @@ describe('makeSettingsPatch with package "test"', () => { }); it('includes project with correct path', () => { - const { patch } = makeSettingsPatch(name, dependencyConfig, projectConfig); + const {patch} = makeSettingsPatch(name, dependencyConfig, projectConfig); expect(patch).toMatchInlineSnapshot(` "include ':test' @@ -59,10 +59,10 @@ project(':test').projectDir = new File(rootProject.projectDir, '../node_modules/ const dependencyConfigWindows = { sourceDir: `C:\\home\\project\\node_modules\\${name}\\android`, }; - const { patch } = makeSettingsPatch( + const {patch} = makeSettingsPatch( name, dependencyConfigWindows, - projectConfigWindows + projectConfigWindows, ); jest.dontMock('path'); @@ -83,7 +83,7 @@ describe('makeSettingsPatch with scoped package "@scoped/test"', () => { it('should build a patch function', () => { expect( - makeSettingsPatch(name, dependencyConfig, projectConfig) + makeSettingsPatch(name, dependencyConfig, projectConfig), ).toMatchObject({ pattern: '\n', patch: expect.any(String), @@ -91,7 +91,7 @@ describe('makeSettingsPatch with scoped package "@scoped/test"', () => { }); it('includes project with correct path', () => { - const { patch } = makeSettingsPatch(name, dependencyConfig, projectConfig); + const {patch} = makeSettingsPatch(name, dependencyConfig, projectConfig); expect(patch).toMatchInlineSnapshot(` "include ':@scoped_test' diff --git a/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js index 9b0c6ec16..f62b9c191 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js @@ -17,7 +17,7 @@ describe('makeStringsPatch', () => { }; expect(makeStringsPatch(params, 'module').patch).toContain( - 'valueA' + 'valueA', ); }); diff --git a/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js b/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js index 26f8eb4c1..73cd1f7a2 100644 --- a/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js +++ b/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js @@ -10,10 +10,10 @@ const platforms = { ios: { - dependencyConfig: () => ({ sampleiOSKey: '' }), + dependencyConfig: () => ({sampleiOSKey: ''}), }, android: { - dependencyConfig: () => ({ sampleAndroidKey: '' }), + dependencyConfig: () => ({sampleAndroidKey: ''}), }, }; @@ -29,9 +29,9 @@ const getDependencyConfig = require('../getDependencyConfig').default; describe('getDependencyConfig', () => { it("should return an array of dependencies' config", () => { const dependencies = getDependencyConfig( - { root: '/root' }, + {root: '/root'}, platforms, - 'react-native-windows' + 'react-native-windows', ); expect(dependencies).toMatchSnapshot(); @@ -39,7 +39,7 @@ describe('getDependencyConfig', () => { it('should throw on invalid react-native dependency', () => { expect(() => - getDependencyConfig({ root: '/root' }, platforms, 'abcd') + getDependencyConfig({root: '/root'}, platforms, 'abcd'), ).toThrowError(); }); }); diff --git a/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js b/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js index d1892eaf8..5eac43b0b 100644 --- a/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js +++ b/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js @@ -29,7 +29,7 @@ describe('getProjectDependencies', () => { '@react-native-community/cli': '*', }, }), - { virtual: true } + {virtual: true}, ); expect(getProjectDependencies(CWD)).toEqual(['lodash']); diff --git a/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js b/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js index 05366ae80..e318c9419 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js @@ -15,7 +15,7 @@ const path = require('path'); const _ = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::addFileToProject', () => { @@ -24,12 +24,12 @@ describe('ios::addFileToProject', () => { }); it('should add file to a project', () => { - const { fileRef } = addFileToProject( + const {fileRef} = addFileToProject( project, - '../../__fixtures__/linearGradient.pbxproj' + '../../__fixtures__/linearGradient.pbxproj', ); expect( - _.includes(Object.keys(project.pbxFileReferenceSection()), fileRef) + _.includes(Object.keys(project.pbxFileReferenceSection()), fileRef), ).toBeTruthy(); }); }); diff --git a/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js index 294195d3f..ee043e301 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js @@ -13,10 +13,10 @@ import addProjectToLibraries from '../../ios/addProjectToLibraries'; const xcode = require('xcode'); const path = require('path'); const PbxFile = require('xcode/lib/pbxFile'); -const { last } = require('lodash'); +const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::addProjectToLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js index c1742a4a4..d6bc90c89 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js @@ -15,7 +15,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::addSharedLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js b/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js index 924d2731e..da718cd0f 100644 --- a/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js @@ -13,10 +13,10 @@ import getGroup from '../../ios/getGroup'; const xcode = require('xcode'); const path = require('path'); -const { last } = require('lodash'); +const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::createGroup', () => { @@ -49,7 +49,7 @@ describe('ios::createGroup', () => { const mainGroup = getGroup(project); expect( - mainGroup.children.filter(group => group.comment === 'Libraries') + mainGroup.children.filter(group => group.comment === 'Libraries'), ).toHaveLength(1); expect(last(outerGroup.children).comment).toBe(createdGroup.name); }); diff --git a/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js b/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js index ca42a07be..b66b2b98c 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::getBuildProperty', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js b/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js index 0312036c6..d100318d1 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::getGroup', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js b/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js index 15860797e..0c0755f55 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js @@ -24,7 +24,7 @@ describe('ios::getHeaderSearchPath', () => { 'react-native-project', 'node_modules', 'package', - 'Gradient.h' + 'Gradient.h', ), path.join('react-native-project', 'node_modules', 'package', 'Manager.h'), ]; @@ -32,7 +32,7 @@ describe('ios::getHeaderSearchPath', () => { const searchPath = getHeaderSearchPath(SRC_DIR, files); expect(searchPath).toBe( - `"${['$(SRCROOT)', '..', 'node_modules', 'package'].join(path.sep)}"` + `"${['$(SRCROOT)', '..', 'node_modules', 'package'].join(path.sep)}"`, ); }); @@ -47,7 +47,7 @@ describe('ios::getHeaderSearchPath', () => { 'package', 'src', 'folderA', - 'Gradient.h' + 'Gradient.h', ), path.join( 'react-native-project', @@ -55,7 +55,7 @@ describe('ios::getHeaderSearchPath', () => { 'package', 'src', 'folderB', - 'Manager.h' + 'Manager.h', ), ]; @@ -63,8 +63,8 @@ describe('ios::getHeaderSearchPath', () => { expect(searchPath).toBe( `"${['$(SRCROOT)', '..', 'node_modules', 'package', 'src'].join( - path.sep - )}/**"` + path.sep, + )}/**"`, ); }); @@ -79,7 +79,7 @@ describe('ios::getHeaderSearchPath', () => { 'package', 'src', 'folderA', - 'Gradient.h' + 'Gradient.h', ), path.join( 'react-native-project', @@ -87,14 +87,14 @@ describe('ios::getHeaderSearchPath', () => { 'package', 'src', 'folderB', - 'Manager.h' + 'Manager.h', ), path.join( 'react-native-project', 'node_modules', 'package', 'src', - 'Manager.h' + 'Manager.h', ), ]; @@ -102,8 +102,8 @@ describe('ios::getHeaderSearchPath', () => { expect(searchPath).toBe( `"${['$(SRCROOT)', '..', 'node_modules', 'package', 'src'].join( - path.sep - )}/**"` + path.sep, + )}/**"`, ); }); }); diff --git a/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js b/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js index aa92dae2d..d28d06b2c 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::getPlist', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js b/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js index f5fa6c6b6..ff5b5f4ad 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::getPlistPath', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js b/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js index aad25bf60..a18758576 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::getTargets', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js b/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js index 80ba7f8df..0b2e9d32a 100644 --- a/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::hasLibraryImported', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js index d8ca549b0..eb51a9aef 100644 --- a/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js @@ -19,17 +19,17 @@ const baseProjectConfig = { describe('ios::isInstalled', () => { it('should return true when .xcodeproj in Libraries', () => { - const dependencyConfig = { projectName: 'React.xcodeproj' }; + const dependencyConfig = {projectName: 'React.xcodeproj'}; expect(isInstalled(baseProjectConfig, dependencyConfig)).toBeTruthy(); }); it('should return false when .xcodeproj not in Libraries', () => { - const dependencyConfig = { projectName: 'Missing.xcodeproj' }; + const dependencyConfig = {projectName: 'Missing.xcodeproj'}; expect(isInstalled(baseProjectConfig, dependencyConfig)).toBeFalsy(); }); it('should return false when `LibraryFolder` is missing', () => { - const dependencyConfig = { projectName: 'React.xcodeproj' }; + const dependencyConfig = {projectName: 'React.xcodeproj'}; const projectConfig = Object.assign({}, baseProjectConfig, { libraryFolder: 'Missing', }); diff --git a/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js b/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js index d0bbe75a1..b53e35f63 100644 --- a/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js @@ -14,7 +14,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::mapHeaderSearchPaths', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js index 4e06f59b4..a56c57b66 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js @@ -14,10 +14,10 @@ import removeProjectFromLibraries from '../../ios/removeProjectFromLibraries'; const xcode = require('xcode'); const PbxFile = require('xcode/lib/pbxFile'); const path = require('path'); -const { last } = require('lodash'); +const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::removeProjectFromLibraries', () => { @@ -26,7 +26,7 @@ describe('ios::removeProjectFromLibraries', () => { addProjectToLibraries( project.pbxGroupByName('Libraries'), - new PbxFile('fakePath') + new PbxFile('fakePath'), ); }); diff --git a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js index c0eb81af7..c8164bc78 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js @@ -16,7 +16,7 @@ const pbxFile = require('xcode/lib/pbxFile'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); const filePath = '../../__fixtures__/linearGradient.pbxproj'; @@ -28,7 +28,7 @@ describe('ios::addFileToProject', () => { it('should return removed file', () => { expect( - removeProjectFromProject(project, filePath) instanceof pbxFile + removeProjectFromProject(project, filePath) instanceof pbxFile, ).toBeTruthy(); }); diff --git a/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js b/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js index f23ceeee1..e81639de7 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js @@ -16,7 +16,7 @@ const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj') + path.join(__dirname, '../../__fixtures__/project.pbxproj'), ); describe('ios::removeSharedLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js b/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js index e10077a99..c74582609 100644 --- a/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js +++ b/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js @@ -15,7 +15,7 @@ jest.mock('path'); jest.mock('fs'); jest.mock('../../ios/getPlistPath', () => jest.fn(() => null)); -const { readFileSync } = jest.requireActual('fs'); +const {readFileSync} = jest.requireActual('fs'); const fs = require('fs'); const xcode = require('xcode'); @@ -23,13 +23,13 @@ const xcode = require('xcode'); const realPath = jest.requireActual('path'); const projectPath = realPath.join( __dirname, - '../../__fixtures__/project.pbxproj' + '../../__fixtures__/project.pbxproj', ); const infoPlistPath = realPath.join(__dirname, '../../__fixtures__/Info.plist'); fs.readFileSync = jest.fn(() => readFileSync(projectPath).toString()); -const { writeFileSync } = fs; +const {writeFileSync} = fs; fs.writeFileSync = jest.fn(writeFileSync); const project = xcode.project('/Basic/project.pbxproj'); @@ -51,7 +51,7 @@ describe('ios::writePlist', () => { const infoPlist = readFileSync(infoPlistPath).toString(); expect(fs.writeFileSync).toHaveBeenCalledWith( '/Basic/Info.plist', - infoPlist + infoPlist, ); }); diff --git a/packages/cli/src/commands/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js index d8f2560dc..59e905d9f 100644 --- a/packages/cli/src/commands/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -jest.mock('chalk', () => ({ grey: str => str })); +jest.mock('chalk', () => ({grey: str => str})); jest.mock('../../../tools/logger'); const context = { @@ -22,7 +22,7 @@ describe('link', () => { it('should reject when run in a folder without package.json', done => { const link = require('../link').func; - link([], { root: '/' }, {}).catch(() => done()); + link([], {root: '/'}, {}).catch(() => done()); }); it('should accept a name of a dependency to link', done => { @@ -40,7 +40,7 @@ describe('link', () => { const link = require('../link').func; link(['react-native-gradient'], context, {}).then(() => { expect(getDependencyConfig.mock.calls[0][2]).toEqual( - 'react-native-gradient' + 'react-native-gradient', ); done(); }); @@ -79,7 +79,7 @@ describe('link', () => { android: {}, }, assets: [], - commands: { prelink, postlink }, + commands: {prelink, postlink}, })); jest.doMock('../getDependencyConfig', () => getDependencyConfig); @@ -87,15 +87,15 @@ describe('link', () => { const registerNativeModule = jest.fn(); jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(false) + jest.fn().mockReturnValue(false), ); jest.doMock( '../android/registerNativeModule.js', - () => registerNativeModule + () => registerNativeModule, ); jest.doMock('../ios/isInstalled.js', () => - jest.fn().mockReturnValue(false) + jest.fn().mockReturnValue(false), ); jest.doMock('../ios/registerNativeModule.js', () => registerNativeModule); @@ -106,11 +106,11 @@ describe('link', () => { expect(registerNativeModule.mock.calls).toHaveLength(2); expect(prelink.mock.invocationCallOrder[0]).toBeLessThan( - registerNativeModule.mock.invocationCallOrder[0] + registerNativeModule.mock.invocationCallOrder[0], ); expect(postlink.mock.invocationCallOrder[0]).toBeGreaterThan( - registerNativeModule.mock.invocationCallOrder[0] + registerNativeModule.mock.invocationCallOrder[0], ); done(); @@ -136,12 +136,12 @@ describe('link', () => { })); jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(false) + jest.fn().mockReturnValue(false), ); jest.doMock('../android/registerNativeModule.js', () => jest.fn()); jest.doMock('../ios/isInstalled.js', () => - jest.fn().mockReturnValue(false) + jest.fn().mockReturnValue(false), ); jest.doMock('../ios/registerNativeModule.js', () => jest.fn()); @@ -182,11 +182,11 @@ describe('link', () => { const registerNativeModule = jest.fn(); jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(true) + jest.fn().mockReturnValue(true), ); jest.doMock( '../android/registerNativeModule.js', - () => registerNativeModule + () => registerNativeModule, ); jest.doMock('../ios/isInstalled.js', () => jest.fn().mockReturnValue(true)); @@ -226,9 +226,9 @@ describe('link', () => { jest.doMock('../../../tools/getPlatforms', () => { const fn = () => ({ - ios: { linkConfig: require('../ios').default }, - android: { linkConfig: require('../android').default }, - windows: { linkConfig: genericLinkConfig }, + ios: {linkConfig: require('../ios').default}, + android: {linkConfig: require('../android').default}, + windows: {linkConfig: genericLinkConfig}, }); fn.getPlatformName = jest.fn(); return fn; @@ -237,11 +237,11 @@ describe('link', () => { jest.doMock('../getDependencyConfig', () => getDependencyConfig); jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(true) + jest.fn().mockReturnValue(true), ); jest.doMock( '../android/registerNativeModule.js', - () => registerNativeModule + () => registerNativeModule, ); jest.doMock('../ios/isInstalled.js', () => jest.fn().mockReturnValue(true)); @@ -275,8 +275,8 @@ describe('link', () => { jest.doMock('../../../tools/getPlatforms', () => { const fn = () => ({ - android: { linkConfig: genericAndroidLinkConfig }, - ios: { linkConfig: genericIOSLinkConfig }, + android: {linkConfig: genericAndroidLinkConfig}, + ios: {linkConfig: genericIOSLinkConfig}, }); fn.getPlatformName = jest.fn(); return fn; @@ -284,11 +284,11 @@ describe('link', () => { jest.doMock( '../android/registerNativeModule.js', - () => registerAndroidNativeModule + () => registerAndroidNativeModule, ); jest.doMock( '../ios/registerNativeModule.js', - () => registerIOSNativeModule + () => registerIOSNativeModule, ); const link = require('../link').func; @@ -301,22 +301,18 @@ describe('link', () => { await link( ['react-native-gradient'], - { root: '/' }, - { platforms: ['android'] } + {root: '/'}, + {platforms: ['android']}, ); assertPlaftormsCalledTimes(1, 0); - await link( - ['react-native-gradient'], - { root: '/' }, - { platforms: ['ios'] } - ); + await link(['react-native-gradient'], {root: '/'}, {platforms: ['ios']}); assertPlaftormsCalledTimes(0, 1); await link( ['react-native-gradient'], - { root: '/' }, - { platforms: ['android', 'ios'] } + {root: '/'}, + {platforms: ['android', 'ios']}, ); assertPlaftormsCalledTimes(1, 1); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js b/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js index df1285937..7c76885fc 100644 --- a/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js +++ b/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js @@ -20,30 +20,30 @@ describe('pods::findLineToAddPod', () => { it('returns null if file is not Podfile', () => { const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) + findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), ).toBeNull(); }); it('returns correct line number for Simple Podfile', () => { const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) - ).toEqual({ line: 7, indentation: 2 }); + findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), + ).toEqual({line: 7, indentation: 2}); }); it('returns correct line number for Podfile with target', () => { const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileWithTarget')); expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) - ).toEqual({ line: 21, indentation: 2 }); + findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), + ).toEqual({line: 21, indentation: 2}); }); it('returns correct line number for Podfile with function', () => { const podfile = readPodfile( - path.join(PODFILES_PATH, 'PodfileWithFunction') + path.join(PODFILES_PATH, 'PodfileWithFunction'), ); expect( - findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) - ).toEqual({ line: 26, indentation: 2 }); + findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), + ).toEqual({line: 26, indentation: 2}); }); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js b/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js index 0b5c99eeb..ae98a21c3 100644 --- a/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js +++ b/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js @@ -25,18 +25,18 @@ describe('pods::findMarkedLinesInPodfile', () => { it('returns empty array for Simple Podfile', () => { const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileSimple')); expect( - findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) + findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), ).toEqual([]); }); it('returns correct line numbers for Podfile with marker', () => { const podfile = readPodfile(path.join(PODFILES_PATH, 'PodfileWithMarkers')); const expectedObject = [ - { line: 18, indentation: 2 }, - { line: 31, indentation: 4 }, + {line: 18, indentation: 2}, + {line: 31, indentation: 4}, ]; expect( - findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE) + findMarkedLinesInPodfile(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), ).toEqual(expectedObject); }); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js b/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js index 86fa1da48..f0538bfb0 100644 --- a/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js +++ b/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js @@ -16,20 +16,20 @@ const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); describe('pods::isInstalled', () => { it('returns false if pod is missing', () => { - const project = { podfile: path.join(PODFILES_PATH, 'PodfileSimple') }; - const podspecName = { podspec: 'NotExisting' }; + const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; + const podspecName = {podspec: 'NotExisting'}; expect(isInstalled(project, podspecName)).toBe(false); }); it('returns true for existing pod with version number', () => { - const project = { podfile: path.join(PODFILES_PATH, 'PodfileSimple') }; - const podspecName = { podspec: 'TestPod' }; + const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; + const podspecName = {podspec: 'TestPod'}; expect(isInstalled(project, podspecName)).toBe(true); }); it('returns true for existing pod with path', () => { - const project = { podfile: path.join(PODFILES_PATH, 'PodfileWithTarget') }; - const podspecName = { podspec: 'Yoga' }; + const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithTarget')}; + const podspecName = {podspec: 'Yoga'}; expect(isInstalled(project, podspecName)).toBe(true); }); @@ -37,7 +37,7 @@ describe('pods::isInstalled', () => { const project = { podfile: path.join(PODFILES_PATH, 'PodfileWithFunction'), }; - const podspecName = { podspec: 'React' }; + const podspecName = {podspec: 'React'}; expect(isInstalled(project, podspecName)).toBe(true); }); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js b/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js index a403c4776..b980cc2a9 100644 --- a/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js +++ b/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js @@ -17,15 +17,15 @@ const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); describe('pods::removePodEntry', () => { it('should remove one line from Podfile with TestPod', () => { - const { podfileContent, podLinesCount } = readTestPodFile('PodfileSimple'); + const {podfileContent, podLinesCount} = readTestPodFile('PodfileSimple'); const podFileWithRemoved = removePodEntry(podfileContent, 'TestPod'); const newLineCount = podFileWithRemoved.split('\n').length; expect(newLineCount).toBe(podLinesCount - 1); }); it('should remove one line from Podfile with Yoga', () => { - const { podfileContent, podLinesCount } = readTestPodFile( - 'PodfileWithTarget' + const {podfileContent, podLinesCount} = readTestPodFile( + 'PodfileWithTarget', ); const podFileWithRemoved = removePodEntry(podfileContent, 'Yoga'); const newLineCount = podFileWithRemoved.split('\n').length; @@ -33,8 +33,8 @@ describe('pods::removePodEntry', () => { }); it('should remove whole reference to React pod from Podfile', () => { - const { podfileContent, podLinesCount } = readTestPodFile( - 'PodfileWithTarget' + const {podfileContent, podLinesCount} = readTestPodFile( + 'PodfileWithTarget', ); const podFileWithRemoved = removePodEntry(podfileContent, 'React'); const newLineCount = podFileWithRemoved.split('\n').length; diff --git a/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js b/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js index 1056989c0..917977355 100644 --- a/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js +++ b/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js @@ -18,7 +18,7 @@ describe('promiseWaterfall', () => { // Check that tasks[0] is executed before tasks[1]. expect(tasks[0].mock.invocationCallOrder[0]).toBeLessThan( - tasks[1].mock.invocationCallOrder[0] + tasks[1].mock.invocationCallOrder[0], ); }); diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js index 08d184d1c..8e894b7d6 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/cli/src/commands/link/android/copyAssets.js @@ -23,7 +23,7 @@ export default function copyAssetsAndroid(files, project) { (assets.font || []).forEach(asset => fs.copySync( asset, - path.join(project.assetsPath, 'fonts', path.basename(asset)) - ) + path.join(project.assetsPath, 'fonts', path.basename(asset)), + ), ); } diff --git a/packages/cli/src/commands/link/android/index.js b/packages/cli/src/commands/link/android/index.js index 3114a8f90..df7ae3332 100644 --- a/packages/cli/src/commands/link/android/index.js +++ b/packages/cli/src/commands/link/android/index.js @@ -14,7 +14,7 @@ import copyAssets from './copyAssets'; import unlinkAssets from './unlinkAssets'; export function getAndroidLinkConfig() { - return { isInstalled, register, unregister, copyAssets, unlinkAssets }; + return {isInstalled, register, unregister, copyAssets, unlinkAssets}; } export default getAndroidLinkConfig; diff --git a/packages/cli/src/commands/link/android/patches/applyParams.js b/packages/cli/src/commands/link/android/patches/applyParams.js index 40862280e..b3981c05d 100644 --- a/packages/cli/src/commands/link/android/patches/applyParams.js +++ b/packages/cli/src/commands/link/android/patches/applyParams.js @@ -7,7 +7,7 @@ * @format */ -import { camelCase as toCamelCase } from 'lodash'; +import {camelCase as toCamelCase} from 'lodash'; export default function applyParams(str, params, prefix) { return str.replace(/\$\{(\w+)\}/g, (pattern, param) => { diff --git a/packages/cli/src/commands/link/android/patches/applyPatch.js b/packages/cli/src/commands/link/android/patches/applyPatch.js index 2fe518cc8..eb8f0d863 100644 --- a/packages/cli/src/commands/link/android/patches/applyPatch.js +++ b/packages/cli/src/commands/link/android/patches/applyPatch.js @@ -14,6 +14,6 @@ export default function applyPatch(file, patch) { file, fs .readFileSync(file, 'utf8') - .replace(patch.pattern, match => `${match}${patch.patch}`) + .replace(patch.pattern, match => `${match}${patch.patch}`), ); } diff --git a/packages/cli/src/commands/link/android/patches/makeBuildPatch.js b/packages/cli/src/commands/link/android/patches/makeBuildPatch.js index 9bdf22447..9966d0705 100644 --- a/packages/cli/src/commands/link/android/patches/makeBuildPatch.js +++ b/packages/cli/src/commands/link/android/patches/makeBuildPatch.js @@ -12,7 +12,7 @@ import normalizeProjectName from './normalizeProjectName'; export default function makeBuildPatch(name) { const normalizedProjectName = normalizeProjectName(name); const installPattern = new RegExp( - `(implementation|api|compile)\\w*\\s*\\(*project\\(['"]:${normalizedProjectName}['"]\\)` + `(implementation|api|compile)\\w*\\s*\\(*project\\(['"]:${normalizedProjectName}['"]\\)`, ); return { diff --git a/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js b/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js index 3944d2968..c73603f3f 100644 --- a/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js +++ b/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js @@ -16,8 +16,8 @@ export default function makeSettingsPatch(name, androidConfig, projectConfig) { const projectDir = slash( path.relative( path.dirname(projectConfig.settingsGradlePath), - androidConfig.sourceDir - ) + androidConfig.sourceDir, + ), ); const normalizedProjectName = normalizeProjectName(name); diff --git a/packages/cli/src/commands/link/android/patches/makeStringsPatch.js b/packages/cli/src/commands/link/android/patches/makeStringsPatch.js index 592d5d818..e99a190de 100644 --- a/packages/cli/src/commands/link/android/patches/makeStringsPatch.js +++ b/packages/cli/src/commands/link/android/patches/makeStringsPatch.js @@ -7,7 +7,7 @@ * @format */ -import { camelCase as toCamelCase } from 'lodash'; +import {camelCase as toCamelCase} from 'lodash'; export default function makeStringsPatch(params, prefix) { const values = Object.keys(params).map(param => { diff --git a/packages/cli/src/commands/link/android/patches/revokePatch.js b/packages/cli/src/commands/link/android/patches/revokePatch.js index d7ae0db9e..ed410953d 100644 --- a/packages/cli/src/commands/link/android/patches/revokePatch.js +++ b/packages/cli/src/commands/link/android/patches/revokePatch.js @@ -12,6 +12,6 @@ import fs from 'fs'; export default function revokePatch(file, patch) { fs.writeFileSync( file, - fs.readFileSync(file, 'utf8').replace(patch.patch, '') + fs.readFileSync(file, 'utf8').replace(patch.patch, ''), ); } diff --git a/packages/cli/src/commands/link/android/registerNativeModule.js b/packages/cli/src/commands/link/android/registerNativeModule.js index 6d03e3da3..9388d82de 100644 --- a/packages/cli/src/commands/link/android/registerNativeModule.js +++ b/packages/cli/src/commands/link/android/registerNativeModule.js @@ -18,13 +18,13 @@ export default function registerNativeAndroidModule( name, androidConfig, params, - projectConfig + projectConfig, ) { const buildPatch = makeBuildPatch(name); applyPatch( projectConfig.settingsGradlePath, - makeSettingsPatch(name, androidConfig, projectConfig) + makeSettingsPatch(name, androidConfig, projectConfig), ); applyPatch(projectConfig.buildGradlePath, buildPatch); @@ -32,11 +32,11 @@ export default function registerNativeAndroidModule( applyPatch( projectConfig.mainFilePath, - makePackagePatch(androidConfig.packageInstance, params, name) + makePackagePatch(androidConfig.packageInstance, params, name), ); applyPatch( projectConfig.mainFilePath, - makeImportPatch(androidConfig.packageImportPath) + makeImportPatch(androidConfig.packageImportPath), ); } diff --git a/packages/cli/src/commands/link/android/unlinkAssets.js b/packages/cli/src/commands/link/android/unlinkAssets.js index 6b42071e2..ff1f2e869 100644 --- a/packages/cli/src/commands/link/android/unlinkAssets.js +++ b/packages/cli/src/commands/link/android/unlinkAssets.js @@ -24,7 +24,7 @@ export default function unlinkAssetsAndroid(files, project) { const filePath = path.join( project.assetsPath, 'fonts', - path.basename(file) + path.basename(file), ); if (fs.existsSync(filePath)) { fs.unlinkSync(filePath); diff --git a/packages/cli/src/commands/link/android/unregisterNativeModule.js b/packages/cli/src/commands/link/android/unregisterNativeModule.js index 7620414cb..29680eaae 100644 --- a/packages/cli/src/commands/link/android/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/android/unregisterNativeModule.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import { camelCase as toCamelCase } from 'lodash'; +import {camelCase as toCamelCase} from 'lodash'; import revokePatch from './patches/revokePatch'; import makeSettingsPatch from './patches/makeSettingsPatch'; @@ -20,7 +20,7 @@ import makePackagePatch from './patches/makePackagePatch'; export default function unregisterNativeAndroidModule( name, androidConfig, - projectConfig + projectConfig, ) { const buildPatch = makeBuildPatch(name); const strings = fs.readFileSync(projectConfig.stringsPath, 'utf8'); @@ -30,12 +30,12 @@ export default function unregisterNativeAndroidModule( /moduleConfig="true" name="(\w+)">(.*) { params[param.slice(toCamelCase(name).length + 1)] = value; - } + }, ); revokePatch( projectConfig.settingsGradlePath, - makeSettingsPatch(name, androidConfig, projectConfig) + makeSettingsPatch(name, androidConfig, projectConfig), ); revokePatch(projectConfig.buildGradlePath, buildPatch); @@ -43,11 +43,11 @@ export default function unregisterNativeAndroidModule( revokePatch( projectConfig.mainFilePath, - makePackagePatch(androidConfig.packageInstance, params, name) + makePackagePatch(androidConfig.packageInstance, params, name), ); revokePatch( projectConfig.mainFilePath, - makeImportPatch(androidConfig.packageImportPath) + makeImportPatch(androidConfig.packageImportPath), ); } diff --git a/packages/cli/src/commands/link/getDependencyConfig.js b/packages/cli/src/commands/link/getDependencyConfig.js index 0588c4036..3cc2e1af2 100644 --- a/packages/cli/src/commands/link/getDependencyConfig.js +++ b/packages/cli/src/commands/link/getDependencyConfig.js @@ -17,18 +17,18 @@ import getAssets from '../../tools/getAssets'; export default function getDependencyConfig( ctx: ContextT, availablePlatforms: PlatformsT, - dependency: string + dependency: string, ): DependenciesConfig { try { const folder = path.join(ctx.root, 'node_modules', dependency); const config = getPackageConfiguration(folder); - const platformConfigs = { ios: undefined, android: undefined }; + const platformConfigs = {ios: undefined, android: undefined}; Object.keys(availablePlatforms).forEach(platform => { platformConfigs[platform] = availablePlatforms[platform].dependencyConfig( folder, - config[platform] || {} + config[platform] || {}, ); }); diff --git a/packages/cli/src/commands/link/getProjectConfig.js b/packages/cli/src/commands/link/getProjectConfig.js index b9305b232..f5095315a 100644 --- a/packages/cli/src/commands/link/getProjectConfig.js +++ b/packages/cli/src/commands/link/getProjectConfig.js @@ -12,16 +12,16 @@ import getPackageConfiguration from '../../tools/getPackageConfiguration'; export default function getProjectConfig( ctx: ContextT, - availablePlatforms: PlatformsT + availablePlatforms: PlatformsT, ): ProjectConfigT { const config = getPackageConfiguration(ctx.root); - const platformConfigs = { ios: undefined, android: undefined }; + const platformConfigs = {ios: undefined, android: undefined}; Object.keys(availablePlatforms).forEach(platform => { platformConfigs[platform] = availablePlatforms[platform].projectConfig( ctx.root, - config[platform] || {} + config[platform] || {}, ); }); diff --git a/packages/cli/src/commands/link/getProjectDependencies.js b/packages/cli/src/commands/link/getProjectDependencies.js index 70cdb6659..9d6c3d4f3 100644 --- a/packages/cli/src/commands/link/getProjectDependencies.js +++ b/packages/cli/src/commands/link/getProjectDependencies.js @@ -26,6 +26,6 @@ const EXCLUDED_PROJECTS = [ export default function getProjectDependencies(cwd: string) { const pkgJson = require(path.join(cwd, './package.json')); return (Object.keys(pkgJson.dependencies || {}).filter( - name => EXCLUDED_PROJECTS.includes(name) === false + name => EXCLUDED_PROJECTS.includes(name) === false, ): Array); } diff --git a/packages/cli/src/commands/link/groupFilesByType.js b/packages/cli/src/commands/link/groupFilesByType.js index 4de668bdb..f40830451 100644 --- a/packages/cli/src/commands/link/groupFilesByType.js +++ b/packages/cli/src/commands/link/groupFilesByType.js @@ -7,7 +7,7 @@ * @format */ -import { groupBy } from 'lodash'; +import {groupBy} from 'lodash'; import mime from 'mime'; /** diff --git a/packages/cli/src/commands/link/ios/addSharedLibraries.js b/packages/cli/src/commands/link/ios/addSharedLibraries.js index 3c42aa9e4..13d611b20 100644 --- a/packages/cli/src/commands/link/ios/addSharedLibraries.js +++ b/packages/cli/src/commands/link/ios/addSharedLibraries.js @@ -20,6 +20,6 @@ export default function addSharedLibraries(project, libraries) { const target = project.getFirstTarget().uuid; for (const name of libraries) { - project.addFramework(name, { target }); + project.addFramework(name, {target}); } } diff --git a/packages/cli/src/commands/link/ios/common/registerNativeModule.js b/packages/cli/src/commands/link/ios/common/registerNativeModule.js index bddfd14b6..e68aa11d7 100644 --- a/packages/cli/src/commands/link/ios/common/registerNativeModule.js +++ b/packages/cli/src/commands/link/ios/common/registerNativeModule.js @@ -14,7 +14,7 @@ export default function registerNativeModule( name, dependencyConfig, params, - projectConfig + projectConfig, ) { if (projectConfig.podfile && dependencyConfig.podspec) { registerDependencyPods(name, dependencyConfig, projectConfig); diff --git a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js index 65db4aa9d..482f3ef67 100644 --- a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js @@ -7,7 +7,7 @@ * @format */ -import { compact } from 'lodash'; +import {compact} from 'lodash'; import isInstalledIOS from '../isInstalled'; import isInstalledPods from '../../pods/isInstalled'; import unregisterDependencyIOS from '../unregisterNativeModule'; @@ -17,7 +17,7 @@ export default function unregisterNativeModule( name, dependencyConfig, projectConfig, - otherDependencies + otherDependencies, ) { const isIosInstalled = isInstalledIOS(projectConfig, dependencyConfig); const isPodInstalled = isInstalledPods(projectConfig, dependencyConfig); diff --git a/packages/cli/src/commands/link/ios/copyAssets.js b/packages/cli/src/commands/link/ios/copyAssets.js index 231973500..58dbec83c 100644 --- a/packages/cli/src/commands/link/ios/copyAssets.js +++ b/packages/cli/src/commands/link/ios/copyAssets.js @@ -31,7 +31,7 @@ export default function linkAssetsIOS(files, projectConfig) { .map(asset => project.addResourceFile(path.relative(projectConfig.sourceDir, asset), { target: project.getFirstTarget().uuid, - }) + }), ) .filter(file => file) // xcode returns false if file is already there .map(file => file.basename); diff --git a/packages/cli/src/commands/link/ios/createGroupWithMessage.js b/packages/cli/src/commands/link/ios/createGroupWithMessage.js index cd2c85bac..2524aef0d 100644 --- a/packages/cli/src/commands/link/ios/createGroupWithMessage.js +++ b/packages/cli/src/commands/link/ios/createGroupWithMessage.js @@ -24,7 +24,7 @@ export default function createGroupWithMessage(project, path) { group = createGroup(project, path); log.warn( - `Group '${path}' does not exist in your Xcode project. We have created it automatically for you.` + `Group '${path}' does not exist in your Xcode project. We have created it automatically for you.`, ); } diff --git a/packages/cli/src/commands/link/ios/getHeaderSearchPath.js b/packages/cli/src/commands/link/ios/getHeaderSearchPath.js index b7c053694..3518620b3 100644 --- a/packages/cli/src/commands/link/ios/getHeaderSearchPath.js +++ b/packages/cli/src/commands/link/ios/getHeaderSearchPath.js @@ -8,7 +8,7 @@ */ import path from 'path'; -import { last, union } from 'lodash'; +import {last, union} from 'lodash'; /** * Given an array of directories, it returns the one that contains @@ -56,6 +56,6 @@ export default function getHeaderSearchPath(sourceDir, headers) { ? `"$(SRCROOT)${path.sep}${path.relative(sourceDir, directories[0])}"` : `"$(SRCROOT)${path.sep}${path.relative( sourceDir, - getOuterDirectory(directories) + getOuterDirectory(directories), )}/**"`; } diff --git a/packages/cli/src/commands/link/ios/getPlistPath.js b/packages/cli/src/commands/link/ios/getPlistPath.js index 64b348453..b0e613309 100644 --- a/packages/cli/src/commands/link/ios/getPlistPath.js +++ b/packages/cli/src/commands/link/ios/getPlistPath.js @@ -19,6 +19,6 @@ export default function getPlistPath(project, sourceDir) { return path.join( sourceDir, - plistFile.replace(/"/g, '').replace('$(SRCROOT)', '') + plistFile.replace(/"/g, '').replace('$(SRCROOT)', ''), ); } diff --git a/packages/cli/src/commands/link/ios/getTargets.js b/packages/cli/src/commands/link/ios/getTargets.js index 2e8147dc2..3c8a84146 100644 --- a/packages/cli/src/commands/link/ios/getTargets.js +++ b/packages/cli/src/commands/link/ios/getTargets.js @@ -12,7 +12,7 @@ */ export default function getTargets(project) { const { - firstProject: { targets }, + firstProject: {targets}, } = project.getFirstProject(); const nativeTargetSection = project.pbxNativeTargetSection(); return targets diff --git a/packages/cli/src/commands/link/ios/index.js b/packages/cli/src/commands/link/ios/index.js index b68f83b57..cb7d49142 100644 --- a/packages/cli/src/commands/link/ios/index.js +++ b/packages/cli/src/commands/link/ios/index.js @@ -14,7 +14,7 @@ import copyAssets from './copyAssets'; import unlinkAssets from './unlinkAssets'; export function getIOSLinkConfig() { - return { isInstalled, register, unregister, copyAssets, unlinkAssets }; + return {isInstalled, register, unregister, copyAssets, unlinkAssets}; } export default getIOSLinkConfig; diff --git a/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js index fbe95bfc8..eda6341e8 100644 --- a/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js +++ b/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js @@ -30,7 +30,7 @@ export default function headerSearchPathIter(project, func) { Object.keys(config) .filter(ref => ref.indexOf('_comment') === -1) .forEach(ref => { - const { buildSettings } = config[ref]; + const {buildSettings} = config[ref]; const shouldVisitBuildSettings = (Array.isArray(buildSettings.OTHER_LDFLAGS) ? buildSettings.OTHER_LDFLAGS diff --git a/packages/cli/src/commands/link/ios/registerNativeModule.js b/packages/cli/src/commands/link/ios/registerNativeModule.js index b735b24a0..d8d9e7551 100644 --- a/packages/cli/src/commands/link/ios/registerNativeModule.js +++ b/packages/cli/src/commands/link/ios/registerNativeModule.js @@ -10,7 +10,7 @@ import xcode from 'xcode'; import fs from 'fs'; import path from 'path'; -import { isEmpty } from 'lodash'; +import {isEmpty} from 'lodash'; import addToHeaderSearchPaths from './addToHeaderSearchPaths'; import getHeadersInFolder from './getHeadersInFolder'; @@ -30,7 +30,7 @@ import addSharedLibraries from './addSharedLibraries'; */ export default function registerNativeModuleIOS( dependencyConfig, - projectConfig + projectConfig, ) { const project = xcode.project(projectConfig.pbxprojPath).parseSync(); const dependencyProject = xcode @@ -39,11 +39,11 @@ export default function registerNativeModuleIOS( const libraries = createGroupWithMessage( project, - projectConfig.libraryFolder + projectConfig.libraryFolder, ); const file = addFileToProject( project, - path.relative(projectConfig.sourceDir, dependencyConfig.projectPath) + path.relative(projectConfig.sourceDir, dependencyConfig.projectPath), ); const targets = getTargets(project); @@ -79,7 +79,7 @@ export default function registerNativeModuleIOS( if (!isEmpty(headers)) { addToHeaderSearchPaths( project, - getHeaderSearchPath(projectConfig.sourceDir, headers) + getHeaderSearchPath(projectConfig.sourceDir, headers), ); } diff --git a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js index 83f329026..ee5333fb5 100644 --- a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js +++ b/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js @@ -14,6 +14,6 @@ import mapHeaderSearchPaths from './mapHeaderSearchPaths'; */ export default function addToHeaderSearchPaths(project, path) { mapHeaderSearchPaths(project, searchPaths => - searchPaths.filter(searchPath => searchPath !== path) + searchPaths.filter(searchPath => searchPath !== path), ); } diff --git a/packages/cli/src/commands/link/ios/removeFromProjectReferences.js b/packages/cli/src/commands/link/ios/removeFromProjectReferences.js index 1398bd845..6382c844c 100644 --- a/packages/cli/src/commands/link/ios/removeFromProjectReferences.js +++ b/packages/cli/src/commands/link/ios/removeFromProjectReferences.js @@ -18,10 +18,10 @@ * Otherwise returns null */ export default function removeFromProjectReferences(project, file) { - const { firstProject } = project.getFirstProject(); + const {firstProject} = project.getFirstProject(); const projectRef = firstProject.projectReferences.find( - item => item.ProjectRef === file.uuid + item => item.ProjectRef === file.uuid, ); if (!projectRef) { @@ -30,7 +30,7 @@ export default function removeFromProjectReferences(project, file) { firstProject.projectReferences.splice( firstProject.projectReferences.indexOf(projectRef), - 1 + 1, ); return projectRef; diff --git a/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js b/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js index 195c14f01..80f8068e4 100644 --- a/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js +++ b/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js @@ -13,8 +13,7 @@ * It's mainly due to limitations of `xcode` library. */ export default function removeProjectFromLibraries(libraries, file) { - // eslint-disable-next-line no-param-reassign libraries.children = libraries.children.filter( - library => library.comment !== file.basename + library => library.comment !== file.basename, ); } diff --git a/packages/cli/src/commands/link/ios/removeSharedLibraries.js b/packages/cli/src/commands/link/ios/removeSharedLibraries.js index 7b5d02381..35882b08b 100644 --- a/packages/cli/src/commands/link/ios/removeSharedLibraries.js +++ b/packages/cli/src/commands/link/ios/removeSharedLibraries.js @@ -15,6 +15,6 @@ export default function removeSharedLibraries(project, libraries) { const target = project.getFirstTarget().uuid; for (const name of libraries) { - project.removeFramework(name, { target }); + project.removeFramework(name, {target}); } } diff --git a/packages/cli/src/commands/link/ios/unlinkAssets.js b/packages/cli/src/commands/link/ios/unlinkAssets.js index 1c6036905..4843dbd28 100644 --- a/packages/cli/src/commands/link/ios/unlinkAssets.js +++ b/packages/cli/src/commands/link/ios/unlinkAssets.js @@ -9,7 +9,7 @@ import fs from 'fs-extra'; import path from 'path'; import xcode from 'xcode'; -import { difference } from 'lodash'; +import {difference} from 'lodash'; import log from '../../../tools/logger'; import groupFilesByType from '../groupFilesByType'; @@ -27,14 +27,14 @@ export default function unlinkAssetsIOS(files, projectConfig) { if (!plist) { log.error( - 'Could not locate "Info.plist" file. Check if your project has "INFOPLIST_FILE" set properly' + 'Could not locate "Info.plist" file. Check if your project has "INFOPLIST_FILE" set properly', ); return; } if (!project.pbxGroupByName('Resources')) { log.error( - 'Group "Resources" does not exist in your Xcode project. There is nothing to unlink.' + 'Group "Resources" does not exist in your Xcode project. There is nothing to unlink.', ); return; } @@ -44,8 +44,8 @@ export default function unlinkAssetsIOS(files, projectConfig) { .map(asset => project.removeResourceFile( path.relative(projectConfig.sourceDir, asset), - { target: project.getFirstTarget().uuid } - ) + {target: project.getFirstTarget().uuid}, + ), ) .map(file => file.basename); diff --git a/packages/cli/src/commands/link/ios/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/unregisterNativeModule.js index 8eebe5929..6dbc11644 100644 --- a/packages/cli/src/commands/link/ios/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/ios/unregisterNativeModule.js @@ -10,7 +10,7 @@ import xcode from 'xcode'; import path from 'path'; import fs from 'fs'; -import { difference, isEmpty } from 'lodash'; +import {difference, isEmpty} from 'lodash'; import getGroup from './getGroup'; import getTargets from './getTargets'; @@ -30,7 +30,7 @@ import removeSharedLibraries from './removeSharedLibraries'; export default function unregisterNativeModule( dependencyConfig, projectConfig, - iOSDependencies + iOSDependencies, ) { const project = xcode.project(projectConfig.pbxprojPath).parseSync(); const dependencyProject = xcode @@ -41,7 +41,7 @@ export default function unregisterNativeModule( const file = removeProjectFromProject( project, - path.relative(projectConfig.sourceDir, dependencyConfig.projectPath) + path.relative(projectConfig.sourceDir, dependencyConfig.projectPath), ); removeProjectFromLibraries(libraries, file); @@ -56,8 +56,8 @@ export default function unregisterNativeModule( dependencyConfig.sharedLibraries, iOSDependencies.reduce( (libs, dependency) => libs.concat(dependency.sharedLibraries), - projectConfig.sharedLibraries - ) + projectConfig.sharedLibraries, + ), ); removeSharedLibraries(project, sharedLibraries); @@ -66,7 +66,7 @@ export default function unregisterNativeModule( if (!isEmpty(headers)) { removeFromHeaderSearchPaths( project, - getHeaderSearchPath(projectConfig.sourceDir, headers) + getHeaderSearchPath(projectConfig.sourceDir, headers), ); } diff --git a/packages/cli/src/commands/link/ios/writePlist.js b/packages/cli/src/commands/link/ios/writePlist.js index eb5d54c5d..38aaf6467 100644 --- a/packages/cli/src/commands/link/ios/writePlist.js +++ b/packages/cli/src/commands/link/ios/writePlist.js @@ -28,6 +28,6 @@ export default function writePlist(project, sourceDir, plist) { // Ref: https://github.com/facebook/react-native/issues/11668 return fs.writeFileSync( plistPath, - `${plistParser.build(plist, { indent: '\t', offset: -1 })}\n` + `${plistParser.build(plist, {indent: '\t', offset: -1})}\n`, ); } diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 6be0b5484..13d601077 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -7,8 +7,8 @@ * @flow */ -import { pick } from 'lodash'; -import type { ContextT } from '../../tools/types.flow'; +import {pick} from 'lodash'; +import type {ContextT} from '../../tools/types.flow'; import promiseWaterfall from './promiseWaterfall'; import logger from '../../tools/logger'; @@ -43,13 +43,13 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { project = getProjectConfig(ctx, platforms); } catch (err) { logger.error( - 'No package found. Are you sure this is a React Native project?' + 'No package found. Are you sure this is a React Native project?', ); return Promise.reject(err); } const hasProjectConfig = Object.keys(platforms).reduce( (acc, key) => acc || key in project, - false + false, ); if (!hasProjectConfig && findReactNativeScripts()) { throw new Error( @@ -57,7 +57,7 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { 'If you need to include a library that relies on custom native code, ' + 'you might have to eject first. ' + 'See https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md ' + - 'for more information.' + 'for more information.', ); } @@ -80,7 +80,7 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { return promiseWaterfall(tasks).catch(err => { logger.error( `Something went wrong while linking. Error: ${err.message} \n` + - 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues' + 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues', ); throw err; }); diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 4a14d13fd..333185dac 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -1,6 +1,6 @@ // @flow -import { uniqBy, flatten } from 'lodash'; +import {uniqBy, flatten} from 'lodash'; import path from 'path'; import type { ContextT, @@ -23,25 +23,25 @@ const dedupeAssets = (assets: Array): Array => function linkAll( context: ContextT, platforms: PlatformsT, - project: ProjectConfigT + project: ProjectConfigT, ) { logger.warn( 'Running `react-native link` without package name is deprecated and will be removed ' + 'in next release. If you use this command to link your project assets, ' + - 'please let us know about your use case here: https://goo.gl/RKTeoc' + 'please let us know about your use case here: https://goo.gl/RKTeoc', ); const projectAssets = getAssets(context.root); const dependencies = getProjectDependencies(context.root); const depenendenciesConfig = dependencies.map(dependnecy => - getDependencyConfig(context, platforms, dependnecy) + getDependencyConfig(context, platforms, dependnecy), ); const assets = dedupeAssets( depenendenciesConfig.reduce( (acc, dependency) => acc.concat(dependency.assets), - projectAssets - ) + projectAssets, + ), ); const tasks = flatten( @@ -50,13 +50,13 @@ function linkAll( () => linkDependency(platforms, project, config), () => promisify(config.commands.postlink || commandStub), () => linkAssets(platforms, project, assets), - ]) + ]), ); return promiseWaterfall(tasks).catch(err => { logger.error( `Something went wrong while linking. Error: ${err.message} \n` + - 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues' + 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues', ); throw err; }); diff --git a/packages/cli/src/commands/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js index 6b36c3796..7060ef4ca 100644 --- a/packages/cli/src/commands/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -1,14 +1,14 @@ // @flow -import { isEmpty } from 'lodash'; -import type { PlatformsT, ProjectConfigT } from '../../tools/types.flow'; +import {isEmpty} from 'lodash'; +import type {PlatformsT, ProjectConfigT} from '../../tools/types.flow'; import logger from '../../tools/logger'; const linkAssets = ( platforms: PlatformsT, project: ProjectConfigT, - assets: Array + assets: Array, ) => { if (isEmpty(assets)) { return; diff --git a/packages/cli/src/commands/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js index 60efb7ac9..e669aae29 100644 --- a/packages/cli/src/commands/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -7,12 +7,12 @@ import type { } from '../../tools/types.flow'; import logger from '../../tools/logger'; import pollParams from './pollParams'; -import { getPlatformName } from '../../tools/getPlatforms'; +import {getPlatformName} from '../../tools/getPlatforms'; const linkDependency = async ( platforms: PlatformsT, project: ProjectConfigT, - dependency: DependenciesConfig + dependency: DependenciesConfig, ) => { const params = await pollParams(dependency.params); @@ -33,20 +33,20 @@ const linkDependency = async ( const isInstalled = linkConfig.isInstalled( project[platform], dependency.name, - dependency.config[platform] + dependency.config[platform], ); if (isInstalled) { logger.info( `${getPlatformName(platform)} module "${ dependency.name - }" is already linked` + }" is already linked`, ); return; } logger.info( - `Linking "${dependency.name}" ${getPlatformName(platform)} dependency` + `Linking "${dependency.name}" ${getPlatformName(platform)} dependency`, ); linkConfig.register( @@ -54,13 +54,13 @@ const linkDependency = async ( dependency.config[platform] || {}, params, // $FlowFixMe: We check if project[platform] exists on line 42 - project[platform] + project[platform], ); logger.info( `${getPlatformName(platform)} module "${ dependency.name - }" has been successfully linked` + }" has been successfully linked`, ); }); }; diff --git a/packages/cli/src/commands/link/pods/addPodEntry.js b/packages/cli/src/commands/link/pods/addPodEntry.js index 45b33f275..25ce4875e 100644 --- a/packages/cli/src/commands/link/pods/addPodEntry.js +++ b/packages/cli/src/commands/link/pods/addPodEntry.js @@ -11,7 +11,7 @@ export default function addPodEntry( podLines, linesToAddEntry, podName, - nodePath + nodePath, ) { const newEntry = `pod '${podName}', :path => '../node_modules/${nodePath}'\n`; @@ -20,11 +20,11 @@ export default function addPodEntry( } if (Array.isArray(linesToAddEntry)) { - linesToAddEntry.map(({ line, indentation }, idx) => - podLines.splice(line + idx, 0, getLineToAdd(newEntry, indentation)) + linesToAddEntry.map(({line, indentation}, idx) => + podLines.splice(line + idx, 0, getLineToAdd(newEntry, indentation)), ); } else { - const { line, indentation } = linesToAddEntry; + const {line, indentation} = linesToAddEntry; podLines.splice(line, 0, getLineToAdd(newEntry, indentation)); } } diff --git a/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js b/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js index c162a59a7..3087937b7 100644 --- a/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js +++ b/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js @@ -13,7 +13,7 @@ export default function findMarkedLinesInPodfile(podLines) { const result = []; for (let i = 0, len = podLines.length; i < len; i++) { if (podLines[i].includes(MARKER_TEXT)) { - result.push({ line: i + 1, indentation: podLines[i].indexOf('#') }); + result.push({line: i + 1, indentation: podLines[i].indexOf('#')}); } } return result; diff --git a/packages/cli/src/commands/link/pods/isInstalled.js b/packages/cli/src/commands/link/pods/isInstalled.js index 312cc4eee..e68059616 100644 --- a/packages/cli/src/commands/link/pods/isInstalled.js +++ b/packages/cli/src/commands/link/pods/isInstalled.js @@ -16,7 +16,7 @@ export default function isInstalled(iOSProject, dependencyConfig) { // match line with pod declaration: pod 'dependencyPodName' (other possible parameters of pod are ignored) const dependencyRegExp = new RegExp( `pod\\s+('|")${dependencyConfig.podspec}('|")`, - 'g' + 'g', ); const podLines = readPodfile(iOSProject.podfile); for (let i = 0, len = podLines.length; i < len; i++) { diff --git a/packages/cli/src/commands/link/pods/registerNativeModule.js b/packages/cli/src/commands/link/pods/registerNativeModule.js index 5e3ffb976..5d8abca42 100644 --- a/packages/cli/src/commands/link/pods/registerNativeModule.js +++ b/packages/cli/src/commands/link/pods/registerNativeModule.js @@ -17,7 +17,7 @@ import savePodFile from './savePodFile'; export default function registerNativeModulePods( name, dependencyConfig, - iOSProject + iOSProject, ) { const podLines = readPodfile(iOSProject.podfile); const linesToAddEntry = getLinesToAddEntry(podLines, iOSProject); @@ -25,7 +25,7 @@ export default function registerNativeModulePods( savePodFile(iOSProject.podfile, podLines); } -function getLinesToAddEntry(podLines, { projectName }) { +function getLinesToAddEntry(podLines, {projectName}) { const linesToAddPodWithMarker = findMarkedLinesInPodfile(podLines); if (linesToAddPodWithMarker.length > 0) { return linesToAddPodWithMarker; diff --git a/packages/cli/src/commands/link/pods/removePodEntry.js b/packages/cli/src/commands/link/pods/removePodEntry.js index 8a0fd0041..1de92fe9b 100644 --- a/packages/cli/src/commands/link/pods/removePodEntry.js +++ b/packages/cli/src/commands/link/pods/removePodEntry.js @@ -11,7 +11,7 @@ export default function removePodEntry(podfileContent, podName) { // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1'] const podRegex = new RegExp( `\\n( |\\t)*pod\\s+("|')${podName}("|')(,\\s*(:[a-z]+\\s*=>)?\\s*(("|').*?("|')|\\[[\\s\\S]*?\\]))*\\n`, - 'g' + 'g', ); return podfileContent.replace(podRegex, '\n'); } diff --git a/packages/cli/src/commands/link/promiseWaterfall.js b/packages/cli/src/commands/link/promiseWaterfall.js index 78f471b37..bc6f2c5a8 100644 --- a/packages/cli/src/commands/link/promiseWaterfall.js +++ b/packages/cli/src/commands/link/promiseWaterfall.js @@ -18,6 +18,6 @@ export default function promiseWaterfall(tasks) { return tasks.reduce( (prevTaskPromise, task) => prevTaskPromise.then(task), - Promise.resolve() + Promise.resolve(), ); } diff --git a/packages/cli/src/commands/link/promisify.js b/packages/cli/src/commands/link/promisify.js index 62b234d2b..e4c2a97a2 100644 --- a/packages/cli/src/commands/link/promisify.js +++ b/packages/cli/src/commands/link/promisify.js @@ -9,5 +9,5 @@ export default func => new Promise((resolve, reject) => - func((err, res) => (err ? reject(err) : resolve(res))) + func((err, res) => (err ? reject(err) : resolve(res))), ); diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 219121141..72f44e8c5 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -7,8 +7,8 @@ * @flow */ -import { flatten, isEmpty, difference } from 'lodash'; -import type { ContextT } from '../../tools/types.flow'; +import {flatten, isEmpty, difference} from 'lodash'; +import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import getProjectConfig from './getProjectConfig'; import getDependencyConfig from './getDependencyConfig'; @@ -16,14 +16,14 @@ import getProjectDependencies from './getProjectDependencies'; import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; import promisify from './promisify'; -import getPlatforms, { getPlatformName } from '../../tools/getPlatforms'; +import getPlatforms, {getPlatformName} from '../../tools/getPlatforms'; const unlinkDependency = ( platforms, project, dependency, packageName, - otherDependencies + otherDependencies, ) => { Object.keys(platforms || {}).forEach(platform => { if (!project[platform] || !dependency.config[platform]) { @@ -42,18 +42,18 @@ const unlinkDependency = ( const isInstalled = linkConfig.isInstalled( project[platform], packageName, - dependency.config[platform] + dependency.config[platform], ); if (!isInstalled) { logger.info( - `${getPlatformName(platform)} module "${packageName}" is not installed` + `${getPlatformName(platform)} module "${packageName}" is not installed`, ); return; } logger.info( - `Unlinking "${packageName}" ${getPlatformName(platform)} dependency` + `Unlinking "${packageName}" ${getPlatformName(platform)} dependency`, ); linkConfig.unregister( @@ -62,13 +62,13 @@ const unlinkDependency = ( dependency.config[platform], // $FlowFixMe: We check for existence on line 38 project[platform], - otherDependencies + otherDependencies, ); logger.info( `${getPlatformName(platform)} module "${ dependency.name - }" has been successfully unlinked` + }" has been successfully unlinked`, ); }); }; @@ -88,13 +88,13 @@ function unlink(args: Array, ctx: ContextT) { platforms = getPlatforms(ctx.root); } catch (err) { logger.error( - "No package.json found. Are you sure it's a React Native project?" + "No package.json found. Are you sure it's a React Native project?", ); return Promise.reject(err); } const allDependencies = getProjectDependencies(ctx.root).map(dependency => - getDependencyConfig(ctx, platforms, dependency) + getDependencyConfig(ctx, platforms, dependency), ); let otherDependencies; let dependency; @@ -107,7 +107,7 @@ function unlink(args: Array, ctx: ContextT) { } otherDependencies = [...allDependencies]; - dependency = otherDependencies.splice(idx, 1)[0]; // eslint-disable-line prefer-destructuring + dependency = otherDependencies.splice(idx, 1)[0]; } catch (err) { return Promise.reject(err); } @@ -122,7 +122,7 @@ function unlink(args: Array, ctx: ContextT) { project, dependency, packageName, - otherDependencies + otherDependencies, ), () => promisify(dependency.commands.postunlink || commandStub), ]; @@ -133,7 +133,7 @@ function unlink(args: Array, ctx: ContextT) { // link const assets = difference( dependency.assets, - flatten(allDependencies, d => d.assets) + flatten(allDependencies, d => d.assets), ); if (isEmpty(assets)) { @@ -155,12 +155,12 @@ function unlink(args: Array, ctx: ContextT) { }); logger.info( - `${packageName} assets has been successfully unlinked from your project` + `${packageName} assets has been successfully unlinked from your project`, ); }) .catch(err => { logger.error( - `It seems something went wrong while unlinking. Error:\n${err.message}` + `It seems something went wrong while unlinking. Error:\n${err.message}`, ); throw err; }); diff --git a/packages/cli/src/commands/logAndroid/logAndroid.js b/packages/cli/src/commands/logAndroid/logAndroid.js index e2d722b63..6eb2cf651 100644 --- a/packages/cli/src/commands/logAndroid/logAndroid.js +++ b/packages/cli/src/commands/logAndroid/logAndroid.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import { spawnSync } from 'child_process'; +import {spawnSync} from 'child_process'; import logger from '../../tools/logger'; /** @@ -20,7 +20,7 @@ async function logAndroid() { logger.info(`Starting the logger (${adbPath} ${adbArgs.join(' ')})...`); - const log = spawnSync(adbPath, adbArgs, { stdio: 'inherit' }); + const log = spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); if (log.error !== null) { throw log.error; diff --git a/packages/cli/src/commands/logIOS/logIOS.js b/packages/cli/src/commands/logIOS/logIOS.js index fb10721c0..e4c46b5a5 100644 --- a/packages/cli/src/commands/logIOS/logIOS.js +++ b/packages/cli/src/commands/logIOS/logIOS.js @@ -7,7 +7,7 @@ * @format */ -import { execFileSync, spawnSync } from 'child_process'; +import {execFileSync, spawnSync} from 'child_process'; import os from 'os'; import path from 'path'; import logger from '../../tools/logger'; @@ -30,10 +30,10 @@ async function logIOS() { const rawDevices = execFileSync( 'xcrun', ['simctl', 'list', 'devices', '--json'], - { encoding: 'utf8' } + {encoding: 'utf8'}, ); - const { devices } = JSON.parse(rawDevices); + const {devices} = JSON.parse(rawDevices); const device = findAvailableDevice(devices); if (device === undefined) { @@ -51,7 +51,7 @@ function tailDeviceLogs(udid) { 'Logs', 'CoreSimulator', udid, - 'asl' + 'asl', ); const log = spawnSync('syslog', ['-w', '-F', 'std', '-d', logDir], { diff --git a/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js b/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js index b09559d68..840e5cb54 100644 --- a/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js +++ b/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js @@ -14,7 +14,7 @@ jest.mock('child_process', () => ({ })); jest.mock('../getAdbPath'); -const { execFileSync } = require('child_process'); +const {execFileSync} = require('child_process'); describe('--appFolder', () => { beforeEach(() => { @@ -56,7 +56,7 @@ describe('--appFolder', () => { }); expect(execFileSync.mock.calls[2][1]).toContain( - 'anotherApp:installStaging' + 'anotherApp:installStaging', ); }); diff --git a/packages/cli/src/commands/runAndroid/adb.js b/packages/cli/src/commands/runAndroid/adb.js index b93d8f98f..d526829bc 100644 --- a/packages/cli/src/commands/runAndroid/adb.js +++ b/packages/cli/src/commands/runAndroid/adb.js @@ -8,7 +8,7 @@ * @flow */ -import { execSync, execFileSync } from 'child_process'; +import {execSync, execFileSync} from 'child_process'; /** * Parses the output of the 'adb devices' command @@ -52,14 +52,14 @@ function getAvailableCPUs(adbPath: string, device: string): Array { let cpus = execFileSync( adbPath, - baseArgs.concat(['ro.product.cpu.abilist']) + baseArgs.concat(['ro.product.cpu.abilist']), ).toString(); // pre-Lollipop if (!cpus || cpus.trim().length === 0) { cpus = execFileSync( adbPath, - baseArgs.concat(['ro.product.cpu.abi']) + baseArgs.concat(['ro.product.cpu.abi']), ).toString(); } diff --git a/packages/cli/src/commands/runAndroid/runAndroid.js b/packages/cli/src/commands/runAndroid/runAndroid.js index a075afe06..d3d2b3033 100644 --- a/packages/cli/src/commands/runAndroid/runAndroid.js +++ b/packages/cli/src/commands/runAndroid/runAndroid.js @@ -7,15 +7,13 @@ * @flow */ -/* eslint-disable consistent-return */ - import path from 'path'; -import { spawnSync, spawn, execFileSync } from 'child_process'; +import {spawnSync, spawn, execFileSync} from 'child_process'; import fs from 'fs'; import isString from 'lodash/isString'; import isPackagerRunning from '../../tools/isPackagerRunning'; -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; @@ -32,11 +30,10 @@ function checkAndroid(root) { /** * Starts the app on a connected Android emulator or device. */ -// eslint-disable-next-line flowtype/no-weak-types function runAndroid(argv: Array, ctx: ContextT, args: Object) { if (!checkAndroid(args.root)) { logger.error( - 'Android project not found. Are you sure this is a React Native project?' + 'Android project not found. Are you sure this is a React Native project?', ); return; } @@ -76,7 +73,7 @@ function buildAndRun(args) { const cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew'; // "app" is usually the default value for Android apps with only 1 app - const { appFolder } = args; + const {appFolder} = args; const packageName = fs .readFileSync(`${appFolder}/src/main/AndroidManifest.xml`, 'utf8') // $FlowFixMe @@ -85,7 +82,7 @@ function buildAndRun(args) { const packageNameWithSuffix = getPackageNameWithSuffix( args.appId, args.appIdSuffix, - packageName + packageName, ); const adbPath = getAdbPath(); @@ -96,7 +93,7 @@ function buildAndRun(args) { cmd, packageNameWithSuffix, packageName, - adbPath + adbPath, ); } logger.error('Argument missing for parameter --deviceId'); @@ -106,7 +103,7 @@ function buildAndRun(args) { cmd, packageNameWithSuffix, packageName, - adbPath + adbPath, ); } } @@ -116,7 +113,7 @@ function runOnSpecificDevice( gradlew, packageNameWithSuffix, packageName, - adbPath + adbPath, ) { const devices = adb.getDevices(adbPath); if (devices && devices.length > 0) { @@ -127,14 +124,14 @@ function runOnSpecificDevice( args.deviceId, packageNameWithSuffix, packageName, - adbPath + adbPath, ); } else { logger.error( `Could not find device with the id: "${ args.deviceId }". Choose one of the following:`, - ...devices + ...devices, ); } } else { @@ -158,7 +155,7 @@ function buildApk(gradlew) { function tryInstallAppOnDevice(args, adbPath, device) { try { // "app" is usually the default value for Android apps with only 1 app - const { appFolder } = args; + const {appFolder} = args; const variant = args.variant.toLowerCase(); const buildDirectory = `${appFolder}/build/outputs/apk/${variant}`; const apkFile = getInstallApkName( @@ -166,13 +163,13 @@ function tryInstallAppOnDevice(args, adbPath, device) { adbPath, variant, device, - buildDirectory + buildDirectory, ); const pathToApk = `${buildDirectory}/${apkFile}`; const adbArgs = ['-s', device, 'install', pathToApk]; logger.info( - `Installing the app on the device (cd android && adb -s ${device} install ${pathToApk}` + `Installing the app on the device (cd android && adb -s ${device} install ${pathToApk}`, ); execFileSync(adbPath, adbArgs, { stdio: [process.stdin, process.stdout, process.stderr], @@ -181,7 +178,7 @@ function tryInstallAppOnDevice(args, adbPath, device) { logger.error( `${ e.message - }\nCould not install the app on the device, read the error above for details.` + }\nCould not install the app on the device, read the error above for details.`, ); } } @@ -191,7 +188,7 @@ function getInstallApkName( adbPath, variant, device, - buildDirectory + buildDirectory, ) { const availableCPUs = adb.getAvailableCPUs(adbPath, device); @@ -217,7 +214,7 @@ function installAndLaunchOnDevice( selectedDevice, packageNameWithSuffix, packageName, - adbPath + adbPath, ) { tryRunAdbReverse(args.port, selectedDevice); tryInstallAppOnDevice(args, adbPath, selectedDevice); @@ -226,14 +223,14 @@ function installAndLaunchOnDevice( packageNameWithSuffix, packageName, adbPath, - args.mainActivity + args.mainActivity, ); } function startServerInNewWindow( port, terminal = process.env.REACT_TERMINAL, - reactNativePath + reactNativePath, ) { /** * Set up OS-specific filenames and commands @@ -252,7 +249,7 @@ function startServerInNewWindow( */ const launchPackagerScript = path.join( reactNativePath, - `scripts/${scriptFile}` + `scripts/${scriptFile}`, ); /** @@ -261,8 +258,7 @@ function startServerInNewWindow( */ const scriptsDir = path.dirname(launchPackagerScript); const packagerEnvFile = path.join(scriptsDir, packagerEnvFilename); - // eslint-disable-next-line flowtype/no-weak-types - const procConfig: Object = { cwd: scriptsDir }; + const procConfig: Object = {cwd: scriptsDir}; /** * Ensure we overwrite file by passing the `w` flag @@ -277,7 +273,7 @@ function startServerInNewWindow( return spawnSync( 'open', ['-a', terminal, launchPackagerScript], - procConfig + procConfig, ); } return spawnSync('open', [launchPackagerScript], procConfig); @@ -297,7 +293,7 @@ function startServerInNewWindow( return spawn('cmd.exe', ['/C', launchPackagerScript], procConfig); } logger.error( - `Cannot start the packager. Unknown platform ${process.platform}` + `Cannot start the packager. Unknown platform ${process.platform}`, ); } diff --git a/packages/cli/src/commands/runAndroid/runOnAllDevices.js b/packages/cli/src/commands/runAndroid/runOnAllDevices.js index 48956701c..043d89f32 100644 --- a/packages/cli/src/commands/runAndroid/runOnAllDevices.js +++ b/packages/cli/src/commands/runAndroid/runOnAllDevices.js @@ -7,9 +7,8 @@ * @flow */ -/* eslint-disable consistent-return */ -import { spawnSync, execFileSync } from 'child_process'; +import {spawnSync, execFileSync} from 'child_process'; import logger from '../../tools/logger'; import adb from './adb'; import tryRunAdbReverse from './tryRunAdbReverse'; @@ -20,12 +19,11 @@ function getCommand(appFolder, command) { } function runOnAllDevices( - // eslint-disable-next-line flowtype/no-weak-types args: Object, cmd: string, packageNameWithSuffix: string, packageName: string, - adbPath: string + adbPath: string, ) { try { const gradleArgs = []; @@ -36,16 +34,16 @@ function runOnAllDevices( gradleArgs.push( `${getCommand( args.appFolder, - 'install' - )}${args.variant[0].toUpperCase()}${args.variant.slice(1)}` + 'install', + )}${args.variant[0].toUpperCase()}${args.variant.slice(1)}`, ); } else if (args.flavor) { logger.warn('--flavor has been deprecated. Use --variant instead'); gradleArgs.push( `${getCommand( args.appFolder, - 'install' - )}${args.flavor[0].toUpperCase()}${args.flavor.slice(1)}` + 'install', + )}${args.flavor[0].toUpperCase()}${args.flavor.slice(1)}`, ); } else { gradleArgs.push(getCommand(args.appFolder, 'installDebug')); @@ -53,8 +51,8 @@ function runOnAllDevices( logger.info( `Building and installing the app on the device (cd android && ${cmd} ${gradleArgs.join( - ' ' - )})...` + ' ', + )})...`, ); execFileSync(cmd, gradleArgs, { @@ -65,7 +63,7 @@ function runOnAllDevices( 'Could not install the app on the device, read the error above for details.\n' + 'Make sure you have an Android emulator running or a device connected and have\n' + 'set up your Android development environment:\n' + - 'https://facebook.github.io/react-native/docs/getting-started.html' + 'https://facebook.github.io/react-native/docs/getting-started.html', ); // stderr is automatically piped from the gradle process, so the user // should see the error already, there is no need to do @@ -81,7 +79,7 @@ function runOnAllDevices( packageNameWithSuffix, packageName, adbPath, - args.mainActivity + args.mainActivity, ); }); } else { @@ -96,9 +94,9 @@ function runOnAllDevices( `${packageNameWithSuffix}/${packageName}.MainActivity`, ]; logger.info( - `Starting the app (${adbPath} ${fallbackAdbArgs.join(' ')}...` + `Starting the app (${adbPath} ${fallbackAdbArgs.join(' ')}...`, ); - spawnSync(adbPath, fallbackAdbArgs, { stdio: 'inherit' }); + spawnSync(adbPath, fallbackAdbArgs, {stdio: 'inherit'}); } catch (e) { logger.error('adb invocation failed. Do you have adb in your PATH?'); // stderr is automatically piped from the gradle process, so the user diff --git a/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js index b8916530f..ee793b751 100644 --- a/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js +++ b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js @@ -7,7 +7,7 @@ * @flow */ -import { spawnSync } from 'child_process'; +import {spawnSync} from 'child_process'; import logger from '../../tools/logger'; function tryLaunchAppOnDevice( @@ -15,7 +15,7 @@ function tryLaunchAppOnDevice( packageNameWithSuffix: string, packageName: string, adbPath: string, - mainActivity: string + mainActivity: string, ) { try { const adbArgs = [ @@ -28,9 +28,9 @@ function tryLaunchAppOnDevice( `${packageNameWithSuffix}/${packageName}.${mainActivity}`, ]; logger.info( - `Starting the app on ${device} (${adbPath} ${adbArgs.join(' ')})...` + `Starting the app on ${device} (${adbPath} ${adbArgs.join(' ')})...`, ); - spawnSync(adbPath, adbArgs, { stdio: 'inherit' }); + spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); } catch (e) { logger.error('adb invocation failed. Do you have adb in your PATH?'); } diff --git a/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js index 952e7e885..8c6198848 100644 --- a/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js +++ b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js @@ -7,7 +7,7 @@ * @flow */ -import { execFileSync } from 'child_process'; +import {execFileSync} from 'child_process'; import logger from '../../tools/logger'; import getAdbPath from './getAdbPath'; diff --git a/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js b/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js index e3657a184..95d0551a1 100644 --- a/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js +++ b/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js @@ -53,8 +53,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6' - ) + 'iPhone 6', + ), ).toEqual({ udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', name: 'iPhone 6', @@ -105,8 +105,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6' - ) + 'iPhone 6', + ), ).toEqual({ udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', name: 'iPhone 6', @@ -154,14 +154,14 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6' - ) + 'iPhone 6', + ), ).toEqual(null); }); it('should return null if an odd input', () => { expect(findMatchingSimulator('random string input', 'iPhone 6')).toEqual( - null + null, ); }); @@ -204,8 +204,8 @@ describe('findMatchingSimulator', () => { ], }, }, - null - ) + null, + ), ).toEqual({ udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', name: 'iPhone 5', @@ -279,8 +279,8 @@ describe('findMatchingSimulator', () => { ], }, }, - null - ) + null, + ), ).toEqual({ udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', name: 'iPhone 5', @@ -328,8 +328,8 @@ describe('findMatchingSimulator', () => { ], }, }, - null - ) + null, + ), ).toEqual({ udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', name: 'iPhone 6s', @@ -377,8 +377,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6' - ) + 'iPhone 6', + ), ).toEqual({ udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', name: 'iPhone 6', @@ -452,8 +452,8 @@ describe('findMatchingSimulator', () => { ], }, }, - null - ) + null, + ), ).toEqual({ udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', name: 'iPhone 7', @@ -527,8 +527,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6s' - ) + 'iPhone 6s', + ), ).toEqual({ udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', name: 'iPhone 6s', @@ -602,8 +602,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6s (10.0)' - ) + 'iPhone 6s (10.0)', + ), ).toEqual({ udid: 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22', name: 'iPhone 6s', @@ -671,8 +671,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'iPhone 6s (10.0)' - ) + 'iPhone 6s (10.0)', + ), ).toEqual(null); }); @@ -703,8 +703,8 @@ describe('findMatchingSimulator', () => { ], }, }, - 'Apple TV' - ) + 'Apple TV', + ), ).toEqual({ udid: '816C30EA-38EA-41AC-BFDA-96FB632D522E', name: 'Apple TV', diff --git a/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js b/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js index 365d48747..a3d79a0df 100644 --- a/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js +++ b/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js @@ -23,7 +23,7 @@ describe('findXcodeProject', () => { 'PodFile', 'Podfile.lock', 'Pods', - ]) + ]), ).toEqual({ name: 'AwesomeApp.xcodeproj', isWorkspace: false, @@ -41,7 +41,7 @@ describe('findXcodeProject', () => { 'PodFile', 'Podfile.lock', 'Pods', - ]) + ]), ).toEqual({ name: 'AwesomeApp.xcworkspace', isWorkspace: true, @@ -57,7 +57,7 @@ describe('findXcodeProject', () => { 'PodFile', 'Podfile.lock', 'Pods', - ]) + ]), ).toEqual(null); }); }); diff --git a/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js b/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js index e92b6a527..b5ebb2372 100644 --- a/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js +++ b/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js @@ -27,7 +27,7 @@ describe('parseIOSDevicesList', () => { 'Blank', 'System Usage', 'Zombies', - ].join('\n') + ].join('\n'), ); expect(devices).toEqual([ @@ -41,7 +41,7 @@ describe('parseIOSDevicesList', () => { it('ignores garbage', () => { expect(parseIOSDevicesList('Something went terribly wrong (-42)')).toEqual( - [] + [], ); }); }); diff --git a/packages/cli/src/commands/runIOS/findMatchingSimulator.js b/packages/cli/src/commands/runIOS/findMatchingSimulator.js index 09f2d9a6b..0cbdf6466 100644 --- a/packages/cli/src/commands/runIOS/findMatchingSimulator.js +++ b/packages/cli/src/commands/runIOS/findMatchingSimulator.js @@ -7,8 +7,6 @@ * @format */ -/* eslint-disable */ - /** * Takes in a parsed simulator list and a desired name, and returns an object with the matching simulator. The desired * name can optionally include the iOS version in between parenthesis after the device name. Ex: "iPhone 6 (9.2)" in @@ -43,9 +41,12 @@ function findMatchingSimulator(simulators, simulatorString) { const device = devices[versionDescriptor]; let version = versionDescriptor; - if ((/^com\.apple\.CoreSimulator\.SimRuntime\./g).test(version)) { + if (/^com\.apple\.CoreSimulator\.SimRuntime\./g.test(version)) { // Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2" - version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3'); + version = version.replace( + /^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, + '$1 $2.$3', + ); } // Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc) diff --git a/packages/cli/src/commands/runIOS/parseIOSDevicesList.js b/packages/cli/src/commands/runIOS/parseIOSDevicesList.js index 4bb61bff8..2cacf661a 100644 --- a/packages/cli/src/commands/runIOS/parseIOSDevicesList.js +++ b/packages/cli/src/commands/runIOS/parseIOSDevicesList.js @@ -26,7 +26,7 @@ function parseIOSDevicesList(text: string): Array { const name = device[1]; const version = device[2]; const udid = device[3]; - devices.push({ udid, name, version }); + devices.push({udid, name, version}); } }); diff --git a/packages/cli/src/commands/runIOS/runIOS.js b/packages/cli/src/commands/runIOS/runIOS.js index e2061a452..8e23d7da4 100644 --- a/packages/cli/src/commands/runIOS/runIOS.js +++ b/packages/cli/src/commands/runIOS/runIOS.js @@ -8,15 +8,14 @@ * @format */ -// eslint-disable-next-line import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; -import { ProcessError } from '../../tools/errors'; +import {ProcessError} from '../../tools/errors'; import logger from '../../tools/logger'; type FlagsT = { @@ -34,7 +33,7 @@ type FlagsT = { function runIOS(_: Array, ctx: ContextT, args: FlagsT) { if (!fs.existsSync(args.projectPath)) { throw new Error( - 'iOS project folder not found. Are you sure this is a React Native project?' + 'iOS project folder not found. Are you sure this is a React Native project?', ); } @@ -43,27 +42,27 @@ function runIOS(_: Array, ctx: ContextT, args: FlagsT) { const xcodeProject = findXcodeProject(fs.readdirSync('.')); if (!xcodeProject) { throw new Error( - `Could not find Xcode project files in "${args.projectPath}" folder` + `Could not find Xcode project files in "${args.projectPath}" folder`, ); } const inferredSchemeName = path.basename( xcodeProject.name, - path.extname(xcodeProject.name) + path.extname(xcodeProject.name), ); const scheme = args.scheme || inferredSchemeName; logger.info( `Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${ xcodeProject.name - }` + }`, ); const devices = parseIOSDevicesList( // $FlowExpectedError https://github.com/facebook/flow/issues/5675 child_process.execFileSync('xcrun', ['instruments', '-s'], { encoding: 'utf8', - }) + }), ); if (args.device) { @@ -76,7 +75,7 @@ function runIOS(_: Array, ctx: ContextT, args: FlagsT) { args.configuration, args.packager, args.verbose, - args.port + args.port, ); } if (devices && devices.length > 0) { @@ -95,10 +94,10 @@ Choose one of the following:${printFoundDevices(devices)}`); } function runOnDeviceByUdid( - args: FlagsT & { udid: string }, + args: FlagsT & {udid: string}, scheme, xcodeProject, - devices + devices, ) { const selectedDevice = matchingDeviceByUdid(devices, args.udid); @@ -110,7 +109,7 @@ function runOnDeviceByUdid( args.configuration, args.packager, args.verbose, - args.port + args.port, ); return; } @@ -132,8 +131,8 @@ async function runOnSimulator(xcodeProject, args, scheme) { child_process.execFileSync( 'xcrun', ['simctl', 'list', '--json', 'devices'], - { encoding: 'utf8' } - ) + {encoding: 'utf8'}, + ), ); } catch (e) { throw new Error('Could not parse the simulator list output'); @@ -156,7 +155,7 @@ async function runOnSimulator(xcodeProject, args, scheme) { * this flag has no effect. */ const activeDeveloperDir = child_process - .execFileSync('xcode-select', ['-p'], { encoding: 'utf8' }) + .execFileSync('xcode-select', ['-p'], {encoding: 'utf8'}) // $FlowExpectedError https://github.com/facebook/flow/issues/5675 .trim(); @@ -178,7 +177,7 @@ async function runOnSimulator(xcodeProject, args, scheme) { args.configuration, args.packager, args.verbose, - args.port + args.port, ); const appPath = getBuildPath(args.configuration, appName, false, scheme); @@ -190,14 +189,14 @@ async function runOnSimulator(xcodeProject, args, scheme) { ['simctl', 'install', selectedSimulator.udid, appPath], { stdio: 'inherit', - } + }, ); const bundleID = child_process .execFileSync( '/usr/libexec/PlistBuddy', ['-c', 'Print:CFBundleIdentifier', path.join(appPath, 'Info.plist')], - { encoding: 'utf8' } + {encoding: 'utf8'}, ) // $FlowExpectedError https://github.com/facebook/flow/issues/5675 .trim(); @@ -209,7 +208,7 @@ async function runOnSimulator(xcodeProject, args, scheme) { ['simctl', 'launch', selectedSimulator.udid, bundleID], { stdio: 'inherit', - } + }, ); } @@ -220,7 +219,7 @@ async function runOnDevice( configuration, launchPackager, verbose, - port + port, ) { const appName = await buildProject( xcodeProject, @@ -229,7 +228,7 @@ async function runOnDevice( configuration, launchPackager, verbose, - port + port, ); const iosDeployInstallArgs = [ @@ -245,12 +244,12 @@ async function runOnDevice( const iosDeployOutput = child_process.spawnSync( 'ios-deploy', iosDeployInstallArgs, - { encoding: 'utf8' } + {encoding: 'utf8'}, ); if (iosDeployOutput.error) { logger.error( - `** INSTALLATION FAILED **\nMake sure you have ios-deploy installed globally.\n(e.g "npm install -g ios-deploy")` + '** INSTALLATION FAILED **\nMake sure you have ios-deploy installed globally.\n(e.g "npm install -g ios-deploy")', ); } else { logger.info('** INSTALLATION SUCCEEDED **'); @@ -264,7 +263,7 @@ function buildProject( configuration, launchPackager = false, verbose, - port + port, ) { return new Promise((resolve, reject) => { const xcodebuildArgs = [ @@ -291,7 +290,7 @@ function buildProject( const buildProcess = child_process.spawn( 'xcodebuild', xcodebuildArgs, - getProcessOptions(launchPackager, port) + getProcessOptions(launchPackager, port), ); let buildOutput = ''; let errorOutput = ''; @@ -314,14 +313,14 @@ function buildProject( reject( new ProcessError( [ - `Failed to build iOS project.`, + 'Failed to build iOS project.', `We ran "xcodebuild" command but it exited with error code ${code}.`, `To debug build logs further, consider building your app with Xcode.app, by opening ${ xcodeProject.name }`, ].join(' '), - errorOutput - ) + errorOutput, + ), ); return; } @@ -361,7 +360,7 @@ function getBuildPath(configuration, appName, isDevice, scheme) { function getProductName(buildOutput) { const productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec( - buildOutput + buildOutput, ); return productNameMatch ? productNameMatch[1] : null; } @@ -382,7 +381,7 @@ function matchingDevice(devices, deviceName) { logger.info( `Using first available device ${ devices[0].name - } due to lack of name supplied.` + } due to lack of name supplied.`, ); return devices[0]; } @@ -421,12 +420,12 @@ function printFoundDevices(devices) { function getProcessOptions(launchPackager, port) { if (launchPackager) { return { - env: { ...process.env, RCT_METRO_PORT: port }, + env: {...process.env, RCT_METRO_PORT: port}, }; } return { - env: { ...process.env, RCT_NO_LAUNCH_PACKAGER: true }, + env: {...process.env, RCT_NO_LAUNCH_PACKAGER: true}, }; } diff --git a/packages/cli/src/commands/server/copyToClipBoard.js b/packages/cli/src/commands/server/copyToClipBoard.js index 0017b5c46..4cfc82fbc 100644 --- a/packages/cli/src/commands/server/copyToClipBoard.js +++ b/packages/cli/src/commands/server/copyToClipBoard.js @@ -7,7 +7,7 @@ * @format */ -import { spawn } from 'child_process'; +import {spawn} from 'child_process'; import path from 'path'; import fs from 'fs'; diff --git a/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js b/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js index 7793792f4..ed950295f 100644 --- a/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js +++ b/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js @@ -55,7 +55,7 @@ // Make sure that the first received bundle is a base. if (!this._initialized && !bundle.base) { throw new Error( - 'DeltaPatcher should receive a base Bundle when being initialized' + 'DeltaPatcher should receive a base Bundle when being initialized', ); } @@ -120,7 +120,7 @@ return [].concat( [this._lastBundle.pre], Array.from(this._lastBundle.modules.values()), - [this._lastBundle.post] + [this._lastBundle.post], ); } } diff --git a/packages/cli/src/commands/server/debugger-ui/debuggerWorker.js b/packages/cli/src/commands/server/debugger-ui/debuggerWorker.js index 4873b4193..070d753b7 100644 --- a/packages/cli/src/commands/server/debugger-ui/debuggerWorker.js +++ b/packages/cli/src/commands/server/debugger-ui/debuggerWorker.js @@ -25,7 +25,7 @@ onmessage = (function() { console.warn( 'Remote debugger is in a background tab which may cause apps to ' + 'perform slowly. Fix this by foregrounding the tab (or opening it in ' + - 'a separate window).' + 'a separate window).', ); }; })(); @@ -56,7 +56,7 @@ onmessage = (function() { var object = message.data; var sendReply = function(result, error) { - postMessage({ replyID: object.id, result: result, error: error }); + postMessage({replyID: object.id, result: result, error: error}); }; var handler = messageHandlers[object.method]; @@ -71,7 +71,7 @@ onmessage = (function() { if (typeof __fbBatchedBridge === 'object') { returnValue = __fbBatchedBridge[object.method].apply( null, - object.arguments + object.arguments, ); } else { error = 'Failed to call function, __fbBatchedBridge is undefined'; diff --git a/packages/cli/src/commands/server/jsPackagerClient.js b/packages/cli/src/commands/server/jsPackagerClient.js index 9387a49c4..3f051df4b 100644 --- a/packages/cli/src/commands/server/jsPackagerClient.js +++ b/packages/cli/src/commands/server/jsPackagerClient.js @@ -48,7 +48,7 @@ class JsPackagerClient { () => new Promise((resolve, reject) => { const messageId = getMessageId(); - this.msgCallbacks.set(messageId, { resolve, reject }); + this.msgCallbacks.set(messageId, {resolve, reject}); this.ws.send( JSON.stringify({ version: PROTOCOL_VERSION, @@ -62,9 +62,9 @@ class JsPackagerClient { this.msgCallbacks.delete(messageId); reject(error); } - } + }, ); - }) + }), ); } @@ -85,9 +85,9 @@ class JsPackagerClient { } else { resolve(); } - } + }, ); - }) + }), ); } @@ -102,9 +102,9 @@ class JsPackagerClient { reject( new Error( `Results received from server are of wrong format:\n${JSON.stringify( - response - )}` - ) + response, + )}`, + ), ); } else { resolve(response); diff --git a/packages/cli/src/commands/server/launchChrome.js b/packages/cli/src/commands/server/launchChrome.js index 5dbf1feec..758dbbd73 100644 --- a/packages/cli/src/commands/server/launchChrome.js +++ b/packages/cli/src/commands/server/launchChrome.js @@ -9,14 +9,14 @@ */ import opn from 'opn'; -import { execSync } from 'child_process'; +import {execSync} from 'child_process'; import logger from '../../tools/logger'; function commandExistsUnixSync(commandName) { try { const stdout = execSync( `command -v ${commandName} 2>/dev/null` + - ` && { echo >&1 '${commandName} found'; exit 0; }` + ` && { echo >&1 '${commandName} found'; exit 0; }`, ); return !!stdout; } catch (error) { @@ -45,7 +45,7 @@ function getChromeAppName(): string { } function launchChrome(url: string) { - opn(url, { app: [getChromeAppName()] }, err => { + opn(url, {app: [getChromeAppName()]}, err => { if (err) { logger.error('Google Chrome exited with error:', err); } diff --git a/packages/cli/src/commands/server/launchEditor.js b/packages/cli/src/commands/server/launchEditor.js index 7dc85fe02..aa0867b94 100644 --- a/packages/cli/src/commands/server/launchEditor.js +++ b/packages/cli/src/commands/server/launchEditor.js @@ -10,7 +10,7 @@ import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; -import { execSync, spawn } from 'child_process'; +import {execSync, spawn} from 'child_process'; import shellQuote from 'shell-quote'; import logger from '../../tools/logger'; @@ -80,7 +80,7 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { case 'code': return addWorkspaceToArgumentsIfExists( ['-g', `${fileName}:${lineNumber}`], - workspace + workspace, ); // For all others, drop the lineNumber until we have // a mapping above, since providing the lineNumber incorrectly @@ -136,7 +136,7 @@ function printInstructions(title) { ' export REACT_EDITOR=atom to your ~/.bashrc or ~/.zshrc depending on ', ' which shell you use.', '', - ].join('\n') + ].join('\n'), ); } @@ -167,7 +167,7 @@ function launchEditor(fileName, lineNumber, projectRoots) { return; } - let [editor, ...args] = guessEditor(); // eslint-disable-line prefer-const + let [editor, ...args] = guessEditor(); if (!editor) { printInstructions('PRO TIP'); return; @@ -176,7 +176,7 @@ function launchEditor(fileName, lineNumber, projectRoots) { const workspace = findRootForFile(projectRoots, fileName); if (lineNumber) { args = args.concat( - getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) + getArgumentsForLineNumber(editor, fileName, lineNumber, workspace), ); } else { args.push(fileName); @@ -195,13 +195,13 @@ function launchEditor(fileName, lineNumber, projectRoots) { 'When running on Windows, file names are checked against a whitelist ' + 'to protect against remote code execution attacks. File names may ' + 'consist only of alphanumeric characters (all languages), periods, ' + - 'dashes, slashes, and underscores.' + 'dashes, slashes, and underscores.', ); return; } logger.info( - `Opening ${chalk.underline(fileName)} with ${chalk.bold(editor)}` + `Opening ${chalk.underline(fileName)} with ${chalk.bold(editor)}`, ); if (_childProcess && isTerminalEditor(editor)) { @@ -218,7 +218,7 @@ function launchEditor(fileName, lineNumber, projectRoots) { stdio: 'inherit', }); } else { - _childProcess = spawn(editor, args, { stdio: 'inherit' }); + _childProcess = spawn(editor, args, {stdio: 'inherit'}); } _childProcess.on('exit', errorCode => { _childProcess = null; diff --git a/packages/cli/src/commands/server/messageSocket.js b/packages/cli/src/commands/server/messageSocket.js index def0193eb..2108cd6e5 100644 --- a/packages/cli/src/commands/server/messageSocket.js +++ b/packages/cli/src/commands/server/messageSocket.js @@ -6,7 +6,7 @@ */ import url from 'url'; -import { Server as WebSocketServer } from 'ws'; +import {Server as WebSocketServer} from 'ws'; import notifier from 'node-notifier'; import logger from '../../tools/logger'; @@ -23,7 +23,7 @@ function parseMessage(data, binary) { return message; } logger.error( - `Received message had wrong protocol version: ${message.version}` + `Received message had wrong protocol version: ${message.version}`, ); } catch (e) { logger.error(`Failed to parse the message as JSON:\n${data}`); @@ -66,7 +66,7 @@ function attachToServer(server, path) { const clientWs = clients.get(clientId); if (clientWs === undefined) { throw new Error( - `could not find id "${clientId}" while forwarding request` + `could not find id "${clientId}" while forwarding request`, ); } return clientWs; @@ -94,7 +94,7 @@ function attachToServer(server, path) { } catch (e) { logger.error( `Failed to send broadcast to client: '${otherId}' ` + - `due to:\n ${e.toString()}` + `due to:\n ${e.toString()}`, ); } } @@ -117,7 +117,7 @@ function attachToServer(server, path) { if (message.id === undefined) { logger.error( `Handling message from ${clientId} failed with:\n${error}\n` + - `message:\n${JSON.stringify(errorMessage)}` + `message:\n${JSON.stringify(errorMessage)}`, ); } else { try { @@ -126,13 +126,13 @@ function attachToServer(server, path) { version: PROTOCOL_VERSION, error, id: message.id, - }) + }), ); } catch (e) { logger.error( `Failed to reply to ${clientId} with error:\n${error}` + `\nmessage:\n${JSON.stringify(errorMessage)}` + - `\ndue to error: ${e.toString()}` + `\ndue to error: ${e.toString()}`, ); } } @@ -161,7 +161,7 @@ function attachToServer(server, path) { version: PROTOCOL_VERSION, result, id: message.id, - }) + }), ); } @@ -174,8 +174,8 @@ function attachToServer(server, path) { id: message.id === undefined ? undefined - : { requestId: message.id, clientId }, - }) + : {requestId: message.id, clientId}, + }), ); } @@ -186,18 +186,17 @@ function attachToServer(server, path) { result: message.result, error: message.error, id: message.id.requestId, - }) + }), ); } clients.set(clientId, clientWs); const onCloseHandler = () => { - clientWs.onmessage = null; // eslint-disable-line no-param-reassign + clientWs.onmessage = null; clients.delete(clientId); }; - clientWs.onclose = onCloseHandler; // eslint-disable-line no-param-reassign - clientWs.onerror = onCloseHandler; // eslint-disable-line no-param-reassign - // eslint-disable-next-line no-param-reassign + clientWs.onclose = onCloseHandler; + clientWs.onerror = onCloseHandler; clientWs.onmessage = event => { const message = parseMessage(event.data, event.binary); if (message === undefined) { @@ -227,9 +226,9 @@ function attachToServer(server, path) { return { broadcast: (method, params) => { - handleSendBroadcast(null, { method, params }); + handleSendBroadcast(null, {method, params}); }, }; } -export default { attachToServer, parseMessage }; +export default {attachToServer, parseMessage}; diff --git a/packages/cli/src/commands/server/middleware/MiddlewareManager.js b/packages/cli/src/commands/server/middleware/MiddlewareManager.js index 696a04d08..ca3025685 100644 --- a/packages/cli/src/commands/server/middleware/MiddlewareManager.js +++ b/packages/cli/src/commands/server/middleware/MiddlewareManager.js @@ -13,7 +13,7 @@ import connect from 'connect'; import errorhandler from 'errorhandler'; import path from 'path'; import serveStatic from 'serve-static'; -import { Server as WebSocketServer } from 'ws'; +import {Server as WebSocketServer} from 'ws'; import indexPageMiddleware from './indexPage'; import copyToClipBoardMiddleware from './copyToClipBoardMiddleware'; @@ -68,7 +68,7 @@ export default class MiddlewareManager { attachDevToolsSocket(socket: WebSocketProxy) { this.app.use( - getDevToolsMiddleware(this.options, () => socket.isChromeConnected()) + getDevToolsMiddleware(this.options, () => socket.isChromeConnected()), ); } } diff --git a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js index 4b2b293e2..6a714c941 100644 --- a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js @@ -15,11 +15,11 @@ function launchChromeDevTools(port, args = '') { launchChrome(debuggerURL); } -function launchDevTools({ port, watchFolders }, isChromeConnected) { +function launchDevTools({port, watchFolders}, isChromeConnected) { // Explicit config always wins const customDebugger = process.env.REACT_DEBUGGER; if (customDebugger) { - customDebugger({ watchFolders, customDebugger }); + customDebugger({watchFolders, customDebugger}); } else if (!isChromeConnected()) { // Dev tools are not yet open; we need to open a session launchChromeDevTools(port); @@ -32,7 +32,7 @@ export default function getDevToolsMiddleware(options, isChromeConnected) { // TODO: remove `logger.info` and dev tools binary logger.info( 'We removed support for Safari dev-tools. ' + - 'If you still need this, please let us know.' + 'If you still need this, please let us know.', ); } else if (req.url === '/launch-chrome-devtools') { // TODO: Remove this case in the future @@ -40,7 +40,7 @@ export default function getDevToolsMiddleware(options, isChromeConnected) { 'The method /launch-chrome-devtools is deprecated. You are ' + ' probably using an application created with an older CLI with the ' + ' packager of a newer CLI. Please upgrade your application: ' + - 'https://facebook.github.io/react-native/docs/upgrading.html' + 'https://facebook.github.io/react-native/docs/upgrading.html', ); launchDevTools(options, isChromeConnected); res.end('OK'); diff --git a/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js b/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js index 8162bb458..676ddd49a 100644 --- a/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js +++ b/packages/cli/src/commands/server/middleware/openStackFrameInEditorMiddleware.js @@ -9,7 +9,7 @@ import launchEditor from '../launchEditor'; -export default function getOpenStackFrameInEditorMiddleware({ watchFolders }) { +export default function getOpenStackFrameInEditorMiddleware({watchFolders}) { return (req, res, next) => { if (req.url === '/open-stack-frame') { const frame = JSON.parse(req.rawBody); diff --git a/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js index 5948ab205..7993995d1 100644 --- a/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js +++ b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js @@ -21,9 +21,9 @@ export default function systraceProfileMiddleware(req, res, next) { fs.writeFileSync(dumpName, req.rawBody); const response = `Your profile was saved at:\n${dumpName}\n\n` + - `On Google Chrome navigate to chrome://tracing and then click on "load" ` + - `to load and visualise your profile.\n\n` + - `This message is also printed to your console by the packager so you can copy it :)`; + 'On Google Chrome navigate to chrome://tracing and then click on "load" ' + + 'to load and visualise your profile.\n\n' + + 'This message is also printed to your console by the packager so you can copy it :)'; logger.info(response); res.end(response); } diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index f1436ed4a..08ae78990 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -9,11 +9,11 @@ import Metro from 'metro'; -import { Terminal } from 'metro-core'; +import {Terminal} from 'metro-core'; import morgan from 'morgan'; import path from 'path'; -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import messageSocket from './messageSocket'; import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; @@ -64,7 +64,7 @@ async function runServer(argv: Array, ctx: ContextT, args: Args) { middlewareManager.getConnectInstance().use(morgan('combined')); metroConfig.watchFolders.forEach( - middlewareManager.serveStatic.bind(middlewareManager) + middlewareManager.serveStatic.bind(middlewareManager), ); metroConfig.server.enhanceMiddleware = middleware => @@ -80,7 +80,7 @@ async function runServer(argv: Array, ctx: ContextT, args: Args) { const wsProxy = webSocketProxy.attachToServer( serverInstance, - '/debugger-proxy' + '/debugger-proxy', ); const ms = messageSocket.attachToServer(serverInstance, '/message'); middlewareManager.attachDevToolsSocket(wsProxy); diff --git a/packages/cli/src/commands/server/webSocketProxy.js b/packages/cli/src/commands/server/webSocketProxy.js index 4d904022c..0f109de08 100644 --- a/packages/cli/src/commands/server/webSocketProxy.js +++ b/packages/cli/src/commands/server/webSocketProxy.js @@ -42,11 +42,11 @@ function attachToServer(server, path) { const clientSocketCloseHandler = () => { clientSocket = null; - send(debuggerSocket, JSON.stringify({ method: '$disconnected' })); + send(debuggerSocket, JSON.stringify({method: '$disconnected'})); }; wss.on('connection', connection => { - const { url } = connection.upgradeReq; + const {url} = connection.upgradeReq; if (url.indexOf('role=debugger') > -1) { if (debuggerSocket) { @@ -56,7 +56,7 @@ function attachToServer(server, path) { debuggerSocket = connection; debuggerSocket.onerror = debuggerSocketCloseHandler; debuggerSocket.onclose = debuggerSocketCloseHandler; - debuggerSocket.onmessage = ({ data }) => send(clientSocket, data); + debuggerSocket.onmessage = ({data}) => send(clientSocket, data); } else if (url.indexOf('role=client') > -1) { if (clientSocket) { clientSocket.onerror = null; @@ -67,7 +67,7 @@ function attachToServer(server, path) { clientSocket = connection; clientSocket.onerror = clientSocketCloseHandler; clientSocket.onclose = clientSocketCloseHandler; - clientSocket.onmessage = ({ data }) => send(debuggerSocket, data); + clientSocket.onmessage = ({data}) => send(debuggerSocket, data); } else { connection.close(1011, 'Missing role param'); } diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 5a987a6cb..438a6f60d 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -4,7 +4,7 @@ import path from 'path'; import fs from 'fs'; import snapshotDiff from 'snapshot-diff'; import upgrade from '../upgrade'; -import { fetch } from '../helpers'; +import {fetch} from '../helpers'; import logger from '../../../tools/logger'; jest.mock('https'); @@ -18,26 +18,26 @@ jest.mock('execa', () => { stdout: '{"react": "16.6.3"}', }); } - return Promise.resolve({ stdout: '' }); + return Promise.resolve({stdout: ''}); }); return module; }); jest.mock( '/project/root/node_modules/react-native/package.json', - () => ({ name: 'react-native', version: '0.57.8' }), - { virtual: true } + () => ({name: 'react-native', version: '0.57.8'}), + {virtual: true}, ); jest.mock( '/project/root/package.json', - () => ({ name: 'TestApp', dependencies: { 'react-native': '^0.57.8' } }), - { virtual: true } + () => ({name: 'TestApp', dependencies: {'react-native': '^0.57.8'}}), + {virtual: true}, ); jest.mock('../../../tools/PackageManager', () => jest.fn(() => ({ install: args => { mockPushLog('$ yarn add', ...args); }, - })) + })), ); jest.mock('../helpers', () => ({ ...jest.requireActual('../helpers'), @@ -88,21 +88,21 @@ test('uses latest version of react-native when none passed', async () => { test('errors when invalid version passed', async () => { await upgrade.func(['next'], ctx, opts); expect(logger.error).toBeCalledWith( - 'Provided version "next" is not allowed. Please pass a valid semver version' + 'Provided version "next" is not allowed. Please pass a valid semver version', ); }); test('errors when older version passed', async () => { await upgrade.func([olderVersion], ctx, opts); expect(logger.error).toBeCalledWith( - `Trying to upgrade from newer version "${currentVersion}" to older "${olderVersion}"` + `Trying to upgrade from newer version "${currentVersion}" to older "${olderVersion}"`, ); }); test('warns when dependency upgrade version is in semver range', async () => { await upgrade.func([currentVersion], ctx, opts); expect(logger.warn).toBeCalledWith( - `Specified version "${currentVersion}" is already installed in node_modules and it satisfies "^0.57.8" semver range. No need to upgrade` + `Specified version "${currentVersion}" is already installed in node_modules and it satisfies "^0.57.8" semver range. No need to upgrade`, ); }); @@ -146,14 +146,12 @@ $ execa git status $ execa git remote remove tmp-rn-diff-purge success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" `); - expect( snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { contextLines: 1, - }) + }), ).toMatchSnapshot('RnDiffApp is replaced with app name (TestApp)'); }); - test('cleans up if patching fails,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); (execa: any).mockImplementation((command, args) => { @@ -164,23 +162,20 @@ test('cleans up if patching fails,', async () => { }); } if (command === 'git' && args[0] === 'apply') { - // eslint-disable-next-line prefer-promise-reject-errors return Promise.reject({ code: 1, stderr: 'error: .flowconfig: does not exist in index\n', }); } - return Promise.resolve({ stdout: '' }); + return Promise.resolve({stdout: ''}); }); - try { await upgrade.func([newVersion], ctx, opts); } catch (error) { expect(error.message).toBe( - 'Upgrade failed. Please see the messages above for details' + 'Upgrade failed. Please see the messages above for details', ); } - expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch diff --git a/packages/cli/src/commands/upgrade/helpers.js b/packages/cli/src/commands/upgrade/helpers.js index e40353588..5c9ad2fc2 100644 --- a/packages/cli/src/commands/upgrade/helpers.js +++ b/packages/cli/src/commands/upgrade/helpers.js @@ -6,7 +6,7 @@ export const fetch = (url: string) => const request = https.get(url, response => { if (response.statusCode < 200 || response.statusCode > 299) { reject( - new Error(`Failed to load page, status code: ${response.statusCode}`) + new Error(`Failed to load page, status code: ${response.statusCode}`), ); } const body = []; diff --git a/packages/cli/src/commands/upgrade/legacyUpgrade.js b/packages/cli/src/commands/upgrade/legacyUpgrade.js index 64d991234..57d82da3e 100644 --- a/packages/cli/src/commands/upgrade/legacyUpgrade.js +++ b/packages/cli/src/commands/upgrade/legacyUpgrade.js @@ -11,7 +11,7 @@ import fs from 'fs'; import path from 'path'; import semver from 'semver'; -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; @@ -23,7 +23,7 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { const projectDir = ctx.root; const packageJSON = JSON.parse( - fs.readFileSync(path.resolve(projectDir, 'package.json'), 'utf8') + fs.readFileSync(path.resolve(projectDir, 'package.json'), 'utf8'), ); warn( @@ -33,14 +33,14 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { '- Go back to the old version of React Native\n' + '- Run "npm install -g react-native-git-upgrade"\n' + '- Run "react-native-git-upgrade"\n' + - 'See https://facebook.github.io/react-native/docs/upgrading.html' + 'See https://facebook.github.io/react-native/docs/upgrading.html', ); const projectName = packageJSON.name; if (!projectName) { warn( 'Your project needs to have a name, declared in package.json, ' + - 'such as "name": "AwesomeApp". Please add a project name. Aborting.' + 'such as "name": "AwesomeApp". Please add a project name. Aborting.', ); return; } @@ -49,7 +49,7 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { if (!version) { warn( 'Your "package.json" file doesn\'t seem to declare "react-native" as ' + - 'a dependency. Nothing to upgrade. Aborting.' + 'a dependency. Nothing to upgrade. Aborting.', ); return; } @@ -58,7 +58,7 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { warn( 'Some major releases introduce breaking changes.\n' + 'Please use a caret version number in your "package.json" file \n' + - 'to avoid breakage. Use e.g. react-native: ^0.38.0. Aborting.' + 'to avoid breakage. Use e.g. react-native: ^0.38.0. Aborting.', ); return; } @@ -66,15 +66,15 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { const installed = JSON.parse( fs.readFileSync( path.resolve(projectDir, 'node_modules/react-native/package.json'), - 'utf8' - ) + 'utf8', + ), ); if (!semver.satisfies(installed.version, version)) { warn( 'react-native version in "package.json" doesn\'t match ' + 'the installed version in "node_modules".\n' + - 'Try running "npm install" to fix this. Aborting.' + 'Try running "npm install" to fix this. Aborting.', ); return; } @@ -84,17 +84,17 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { if (!semver.valid(v)) { warn( "A valid version number for 'react-native' is not specified in your " + - "'package.json' file. Aborting." + "'package.json' file. Aborting.", ); return; } logger.info( `Upgrading project to react-native v${installed.version}\n` + - `Check out the release notes and breaking changes: ` + + 'Check out the release notes and breaking changes: ' + `https://github.com/facebook/react-native/releases/tag/v${semver.major( - v - )}.${semver.minor(v)}.0` + v, + )}.${semver.minor(v)}.0`, ); // >= v0.21.0, we require react to be a peer dependency @@ -103,7 +103,7 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { 'Your "package.json" file doesn\'t seem to have "react" as a dependency.\n' + '"react" was changed from a dependency to a peer dependency in react-native v0.21.0.\n' + 'Therefore, it\'s necessary to include "react" in your project\'s dependencies.\n' + - 'Please run "npm install --save react", then re-run "react-native upgrade".\n' + 'Please run "npm install --save react", then re-run "react-native upgrade".\n', ); return; } @@ -115,14 +115,14 @@ function validateAndUpgrade(argv: Array, ctx: ContextT) { 'to do it automatically.\n' + 'Just run:\n' + '"npm install -g rnpm && npm install rnpm-plugin-upgrade@0.26 --save-dev", ' + - 'then run "rnpm upgrade".' + 'then run "rnpm upgrade".', ); } upgradeProjectFiles(projectDir, projectName); logger.info( - `Successfully upgraded this project to react-native v${installed.version}` + `Successfully upgraded this project to react-native v${installed.version}`, ); } @@ -135,7 +135,7 @@ function upgradeProjectFiles(projectDir, projectName) { path.dirname(require.resolve('react-native/template')), projectDir, projectName, - { upgrade: true } + {upgrade: true}, ); } diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 00db8441d..14512eb12 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -1,14 +1,13 @@ // @flow -/* eslint-disable consistent-return */ import path from 'path'; import fs from 'fs'; import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; -import type { ContextT } from '../../tools/types.flow'; +import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import PackageManager from '../../tools/PackageManager'; -import { fetch } from './helpers'; +import {fetch} from './helpers'; import legacyUpgrade from './legacyUpgrade'; type FlagsT = { @@ -19,14 +18,14 @@ const rnDiffPurgeUrl = 'https://github.com/pvinis/rn-diff-purge'; const getLatestRNVersion = async (): Promise => { logger.info('No version passed. Fetching latest...'); - const { stdout } = await execa('npm', ['info', 'react-native', 'version']); + const {stdout} = await execa('npm', ['info', 'react-native', 'version']); return stdout; }; const getRNPeerDeps = async ( - version: string -): Promise<{ [key: string]: string }> => { - const { stdout } = await execa('npm', [ + version: string, +): Promise<{[key: string]: string}> => { + const {stdout} = await execa('npm', [ 'info', `react-native@${version}`, 'peerDependencies', @@ -40,20 +39,20 @@ const getPatch = async (currentVersion, newVersion, projectDir) => { let patch; const rnDiffAppName = 'RnDiffApp'; - const { name } = require(path.join(projectDir, 'package.json')); + const {name} = require(path.join(projectDir, 'package.json')); logger.info(`Fetching diff between v${currentVersion} and v${newVersion}...`); try { patch = await fetch( - `${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}.diff` + `${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}.diff`, ); } catch (error) { logger.error( - `Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?` + `Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?`, ); logger.info( - `For available releases to diff see: https://github.com/pvinis/rn-diff-purge#version-changes` + 'For available releases to diff see: https://github.com/pvinis/rn-diff-purge#version-changes', ); return null; } @@ -73,30 +72,30 @@ const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => { logger.error( `Provided version "${ argv[0] - }" is not allowed. Please pass a valid semver version` + }" is not allowed. Please pass a valid semver version`, ); return null; } if (currentVersion > newVersion) { logger.error( - `Trying to upgrade from newer version "${currentVersion}" to older "${newVersion}"` + `Trying to upgrade from newer version "${currentVersion}" to older "${newVersion}"`, ); return null; } if (currentVersion === newVersion) { const { - dependencies: { 'react-native': version }, + dependencies: {'react-native': version}, } = require(path.join(projectDir, 'package.json')); if (semver.satisfies(newVersion, version)) { logger.warn( - `Specified version "${newVersion}" is already installed in node_modules and it satisfies "${version}" semver range. No need to upgrade` + `Specified version "${newVersion}" is already installed in node_modules and it satisfies "${version}" semver range. No need to upgrade`, ); return null; } logger.error( - `Dependency mismatch. Specified version "${newVersion}" is already installed in node_modules and it doesn't satisfy "${version}" semver range of your "react-native" dependency. Please re-install your dependencies` + `Dependency mismatch. Specified version "${newVersion}" is already installed in node_modules and it doesn't satisfy "${version}" semver range of your "react-native" dependency. Please re-install your dependencies`, ); return null; } @@ -107,19 +106,19 @@ const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => { const installDeps = async (newVersion, projectDir, patchSuccess) => { if (!patchSuccess) { logger.warn( - 'Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually' + 'Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually', ); } logger.info( - `Installing react-native@${newVersion} and its peer dependencies...` + `Installing react-native@${newVersion} and its peer dependencies...`, ); const peerDeps = await getRNPeerDeps(newVersion); - const pm = new PackageManager({ projectDir }); + const pm = new PackageManager({projectDir}); const deps = [ `react-native@${newVersion}`, ...Object.keys(peerDeps).map(module => `${module}@${peerDeps[module]}`), ]; - await pm.install(deps, { silent: true }); + await pm.install(deps, {silent: true}); await execa('git', ['add', 'package.json']); try { await execa('git', ['add', 'yarn.lock']); @@ -136,7 +135,7 @@ const installDeps = async (newVersion, projectDir, patchSuccess) => { const applyPatch = async ( currentVersion: string, newVersion: string, - tmpPatchFile: string + tmpPatchFile: string, ) => { let filesToExclude = ['package.json']; try { @@ -150,7 +149,7 @@ const applyPatch = async ( '-p2', '--3way', ]); - logger.info(`Applying diff...`); + logger.info('Applying diff...'); } catch (error) { filesToExclude = [ ...filesToExclude, @@ -171,10 +170,10 @@ const applyPatch = async ( } logger.error('Automatically applying diff failed'); logger.info( - `Here's the diff we tried to apply: ${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}` + `Here's the diff we tried to apply: ${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}`, ); logger.info( - `You may find release notes helpful: https://github.com/facebook/react-native/releases/tag/v${newVersion}` + `You may find release notes helpful: https://github.com/facebook/react-native/releases/tag/v${newVersion}`, ); return false; } @@ -188,19 +187,19 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } - const rnDiffGitAddress = `https://github.com/pvinis/rn-diff-purge.git`; + const rnDiffGitAddress = 'https://github.com/pvinis/rn-diff-purge.git'; const tmpRemote = 'tmp-rn-diff-purge'; const tmpPatchFile = 'tmp-upgrade-rn.patch'; const projectDir = ctx.root; - const { version: currentVersion } = require(path.join( + const {version: currentVersion} = require(path.join( projectDir, - 'node_modules/react-native/package.json' + 'node_modules/react-native/package.json', )); const newVersion = await getVersionToUpgradeTo( argv, currentVersion, - projectDir + projectDir, ); if (!newVersion) { @@ -217,11 +216,10 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { logger.info('Diff has no changes to apply, proceeding further'); await installDeps(newVersion, projectDir); logger.success( - `Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes` + `Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`, ); return; } - let patchSuccess; try { @@ -242,25 +240,22 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { } await installDeps(newVersion, projectDir, patchSuccess); logger.info('Running "git status" to check what changed...'); - await execa('git', ['status'], { stdio: 'inherit' }); + await execa('git', ['status'], {stdio: 'inherit'}); await execa('git', ['remote', 'remove', tmpRemote]); if (!patchSuccess) { logger.warn( - 'Please run "git diff" to review the conflicts and resolve them' + 'Please run "git diff" to review the conflicts and resolve them', ); - // eslint-disable-next-line no-unsafe-finally throw new Error( - 'Upgrade failed. Please see the messages above for details' + 'Upgrade failed. Please see the messages above for details', ); } } - logger.success( - `Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes` + `Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`, ); } - const upgradeCommand = { name: 'upgrade [version]', description: @@ -275,5 +270,4 @@ const upgradeCommand = { }, ], }; - export default upgradeCommand; diff --git a/packages/cli/src/tools/PackageManager.js b/packages/cli/src/tools/PackageManager.js index a586dd3c9..bcc8de4a4 100644 --- a/packages/cli/src/tools/PackageManager.js +++ b/packages/cli/src/tools/PackageManager.js @@ -1,5 +1,5 @@ // @flow -import { execSync } from 'child_process'; +import {execSync} from 'child_process'; import yarn from './yarn'; type PackageManagerOptions = { @@ -14,7 +14,7 @@ export default class PackageManager { this.options = options; } - executeCommand(command: string, options?: { silent: boolean }) { + executeCommand(command: string, options?: {silent: boolean}) { return execSync(command, { stdio: options && options.silent ? 'pipe' : 'inherit', }); @@ -28,12 +28,12 @@ export default class PackageManager { ); } - install(packageNames: Array, options?: { silent: boolean }) { + install(packageNames: Array, options?: {silent: boolean}) { return this.shouldCallYarn() ? this.executeCommand(`yarn add ${packageNames.join(' ')}`, options) : this.executeCommand( `npm install ${packageNames.join(' ')} --save --save-exact`, - options + options, ); } @@ -41,7 +41,7 @@ export default class PackageManager { return this.shouldCallYarn() ? this.executeCommand(`yarn add -D ${packageNames.join(' ')}`) : this.executeCommand( - `npm install ${packageNames.join(' ')} --save-dev --save-exact` + `npm install ${packageNames.join(' ')} --save-dev --save-exact`, ); } diff --git a/packages/cli/src/tools/__fixtures__/android.js b/packages/cli/src/tools/__fixtures__/android.js index d6097b0bf..d5f603069 100644 --- a/packages/cli/src/tools/__fixtures__/android.js +++ b/packages/cli/src/tools/__fixtures__/android.js @@ -11,10 +11,10 @@ const fs = jest.requireActual('fs'); const path = jest.requireActual('path'); const manifest = fs.readFileSync( - path.join(__dirname, './files/AndroidManifest.xml') + path.join(__dirname, './files/AndroidManifest.xml'), ); const mainJavaClass = fs.readFileSync( - path.join(__dirname, './files/Main.java') + path.join(__dirname, './files/Main.java'), ); function generateValidFileStructure(classFileName) { @@ -27,7 +27,7 @@ function generateValidFileStructure(classFileName) { example: { 'Main.java': mainJavaClass, [classFileName]: fs.readFileSync( - path.join(__dirname, `./files/${classFileName}`) + path.join(__dirname, `./files/${classFileName}`), ), }, }, @@ -50,7 +50,7 @@ exports.userConfigManifest = { example: { 'Main.java': mainJavaClass, 'ReactPackage.java': fs.readFileSync( - path.join(__dirname, './files/ReactPackage.java') + path.join(__dirname, './files/ReactPackage.java'), ), }, }, @@ -58,7 +58,7 @@ exports.userConfigManifest = { }, debug: { 'AndroidManifest.xml': fs.readFileSync( - path.join(__dirname, './files/AndroidManifest-debug.xml') + path.join(__dirname, './files/AndroidManifest-debug.xml'), ), }, }, diff --git a/packages/cli/src/tools/__fixtures__/ios.js b/packages/cli/src/tools/__fixtures__/ios.js index 9e4ac610f..876a6cfd1 100644 --- a/packages/cli/src/tools/__fixtures__/ios.js +++ b/packages/cli/src/tools/__fixtures__/ios.js @@ -14,7 +14,7 @@ const fs = jest.requireActual('fs'); exports.valid = { 'demoProject.xcodeproj': { 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj') + path.join(__dirname, './files/project.pbxproj'), ), }, 'TestPod.podspec': 'empty', @@ -23,7 +23,7 @@ exports.valid = { exports.validTestName = { 'MyTestProject.xcodeproj': { 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj') + path.join(__dirname, './files/project.pbxproj'), ), }, }; diff --git a/packages/cli/src/tools/__fixtures__/projects.js b/packages/cli/src/tools/__fixtures__/projects.js index 321d50cb0..67034aeae 100644 --- a/packages/cli/src/tools/__fixtures__/projects.js +++ b/packages/cli/src/tools/__fixtures__/projects.js @@ -34,6 +34,6 @@ const withPods = { ios: ios.pod, }; -export default { flat, nested, withExamples, withPods }; +export default {flat, nested, withExamples, withPods}; // export { flat, nested, withExamples, withPods }; diff --git a/packages/cli/src/tools/__tests__/PackageManager-test.js b/packages/cli/src/tools/__tests__/PackageManager-test.js index 522bd9b6d..97bb96318 100644 --- a/packages/cli/src/tools/__tests__/PackageManager-test.js +++ b/packages/cli/src/tools/__tests__/PackageManager-test.js @@ -5,7 +5,7 @@ import yarn from '../yarn'; const PROJECT_DIR = '/project/directory'; const PACKAGES = ['react', 'react-native']; -const EXEC_OPTS = { stdio: 'inherit' }; +const EXEC_OPTS = {stdio: 'inherit'}; beforeEach(() => { jest.spyOn(ChildProcess, 'execSync').mockImplementation(() => {}); @@ -20,35 +20,35 @@ describe('yarn', () => { }); it('should install', () => { - const packageManager = new PackageManager({ projectDir: PROJECT_DIR }); + const packageManager = new PackageManager({projectDir: PROJECT_DIR}); packageManager.install(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'yarn add react react-native', - EXEC_OPTS + EXEC_OPTS, ); }); it('should installDev', () => { - const packageManager = new PackageManager({ projectDir: PROJECT_DIR }); + const packageManager = new PackageManager({projectDir: PROJECT_DIR}); packageManager.installDev(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'yarn add -D react react-native', - EXEC_OPTS + EXEC_OPTS, ); }); it('should uninstall', () => { - const packageManager = new PackageManager({ projectDir: PROJECT_DIR }); + const packageManager = new PackageManager({projectDir: PROJECT_DIR}); packageManager.uninstall(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( - `yarn remove react react-native`, - EXEC_OPTS + 'yarn remove react react-native', + EXEC_OPTS, ); }); }); @@ -64,7 +64,7 @@ describe('npm', () => { expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save --save-exact', - EXEC_OPTS + EXEC_OPTS, ); }); @@ -78,7 +78,7 @@ describe('npm', () => { expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save-dev --save-exact', - EXEC_OPTS + EXEC_OPTS, ); }); @@ -91,32 +91,32 @@ describe('npm', () => { packageManager.uninstall(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( - `npm uninstall react react-native --save`, - EXEC_OPTS + 'npm uninstall react react-native --save', + EXEC_OPTS, ); }); }); it('should use npm if yarn is not available', () => { jest.spyOn(yarn, 'getYarnVersionIfAvailable').mockImplementation(() => false); - const packageManager = new PackageManager({ projectDir: PROJECT_DIR }); + const packageManager = new PackageManager({projectDir: PROJECT_DIR}); packageManager.install(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( - `npm install react react-native --save --save-exact`, - EXEC_OPTS + 'npm install react react-native --save --save-exact', + EXEC_OPTS, ); }); it('should use npm if global cli is not using yarn', () => { jest.spyOn(yarn, 'isGlobalCliUsingYarn').mockImplementation(() => false); - const packageManager = new PackageManager({ projectDir: PROJECT_DIR }); + const packageManager = new PackageManager({projectDir: PROJECT_DIR}); packageManager.install(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( - `npm install react react-native --save --save-exact`, - EXEC_OPTS + 'npm install react react-native --save --save-exact', + EXEC_OPTS, ); }); diff --git a/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js b/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js index a2ddc80ac..9c9cd8b80 100644 --- a/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js +++ b/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js @@ -30,7 +30,7 @@ const fs = require('fs'); android: mocks.validKotlin, }, }, - platform + platform, ); }); @@ -40,13 +40,13 @@ const fs = require('fs'); it('returns the name of the java class implementing ReactPackage', () => { expect(findPackageClassName(`${root}flatJava`)).toBe( - 'SomeExampleJavaPackage' + 'SomeExampleJavaPackage', ); }); it('returns the name of the kotlin class implementing ReactPackage', () => { expect(findPackageClassName(`${root}flatKotlin`)).toBe( - 'SomeExampleKotlinPackage' + 'SomeExampleKotlinPackage', ); }); diff --git a/packages/cli/src/tools/__tests__/findAssets-test.js b/packages/cli/src/tools/__tests__/findAssets-test.js index 240b8a07e..a912a846f 100644 --- a/packages/cli/src/tools/__tests__/findAssets-test.js +++ b/packages/cli/src/tools/__tests__/findAssets-test.js @@ -15,11 +15,11 @@ jest.mock('fs'); const fs = require('fs'); -const { findAssets } = require('../getAssets'); +const {findAssets} = require('../getAssets'); describe('findAssets', () => { beforeEach(() => { - fs.__setMockFilesystem({ testDir: dependencies.withAssets }); + fs.__setMockFilesystem({testDir: dependencies.withAssets}); }); it('returns an array of all files in given folders', () => { diff --git a/packages/cli/src/tools/__tests__/findPlugins-test.js b/packages/cli/src/tools/__tests__/findPlugins-test.js index 464165d1b..c1cee2079 100644 --- a/packages/cli/src/tools/__tests__/findPlugins-test.js +++ b/packages/cli/src/tools/__tests__/findPlugins-test.js @@ -24,9 +24,9 @@ describe('findPlugins', () => { jest.doMock( pjsonPath, () => ({ - dependencies: { 'rnpm-plugin-test': '*' }, + dependencies: {'rnpm-plugin-test': '*'}, }), - { virtual: true } + {virtual: true}, ); expect(findPlugins(ROOT)).toHaveProperty('commands'); @@ -37,7 +37,7 @@ describe('findPlugins', () => { }); it('returns an empty array if there are no plugins in this folder', () => { - jest.doMock(pjsonPath, () => ({}), { virtual: true }); + jest.doMock(pjsonPath, () => ({}), {virtual: true}); expect(findPlugins(ROOT)).toHaveProperty('commands'); expect(findPlugins(ROOT)).toHaveProperty('platforms'); expect(findPlugins(ROOT).commands).toHaveLength(0); @@ -55,10 +55,10 @@ describe('findPlugins', () => { jest.doMock( pjsonPath, () => ({ - dependencies: { 'rnpm-plugin-test': '*' }, - devDependencies: { 'rnpm-plugin-test-2': '*' }, + dependencies: {'rnpm-plugin-test': '*'}, + devDependencies: {'rnpm-plugin-test-2': '*'}, }), - { virtual: true } + {virtual: true}, ); expect(findPlugins(ROOT)).toHaveProperty('commands'); expect(findPlugins(ROOT)).toHaveProperty('platforms'); @@ -70,10 +70,10 @@ describe('findPlugins', () => { jest.doMock( pjsonPath, () => ({ - dependencies: { 'rnpm-plugin-test': '*' }, - devDependencies: { 'rnpm-plugin-test': '*' }, + dependencies: {'rnpm-plugin-test': '*'}, + devDependencies: {'rnpm-plugin-test': '*'}, }), - { virtual: true } + {virtual: true}, ); expect(findPlugins(ROOT).commands).toHaveLength(1); }); @@ -89,7 +89,7 @@ describe('findPlugins', () => { '@react-native-org/test': '*', }, }), - { virtual: true } + {virtual: true}, ); expect(findPlugins(ROOT)).toHaveProperty('commands'); diff --git a/packages/cli/src/tools/__tests__/ios/findProject-test.js b/packages/cli/src/tools/__tests__/ios/findProject-test.js index 3f7cd0347..0b490a053 100644 --- a/packages/cli/src/tools/__tests__/ios/findProject-test.js +++ b/packages/cli/src/tools/__tests__/ios/findProject-test.js @@ -24,22 +24,22 @@ describe('ios::findProject', () => { }); it('returns null if there are no projects', () => { - fs.__setMockFilesystem({ testDir: projects }); + fs.__setMockFilesystem({testDir: projects}); expect(findProject('/')).toBeNull(); }); it('returns ios project regardless of its name', () => { - fs.__setMockFilesystem({ ios: ios.validTestName }); + fs.__setMockFilesystem({ios: ios.validTestName}); expect(findProject('/')).not.toBeNull(); }); it('ignores node_modules', () => { - fs.__setMockFilesystem({ node_modules: projects.flat }); + fs.__setMockFilesystem({node_modules: projects.flat}); expect(findProject('/')).toBeNull(); }); it('ignores Pods', () => { - fs.__setMockFilesystem({ Pods: projects.flat }); + fs.__setMockFilesystem({Pods: projects.flat}); expect(findProject('/')).toBeNull(); }); diff --git a/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js b/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js index b5cf7c5e9..cd51f654c 100644 --- a/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js +++ b/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js @@ -21,7 +21,7 @@ describe('ios::getProjectConfig', () => { const userConfig = {}; beforeEach(() => { - fs.__setMockFilesystem({ testDir: projects }); + fs.__setMockFilesystem({testDir: projects}); }); it('returns an object with ios project configuration', () => { diff --git a/packages/cli/src/tools/__tests__/makeCommand-test.js b/packages/cli/src/tools/__tests__/makeCommand-test.js index 38a076a30..6eee9758e 100644 --- a/packages/cli/src/tools/__tests__/makeCommand-test.js +++ b/packages/cli/src/tools/__tests__/makeCommand-test.js @@ -16,7 +16,7 @@ jest.setMock('child_process', { }), }); -const { makeCommand } = require('../getHooks'); +const {makeCommand} = require('../getHooks'); describe('makeCommand', () => { const command = makeCommand('echo'); diff --git a/packages/cli/src/tools/android/findPackageClassName.js b/packages/cli/src/tools/android/findPackageClassName.js index 76ca9cf6c..eaac9631d 100644 --- a/packages/cli/src/tools/android/findPackageClassName.js +++ b/packages/cli/src/tools/android/findPackageClassName.js @@ -18,7 +18,7 @@ import path from 'path'; * @param {String} folder Folder to find java/kt files */ export default function getPackageClassName(folder) { - const files = glob.sync('**/+(*.java|*.kt)', { cwd: folder }); + const files = glob.sync('**/+(*.java|*.kt)', {cwd: folder}); const packages = files .map(filePath => fs.readFileSync(path.join(folder, filePath), 'utf8')) diff --git a/packages/cli/src/tools/android/index.js b/packages/cli/src/tools/android/index.js index 631c8b80a..4fa788a18 100644 --- a/packages/cli/src/tools/android/index.js +++ b/packages/cli/src/tools/android/index.js @@ -53,28 +53,28 @@ export function projectConfig(folder, userConfig = {}) { const mainFilePath = path.join( sourceDir, userConfig.mainFilePath || - `src/main/java/${packageFolder}/MainApplication.java` + `src/main/java/${packageFolder}/MainApplication.java`, ); const stringsPath = path.join( sourceDir, - userConfig.stringsPath || 'src/main/res/values/strings.xml' + userConfig.stringsPath || 'src/main/res/values/strings.xml', ); const settingsGradlePath = path.join( folder, 'android', - userConfig.settingsGradlePath || 'settings.gradle' + userConfig.settingsGradlePath || 'settings.gradle', ); const assetsPath = path.join( sourceDir, - userConfig.assetsPath || 'src/main/assets' + userConfig.assetsPath || 'src/main/assets', ); const buildGradlePath = path.join( sourceDir, - userConfig.buildGradlePath || 'build.gradle' + userConfig.buildGradlePath || 'build.gradle', ); return { @@ -128,5 +128,5 @@ export function dependencyConfig(folder, userConfig = {}) { const packageInstance = userConfig.packageInstance || `new ${packageClassName}()`; - return { sourceDir, folder, manifest, packageImportPath, packageInstance }; + return {sourceDir, folder, manifest, packageImportPath, packageInstance}; } diff --git a/packages/cli/src/tools/assertRequiredOptions.js b/packages/cli/src/tools/assertRequiredOptions.js index 509c37178..c4de673c0 100644 --- a/packages/cli/src/tools/assertRequiredOptions.js +++ b/packages/cli/src/tools/assertRequiredOptions.js @@ -7,8 +7,8 @@ * @format */ -import { Option } from 'commander'; -import { camelCase } from 'lodash'; +import {Option} from 'commander'; +import {camelCase} from 'lodash'; // Commander.js has a 2 years old open issue to support <...> syntax // for options. Until that gets merged, we run the checks manually diff --git a/packages/cli/src/tools/copyAndReplace.js b/packages/cli/src/tools/copyAndReplace.js index 1d6d96438..986088e43 100644 --- a/packages/cli/src/tools/copyAndReplace.js +++ b/packages/cli/src/tools/copyAndReplace.js @@ -29,7 +29,7 @@ function copyAndReplace( srcPath, destPath, replacements, - contentChangedCallback + contentChangedCallback, ) { if (fs.lstatSync(srcPath).isDirectory()) { if (!fs.existsSync(destPath)) { diff --git a/packages/cli/src/tools/findPlugins.js b/packages/cli/src/tools/findPlugins.js index caa78179a..3ae92775c 100644 --- a/packages/cli/src/tools/findPlugins.js +++ b/packages/cli/src/tools/findPlugins.js @@ -8,7 +8,7 @@ */ import path from 'path'; -import { union, uniq, flatten } from 'lodash'; +import {union, uniq, flatten} from 'lodash'; const RNPM_PLUGIN_PATTERNS = [/^rnpm-plugin-/, /^@(.*)\/rnpm-plugin-/]; @@ -68,14 +68,12 @@ const findHasteConfigInPackageAndConcat = (pjson, haste) => { const pkgHaste = pjson.rnpm.haste; if (pkgHaste.platforms) { - // eslint-disable-next-line no-param-reassign haste.platforms = haste.platforms.concat(pkgHaste.platforms); } if (pkgHaste.providesModuleNodeModules) { - // eslint-disable-next-line no-param-reassign haste.providesModuleNodeModules = haste.providesModuleNodeModules.concat( - pkgHaste.providesModuleNodeModules + pkgHaste.providesModuleNodeModules, ); } }; @@ -89,11 +87,11 @@ const findPluginsInFolder = folder => { const deps = union( Object.keys(pjson.dependencies || {}), - Object.keys(pjson.devDependencies || {}) + Object.keys(pjson.devDependencies || {}), ); return deps.reduce((acc, pkg) => { - let { commands, platforms } = acc; + let {commands, platforms} = acc; if (isRNPMPlugin(pkg)) { commands = commands.concat(pkg); } @@ -105,7 +103,7 @@ const findPluginsInFolder = folder => { findHasteConfigInPackageAndConcat(pkgJson, acc.haste); } } - return { commands, platforms, haste: acc.haste }; + return {commands, platforms, haste: acc.haste}; }, getEmptyPluginConfig()); }; @@ -121,7 +119,7 @@ export default function findPlugins(folder: string) { haste: { platforms: uniq(flatten(plugin.haste.platforms)), providesModuleNodeModules: uniq( - flatten(plugin.haste.providesModuleNodeModules) + flatten(plugin.haste.providesModuleNodeModules), ), }, }; diff --git a/packages/cli/src/tools/findReactNativeScripts.js b/packages/cli/src/tools/findReactNativeScripts.js index 9918081b7..876b9dcae 100644 --- a/packages/cli/src/tools/findReactNativeScripts.js +++ b/packages/cli/src/tools/findReactNativeScripts.js @@ -15,7 +15,7 @@ function findReactNativeScripts(): ?string { const executablePath = path.resolve( 'node_modules', '.bin', - 'react-native-scripts' + 'react-native-scripts', ); if (fs.existsSync(executablePath)) { return executablePath; diff --git a/packages/cli/src/tools/findSymlinkedModules.js b/packages/cli/src/tools/findSymlinkedModules.js index 068ded2db..90a0f5933 100644 --- a/packages/cli/src/tools/findSymlinkedModules.js +++ b/packages/cli/src/tools/findSymlinkedModules.js @@ -32,7 +32,7 @@ import fs from 'fs'; */ export default function findSymlinkedModules( projectRoot: string, - ignoredRoots?: Array = [] + ignoredRoots?: Array = [], ) { const nodeModuleRoot = path.join(projectRoot, 'node_modules'); const resolvedSymlinks = findModuleSymlinks(nodeModuleRoot, [ @@ -44,7 +44,7 @@ export default function findSymlinkedModules( function findModuleSymlinks( modulesPath: string, - ignoredPaths: Array = [] + ignoredPaths: Array = [], ): Array { if (!fs.existsSync(modulesPath)) { return []; @@ -58,7 +58,7 @@ function findModuleSymlinks( if (folderName.startsWith('@')) { const scopedModuleFolders = fs.readdirSync(folderPath); maybeSymlinkPaths.push( - ...scopedModuleFolders.map(name => path.join(folderPath, name)) + ...scopedModuleFolders.map(name => path.join(folderPath, name)), ); } else { maybeSymlinkPaths.push(folderPath); @@ -76,9 +76,9 @@ function findModuleSymlinks( findModuleSymlinks(path.join(symlinkPath, 'node_modules'), [ ...ignoredPaths, ...symlinks, - ]) + ]), ), - [] + [], ); return [...new Set([...symlinks, ...nestedSymlinks])]; @@ -89,7 +89,7 @@ function resolveSymlinkPaths(maybeSymlinkPaths, ignoredPaths) { if (fs.lstatSync(maybeSymlinkPath).isSymbolicLink()) { const resolved = path.resolve( path.dirname(maybeSymlinkPath), - fs.readlinkSync(maybeSymlinkPath) + fs.readlinkSync(maybeSymlinkPath), ); if (ignoredPaths.indexOf(resolved) === -1 && fs.existsSync(resolved)) { links.push(resolved); diff --git a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js index 5a0362a6e..dd8ca4b98 100644 --- a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js +++ b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js @@ -34,7 +34,7 @@ function copyProjectTemplateAndReplace( srcPath, destPath, newProjectName, - options = {} + options = {}, ) { if (!srcPath) { throw new Error('Need a path to copy from'); @@ -67,7 +67,7 @@ function copyProjectTemplateAndReplace( } const relativeFilePath = translateFilePath( - path.relative(srcPath, absoluteSrcFilePath) + path.relative(srcPath, absoluteSrcFilePath), ) .replace(/HelloWorld/g, newProjectName) .replace(/helloworld/g, newProjectName.toLowerCase()); @@ -94,7 +94,7 @@ function copyProjectTemplateAndReplace( upgradeFileContentChangedCallback( absoluteSrcFilePath, relativeFilePath, - contentChanged + contentChanged, ); } copyAndReplace( @@ -105,7 +105,7 @@ function copyProjectTemplateAndReplace( HelloWorld: newProjectName, helloworld: newProjectName.toLowerCase(), }, - contentChangedCallback + contentChangedCallback, ); }); } @@ -135,7 +135,7 @@ function translateFilePath(filePath) { function upgradeFileContentChangedCallback( absoluteSrcFilePath, relativeDestPath, - contentChanged + contentChanged, ) { if (contentChanged === 'new') { logger.info(`${chalk.bold('new')} ${relativeDestPath}`); @@ -145,11 +145,11 @@ function upgradeFileContentChangedCallback( logger.info( `${chalk.bold(relativeDestPath)} ` + `has changed in the new version.\nDo you want to keep your ${relativeDestPath} or replace it with the ` + - `latest version?\nIf you ever made any changes ` + - `to this file, you'll probably want to keep it.\n` + + 'latest version?\nIf you ever made any changes ' + + "to this file, you'll probably want to keep it.\n" + `You can see the new version here: ${absoluteSrcFilePath}\n` + `Do you want to replace ${relativeDestPath}? ` + - `Answer y to replace, n to keep your version: ` + 'Answer y to replace, n to keep your version: ', ); const answer = prompt(); if (answer === 'y') { @@ -163,7 +163,7 @@ function upgradeFileContentChangedCallback( return 'keep'; } throw new Error( - `Unknown file changed state: ${relativeDestPath}, ${contentChanged}` + `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`, ); } diff --git a/packages/cli/src/tools/generator/printRunInstructions.js b/packages/cli/src/tools/generator/printRunInstructions.js index fa0ab52c5..f09f7adcf 100644 --- a/packages/cli/src/tools/generator/printRunInstructions.js +++ b/packages/cli/src/tools/generator/printRunInstructions.js @@ -17,11 +17,11 @@ function printRunInstructions(projectDir: string, projectName: string) { const xcodeProjectPath = `${path.resolve( projectDir, 'ios', - projectName + projectName, )}.xcodeproj`; const relativeXcodeProjectPath = path.relative( process.cwd(), - xcodeProjectPath + xcodeProjectPath, ); logger.log(` diff --git a/packages/cli/src/tools/generator/promptSync.js b/packages/cli/src/tools/generator/promptSync.js index ce17409af..8c73a5a2c 100644 --- a/packages/cli/src/tools/generator/promptSync.js +++ b/packages/cli/src/tools/generator/promptSync.js @@ -10,8 +10,6 @@ // Simplified version of: // https://github.com/0x00A/prompt-sync/blob/master/index.js -/* eslint-disable */ - import fs from 'fs'; const term = 13; // carriage return @@ -112,7 +110,7 @@ function create() { if (masked) { process.stdout.write( - `\u001b[2K\u001b[0G${ask}${Array(str.length + 1).join(echo)}` + `\u001b[2K\u001b[0G${ask}${Array(str.length + 1).join(echo)}`, ); } else { process.stdout.write('\u001b[s'); @@ -122,7 +120,7 @@ function create() { process.stdout.write(`\u001b[2K\u001b[0G${ask}${str}`); } else { process.stdout.write( - `\u001b[2K\u001b[0G${str}\u001b[${str.length - insert}D` + `\u001b[2K\u001b[0G${str}\u001b[${str.length - insert}D`, ); } process.stdout.write('\u001b[u'); diff --git a/packages/cli/src/tools/generator/templates.js b/packages/cli/src/tools/generator/templates.js index 66150c6b4..85d426e82 100644 --- a/packages/cli/src/tools/generator/templates.js +++ b/packages/cli/src/tools/generator/templates.js @@ -8,7 +8,7 @@ * @flow */ -import { execSync } from 'child_process'; +import {execSync} from 'child_process'; import fs from 'fs'; import path from 'path'; import copyProjectTemplateAndReplace from './copyProjectTemplateAndReplace'; @@ -26,7 +26,7 @@ function createProjectFromTemplate( destPath: string, newProjectName: string, template: string, - destinationRoot: string + destinationRoot: string, ) { const templatePath = path.dirname(require.resolve('react-native/template')); copyProjectTemplateAndReplace(templatePath, destPath, newProjectName); @@ -56,7 +56,7 @@ function createFromRemoteTemplate( template: string, destPath: string, newProjectName: string, - destinationRoot: string + destinationRoot: string, ) { let installPackage; let templateName; @@ -72,7 +72,7 @@ function createFromRemoteTemplate( // Check if the template exists logger.info(`Fetching template ${installPackage}...`); - const packageManager = new PackageManager({ projectDir: destinationRoot }); + const packageManager = new PackageManager({projectDir: destinationRoot}); try { packageManager.install([installPackage]); const templatePath = path.resolve('node_modules', templateName); @@ -98,7 +98,7 @@ function createFromRemoteTemplate( // if this the clean up fails. logger.warn( `Failed to clean up template temp files in node_modules/${templateName}. ` + - 'This is not a critical error, you can work on your app.' + 'This is not a critical error, you can work on your app.', ); } } @@ -119,17 +119,17 @@ function installTemplateDependencies(templatePath, destinationRoot) { dependencies = require(dependenciesJsonPath); } catch (err) { throw new Error( - `Could not parse the template's dependencies.json: ${err.message}` + `Could not parse the template's dependencies.json: ${err.message}`, ); } const dependenciesToInstall = Object.keys(dependencies).map( - depName => `${depName}@${dependencies[depName]}` + depName => `${depName}@${dependencies[depName]}`, ); - new PackageManager({ projectDir: destinationRoot }).install( - dependenciesToInstall + new PackageManager({projectDir: destinationRoot}).install( + dependenciesToInstall, ); logger.info("Linking native dependencies into the project's build files..."); - execSync('react-native link', { stdio: 'inherit' }); + execSync('react-native link', {stdio: 'inherit'}); } function installTemplateDevDependencies(templatePath, destinationRoot) { @@ -137,7 +137,7 @@ function installTemplateDevDependencies(templatePath, destinationRoot) { // that are required by this template const devDependenciesJsonPath = path.resolve( templatePath, - 'devDependencies.json' + 'devDependencies.json', ); logger.info('Adding develop dependencies for the project...'); if (!fs.existsSync(devDependenciesJsonPath)) { @@ -150,16 +150,16 @@ function installTemplateDevDependencies(templatePath, destinationRoot) { dependencies = require(devDependenciesJsonPath); } catch (err) { throw new Error( - `Could not parse the template's devDependencies.json: ${err.message}` + `Could not parse the template's devDependencies.json: ${err.message}`, ); } const dependenciesToInstall = Object.keys(dependencies).map( - depName => `${depName}@${dependencies[depName]}` + depName => `${depName}@${dependencies[depName]}`, ); - new PackageManager({ projectDir: destinationRoot }).installDev( - dependenciesToInstall + new PackageManager({projectDir: destinationRoot}).installDev( + dependenciesToInstall, ); } -export { createProjectFromTemplate }; +export {createProjectFromTemplate}; diff --git a/packages/cli/src/tools/getAssets.js b/packages/cli/src/tools/getAssets.js index 26c751dcd..d0927ea61 100644 --- a/packages/cli/src/tools/getAssets.js +++ b/packages/cli/src/tools/getAssets.js @@ -7,7 +7,7 @@ import path from 'path'; import getPackageConfiguration from './getPackageConfiguration'; const findAssetsInFolder = folder => - glob.sync(path.join(folder, '**'), { nodir: true }); + glob.sync(path.join(folder, '**'), {nodir: true}); /** * Given an array of assets folders, e.g. ['Fonts', 'Images'], @@ -21,7 +21,7 @@ export function findAssets(folder: string, assets?: string[]) { .reduce( (acc, assetPath) => (acc.concat(findAssetsInFolder(assetPath)): Array), - [] + [], ); } diff --git a/packages/cli/src/tools/getHooks.js b/packages/cli/src/tools/getHooks.js index ec8da8a4a..aac342808 100644 --- a/packages/cli/src/tools/getHooks.js +++ b/packages/cli/src/tools/getHooks.js @@ -2,15 +2,14 @@ * @flow */ -import { spawn } from 'child_process'; +import {spawn} from 'child_process'; import getPackageConfiguration from './getPackageConfiguration'; export function makeCommand(command: string) { - // eslint-disable-next-line flowtype/no-weak-types return (cb: Function) => { if (!cb) { throw new Error( - `You missed a callback function for the ${command} command` + `You missed a callback function for the ${command} command`, ); } diff --git a/packages/cli/src/tools/getLegacyConfig.js b/packages/cli/src/tools/getLegacyConfig.js index c359d8fc5..2b5386f8e 100644 --- a/packages/cli/src/tools/getLegacyConfig.js +++ b/packages/cli/src/tools/getLegacyConfig.js @@ -22,7 +22,7 @@ const generateDeprecationMessage = api => export default (root: string) => ({ getPlatformConfig: util.deprecate( () => getPlatforms(root), - generateDeprecationMessage('getPlatformConfig()') + generateDeprecationMessage('getPlatformConfig()'), ), getProjectConfig: util.deprecate(() => { const platforms = getPlatforms(root); diff --git a/packages/cli/src/tools/getPackageConfiguration.js b/packages/cli/src/tools/getPackageConfiguration.js index e430b565c..b1ce140e5 100644 --- a/packages/cli/src/tools/getPackageConfiguration.js +++ b/packages/cli/src/tools/getPackageConfiguration.js @@ -2,13 +2,13 @@ * @flow */ import path from 'path'; -import type { PackageConfigurationT } from './types.flow'; +import type {PackageConfigurationT} from './types.flow'; /** * Returns configuration of the CLI from `package.json`. */ export default function getPackageConfiguration( - folder: string + folder: string, ): PackageConfigurationT { return require(path.join(folder, './package.json')).rnpm || {}; } diff --git a/packages/cli/src/tools/getPlatforms.js b/packages/cli/src/tools/getPlatforms.js index 84fd95554..2aefde45d 100644 --- a/packages/cli/src/tools/getPlatforms.js +++ b/packages/cli/src/tools/getPlatforms.js @@ -3,7 +3,7 @@ */ import path from 'path'; -import type { PlatformsT } from './types.flow'; +import type {PlatformsT} from './types.flow'; import findPlugins from './findPlugins'; @@ -35,9 +35,9 @@ export default function getPlatforms(root: string): PlatformsT { (acc, pathToPlatform) => Object.assign( acc, - require(path.join(root, 'node_modules', pathToPlatform)) + require(path.join(root, 'node_modules', pathToPlatform)), ), - {} + {}, ); return { diff --git a/packages/cli/src/tools/ios/findPodspecName.js b/packages/cli/src/tools/ios/findPodspecName.js index 67126cea1..08b8ec83c 100644 --- a/packages/cli/src/tools/ios/findPodspecName.js +++ b/packages/cli/src/tools/ios/findPodspecName.js @@ -11,19 +11,19 @@ import glob from 'glob'; import path from 'path'; export default function findPodspecName(folder) { - const podspecs = glob.sync('*.podspec', { cwd: folder }); + const podspecs = glob.sync('*.podspec', {cwd: folder}); let podspecFile = null; if (podspecs.length === 0) { return null; } if (podspecs.length === 1) { - podspecFile = podspecs[0]; // eslint-disable-line prefer-destructuring + podspecFile = podspecs[0]; } else { const folderParts = folder.split(path.sep); const currentFolder = folderParts[folderParts.length - 1]; const toSelect = podspecs.indexOf(`${currentFolder}.podspec`); if (toSelect === -1) { - podspecFile = podspecs[0]; // eslint-disable-line prefer-destructuring + podspecFile = podspecs[0]; } else { podspecFile = podspecs[toSelect]; } diff --git a/packages/cli/src/tools/ios/findProject.js b/packages/cli/src/tools/ios/findProject.js index 62715579c..3b1862f88 100644 --- a/packages/cli/src/tools/ios/findProject.js +++ b/packages/cli/src/tools/ios/findProject.js @@ -46,7 +46,7 @@ export default function findProject(folder) { }) .filter( project => - path.dirname(project) === IOS_BASE || !TEST_PROJECTS.test(project) + path.dirname(project) === IOS_BASE || !TEST_PROJECTS.test(project), ) .sort(project => (path.dirname(project) === IOS_BASE ? -1 : 1)); diff --git a/packages/cli/src/tools/isPackagerRunning.js b/packages/cli/src/tools/isPackagerRunning.js index c08ca4142..97f92550d 100644 --- a/packages/cli/src/tools/isPackagerRunning.js +++ b/packages/cli/src/tools/isPackagerRunning.js @@ -23,10 +23,11 @@ function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || 8081) { res => res .text() - .then(body => - body === 'packager-status:running' ? 'running' : 'unrecognized' + .then( + body => + body === 'packager-status:running' ? 'running' : 'unrecognized', ), - () => 'not_running' + () => 'not_running', ); } diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 2d79bb173..127083ff1 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -3,16 +3,16 @@ * @flow */ import path from 'path'; -import { createBlacklist } from 'metro'; -import { loadConfig } from 'metro-config'; -import type { ContextT } from './types.flow'; +import {createBlacklist} from 'metro'; +import {loadConfig} from 'metro-config'; +import type {ContextT} from './types.flow'; import findPlugins from './findPlugins'; import findSymlinkedModules from './findSymlinkedModules'; const resolveSymlinksForRoots = roots => roots.reduce( (arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)), - [...roots] + [...roots], ); const getWatchFolders = () => { @@ -48,7 +48,7 @@ export const getDefaultConfig = (ctx: ContextT) => { serializer: { getModulesRunBeforeMainModule: () => [ require.resolve( - path.join(ctx.reactNativePath, 'Libraries/tools/InitializeCore') + path.join(ctx.reactNativePath, 'Libraries/tools/InitializeCore'), ), ], getPolyfills: () => @@ -59,11 +59,11 @@ export const getDefaultConfig = (ctx: ContextT) => { }, transformer: { babelTransformerPath: require.resolve( - 'metro-react-native-babel-transformer' + 'metro-react-native-babel-transformer', ), assetRegistryPath: path.join( ctx.reactNativePath, - 'Libraries/Image/AssetRegistry' + 'Libraries/Image/AssetRegistry', ), }, watchFolders: getWatchFolders(), @@ -76,7 +76,7 @@ export type ConfigOptionsT = {| resetCache?: boolean, watchFolders?: string[], sourceExts?: string[], - reporter?: any, // eslint-disable-line flowtype/no-weak-types + reporter?: any, config?: string, |}; @@ -85,10 +85,10 @@ export type ConfigOptionsT = {| * * This allows the CLI to always overwrite the file settings. */ -export default async function load( +export default (async function load( ctx: ContextT, // $FlowFixMe - troubles with empty object being inexact - options?: ConfigOptionsT = {} + options?: ConfigOptionsT = {}, ) { const defaultConfig = getDefaultConfig(ctx); @@ -97,8 +97,8 @@ export default async function load( cwd: ctx.root, ...options, }, - defaultConfig + defaultConfig, ); return config; -} +}); diff --git a/packages/cli/src/tools/types.flow.js b/packages/cli/src/tools/types.flow.js index 408241333..495c26190 100644 --- a/packages/cli/src/tools/types.flow.js +++ b/packages/cli/src/tools/types.flow.js @@ -2,8 +2,6 @@ * @flow */ -/* eslint-disable flowtype/no-weak-types */ - export type ContextT = { root: string, reactNativePath: string, @@ -64,7 +62,7 @@ export type PlatformConfigT = { string, DependencyConfigT, ProjectConfigT, - Array + Array, ) => void, copyAssets: (string[], ProjectConfigT) => void, unlinkAssets: (string[], ProjectConfigT) => void, @@ -112,7 +110,7 @@ export type DependenciesConfig = { name: string, path: string, assets: string[], - commands: { [name: string]: string }, + commands: {[name: string]: string}, params: InquirerPromptT[], }; @@ -123,12 +121,12 @@ export type PlatformsT = { ios: PlatformConfigT< ProjectConfigIOST, DependencyConfigIOST, - IOSConfigParamsT + IOSConfigParamsT, >, android: PlatformConfigT< ProjectConfigAndroidT, DependencyConfigAndroidT, - AndroidConfigParamsT + AndroidConfigParamsT, >, [name: string]: PlatformConfigT, }; @@ -140,7 +138,7 @@ export type InquirerPromptT = any; */ export type PackageConfigurationT = { assets?: string[], - commands?: { [name: string]: string }, + commands?: {[name: string]: string}, params?: InquirerPromptT[], android: AndroidConfigParamsT, ios: IOSConfigParamsT, diff --git a/packages/cli/src/tools/yarn.js b/packages/cli/src/tools/yarn.js index bb7372bf7..38317daca 100644 --- a/packages/cli/src/tools/yarn.js +++ b/packages/cli/src/tools/yarn.js @@ -7,7 +7,7 @@ * @format */ -import { execSync } from 'child_process'; +import {execSync} from 'child_process'; import fs from 'fs'; import path from 'path'; import semver from 'semver'; diff --git a/packages/global-cli/index.js b/packages/global-cli/index.js index 1c8da2dad..d24657bbd 100755 --- a/packages/global-cli/index.js +++ b/packages/global-cli/index.js @@ -68,7 +68,7 @@ const getRNPkgJsonPath = function() { process.cwd(), 'node_modules', 'react-native', - 'package.json' + 'package.json', ); }; @@ -114,7 +114,10 @@ const commands = options._; if (cli) { cli.run(); } else { - if (options._.length === 0 && (options.h || options.help) || commands.length === 0) { + if ( + (options._.length === 0 && (options.h || options.help)) || + commands.length === 0 + ) { console.log( [ '', @@ -131,7 +134,7 @@ if (cli) { ' -v, --version use a specific version of React Native', ' --template use an app template. Use --template to see available templates.', '', - ].join('\n') + ].join('\n'), ); process.exit(0); } @@ -149,7 +152,7 @@ if (cli) { console.error( 'Command `%s` unrecognized. ' + 'Make sure that you have run `npm install` and that you are inside a react-native project.', - commands[0] + commands[0], ); process.exit(1); break; @@ -161,7 +164,7 @@ function validateProjectName(name) { console.error( '"%s" is not a valid name for a project. Please use a valid identifier ' + 'name (alphanumeric).', - name + name, ); process.exit(1); } @@ -170,7 +173,7 @@ function validateProjectName(name) { console.error( '"%s" is not a valid name for a project. Please do not use the ' + 'reserved word "React".', - name + name, ); process.exit(1); } @@ -220,7 +223,7 @@ function createProject(name, options) { console.log( 'This will walk you through creating a new React Native project in', - root + root, ); if (!fs.existsSync(root)) { @@ -239,7 +242,7 @@ function createProject(name, options) { }; fs.writeFileSync( path.join(root, 'package.json'), - JSON.stringify(packageJson) + JSON.stringify(packageJson), ); process.chdir(root); @@ -278,18 +281,18 @@ function run(root, projectName, options) { console.log(`Installing ${getInstallPackage(rnPackage)}...`); if (!forceNpmClient) { console.log( - 'Consider installing yarn to make this faster: https://yarnpkg.com' + 'Consider installing yarn to make this faster: https://yarnpkg.com', ); } installCommand = `npm install --save --save-exact ${getInstallPackage( - rnPackage + rnPackage, )}`; if (options.verbose) { installCommand += ' --verbose'; } } try { - execSync(installCommand, { stdio: 'inherit' }); + execSync(installCommand, {stdio: 'inherit'}); } catch (err) { console.error(err); console.error(`Command \`${installCommand}\` failed.`); @@ -307,11 +310,11 @@ function checkNodeVersion() { } if (!semver.satisfies(process.version, packageJson.engines.node)) { console.error( - 'You are currently running Node %s but React Native requires %s. ' + - 'Please use a supported version of Node.\n' + - 'See https://facebook.github.io/react-native/docs/getting-started.html', + 'You are currently running Node %s but React Native requires %s. ' + + 'Please use a supported version of Node.\n' + + 'See https://facebook.github.io/react-native/docs/getting-started.html', process.version, - packageJson.engines.node + packageJson.engines.node, ); } } @@ -322,7 +325,7 @@ function printVersionsAndExit(reactNativePackageJsonPath) { console.log(`react-native: ${require(reactNativePackageJsonPath).version}`); } catch (e) { console.log( - 'react-native: n/a - not inside a React Native project directory' + 'react-native: n/a - not inside a React Native project directory', ); } process.exit(); diff --git a/scripts/build.js b/scripts/build.js index 689ba6d6a..cceda31af 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -25,9 +25,8 @@ const mkdirp = require('mkdirp'); const babel = require('@babel/core'); const chalk = require('chalk'); const micromatch = require('micromatch'); -const prettier = require('prettier'); const stringLength = require('string-length'); -const { PACKAGES_DIR, getPackages } = require('./helpers'); +const {PACKAGES_DIR, getPackages} = require('./helpers'); const OK = chalk.reset.inverse.bold.green(' DONE '); const SRC_DIR = 'src'; @@ -37,10 +36,6 @@ const IGNORE_PATTERN = '**/__{tests,mocks,fixtures}__/**'; const transformOptions = require('../babel.config.js'); -const prettierConfig = prettier.resolveConfig.sync(__filename); -prettierConfig.trailingComma = 'none'; -prettierConfig.parser = 'babel'; - const adjustToTerminalWidth = str => { const columns = process.stdout.columns || 80; const WIDTH = columns - stringLength(OK) + 1; @@ -87,7 +82,7 @@ function buildFile(file, silent) { silent || process.stdout.write( `${chalk.dim(' \u2022 ') + - path.relative(PACKAGES_DIR, file)} (ignore)\n` + path.relative(PACKAGES_DIR, file)} (ignore)\n`, ); return; } @@ -101,21 +96,20 @@ function buildFile(file, silent) { `${chalk.red(' \u2022 ') + path.relative(PACKAGES_DIR, file) + chalk.red(' \u21D2 ') + - path.relative(PACKAGES_DIR, destPath)} (copy)\n` + path.relative(PACKAGES_DIR, destPath)} (copy)\n`, ); } else { const options = Object.assign({}, transformOptions); const transformed = babel.transformFileSync(file, options).code; - const prettyCode = prettier.format(transformed, prettierConfig); - fs.writeFileSync(destPath, prettyCode); + fs.writeFileSync(destPath, transformed); silent || process.stdout.write( `${chalk.green(' \u2022 ') + path.relative(PACKAGES_DIR, file) + chalk.green(' \u21D2 ') + - path.relative(PACKAGES_DIR, destPath)}\n` + path.relative(PACKAGES_DIR, destPath)}\n`, ); } } diff --git a/scripts/watch.js b/scripts/watch.js index 4da6e2fd8..20f711590 100644 --- a/scripts/watch.js +++ b/scripts/watch.js @@ -10,10 +10,10 @@ */ const fs = require('fs'); -const { execSync } = require('child_process'); +const {execSync} = require('child_process'); const path = require('path'); const chalk = require('chalk'); -const { getPackages } = require('./helpers'); +const {getPackages} = require('./helpers'); const BUILD_CMD = `node ${path.resolve(__dirname, './build.js')}`; @@ -33,7 +33,7 @@ getPackages().forEach(p => { const srcDir = path.resolve(p, 'src'); try { fs.accessSync(srcDir, fs.F_OK); - fs.watch(path.resolve(p, 'src'), { recursive: true }, (event, filename) => { + fs.watch(path.resolve(p, 'src'), {recursive: true}, (event, filename) => { const filePath = path.resolve(srcDir, filename); if ((event === 'change' || event === 'rename') && exists(filePath)) { @@ -47,8 +47,8 @@ getPackages().forEach(p => { `${chalk.red(' \u2022 ') + path.relative( path.resolve(srcDir, '..', '..'), - buildFile - )} (deleted)\n` + buildFile, + )} (deleted)\n`, ); } catch (e) { // omit @@ -65,7 +65,7 @@ setInterval(() => { if (files.length) { filesToBuild = new Map(); try { - execSync(`${BUILD_CMD} ${files.join(' ')}`, { stdio: [0, 1, 2] }); + execSync(`${BUILD_CMD} ${files.join(' ')}`, {stdio: [0, 1, 2]}); } catch (e) { // omit } diff --git a/yarn.lock b/yarn.lock index 3e1667e42..004d46d55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -989,22 +989,6 @@ lodash "^4.17.10" to-fast-properties "^2.0.0" -"@callstack/eslint-config@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@callstack/eslint-config/-/eslint-config-3.0.2.tgz#e40fcf73749aa8fb0b83bf243a2d6fdbc416fbd2" - integrity sha512-Frzn1E/egdqppp/2OLi76SMa6Z3yv4oRDjXDdYPCPtEJDyjzUh2lfTpURqziKbACUexTXMxAA+XMN0BSJ9RgUw== - dependencies: - babel-eslint "^10.0.1" - eslint-config-airbnb "^17.1.0" - eslint-config-prettier "^3.0.1" - eslint-plugin-flowtype "^3.0.0" - eslint-plugin-import "^2.14.0" - eslint-plugin-jest "^21.21.0" - eslint-plugin-jsx-a11y "^6.1.1" - eslint-plugin-prettier "^3.0.0" - eslint-plugin-react "^7.5.1" - prettier "^1.14.2" - "@lerna/add@3.10.6": version "3.10.6" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.10.6.tgz#6f2c6b26eb905c40fef4180f3ffa34ad9dbb860b" @@ -1610,6 +1594,21 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== +"@react-native-community/eslint-config@^0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.2.tgz#042224762e00ef06b45693a14be78ebda5fb7def" + integrity sha512-oKtMR046Ptfjvzd67MPm7Q8a5H8MeMsKB7E5bKgcMoybdZBmrsqo3Fn49FCKwc6yHd4KUkTyQihE4Fgk9jaanA== + dependencies: + babel-eslint "9.0.0" + eslint-plugin-eslint-comments "^3.0.1" + eslint-plugin-flowtype "2.43.0" + eslint-plugin-jest "21.8.0" + eslint-plugin-prettier "2.6.0" + eslint-plugin-react "7.8.2" + eslint-plugin-react-hooks "^1.0.1" + eslint-plugin-react-native "3.5.0" + prettier "1.13.6" + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1754,14 +1753,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -aria-query@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" - integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= - dependencies: - ast-types-flow "0.0.7" - commander "^2.11.0" - arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" @@ -1859,11 +1850,6 @@ assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" -ast-types-flow@0.0.7, ast-types-flow@^0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" - integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -1898,17 +1884,10 @@ aws4@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" -axobject-query@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9" - integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww== - dependencies: - ast-types-flow "0.0.7" - -babel-eslint@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" - integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== +babel-eslint@9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220" + integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g== dependencies: "@babel/code-frame" "^7.0.0" "@babel/parser" "^7.0.0" @@ -2402,7 +2381,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.11.0, commander@^2.9.0: +commander@^2.9.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" @@ -2483,11 +2462,6 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= - conventional-changelog-angular@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.2.tgz#39d945635e03b6d0c9d4078b1df74e06163dc66a" @@ -2663,11 +2637,6 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -damerau-levenshtein@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" - integrity sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ= - dargs@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-4.1.0.tgz#03a9dbb4b5c2f139bf14ae53f0b8a2a6a86f4e17" @@ -2694,7 +2663,7 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: +debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -2875,17 +2844,10 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - -doctrine@^2.1.0: +doctrine@^2.0.2, doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: esutils "^2.0.2" @@ -2944,11 +2906,6 @@ electron-to-chromium@^1.3.103: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.103.tgz#a695777efdbc419cad6cbb0e58458251302cd52f" integrity sha512-tObPqGmY9X8MUM8i3MEimYmbnLLf05/QV5gPlkR8MQ3Uj8G8B2govE1U4cQcBYtv3ymck9Y8cIOu4waoiykMZQ== -emoji-regex@^6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" - integrity sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ== - encodeurl@~1.0.1, encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -2987,7 +2944,7 @@ errorhandler@^1.5.0: accepts "~1.3.3" escape-html "~1.0.3" -es-abstract@^1.5.1, es-abstract@^1.6.1, es-abstract@^1.7.0: +es-abstract@^1.5.1, es-abstract@^1.7.0: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" dependencies: @@ -3036,118 +2993,60 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-config-airbnb-base@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz#b5a1b480b80dfad16433d6c4ad84e6605052c05c" - integrity sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw== - dependencies: - eslint-restricted-globals "^0.1.1" - object.assign "^4.1.0" - object.entries "^1.0.4" - -eslint-config-airbnb@^17.1.0: - version "17.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-17.1.0.tgz#3964ed4bc198240315ff52030bf8636f42bc4732" - integrity sha512-R9jw28hFfEQnpPau01NO5K/JWMGLi6aymiF6RsnMURjTk+MqZKllCqGK/0tOvHkPi/NWSSOU2Ced/GX++YxLnw== - dependencies: - eslint-config-airbnb-base "^13.1.0" - object.assign "^4.1.0" - object.entries "^1.0.4" - -eslint-config-prettier@^3.0.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.3.0.tgz#41afc8d3b852e757f06274ed6c44ca16f939a57d" - integrity sha512-Bc3bh5bAcKNvs3HOpSi6EfGA2IIp7EzWcg2tS4vP7stnXu/J1opihHDM7jI9JCIckyIDTgZLSWn7J3HY0j2JfA== - dependencies: - get-stdin "^6.0.0" - -eslint-import-resolver-node@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" - integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== +eslint-plugin-eslint-comments@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.1.tgz#32ff0afba8a48e17073817e6d03fbc5622f735b7" + integrity sha512-GZDKhOFqJLKlaABX+kdoLskcTINMrVOWxGca54KcFb1QCPd0CLmqgAMRxkkUfGSmN+5NJUMGh7NGccIMcWPSfQ== dependencies: - debug "^2.6.9" - resolve "^1.5.0" + escape-string-regexp "^1.0.5" + ignore "^5.0.5" -eslint-module-utils@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" - integrity sha1-snA2LNiLGkitMIl2zn+lTphBF0Y= +eslint-plugin-flowtype@2.43.0: + version "2.43.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.43.0.tgz#47cdac5f01cda53f1c3e8477f0c83fee66a1606e" + integrity sha512-gFlHd3b6L28Mm8nbNoK6YtWgJ6STngf8GY3RA5DfeUYU3mRYJcHZ4c70bsBoERnCZy+nGHyus+aJ4jkimSnu5g== dependencies: - debug "^2.6.8" - pkg-dir "^1.0.0" + lodash "^4.15.0" -eslint-plugin-flowtype@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.2.0.tgz#824364ed5940a404b91326fdb5a313a2a74760df" - integrity sha512-baJmzngM6UKbEkJ5OY3aGw2zjXBt5L2QKZvTsOlXX7yHKIjNRrlJx2ods8Rng6EdqPR9rVNIQNYHpTs0qfn2qA== - dependencies: - lodash "^4.17.10" +eslint-plugin-jest@21.8.0: + version "21.8.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.8.0.tgz#4f3155e2898c1efb0ce548f3e084e07db5e21c07" + integrity sha512-u8+tOrVHHAv9SetdzCghLaBrHyaBLx+6surC+A+VfLy7CfXixTvQnJmD/Ym8mDE6e7wPDZWWgsqb3FGAWh7NTw== -eslint-plugin-import@^2.14.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" - integrity sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g== +eslint-plugin-prettier@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" + integrity sha512-floiaI4F7hRkTrFe8V2ItOK97QYrX75DjmdzmVITZoAP6Cn06oEDPQRsO6MlHEP/u2SxI3xQ52Kpjw6j5WGfeQ== dependencies: - contains-path "^0.1.0" - debug "^2.6.8" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.2.0" - has "^1.0.1" - lodash "^4.17.4" - minimatch "^3.0.3" - read-pkg-up "^2.0.0" - resolve "^1.6.0" + fast-diff "^1.1.1" + jest-docblock "^21.0.0" -eslint-plugin-jest@^21.21.0: - version "21.27.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.27.2.tgz#2a795b7c3b5e707df48a953d651042bd01d7b0a8" - integrity sha512-0E4OIgBJVlAmf1KfYFtZ3gYxgUzC5Eb3Jzmrc9ikI1OY+/cM8Kh72Ti7KfpeHNeD3HJNf9SmEfmvQLIz44Hrhw== - -eslint-plugin-jsx-a11y@^6.1.1: - version "6.1.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.2.tgz#69bca4890b36dcf0fe16dd2129d2d88b98f33f88" - integrity sha512-7gSSmwb3A+fQwtw0arguwMdOdzmKUgnUcbSNlo+GjKLAQFuC2EZxWqG9XHRI8VscBJD5a8raz3RuxQNFW+XJbw== - dependencies: - aria-query "^3.0.0" - array-includes "^3.0.3" - ast-types-flow "^0.0.7" - axobject-query "^2.0.1" - damerau-levenshtein "^1.0.4" - emoji-regex "^6.5.1" - has "^1.0.3" - jsx-ast-utils "^2.0.1" +eslint-plugin-react-hooks@^1.0.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.4.0.tgz#ad86001e05519368e55a888b1b31004b8e2ae8f6" + integrity sha512-fMGlzztW/5hSQT0UBnlPwulao0uF8Kyp0Uv6PA81lzmcDz2LBtthkWQaE8Wz2F2kEe7mSRDgK8ABEFK1ipeDxw== -eslint-plugin-prettier@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz#f6b823e065f8c36529918cdb766d7a0e975ec30c" - integrity sha512-4g11opzhqq/8+AMmo5Vc2Gn7z9alZ4JqrbZ+D4i8KlSyxeQhZHlmIrY8U9Akf514MoEhogPa87Jgkq87aZ2Ohw== - dependencies: - prettier-linter-helpers "^1.0.0" +eslint-plugin-react-native-globals@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native-globals/-/eslint-plugin-react-native-globals-0.1.2.tgz#ee1348bc2ceb912303ce6bdbd22e2f045ea86ea2" + integrity sha512-9aEPf1JEpiTjcFAmmyw8eiIXmcNZOqaZyHO77wgm0/dWfT/oxC1SrIq8ET38pMxHYrcB6Uew+TzUVsBeczF88g== -eslint-plugin-prettier@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz#19d521e3981f69dd6d14f64aec8c6a6ac6eb0b0d" - integrity sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ== +eslint-plugin-react-native@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-3.5.0.tgz#78a5d6aadb11f85d1b114488d1fddfa2bf4fc1fb" + integrity sha512-L0qwiBQbG3MVMQk4XVCyyX+9nqJjr9YUmqpJ98Gb+uAmD+xlxT33rDL9ZBQgzMzBxDcUW6WiPcll8j9uXpyLyQ== dependencies: - prettier-linter-helpers "^1.0.0" + eslint-plugin-react-native-globals "^0.1.1" -eslint-plugin-react@^7.5.1: - version "7.11.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c" - integrity sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw== +eslint-plugin-react@7.8.2: + version "7.8.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.8.2.tgz#e95c9c47fece55d2303d1a67c9d01b930b88a51d" + integrity sha512-H3ne8ob4Bn6NXSN9N9twsn7t8dyHT5bF/ibQepxIHi6JiPIdC2gXlfYvZYucbdrWio4FxBq7Z4mSauQP+qmMkQ== dependencies: - array-includes "^3.0.3" - doctrine "^2.1.0" - has "^1.0.3" + doctrine "^2.0.2" + has "^1.0.1" jsx-ast-utils "^2.0.1" - prop-types "^15.6.2" - -eslint-restricted-globals@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7" - integrity sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc= + prop-types "^15.6.0" eslint-scope@3.7.1: version "3.7.1" @@ -3414,7 +3313,7 @@ fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" -fast-diff@^1.1.2: +fast-diff@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== @@ -3671,7 +3570,7 @@ fstream@^1.0.0, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" -function-bind@^1.1.0, function-bind@^1.1.1: +function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -3736,11 +3635,6 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - get-stream@^3.0.0: version "3.0.0" resolved "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -3941,7 +3835,7 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" -has@^1.0.1, has@^1.0.3: +has@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" dependencies: @@ -4032,6 +3926,11 @@ ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" +ignore@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.0.5.tgz#c663c548d6ce186fb33616a8ccb5d46e56bdbbf9" + integrity sha512-kOC8IUb8HSDMVcYrDVezCxpJkzSQWTAzf3olpKM6o9rM5zpojx23O0Fl8Wr4+qJ6ZbPEHqf1fdwev/DS7v7pmA== + image-size@^0.6.0: version "0.6.3" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2" @@ -4431,7 +4330,7 @@ is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -4632,6 +4531,11 @@ jest-diff@^24.0.0: jest-get-type "^24.0.0" pretty-format "^24.0.0" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== + jest-docblock@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.0.0.tgz#54d77a188743e37f62181a91a01eb9222289f94e" @@ -5303,11 +5207,11 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: +lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" -loose-envify@^1.0.0, loose-envify@^1.3.1: +loose-envify@^1.0.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: @@ -6159,7 +6063,7 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-keys@^1.0.11, object-keys@^1.0.12: +object-keys@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" @@ -6169,26 +6073,6 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.entries@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f" - integrity sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8= - dependencies: - define-properties "^1.1.2" - es-abstract "^1.6.1" - function-bind "^1.1.0" - has "^1.0.1" - object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" @@ -6478,7 +6362,7 @@ path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" -path-parse@^1.0.5, path-parse@^1.0.6: +path-parse@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -6532,13 +6416,6 @@ pirates@^4.0.0: dependencies: node-modules-regexp "^1.0.0" -pkg-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" - integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= - dependencies: - find-up "^1.0.0" - pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -6587,22 +6464,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" - -prettier@^1.14.2: - version "1.15.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a" - integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg== - -prettier@^1.16.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.0.tgz#104dd25f5ee3d0c9d0a6ce4bb40ced8481d51219" - integrity sha512-MCBCYeAuZfejUPdEpkleLWvpRBwLii/Sp5jQs0eb8Ul/drGIDjkL6tAU24tk6yCGf0KPV5rhPPPlczfBmN2pWQ== +prettier@1.13.6: + version "1.13.6" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" + integrity sha512-p5eqCNiohWZN++7aJXUVj0JgLqHCPLf9GLIcLBHGNWs4Y9FJOPs6+KNO2WT0udJIQJTbeZFrJkjzjcb8fkAYYQ== pretty-format@24.0.0-alpha.6: version "24.0.0-alpha.6" @@ -6680,13 +6545,14 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.6.2: - version "15.6.2" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" - integrity sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ== +prop-types@^15.6.0: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== dependencies: - loose-envify "^1.3.1" + loose-envify "^1.4.0" object-assign "^4.1.1" + react-is "^16.8.1" proto-list@~1.2.1: version "1.2.4" @@ -6779,6 +6645,11 @@ react-deep-force-update@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz#3d2ae45c2c9040cbb1772be52f8ea1ade6ca2ee1" +react-is@^16.8.1: + version "16.8.3" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.3.tgz#4ad8b029c2a718fc0cfc746c8d4e1b7221e5387d" + integrity sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA== + react-proxy@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a" @@ -7090,13 +6961,6 @@ resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: dependencies: path-parse "^1.0.5" -resolve@^1.6.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.9.0.tgz#a14c6fdfa8f92a7df1d996cb7105fa744658ea06" - integrity sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ== - dependencies: - path-parse "^1.0.6" - restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" From 82087ef2a92cc1ebb3d65275b3f4c81ed12cf973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 5 Mar 2019 21:17:34 +0100 Subject: [PATCH 002/234] fix: change diff links for upgrade command (#206) * fix: change diff links for upgrade command * use prettier without @format pragma --- package.json | 3 +++ packages/cli/src/commands/runAndroid/runOnAllDevices.js | 1 - .../cli/src/commands/upgrade/__tests__/upgrade.test.js | 6 +++--- packages/cli/src/commands/upgrade/upgrade.js | 8 +++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4689b5538..0ee2153c1 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,9 @@ "es6": true, "jest": true, "node": true + }, + "rules": { + "prettier/prettier": [2, "fb"] } }, "jest": { diff --git a/packages/cli/src/commands/runAndroid/runOnAllDevices.js b/packages/cli/src/commands/runAndroid/runOnAllDevices.js index 043d89f32..993cf72a4 100644 --- a/packages/cli/src/commands/runAndroid/runOnAllDevices.js +++ b/packages/cli/src/commands/runAndroid/runOnAllDevices.js @@ -7,7 +7,6 @@ * @flow */ - import {spawnSync, execFileSync} from 'child_process'; import logger from '../../tools/logger'; import adb from './adb'; diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 438a6f60d..fbd09d97c 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -129,7 +129,7 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/pvinis/rn-diff-purge.git +$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git $ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff... @@ -179,14 +179,14 @@ test('cleans up if patching fails,', async () => { expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/pvinis/rn-diff-purge.git +$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git $ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way error: .flowconfig: does not exist in index error Automatically applying diff failed -info Here's the diff we tried to apply: https://github.com/pvinis/rn-diff-purge/compare/version/0.57.8...version/0.58.4 +info Here's the diff we tried to apply: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8...version/0.58.4 info You may find release notes helpful: https://github.com/facebook/react-native/releases/tag/v0.58.4 [fs] unlink tmp-upgrade-rn.patch warn Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 14512eb12..c22720b3d 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -14,7 +14,8 @@ type FlagsT = { legacy: boolean, }; -const rnDiffPurgeUrl = 'https://github.com/pvinis/rn-diff-purge'; +const rnDiffPurgeUrl = + 'https://github.com/react-native-community/rn-diff-purge'; const getLatestRNVersion = async (): Promise => { logger.info('No version passed. Fetching latest...'); @@ -52,7 +53,7 @@ const getPatch = async (currentVersion, newVersion, projectDir) => { `Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?`, ); logger.info( - 'For available releases to diff see: https://github.com/pvinis/rn-diff-purge#version-changes', + 'For available releases to diff see: https://github.com/react-native-community/rn-diff-purge#version-changes', ); return null; } @@ -187,7 +188,8 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } - const rnDiffGitAddress = 'https://github.com/pvinis/rn-diff-purge.git'; + const rnDiffGitAddress = + 'https://github.com/react-native-community/rn-diff-purge.git'; const tmpRemote = 'tmp-rn-diff-purge'; const tmpPatchFile = 'tmp-upgrade-rn.patch'; const projectDir = ctx.root; From ccc179737b0aea3d0979bd2777f9ea4b50ad83a3 Mon Sep 17 00:00:00 2001 From: Krzysztof Borowy Date: Wed, 6 Mar 2019 12:18:17 +0100 Subject: [PATCH 003/234] fix: correct paths for eject command (#208) Summary: --------- `eject` had wrong paths (pointing to old RN directories), so this PR fixes that. Fixes #207 Test Plan: ---------- 1. Init new project RN 0.59+ 2. Remove `android` and/or `ios` 3. Use the `eject` command to generate ios/android projects --- packages/cli/src/commands/eject/eject.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/cli/src/commands/eject/eject.js b/packages/cli/src/commands/eject/eject.js index c746193fb..32144fbd7 100644 --- a/packages/cli/src/commands/eject/eject.js +++ b/packages/cli/src/commands/eject/eject.js @@ -71,15 +71,7 @@ function eject() { if (!doesIOSExist) { logger.info('Generating the iOS folder.'); copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - '@react-native-community', - 'cli', - 'templates', - 'HelloWorld', - 'ios', - ), + path.resolve('node_modules', 'react-native', 'template', 'ios'), path.resolve('ios'), appName, templateOptions, @@ -89,15 +81,7 @@ function eject() { if (!doesAndroidExist) { logger.info('Generating the Android folder.'); copyProjectTemplateAndReplace( - path.resolve( - 'node_modules', - 'react-native', - '@react-native-community', - 'cli', - 'templates', - 'HelloWorld', - 'android', - ), + path.resolve('node_modules', 'react-native', 'template', 'android'), path.resolve('android'), appName, templateOptions, From 5564634044252eecccac99423c369dda91cc6331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 11 Mar 2019 16:28:05 +0100 Subject: [PATCH 004/234] chore: simplify commander/minimist usage (#209) * chore: simplify commander/minimist usage * feedback * remove extra parse * add options back * rephrase comment * remove excess whitespace --- packages/cli/package.json | 2 +- packages/cli/src/cliEntry.js | 82 +++++++++++++++++------------------- yarn.lock | 5 ++- 3 files changed, 43 insertions(+), 46 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 5662ced6b..fff93c214 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "chalk": "^1.1.1", - "commander": "^2.9.0", + "commander": "^2.19.0", "compression": "^1.7.1", "connect": "^3.6.5", "denodeify": "^1.2.1", diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 90ee8dea5..7b03f702e 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -10,7 +10,6 @@ import chalk from 'chalk'; import childProcess from 'child_process'; import commander from 'commander'; -import minimist from 'minimist'; import path from 'path'; import type {CommandT, ContextT} from './tools/types.flow'; import getLegacyConfig from './tools/getLegacyConfig'; @@ -18,10 +17,10 @@ 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'; +import pkgJson from '../package.json'; commander - .version(pkg.version) + .option('--version', 'Print CLI version') .option('--projectRoot [string]', 'Path to the root of the project') .option('--reactNativePath [string]', 'Path to React Native'); @@ -39,41 +38,33 @@ const handleError = err => { // Custom printHelpInformation command inspired by internal Commander.js // one modified to suit our needs -function printHelpInformation() { +function printHelpInformation(examples, pkg) { let cmdName = this._name; if (this._alias) { cmdName = `${cmdName}|${this._alias}`; } - const sourceInformation = this.pkg - ? [` ${chalk.bold('Source:')} ${this.pkg.name}@${this.pkg.version}`, ''] + const sourceInformation = pkg + ? [`${chalk.bold('Source:')} ${pkg.name}@${pkg.version}`, ''] : []; let output = [ - '', - chalk.bold(chalk.cyan(` react-native ${cmdName} ${this.usage()}`)), - this._description ? ` ${this._description}` : '', - '', + chalk.bold(`react-native ${cmdName} ${this.usage()}`), + this._description ? `\n${this._description}\n` : '', ...sourceInformation, - ` ${chalk.bold('Options:')}`, - '', - this.optionHelp().replace(/^/gm, ' '), - '', + `${chalk.bold('Options:')}`, + this.optionHelp().replace(/^/gm, ' '), ]; - if (this.examples && this.examples.length > 0) { - const formattedUsage = this.examples - .map(example => ` ${example.desc}: \n ${chalk.cyan(example.cmd)}`) + if (examples && examples.length > 0) { + const formattedUsage = examples + .map(example => ` ${example.desc}: \n ${chalk.cyan(example.cmd)}`) .join('\n\n'); - output = output.concat([ - chalk.bold(' Example usage:'), - '', - formattedUsage, - ]); + output = output.concat([chalk.bold('\nExample usage:'), formattedUsage]); } - return output.concat(['', '']).join('\n'); + return output.join('\n'); } function printUnknownCommand(cmdName) { @@ -93,9 +84,7 @@ const addCommand = (command: CommandT, ctx: ContextT) => { const options = command.options || []; const cmd = commander - .command(command.name, undefined, { - noHelp: !command.description, - }) + .command(command.name, undefined, {noHelp: !command.description}) .description(command.description) .action(function handleAction(...args) { const passedOptions = this.opts(); @@ -109,10 +98,12 @@ const addCommand = (command: CommandT, ctx: ContextT) => { .catch(handleError); }); - cmd.helpInformation = printHelpInformation.bind(cmd); - cmd.examples = command.examples; - // $FlowFixMe: This is either null or not - cmd.pkg = command.pkg; + cmd.helpInformation = printHelpInformation.bind( + cmd, + command.examples, + // $FlowFixMe - we know pkg may be missing... + command.pkg, + ); options.forEach(opt => cmd.option( @@ -123,7 +114,11 @@ const addCommand = (command: CommandT, ctx: ContextT) => { ), ); - // Redefined here to appear in the `--help` section + /** + * We want every command (like "start", "link") to accept below options. + * To achieve that we append them to regular options of each command here. + * This way they'll be displayed in the commands --help menus. + */ cmd .option('--projectRoot [string]', 'Path to the root of the project') .option('--reactNativePath [string]', 'Path to React Native'); @@ -157,20 +152,12 @@ async function setupAndRun() { } } - /** - * Read passed `options` and take the "global" settings - * - * @todo(grabbou): Consider unifying this by removing either `commander` - * or `minimist` - */ - const options = minimist(process.argv.slice(2)); - - const root = options.projectRoot - ? path.resolve(options.projectRoot) + const root = commander.projectRoot + ? path.resolve(commander.projectRoot) : process.cwd(); - const reactNativePath = options.reactNativePath - ? path.resolve(options.reactNativePath) + const reactNativePath = commander.reactNativePath + ? path.resolve(commander.reactNativePath) : (() => { try { return path.dirname( @@ -198,9 +185,16 @@ async function setupAndRun() { commander.parse(process.argv); - if (!options._.length) { + if (commander.rawArgs.length === 2) { commander.outputHelp(); } + + // We handle --version as a special case like this because both `commander` + // and `yargs` append it to every command and we don't want to do that. + // E.g. outside command `init` has --version flag and we want to preserve it. + if (commander.args.length === 0 && commander.version === true) { + console.log(pkgJson.version); + } } export default { diff --git a/yarn.lock b/yarn.lock index 004d46d55..77823481f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2381,17 +2381,20 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.9.0: +commander@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== commander@~2.13.0: version "2.13.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + integrity sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA== commander@~2.17.1: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== compare-func@^1.3.1: version "1.3.2" From a56441021f6455b61f353fcb137d17c86ccc0043 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 11 Mar 2019 16:47:43 +0100 Subject: [PATCH 005/234] chore: remove unnecessary noHelp option for a command (#215) `noHelp` doesn't work because we override `printHelpInformation` and we need to handle `description` (that can be undefined) manually --- packages/cli/src/cliEntry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 7b03f702e..9a4d6fe48 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -84,7 +84,7 @@ const addCommand = (command: CommandT, ctx: ContextT) => { const options = command.options || []; const cmd = commander - .command(command.name, undefined, {noHelp: !command.description}) + .command(command.name) .description(command.description) .action(function handleAction(...args) { const passedOptions = this.opts(); From 5d0a5d1451b122794de1f9590c7a1b8fbad6a7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 11 Mar 2019 17:07:31 +0100 Subject: [PATCH 006/234] chore: remove unnecessary checks for react peer dep (#216) --- packages/cli/src/commands/init/init.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 97dfedd18..d663dc617 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -49,22 +49,8 @@ function init(projectDir, argsOrName) { * @param options Command line arguments parsed by minimist. */ function generateProject(destinationRoot, newProjectName, options) { - const reactNativePackageJson = require('react-native/package.json'); - const {peerDependencies} = reactNativePackageJson; - if (!peerDependencies) { - logger.error( - "Missing React peer dependency in React Native's package.json. Aborting.", - ); - return; - } - - const reactVersion = peerDependencies.react; - if (!reactVersion) { - logger.error( - "Missing React peer dependency in React Native's package.json. Aborting.", - ); - return; - } + const pkgJson = require('react-native/package.json'); + const reactVersion = pkgJson.peerDependencies.react; const packageManager = new PackageManager({ projectDir: destinationRoot, From 9aadfd039fcb9dfb568dff5a7a5809b2bc4c0309 Mon Sep 17 00:00:00 2001 From: Benoit Lemaire Date: Mon, 11 Mar 2019 11:17:25 -0700 Subject: [PATCH 007/234] docs: fix cli path in contributing doc (#218) Summary: --------- Fix incorrect path to cli index.js in Contributing documentation. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 436768813..ca0ad0b51 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ Repository is splitted into two packages: You can test your changes by calling `cli.js` directly from the cloned repository. You need to make sure the version of React Native matches the one present in devDependencies of the CLI. Otherwise, you may get unexpected errors. ```sh -node /path/to/cloned/project/packages/cli/index.js +node /path/to/cloned/project/packages/cli/build/index.js ``` ## Testing `init` command From d70b10f64560a18663db6ba5495a703a1f7eb7df Mon Sep 17 00:00:00 2001 From: Benoit Lemaire Date: Mon, 11 Mar 2019 14:37:52 -0700 Subject: [PATCH 008/234] fix: path to InitializeCore module in default metro config (#220) Summary: --------- Fix path to React Native `InitializeCore` module in default metro config. For some reason, this path was modified when moving the `loadMetroConfig.js` file in new `tools` directory. In current released version (v1.3.2) of the cli, the path is the correct one, as seen in the [loadMetroConfig.js](https://github.com/react-native-community/react-native-cli/blob/%40react-native-community/cli%401.3.2/packages/cli/src/util/loadMetroConfig.js#L52) of v1.3.2. Test Plan: ---------- Was trying out `react-native run-ios` / `run-android` commands, after a fresh `react-native init` with current master branch of the cli, and was facing following metro bundler error: ``` error: bundling failed: Error: Cannot find module '/Users/blemair/Code/foo/node_modules/react-native/Libraries/tools/InitializeCore' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.resolve (internal/modules/cjs/helpers.js:30:19) at Object.getModulesRunBeforeMainModule (/Users/blemair/Code/foo/node_modules/@react-native-community/cli/build/tools/loadMetroConfig.js:80:53) [...] ``` After fixing the path, bundling error was gone. --- packages/cli/src/tools/loadMetroConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 127083ff1..3d15e59d3 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -48,7 +48,7 @@ export const getDefaultConfig = (ctx: ContextT) => { serializer: { getModulesRunBeforeMainModule: () => [ require.resolve( - path.join(ctx.reactNativePath, 'Libraries/tools/InitializeCore'), + path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'), ), ], getPolyfills: () => From 069163376f39e432d9414b2965b287296d3d8e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 09:14:52 +0100 Subject: [PATCH 009/234] chore: remove some unused files (#217) --- commitlint.config.js | 3 - packages/cli/package.json | 1 - .../src/commands/link/android/copyAssets.js | 11 +- packages/cli/src/commands/link/android/fs.js | 17 --- .../cli/src/commands/link/android/index.js | 2 +- .../src/commands/link/android/unlinkAssets.js | 2 +- .../cli/src/commands/link/groupFilesByType.js | 4 +- .../cli/src/commands/link/ios/copyAssets.js | 2 +- .../cli/src/commands/link/ios/unlinkAssets.js | 2 +- .../src/commands/server/jsPackagerClient.js | 121 ------------------ 10 files changed, 13 insertions(+), 152 deletions(-) delete mode 100644 commitlint.config.js delete mode 100644 packages/cli/src/commands/link/android/fs.js delete mode 100644 packages/cli/src/commands/server/jsPackagerClient.js diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 84dcb122a..000000000 --- a/commitlint.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], -}; diff --git a/packages/cli/package.json b/packages/cli/package.json index fff93c214..a287f61b7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,7 +28,6 @@ "errorhandler": "^1.5.0", "escape-string-regexp": "^1.0.5", "execa": "^1.0.0", - "fs-extra": "^1.0.0", "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js index 8e894b7d6..81f4ad58a 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/cli/src/commands/link/android/copyAssets.js @@ -4,10 +4,10 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ -import fs from 'fs-extra'; +import fs from 'fs'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; @@ -17,11 +17,14 @@ import groupFilesByType from '../groupFilesByType'; * For now, the only types of files that are handled are: * - Fonts (otf, ttf) - copied to targetPath/fonts under original name */ -export default function copyAssetsAndroid(files, project) { +export default function copyAssetsAndroid( + files: Array, + project: {assetsPath: string}, +) { const assets = groupFilesByType(files); (assets.font || []).forEach(asset => - fs.copySync( + fs.copyFileSync( asset, path.join(project.assetsPath, 'fonts', path.basename(asset)), ), diff --git a/packages/cli/src/commands/link/android/fs.js b/packages/cli/src/commands/link/android/fs.js deleted file mode 100644 index 26ecbdae0..000000000 --- a/packages/cli/src/commands/link/android/fs.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import fs from 'fs-extra'; - -exports.readFile = file => () => fs.readFileSync(file, 'utf8'); - -exports.writeFile = (file, content) => - content - ? fs.writeFileSync(file, content, 'utf8') - : c => fs.writeFileSync(file, c, 'utf8'); diff --git a/packages/cli/src/commands/link/android/index.js b/packages/cli/src/commands/link/android/index.js index df7ae3332..26583d7ff 100644 --- a/packages/cli/src/commands/link/android/index.js +++ b/packages/cli/src/commands/link/android/index.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import isInstalled from './isInstalled'; diff --git a/packages/cli/src/commands/link/android/unlinkAssets.js b/packages/cli/src/commands/link/android/unlinkAssets.js index ff1f2e869..e1b39fd1d 100644 --- a/packages/cli/src/commands/link/android/unlinkAssets.js +++ b/packages/cli/src/commands/link/android/unlinkAssets.js @@ -7,7 +7,7 @@ * @format */ -import fs from 'fs-extra'; +import fs from 'fs'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; diff --git a/packages/cli/src/commands/link/groupFilesByType.js b/packages/cli/src/commands/link/groupFilesByType.js index f40830451..cc9a723e8 100644 --- a/packages/cli/src/commands/link/groupFilesByType.js +++ b/packages/cli/src/commands/link/groupFilesByType.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import {groupBy} from 'lodash'; @@ -31,6 +31,6 @@ mime.define({ * Given an array ['fonts/a.ttf', 'images/b.jpg'], * the returned object will be: {font: ['fonts/a.ttf'], image: ['images/b.jpg']} */ -export default function groupFilesByType(assets) { +export default function groupFilesByType(assets: Array) { return groupBy(assets, type => mime.lookup(type).split('/')[0]); } diff --git a/packages/cli/src/commands/link/ios/copyAssets.js b/packages/cli/src/commands/link/ios/copyAssets.js index 58dbec83c..cf9fcd796 100644 --- a/packages/cli/src/commands/link/ios/copyAssets.js +++ b/packages/cli/src/commands/link/ios/copyAssets.js @@ -7,7 +7,7 @@ * @format */ -import fs from 'fs-extra'; +import fs from 'fs'; import path from 'path'; import xcode from 'xcode'; import groupFilesByType from '../groupFilesByType'; diff --git a/packages/cli/src/commands/link/ios/unlinkAssets.js b/packages/cli/src/commands/link/ios/unlinkAssets.js index 4843dbd28..546e1d371 100644 --- a/packages/cli/src/commands/link/ios/unlinkAssets.js +++ b/packages/cli/src/commands/link/ios/unlinkAssets.js @@ -6,7 +6,7 @@ * */ -import fs from 'fs-extra'; +import fs from 'fs'; import path from 'path'; import xcode from 'xcode'; import {difference} from 'lodash'; diff --git a/packages/cli/src/commands/server/jsPackagerClient.js b/packages/cli/src/commands/server/jsPackagerClient.js deleted file mode 100644 index 3f051df4b..000000000 --- a/packages/cli/src/commands/server/jsPackagerClient.js +++ /dev/null @@ -1,121 +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 - */ - -import WebSocket from 'ws'; -import logger from '../../tools/logger'; -import MessageSocket from './messageSocket'; - -const PROTOCOL_VERSION = 2; -const TARGET_SERVER = 'server'; - -function getMessageId() { - return `${Date.now()}:${Math.random()}`; -} - -class JsPackagerClient { - constructor(url) { - this.ws = new WebSocket(url); - this.msgCallbacks = new Map(); - - this.openPromise = new Promise((resolve, reject) => { - this.ws.on('error', error => reject(error)); - this.ws.on('open', resolve); - }); - - this.ws.on('message', (data, flags) => { - const message = MessageSocket.parseMessage(data, flags.binary); - const msgCallback = this.msgCallbacks.get(message.id); - if (message === undefined || message.id === undefined) { - // gracefully ignore wrong messages or broadcasts - } else if (msgCallback === undefined) { - logger.warn(`Response with non-existing message id: '${message.id}'`); - } else if (message.error === undefined) { - msgCallback.resolve(message.result); - } else { - msgCallback.reject(message.error); - } - }); - } - - sendRequest(method, target, params) { - return this.openPromise.then( - () => - new Promise((resolve, reject) => { - const messageId = getMessageId(); - this.msgCallbacks.set(messageId, {resolve, reject}); - this.ws.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - target, - method, - id: messageId, - params, - }), - error => { - if (error !== undefined) { - this.msgCallbacks.delete(messageId); - reject(error); - } - }, - ); - }), - ); - } - - sendNotification(method, target, params) { - return this.openPromise.then( - () => - new Promise((resolve, reject) => { - this.ws.send( - JSON.stringify({ - version: PROTOCOL_VERSION, - target, - method, - params, - }), - error => { - if (error !== undefined) { - reject(error); - } else { - resolve(); - } - }, - ); - }), - ); - } - - sendBroadcast(method, params) { - return this.sendNotification(method, undefined, params); - } - - getPeers() { - return new Promise((resolve, reject) => { - this.sendRequest('getpeers', TARGET_SERVER, undefined).then(response => { - if (!(response instanceof Map)) { - reject( - new Error( - `Results received from server are of wrong format:\n${JSON.stringify( - response, - )}`, - ), - ); - } else { - resolve(response); - } - }, reject); - }); - } - - getId() { - return this.sendRequest('getid', TARGET_SERVER, undefined); - } -} - -export default JsPackagerClient; From e4ab21e4eb597c37f635c9fd64cc7b0e8d743634 Mon Sep 17 00:00:00 2001 From: Matei Radu Date: Tue, 12 Mar 2019 11:34:21 +0100 Subject: [PATCH 010/234] fix: android unlink regression (#221) * Fix Android unlink regression * Update regex to accept extra whitespaces * Extract dependency regex string to own function With this approach we have one source of truth for both the regex and the dependency types. * Rename dependency types to dependency configs The Gradle documentation calls "configurations" what we have been referring to as "types". --- .../__tests__/android/makeBuildPatch-test.js | 25 ++++++++++++++ .../link/android/patches/makeBuildPatch.js | 34 +++++++++++++++++-- .../link/android/unregisterNativeModule.js | 2 +- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js index 44b5ac3fe..2e4fb76a1 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js @@ -10,6 +10,14 @@ import makeBuildPatch from '../../android/patches/makeBuildPatch'; import normalizeProjectName from '../../android/patches/normalizeProjectName'; +import path from 'path'; + +const projectConfig = { + buildGradlePath: path.join( + __dirname, + '../../__fixtures__/android/patchedBuild.gradle', + ), +}; const name = 'test'; const scopedName = '@scoped/test'; @@ -31,6 +39,23 @@ describe('makeBuildPatch', () => { const {installPattern} = makeBuildPatch(name); expect(installPattern.toString()).toEqual(expect.stringContaining(name)); }); + + test.each([ + ['test-impl', " implementation project(':test-impl')\n"], + ['test-compile', " compile project(':test-compile')\n"], + ['test-api', " api project(':test-api')\n"], + [ + 'test-not-there-yet', + " implementation project(':test-not-there-yet')\n", + ], + ])( + 'properly detects the patch string of project %p in build.gradle', + (project, projectPatchString) => { + expect(makeBuildPatch(project, projectConfig.buildGradlePath).patch).toBe( + projectPatchString, + ); + }, + ); }); describe('makeBuildPatchWithScopedPackage', () => { diff --git a/packages/cli/src/commands/link/android/patches/makeBuildPatch.js b/packages/cli/src/commands/link/android/patches/makeBuildPatch.js index 9966d0705..8ca0b7453 100644 --- a/packages/cli/src/commands/link/android/patches/makeBuildPatch.js +++ b/packages/cli/src/commands/link/android/patches/makeBuildPatch.js @@ -7,17 +7,45 @@ * @format */ +import fs from 'fs'; import normalizeProjectName from './normalizeProjectName'; -export default function makeBuildPatch(name) { +const depConfigs = ['compile', 'api', 'implementation']; + +export default function makeBuildPatch(name, buildGradlePath) { const normalizedProjectName = normalizeProjectName(name); const installPattern = new RegExp( - `(implementation|api|compile)\\w*\\s*\\(*project\\(['"]:${normalizedProjectName}['"]\\)`, + buildDepRegExp(normalizedProjectName, ...depConfigs), ); return { installPattern, pattern: /[^ \t]dependencies {(\r\n|\n)/, - patch: ` implementation project(':${normalizedProjectName}')\n`, + patch: makePatchString(normalizedProjectName, buildGradlePath), }; } + +function makePatchString(normalizedProjectName, buildGradlePath) { + const defaultPatchString = ` implementation project(':${normalizedProjectName}')\n`; + if (!buildGradlePath) { + return defaultPatchString; + } + + const buildGradle = fs.readFileSync(buildGradlePath); + + for (const config of depConfigs) { + const depPattern = new RegExp( + buildDepRegExp(normalizedProjectName, config), + ); + if (depPattern.test(buildGradle)) { + return ` ${config} project(':${normalizedProjectName}')\n`; + } + } + + return defaultPatchString; +} + +function buildDepRegExp(normalizedProjectName, ...configs) { + const orConfigs = configs.join('|'); + return `(${orConfigs})\\w*\\s*\\(*project\\s*\\(['"]:${normalizedProjectName}['"]\\)`; +} diff --git a/packages/cli/src/commands/link/android/unregisterNativeModule.js b/packages/cli/src/commands/link/android/unregisterNativeModule.js index 29680eaae..74098a936 100644 --- a/packages/cli/src/commands/link/android/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/android/unregisterNativeModule.js @@ -22,7 +22,7 @@ export default function unregisterNativeAndroidModule( androidConfig, projectConfig, ) { - const buildPatch = makeBuildPatch(name); + const buildPatch = makeBuildPatch(name, projectConfig.buildGradlePath); const strings = fs.readFileSync(projectConfig.stringsPath, 'utf8'); const params = {}; From a8bb073820c788d3f693af2a8bf6d561d5f4e3f6 Mon Sep 17 00:00:00 2001 From: Benoit Lemaire Date: Tue, 12 Mar 2019 06:15:26 -0700 Subject: [PATCH 011/234] docs: fix verdaccio command in contributing doc (#219) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca0ad0b51..fd506a249 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ yarn global add verdaccio ``` * Run verdaccio ```sh -yarn verdaccio +verdaccio ``` * Set npm registry to `verdaccio` proxy server ```sh From 13383b9edb270b728179c19f05c89c00aae30ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 16:06:07 +0100 Subject: [PATCH 012/234] fix: re-export findPlugins under cli/core for backcompat with RN 0.59 (#224) --- packages/cli/src/cliEntry.js | 3 ++- packages/cli/src/core/findPlugins.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/cli/src/core/findPlugins.js diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 9a4d6fe48..e29a0ecad 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -17,6 +17,7 @@ import {getCommands} from './commands'; import init from './commands/init/init'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; +import findPlugins from './tools/findPlugins'; import pkgJson from '../package.json'; commander @@ -202,4 +203,4 @@ export default { init, }; -// export { run, init }; +export {run, init, findPlugins}; diff --git a/packages/cli/src/core/findPlugins.js b/packages/cli/src/core/findPlugins.js new file mode 100644 index 000000000..bfcc7e1ba --- /dev/null +++ b/packages/cli/src/core/findPlugins.js @@ -0,0 +1,12 @@ +/** + * This file exists only because RN 0.59.0 stable consumes it and we don't want + * to introduce a breaking change. + * See consumer: https://github.com/facebook/react-native/blob/7c73f2bb5a0f97902f469bc043681e79e161aac3/jest/hasteImpl.js#L28 + * @todo: remove in 2.0 + * + * @flow + */ + +import findPlugins from '../tools/findPlugins'; + +export default findPlugins; From e32dbb9978a12ed67441169e9d846a3d699a08ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 17:43:48 +0100 Subject: [PATCH 013/234] v1.4.0 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index a287f61b7..f3aa5a288 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.3.2", + "version": "1.4.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 2057a9b3c98e6e8a9da50154adfb7d3edc13ed20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 21:31:12 +0100 Subject: [PATCH 014/234] fix: set proper peer dependencies (#227) --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index f3aa5a288..b8c0041e1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -54,7 +54,7 @@ "xmldoc": "^0.4.0" }, "peerDependencies": { - "react-native": "^0.57.0" + "react-native": "^0.59.0" }, "devDependencies": { "snapshot-diff": "^0.5.0" From 52b0007bd905c98710ffef9b7b353821501bba07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 21:38:44 +0100 Subject: [PATCH 015/234] fix: debugger-ui incorrect path (#226) Summary: --------- Missed this one while moving files around in https://github.com/react-native-community/react-native-cli/pull/201. Fixes https://github.com/react-native-community/react-native-cli/issues/225 Test Plan: ---------- Verified locally on a clean project. --- .../cli/src/commands/server/middleware/MiddlewareManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/middleware/MiddlewareManager.js b/packages/cli/src/commands/server/middleware/MiddlewareManager.js index ca3025685..a132b43b6 100644 --- a/packages/cli/src/commands/server/middleware/MiddlewareManager.js +++ b/packages/cli/src/commands/server/middleware/MiddlewareManager.js @@ -42,7 +42,7 @@ export default class MiddlewareManager { options: Options; constructor(options: Options) { - const debuggerUIFolder = path.join(__dirname, '..', 'util', 'debugger-ui'); + const debuggerUIFolder = path.join(__dirname, '..', 'debugger-ui'); this.options = options; this.app = connect() From b572a9cabc44dd98e5dff5f7f3141840cd41919b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 12 Mar 2019 21:39:47 +0100 Subject: [PATCH 016/234] v1.4.1 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index b8c0041e1..55b061976 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.0", + "version": "1.4.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From a79130cd3b4456fc612f53a090cf303b39a79bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 10:20:30 +0100 Subject: [PATCH 017/234] fix: refine upgrade error handling; improve the output (#232) * fix: refine upgrade error handling * moar refinements to the output --- .../upgrade/__tests__/upgrade.test.js | 24 +++---- packages/cli/src/commands/upgrade/upgrade.js | 62 ++++++++++++------- 2 files changed, 47 insertions(+), 39 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index fbd09d97c..2730bb013 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -112,8 +112,7 @@ test('fetches empty patch and installs deps', async () => { expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... info Diff has no changes to apply, proceeding further -warn Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually -info Installing react-native@0.58.4 and its peer dependencies... +info Installing \\"react-native@0.58.4\\" and its peer dependencies... $ execa npm info react-native@0.58.4 peerDependencies --json $ yarn add react-native@0.58.4 react@16.6.3 $ execa git add package.json @@ -135,7 +134,8 @@ $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way [fs] unlink tmp-upgrade-rn.patch -info Installing react-native@0.58.4 and its peer dependencies... +$ execa git status -s +info Installing \\"react-native@0.58.4\\" and its peer dependencies... $ execa npm info react-native@0.58.4 peerDependencies --json $ yarn add react-native@0.58.4 react@16.6.3 $ execa git add package.json @@ -186,19 +186,13 @@ info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way error: .flowconfig: does not exist in index error Automatically applying diff failed -info Here's the diff we tried to apply: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8...version/0.58.4 -info You may find release notes helpful: https://github.com/facebook/react-native/releases/tag/v0.58.4 [fs] unlink tmp-upgrade-rn.patch -warn Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually -info Installing react-native@0.58.4 and its peer dependencies... -$ execa npm info react-native@0.58.4 peerDependencies --json -$ yarn add react-native@0.58.4 react@16.6.3 -$ execa git add package.json -$ execa git add yarn.lock -$ execa git add package-lock.json -info Running \\"git status\\" to check what changed... -$ execa git status +$ execa git status -s +error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading $ execa git remote remove tmp-rn-diff-purge -warn Please run \\"git diff\\" to review the conflicts and resolve them" +info You may find these resources helpful: +• Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 +• Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 +• Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" `); }); diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index c22720b3d..d49a1f31b 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -104,14 +104,9 @@ const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => { return newVersion; }; -const installDeps = async (newVersion, projectDir, patchSuccess) => { - if (!patchSuccess) { - logger.warn( - 'Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually', - ); - } +const installDeps = async (newVersion, projectDir) => { logger.info( - `Installing react-native@${newVersion} and its peer dependencies...`, + `Installing "react-native@${newVersion}" and its peer dependencies...`, ); const peerDeps = await getRNPeerDeps(newVersion); const pm = new PackageManager({projectDir}); @@ -170,12 +165,6 @@ const applyPatch = async ( logger.log(`${chalk.dim(error.stderr.trim())}`); } logger.error('Automatically applying diff failed'); - logger.info( - `Here's the diff we tried to apply: ${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}`, - ); - logger.info( - `You may find release notes helpful: https://github.com/facebook/react-native/releases/tag/v${newVersion}`, - ); return false; } return true; @@ -188,8 +177,7 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } - const rnDiffGitAddress = - 'https://github.com/react-native-community/rn-diff-purge.git'; + const rnDiffGitAddress = `${rnDiffPurgeUrl}.git`; const tmpRemote = 'tmp-rn-diff-purge'; const tmpPatchFile = 'tmp-upgrade-rn.patch'; const projectDir = ctx.root; @@ -229,9 +217,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { await execa('git', ['remote', 'add', tmpRemote, rnDiffGitAddress]); await execa('git', ['fetch', '--no-tags', tmpRemote]); patchSuccess = await applyPatch(currentVersion, newVersion, tmpPatchFile); - if (!patchSuccess) { - return; - } } catch (error) { throw new Error(error.stderr || error); } finally { @@ -240,15 +225,44 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { } catch (e) { // ignore } - await installDeps(newVersion, projectDir, patchSuccess); - logger.info('Running "git status" to check what changed...'); - await execa('git', ['status'], {stdio: 'inherit'}); + const {stdout} = await execa('git', ['status', '-s']); + if (!patchSuccess) { + if (stdout) { + logger.warn( + 'Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually', + ); + await installDeps(newVersion, projectDir); + logger.info('Running "git status" to check what changed...'); + await execa('git', ['status'], {stdio: 'inherit'}); + } else { + logger.error( + 'Patch failed to apply for unknown reason. Please fall back to manual way of upgrading', + ); + } + } else { + await installDeps(newVersion, projectDir); + logger.info('Running "git status" to check what changed...'); + await execa('git', ['status'], {stdio: 'inherit'}); + } await execa('git', ['remote', 'remove', tmpRemote]); if (!patchSuccess) { - logger.warn( - 'Please run "git diff" to review the conflicts and resolve them', - ); + if (stdout) { + logger.warn( + 'Please run "git diff" to review the conflicts and resolve them', + ); + } + logger.info(`You may find these resources helpful: +• Release notes: ${chalk.underline.dim( + `https://github.com/facebook/react-native/releases/tag/v${newVersion}`, + )} +• Comparison between versions: ${chalk.underline.dim( + `${rnDiffPurgeUrl}/compare/version/${currentVersion}..version/${newVersion}`, + )} +• Git diff: ${chalk.underline.dim( + `${rnDiffPurgeUrl}/compare/version/${currentVersion}..version/${newVersion}.diff`, + )}`); + throw new Error( 'Upgrade failed. Please see the messages above for details', ); From 07a976127d8c758775b16daeacc9fd5f6f3a55ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 10:32:34 +0100 Subject: [PATCH 018/234] fix: linking assets on Android (#231) --- packages/cli/package.json | 1 + .../cli/src/commands/link/android/copyAssets.js | 14 +++++++------- yarn.lock | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 55b061976..24a01e2b4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,6 +28,7 @@ "errorhandler": "^1.5.0", "escape-string-regexp": "^1.0.5", "execa": "^1.0.0", + "fs-extra": "^7.0.1", "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js index 81f4ad58a..fb8f124db 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/cli/src/commands/link/android/copyAssets.js @@ -7,7 +7,7 @@ * @flow */ -import fs from 'fs'; +import fs from 'fs-extra'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; @@ -23,10 +23,10 @@ export default function copyAssetsAndroid( ) { const assets = groupFilesByType(files); - (assets.font || []).forEach(asset => - fs.copyFileSync( - asset, - path.join(project.assetsPath, 'fonts', path.basename(asset)), - ), - ); + (assets.font || []).forEach(asset => { + const fontsDir = path.join(project.assetsPath, 'fonts'); + // @todo: replace with fs.mkdirSync(path, {recursive}) + fs.copyFileSync + // and get rid of fs-extra once we move to Node 10 + fs.copySync(asset, path.join(fontsDir, path.basename(asset))); + }); } diff --git a/yarn.lock b/yarn.lock index 77823481f..7e951d145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3518,7 +3518,7 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" -fs-extra@^7.0.0: +fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== From a20aad7d9a596301d9371a64e7785d67d04be9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 13:09:23 +0100 Subject: [PATCH 019/234] v1.4.2 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 24a01e2b4..12824cd6c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.1", + "version": "1.4.2", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From df17527c6819d3f707fa9ebf3bbfd4df1f0e1998 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 14 Mar 2019 22:32:44 +0100 Subject: [PATCH 020/234] fix: correct export of findPlugins --- packages/cli/src/core/findPlugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/core/findPlugins.js b/packages/cli/src/core/findPlugins.js index bfcc7e1ba..50350076a 100644 --- a/packages/cli/src/core/findPlugins.js +++ b/packages/cli/src/core/findPlugins.js @@ -9,4 +9,4 @@ import findPlugins from '../tools/findPlugins'; -export default findPlugins; +module.exports = findPlugins; From 962a59c9f425e9d66b60b9c360686fa679af8d5f Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 14 Mar 2019 22:35:18 +0100 Subject: [PATCH 021/234] Publish - @react-native-community/cli@1.4.3 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 12824cd6c..f24891338 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.2", + "version": "1.4.3", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 33647ab41cc8446563573d00c9fe4024f0ada22b Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 14 Mar 2019 22:41:36 +0100 Subject: [PATCH 022/234] Revert "fix: correct export of findPlugins" This reverts commit df17527c6819d3f707fa9ebf3bbfd4df1f0e1998. --- packages/cli/src/core/findPlugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/core/findPlugins.js b/packages/cli/src/core/findPlugins.js index 50350076a..bfcc7e1ba 100644 --- a/packages/cli/src/core/findPlugins.js +++ b/packages/cli/src/core/findPlugins.js @@ -9,4 +9,4 @@ import findPlugins from '../tools/findPlugins'; -module.exports = findPlugins; +export default findPlugins; From 4d7110d9074a57c616e4004a93fb3ca2245421f4 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 14 Mar 2019 22:42:00 +0100 Subject: [PATCH 023/234] chore: export findPlugins for ReactNative --- packages/cli/src/cliEntry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index e29a0ecad..ddc9b97e1 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -201,6 +201,7 @@ async function setupAndRun() { export default { run, init, + findPlugins, }; export {run, init, findPlugins}; From ad65130e7628d21b0073afb842ea2ecf7222d826 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 14 Mar 2019 22:42:20 +0100 Subject: [PATCH 024/234] Publish - @react-native-community/cli@1.4.4 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index f24891338..223574378 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.3", + "version": "1.4.4", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From e1fa0d1e4dea09ae314f817101c837f761808301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 23:23:56 +0100 Subject: [PATCH 025/234] fix: reactNativePath and projectRoot not being parsed by commander (#234) * fix: reactNativePath and projectRoot not being parsed by commander * add minimist --- packages/cli/src/cliEntry.js | 16 ++++++++++++---- yarn.lock | 7 ++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index ddc9b97e1..dcd9941c5 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -10,6 +10,7 @@ import chalk from 'chalk'; import childProcess from 'child_process'; import commander from 'commander'; +import minimist from 'minimist'; import path from 'path'; import type {CommandT, ContextT} from './tools/types.flow'; import getLegacyConfig from './tools/getLegacyConfig'; @@ -153,12 +154,19 @@ async function setupAndRun() { } } - const root = commander.projectRoot - ? path.resolve(commander.projectRoot) + /** + * At this point, commander arguments are not parsed yet because we need to + * add all the commands and their options. That's why we resort to using + * minimist for parsing some global options. + */ + const options = minimist(process.argv.slice(2)); + + const root = options.projectRoot + ? path.resolve(options.projectRoot) : process.cwd(); - const reactNativePath = commander.reactNativePath - ? path.resolve(commander.reactNativePath) + const reactNativePath = options.reactNativePath + ? path.resolve(options.reactNativePath) : (() => { try { return path.dirname( diff --git a/yarn.lock b/yarn.lock index 7e951d145..3fadcbb86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5695,10 +5695,15 @@ minimist@0.0.8: version "0.0.8" resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.1, minimist@^1.1.3: version "1.2.0" resolved "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + minimist@~0.0.1: version "0.0.10" resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" From f46578964a41a98362fa4fb03ab329ed568c0f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 23:25:17 +0100 Subject: [PATCH 026/234] v1.4.5 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 223574378..db0fc1d42 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.4", + "version": "1.4.5", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 2c9729cd6b8515557a34fc440a9c0bd778bc0fd9 Mon Sep 17 00:00:00 2001 From: cpojer Date: Fri, 15 Mar 2019 09:03:10 +0000 Subject: [PATCH 027/234] build: remove dependepcies command --- .../src/commands/dependencies/dependencies.js | 112 ------------------ packages/cli/src/commands/index.js | 2 - 2 files changed, 114 deletions(-) delete mode 100644 packages/cli/src/commands/dependencies/dependencies.js diff --git a/packages/cli/src/commands/dependencies/dependencies.js b/packages/cli/src/commands/dependencies/dependencies.js deleted file mode 100644 index 2004e04e9..000000000 --- a/packages/cli/src/commands/dependencies/dependencies.js +++ /dev/null @@ -1,112 +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. - * - */ - -import Metro from 'metro'; - -import denodeify from 'denodeify'; -import fs from 'fs'; -import path from 'path'; -import util from 'util'; - -async function dependencies(argv, configPromise, args, packagerInstance) { - const rootModuleAbsolutePath = args.entryFile; - const config = await configPromise; - if (!fs.existsSync(rootModuleAbsolutePath)) { - return Promise.reject( - new Error(`File ${rootModuleAbsolutePath} does not exist`), - ); - } - - config.cacheStores = []; - - const relativePath = path.relative( - config.projectRoot, - rootModuleAbsolutePath, - ); - - const options = { - platform: args.platform, - entryFile: relativePath, - dev: args.dev, - minify: false, - generateSourceMaps: !args.dev, - }; - - const writeToFile = args.output; - const outStream = writeToFile - ? fs.createWriteStream(args.output) - : process.stdout; - - const deps = packagerInstance - ? await packagerInstance.getOrderedDependencyPaths(options) - : await Metro.getOrderedDependencyPaths(config, options); - - deps.forEach(modulePath => { - // Temporary hack to disable listing dependencies not under this directory. - // Long term, we need either - // (a) JS code to not depend on anything outside this directory, or - // (b) Come up with a way to declare this dependency in Buck. - const isInsideProjectRoots = - config.watchFolders.filter(root => modulePath.startsWith(root)).length > - 0; - - if (isInsideProjectRoots) { - outStream.write(`${modulePath}\n`); - } - }); - return writeToFile - ? denodeify(outStream.end).bind(outStream)() - : Promise.resolve(); -} - -export default { - name: 'dependencies', - description: 'lists dependencies', - func: util.deprecate( - dependencies, - 'dependencies command was moved to metro, and will be removed from cli in next release', - ), - options: [ - { - command: '--entry-file ', - description: 'Absolute path to the root JS file', - }, - { - command: '--output [path]', - description: - 'File name where to store the output, ex. /tmp/dependencies.txt', - }, - { - command: '--platform [extension]', - description: 'The platform extension used for selecting modules', - }, - { - command: '--transformer [path]', - description: 'Specify a custom transformer to be used', - }, - { - command: '--max-workers [number]', - description: - 'Specifies the maximum number of workers the worker-pool ' + - 'will spawn for transforming files. This defaults to the number of the ' + - 'cores available on your machine.', - parse: workers => Number(workers), - }, - { - command: '--dev [boolean]', - description: 'If false, skip all dev-only code path', - parse: val => val !== 'false', - default: true, - }, - { - command: '--verbose', - description: 'Enables logging', - default: false, - }, - ], -}; diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index b35c831fb..fded7f655 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -27,7 +27,6 @@ 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'; /** @@ -49,7 +48,6 @@ const loadLocalCommands: Array = [ upgrade, logAndroid, logIOS, - dependencies, info, ]; From c2fead3c3da5a383bf7ca3afe83d63b3d9275f2d Mon Sep 17 00:00:00 2001 From: Benoit Lemaire Date: Mon, 11 Mar 2019 10:16:12 -0700 Subject: [PATCH 028/234] chore: bump metro to 0.53 --- packages/cli/package.json | 10 +- yarn.lock | 503 ++++++++++++++------------------------ 2 files changed, 188 insertions(+), 325 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index db0fc1d42..5a0ea8b21 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -33,11 +33,11 @@ "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", "lodash": "^4.17.5", - "metro": "^0.51.0", - "metro-config": "^0.51.0", - "metro-core": "^0.51.0", - "metro-memory-fs": "^0.51.0", - "metro-react-native-babel-transformer": "^0.51.0", + "metro": "^0.53.1", + "metro-config": "^0.53.1", + "metro-core": "^0.53.1", + "metro-memory-fs": "^0.53.1", + "metro-react-native-babel-transformer": "^0.53.1", "mime": "^1.3.4", "minimist": "^1.2.0", "mkdirp": "^0.5.1", diff --git a/yarn.lock b/yarn.lock index 3fadcbb86..69b82318e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -384,6 +384,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-flow@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" + integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" @@ -454,6 +461,15 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-async-to-generator@^7.0.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.3.4.tgz#4e45408d3c3da231c0e7b823f407a53a7eb3048c" + integrity sha512-Y7nCzv2fw/jEZ9f678MuKdMo99MFDJMT/PvD9LisrR5JDFcJH6vYeH6RnjVt3p5tceyGRvTtEN0VOlU+rgHZjA== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-transform-async-to-generator@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.2.0.tgz#68b8a438663e88519e65b776f8938f3445b1a2ff" @@ -904,6 +920,19 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-flow-strip-types" "^7.0.0" +"@babel/register@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827" + integrity sha512-f/+CRmaCe7rVEvcvPvxeA8j5aJhHC3aJie7YuqcMDhUOuyWLA7J/aNrTaHIzoWPEhpHA54mec4Mm8fv8KBlv3g== + dependencies: + core-js "^2.5.7" + find-cache-dir "^1.0.0" + home-or-tmp "^3.0.0" + lodash "^4.17.10" + mkdirp "^0.5.1" + pirates "^4.0.0" + source-map-support "^0.5.9" + "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2": version "7.1.2" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.1.2.tgz#090484a574fef5a2d2d7726a674eceda5c5b5644" @@ -1753,17 +1782,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - dependencies: - arr-flatten "^1.0.1" - arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" -arr-flatten@^1.0.1, arr-flatten@^1.1.0: +arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" @@ -1820,10 +1843,6 @@ array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" - array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" @@ -1922,9 +1941,10 @@ babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" -babel-preset-fbjs@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.1.0.tgz#6d1438207369d96384d09257b01602dd0dda6608" +babel-preset-fbjs@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.2.0.tgz#c0e6347d3e0379ed84b3c2434d3467567aa05297" + integrity sha512-5Jo+JeWiVz2wHUUyAlvb/sSYnXNig9r+HqGAOSfh5Fzxp7SnAaR/tEGRJ1ZX7C77kfk82658w6R5Z+uPATTD9g== dependencies: "@babel/plugin-proposal-class-properties" "^7.0.0" "@babel/plugin-proposal-object-rest-spread" "^7.0.0" @@ -2040,14 +2060,6 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -2396,6 +2408,11 @@ commander@~2.17.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + compare-func@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648" @@ -2570,6 +2587,11 @@ copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" +core-js@^2.2.2, core-js@^2.5.7: + version "2.6.5" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" + integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== + core-js@^2.4.1: version "2.5.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" @@ -3209,12 +3231,6 @@ exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - dependencies: - is-posix-bracket "^0.1.0" - expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -3227,12 +3243,6 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - dependencies: - fill-range "^2.1.0" - expect@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/expect/-/expect-24.0.0.tgz#71f71d88a4202746fc79849bb4c6498008b5ef03" @@ -3277,12 +3287,6 @@ external-editor@^3.0.0: iconv-lite "^0.4.24" tmp "^0.0.33" -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - dependencies: - is-extglob "^1.0.0" - extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -3382,10 +3386,6 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - fileset@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" @@ -3393,16 +3393,6 @@ fileset@^2.0.3: glob "^7.0.3" minimatch "^3.0.3" -fill-range@^2.1.0: - version "2.2.4" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^3.0.0" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -3424,6 +3414,15 @@ finalhandler@1.1.0: statuses "~1.3.1" unpipe "~1.0.0" +find-cache-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" + integrity sha1-kojj6ePMN0hxfTnq3hfPcfww7m8= + dependencies: + commondir "^1.0.1" + make-dir "^1.0.0" + pkg-dir "^2.0.0" + find-npm-prefix@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/find-npm-prefix/-/find-npm-prefix-1.0.2.tgz#8d8ce2c78b3b4b9e66c8acc6a37c231eb841cfdf" @@ -3470,16 +3469,10 @@ flush-write-stream@^1.0.0: inherits "^2.0.1" readable-stream "^2.0.4" -for-in@^1.0.1, for-in@^1.0.2: +for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - dependencies: - for-in "^1.0.1" - forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -3692,19 +3685,6 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - dependencies: - is-glob "^2.0.0" - glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" @@ -3844,6 +3824,11 @@ has@^1.0.1: dependencies: function-bind "^1.1.1" +home-or-tmp@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" + integrity sha1-V6j+JM8zzdUkhgoVgh3cJchmcfs= + hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -4161,16 +4146,6 @@ is-directory@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - dependencies: - is-primitive "^2.0.0" - is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -4181,10 +4156,6 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -4212,12 +4183,6 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" integrity sha512-elzyIdM7iKoFHzcrndIqjYomImhxrFRnGP3galODoII4TB9gI7mZ+FnlLQmmjf27SxHS2gKEeyhX5/+YRS6H9g== -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - dependencies: - is-extglob "^1.0.0" - is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -4232,22 +4197,12 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - dependencies: - kind-of "^3.0.2" - is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" dependencies: kind-of "^3.0.2" -is-number@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" - is-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" @@ -4280,14 +4235,6 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -4578,20 +4525,7 @@ jest-get-type@^24.0.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.0.0.tgz#36e72930b78e33da59a4f63d44d332188278940b" integrity sha512-z6/Eyf6s9ZDGz7eOvl+fzpuJmN9i0KyTt1no37/dHu8galssxz5ZEgnc1KaV8R31q1khxyhB4ui/X5ZjjPk77w== -jest-haste-map@24.0.0-alpha.6: - version "24.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0-alpha.6.tgz#fb2c785080f391b923db51846b86840d0d773076" - integrity sha512-+NO2HMbjvrG8BC39ieLukdpFrcPhhjCJGhpbHodHNZygH1Tt06WrlNYGpZtWKx/zpf533tCtMQXO/q59JenjNw== - dependencies: - fb-watchman "^2.0.0" - graceful-fs "^4.1.11" - invariant "^2.2.4" - jest-serializer "^24.0.0-alpha.6" - jest-worker "^24.0.0-alpha.6" - micromatch "^2.3.11" - sane "^3.0.0" - -jest-haste-map@^24.0.0: +jest-haste-map@24.0.0, jest-haste-map@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0.tgz#e9ef51b2c9257384b4d6beb83bd48c65b37b5e6e" integrity sha512-CcViJyUo41IQqttLxXVdI41YErkzBKbE6cS6dRAploCeutePYfUimWd3C9rQEWhX0YBOQzvNsC0O9nYxK2nnxQ== @@ -4724,12 +4658,7 @@ jest-runtime@^24.0.0: write-file-atomic "^2.4.2" yargs "^12.0.2" -jest-serializer@24.0.0-alpha.6, jest-serializer@^24.0.0-alpha.6: - version "24.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0-alpha.6.tgz#27d2fee4b1a85698717a30c3ec2ab80767312597" - integrity sha512-IPA5T6/GhlE6dedSk7Cd7YfuORnYjN0VD5iJVFn1Q81RJjpj++Hen5kJbKcg547vXsQ1TddV15qOA/zeIfOCLw== - -jest-serializer@^24.0.0: +jest-serializer@24.0.0, jest-serializer@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0.tgz#522c44a332cdd194d8c0531eb06a1ee5afb4256b" integrity sha512-9FKxQyrFgHtx3ozU+1a8v938ILBE7S8Ko3uiAVjT8Yfi2o91j/fj81jacCQZ/Ihjiff/VsUCXVgQ+iF1XdImOw== @@ -4785,14 +4714,7 @@ jest-watcher@^24.0.0: jest-util "^24.0.0" string-length "^2.0.0" -jest-worker@24.0.0-alpha.6, jest-worker@^24.0.0-alpha.6: - version "24.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0-alpha.6.tgz#463681b92c117c57107135c14b9b9d6cd51d80ce" - integrity sha512-iXtH7MR9bjWlNnlnRBcrBRrb4cSVxML96La5vsnmBvDI+mJnkP5uEt6Fgpo5Y8f3z9y2Rd7wuPnKRxqQsiU/dA== - dependencies: - merge-stream "^1.0.1" - -jest-worker@^24.0.0: +jest-worker@24.0.0, jest-worker@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0.tgz#3d3483b077bf04f412f47654a27bba7e947f8b6d" integrity sha512-s64/OThpfQvoCeHG963MiEZOAAxu8kHsaL/rCMF7lpdzo7vgF0CtPml9hfguOMgykgH/eOm4jFP4ibfHLruytg== @@ -5305,10 +5227,6 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -math-random@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac" - mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" @@ -5369,122 +5287,96 @@ merge@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" -metro-babel-transformer@0.51.0: - version "0.51.0" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.51.0.tgz#9ee5199163ac46b2057527b3f8cbd8b089ffc03e" - integrity sha512-M7KEY/hjD3E8tJEliWgI0VOSaJtqaznC0ItM6FiMrhoGDqqa1BvGofl+EPcKqjBSOV1UgExua/T1VOIWbjwQsw== +metro-babel-register@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.53.1.tgz#41c73313ff882d28d8f7df072d2c7a6b7b314ac8" + integrity sha512-kDu7mktGCVdpa2islDzmNXZ0sGQjUvIEcQkmO9pt4b4d8QVecEHyHSZB9jvWnE2w9lADzvnERmZLHS2iDDYOyw== dependencies: "@babel/core" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-optional-chaining" "^7.0.0" + "@babel/plugin-transform-async-to-generator" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/register" "^7.0.0" + core-js "^2.2.2" + escape-string-regexp "^1.0.5" -metro-babel-transformer@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.51.1.tgz#97be9e2b96c78aa202b52ae05fb86f71327aef72" - integrity sha512-+tOnZZzOzufB86ASdfimUEGB1jBKsdsVpPdjNJZkueTFyvYlGqWDQKHM1w9bwKMeM/czPQ48Y6m8Bou6le0X4w== +metro-babel-transformer@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.53.1.tgz#a076fd77a9a7aef8004706edf537dcd1fec4a79e" + integrity sha512-cgZj9KK/SLxsO/rAmrlnZpaBlLhxuWxGrQkkiWxV/OjfbW8nvodozfZ3Euxvh4Ytf0e8qgTFG3JpQf8EGSDp7w== dependencies: "@babel/core" "^7.0.0" -metro-babel7-plugin-react-transform@0.51.0: - version "0.51.0" - resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.51.0.tgz#af27dd81666b91f05d2b371b0d6d283c585e38b6" - integrity sha512-dZ95kXcE2FJMoRsYhxr7YLCbOlHWKwe0bOpihRhfImDTgFfuKIzU4ROQwMUbE0NCbzB+ATFsa2FZ3pHDJ5GI0w== +metro-babel7-plugin-react-transform@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.53.1.tgz#9ad31e5c84f5003333a6a3cf79f2d093cd3b2ddc" + integrity sha512-98lEpTu7mox/7QurxVuLnbjrGDdayjpS2Z1T4vkLcP+mBxzloKJuTRnmtyWC8cNlx9qjimHGDlqtNY78rQ8rsA== dependencies: "@babel/helper-module-imports" "^7.0.0" -metro-babel7-plugin-react-transform@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.51.1.tgz#9cce2c340cc4006fc82aa6dfab27af22d592607e" - integrity sha512-wzn4X9KgmAMZ7Bi6v9KxA7dw+AHGL0RODPxU5NDJ3A6d0yERvzfZ3qkzWhz8jbFkVBK12cu5DTho3HBazKQDOw== +metro-cache@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.53.1.tgz#38d73c441771bdd2437a55d50943e346e1897108" + integrity sha512-27Cbo32nabef/P+y5s3cpaIUWa7Hpql2xD0HqQD8AbCfSG4xraEoBOLCmvB6wusvDAnQAcuglLq9AUbTvcSebA== dependencies: - "@babel/helper-module-imports" "^7.0.0" - -metro-cache@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.51.1.tgz#d0b296eab8e009214413bba87e4eac3d9b44cd04" - integrity sha512-0m1+aicsw77LVAehNuTxDpE1c/7Xv/ajRD+UL/lFCWUxnrjSbxVtIKr8l5DxEY11082c1axVRuaV9e436W+eXg== - dependencies: - jest-serializer "24.0.0-alpha.6" - metro-core "0.51.1" + jest-serializer "24.0.0" + metro-core "0.53.1" mkdirp "^0.5.1" rimraf "^2.5.4" -metro-config@0.51.1, metro-config@^0.51.0: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.51.1.tgz#8f1a241ce2c0b521cd492c39bc5c6c69e3397b82" - integrity sha512-WCNd0tTI9gb/ubgTqK1+ljZL4b3hsXVinsOAtep4nHiVb6DSDdbO2yXDD2rpYx3NE6hDRMFS9HHg6G0139pAqQ== +metro-config@0.53.1, metro-config@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.53.1.tgz#a522beec446187b010c0e68273015818d1c6dfb9" + integrity sha512-3hRweWmrGs8NOjQXLsg/FHAEWqCnfNKLXM4BcI8RXQFvrQQRqhoXCuhcTfM9lSfNkefJiRp+4wW6cHXgo/TP6w== dependencies: cosmiconfig "^5.0.5" - metro "0.51.1" - metro-cache "0.51.1" - metro-core "0.51.1" + metro "0.53.1" + metro-cache "0.53.1" + metro-core "0.53.1" pretty-format "24.0.0-alpha.6" -metro-core@0.51.1, metro-core@^0.51.0: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.51.1.tgz#e7227fb1dd1bb3f953272fad9876e6201140b038" - integrity sha512-sG1yACjdFqmIzZN50HqLTKUMp1oy0AehHhmIuYeIllo1DjX6Y2o3UAT3rGP8U+SAqJGXf/OWzl6VNyRPGDENfA== +metro-core@0.53.1, metro-core@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.53.1.tgz#350211c6327ccf307270199bb1c04012ec2d7d96" + integrity sha512-bBK0GMZWsZrdBGi+jh/87g0VvItT2jez6aj+vRw8AcBataT81SZ5WsSAw3CtbivBXXR7x3oK49T6ZZ+D79VZAw== dependencies: - jest-haste-map "24.0.0-alpha.6" + jest-haste-map "24.0.0" lodash.throttle "^4.1.1" - metro-resolver "0.51.1" + metro-resolver "0.53.1" wordwrap "^1.0.0" -metro-memory-fs@^0.51.0: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-memory-fs/-/metro-memory-fs-0.51.1.tgz#624291f5956b0fd11532d80b1b85d550926f96c9" - integrity sha512-dXVUpLPLwfQcYHd1HlqHGVzBsiwvUdT92TDSbdc10152TP+iynHBqLDWbxt0MAtd6c/QXwOuGZZ1IcX3+lv5iw== - -metro-minify-uglify@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.51.1.tgz#60cd8fe4d3e82d6670c717b8ddb52ae63199c0e4" - integrity sha512-HAqd/rFrQ6mnbqVAszDXIKTg2rqHlY9Fm8DReakgbkAeyMbF2mH3kEgtesPmTrhajdFk81UZcNSm6wxj1JMgVg== +metro-inspector-proxy@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-inspector-proxy/-/metro-inspector-proxy-0.53.1.tgz#cff4b9fa8b9e5598c034469bd30ef07093f75b28" + integrity sha512-4q5WIFFmpjtKbY2vze3tNI3hPUFrvv1iwTrpz3DMdQ+NYZO6aEwCxtgZAt8N4HC3xZMdECL+DDKKAJu+4jsiEA== dependencies: - uglify-es "^3.1.9" + chalk "^2.4.1" + connect "^3.6.5" + rxjs "^5.4.3" + ws "^1.1.5" + yargs "^9.0.0" -metro-react-native-babel-preset@0.51.0: - version "0.51.0" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.51.0.tgz#978d960acf2d214bbbe43e59145878d663bd07de" - integrity sha512-Y/aPeLl4RzY8IEAneOyDcpdjto/8yjIuX9eUWRngjSqdHYhGQtqiSBpfTpo0BvXpwNRLwCLHyXo58gNpckTJFw== +metro-memory-fs@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-memory-fs/-/metro-memory-fs-0.53.1.tgz#d8975317122b8a9a90f649337d58da85e4ae2559" + integrity sha512-Xb6/TnMOjquTIRyKpaGx/jYM01+ajtQEjGpGS/N1TtnQeW0P7HMZnD+e/FpMgXmdqsf2IiQMK7l8WONU2L3Evw== + +metro-minify-uglify@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.53.1.tgz#145b6e37c09e3ff8fb1bbd3221e5a3fded044904" + integrity sha512-uTdsoACy0WP51qDNrKcLILcpZOMLGyi2B9j3pu9zVRts7hlfVQGxBg4v3uDZ+L7zJ7TKR15p4iMXFmTAkRBpdA== dependencies: - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-export-default-from" "^7.0.0" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" - "@babel/plugin-proposal-optional-chaining" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.0.0" - "@babel/plugin-syntax-export-default-from" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.0.0" - "@babel/plugin-transform-classes" "^7.0.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-exponentiation-operator" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/plugin-transform-for-of" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.0.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-modules-commonjs" "^7.0.0" - "@babel/plugin-transform-object-assign" "^7.0.0" - "@babel/plugin-transform-parameters" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-react-jsx-source" "^7.0.0" - "@babel/plugin-transform-regenerator" "^7.0.0" - "@babel/plugin-transform-runtime" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-sticky-regex" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.0.0" - "@babel/plugin-transform-unicode-regex" "^7.0.0" - "@babel/template" "^7.0.0" - metro-babel7-plugin-react-transform "0.51.0" - react-transform-hmr "^1.0.4" + uglify-es "^3.1.9" -metro-react-native-babel-preset@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.51.1.tgz#44aeeedfea37f7c2ab8f6f273fa71b90fe65f089" - integrity sha512-e9tsYDFhU70gar0jQWcZXRPJVCv4k7tEs6Pm74wXO2OO/T1MEumbvniDIGwGG8bG8RUnYdHhjcaiub2Vc5BRWw== +metro-react-native-babel-preset@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.53.1.tgz#6cd9e41a1b9a6e210e71ef2adf114219b4eaf2ec" + integrity sha512-Uf8EGL8kIPhDkoSdAAysNPxPQclUS2R1QC4cwnc8bkk2f6yqGn+1CorfiY9AaqlLEth5mKQqdtRYFDTFfB9QyA== dependencies: "@babel/plugin-proposal-class-properties" "^7.0.0" "@babel/plugin-proposal-export-default-from" "^7.0.0" @@ -5494,6 +5386,7 @@ metro-react-native-babel-preset@0.51.1: "@babel/plugin-proposal-optional-chaining" "^7.0.0" "@babel/plugin-syntax-dynamic-import" "^7.0.0" "@babel/plugin-syntax-export-default-from" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.2.0" "@babel/plugin-transform-arrow-functions" "^7.0.0" "@babel/plugin-transform-block-scoping" "^7.0.0" "@babel/plugin-transform-classes" "^7.0.0" @@ -5519,37 +5412,37 @@ metro-react-native-babel-preset@0.51.1: "@babel/plugin-transform-typescript" "^7.0.0" "@babel/plugin-transform-unicode-regex" "^7.0.0" "@babel/template" "^7.0.0" - metro-babel7-plugin-react-transform "0.51.1" + metro-babel7-plugin-react-transform "0.53.1" react-transform-hmr "^1.0.4" -metro-react-native-babel-transformer@^0.51.0: - version "0.51.0" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.51.0.tgz#57a695e97a19d95de63c9633f9d0dc024ee8e99a" - integrity sha512-VFnqtE0qrVmU1HV9B04o53+NZHvDwR+CWCoEx4+7vCqJ9Tvas741biqCjah9xtifoKdElQELk6x0soOAWCDFJA== +metro-react-native-babel-transformer@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.53.1.tgz#addf31b3a9b5fc512b9ff6967d923dcfcda56394" + integrity sha512-UB64jN/akuTdDmoQlw+yLBifJhQzJr7QPP3cwitwM5XD4d9M+12pZreeFn66oMakTy4pNx4jkaYEJ5rLyh/b0Q== dependencies: "@babel/core" "^7.0.0" - babel-preset-fbjs "^3.0.1" - metro-babel-transformer "0.51.0" - metro-react-native-babel-preset "0.51.0" + babel-preset-fbjs "^3.1.2" + metro-babel-transformer "0.53.1" + metro-react-native-babel-preset "0.53.1" -metro-resolver@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.51.1.tgz#4c26f0baee47d30250187adca3d34c902e627611" - integrity sha512-zmWbD/287NDA/jLPuPV0hne/YMMSG0dljzu21TYMg2lXRLur/zROJHHhyepZvuBHgInXBi4Vhr2wvuSnY39SuA== +metro-resolver@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.53.1.tgz#e21df30c0b9913c7cbeeda9c28d8ffe0ae58cd53" + integrity sha512-UOL2AY3HF3kyuwO+SXceA7MvVbxGZTwRmWOcRl2mYMZ66osSygFgR0WoYFAlxoW83c1ZDYXMIg78ob8bs0lSAg== dependencies: absolute-path "^0.0.0" -metro-source-map@0.51.1: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.51.1.tgz#1a8da138e98e184304d5558b4f92a5c2141822d0" - integrity sha512-JyrE+RV4YumrboHPHTGsUUGERjQ681ImRLrSYDGcmNv4tfpk9nvAK26UAas4IvBYFCC9oW90m0udt3kaQGv59Q== +metro-source-map@0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.53.1.tgz#61d915720eb90722d55252f3bd014ba0ce8fabfd" + integrity sha512-mZ8NJMq5lKE9+0gfhpYFVqK3z4wng6xCzOMXoROjkOsO/exbHGK4oSfOzEnVl6oCRBTGMfaeB32ZeECwZ9O0jw== dependencies: source-map "^0.5.6" -metro@0.51.1, metro@^0.51.0: - version "0.51.1" - resolved "https://registry.yarnpkg.com/metro/-/metro-0.51.1.tgz#b0aad4731593b9f244261bad1abb2a006d1c8969" - integrity sha512-nM0dqn8LQlMjhChl2fzTUq2EWiUebZM7nkesD9vQe47W10bj/tbRLPiIIAxht6SRDbPd/hRA+t39PxLhPSKEKg== +metro@0.53.1, metro@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/metro/-/metro-0.53.1.tgz#23fb558eb22e8de8d84fa3f456adfdedec435021" + integrity sha512-Q2iVHfUu5NO2o0dZukBkWrW5s2LiResQuK5KalomNsOHLguOYI5r1nR5QdznZ05GI96iR0fgNvFWfPMyIhtKvw== dependencies: "@babel/core" "^7.0.0" "@babel/generator" "^7.0.0" @@ -5560,7 +5453,7 @@ metro@0.51.1, metro@^0.51.0: "@babel/types" "^7.0.0" absolute-path "^0.0.0" async "^2.4.0" - babel-preset-fbjs "^3.0.1" + babel-preset-fbjs "^3.1.2" buffer-crc32 "^0.2.13" chalk "^2.4.1" concat-stream "^1.6.0" @@ -5573,19 +5466,21 @@ metro@0.51.1, metro@^0.51.0: graceful-fs "^4.1.3" image-size "^0.6.0" invariant "^2.2.4" - jest-haste-map "24.0.0-alpha.6" - jest-worker "24.0.0-alpha.6" + jest-haste-map "24.0.0" + jest-worker "24.0.0" json-stable-stringify "^1.0.1" lodash.throttle "^4.1.1" merge-stream "^1.0.1" - metro-babel-transformer "0.51.1" - metro-cache "0.51.1" - metro-config "0.51.1" - metro-core "0.51.1" - metro-minify-uglify "0.51.1" - metro-react-native-babel-preset "0.51.1" - metro-resolver "0.51.1" - metro-source-map "0.51.1" + metro-babel-register "0.53.1" + metro-babel-transformer "0.53.1" + metro-cache "0.53.1" + metro-config "0.53.1" + metro-core "0.53.1" + metro-inspector-proxy "0.53.1" + metro-minify-uglify "0.53.1" + metro-react-native-babel-preset "0.53.1" + metro-resolver "0.53.1" + metro-source-map "0.53.1" mime-types "2.1.11" mkdirp "^0.5.1" node-fetch "^2.2.0" @@ -5603,24 +5498,6 @@ metro@0.51.1, metro@^0.51.0: xpipe "^1.0.5" yargs "^9.0.0" -micromatch@^2.3.11: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -5944,7 +5821,7 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.0.1, normalize-path@^2.1.1: +normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" dependencies: @@ -6088,13 +5965,6 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.2" es-abstract "^1.5.1" -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -6309,15 +6179,6 @@ parse-github-repo-url@^1.3.0: resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" integrity sha1-nn2LslKmy2ukJZUGC3v23z28H1A= -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" - parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -6468,10 +6329,6 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - prettier@1.13.6: version "1.13.6" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" @@ -6628,14 +6485,6 @@ quick-lru@^1.0.0: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= -randomatic@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" - dependencies: - is-number "^4.0.0" - kind-of "^6.0.0" - math-random "^1.0.1" - range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -6825,12 +6674,6 @@ regenerator-transform@^0.13.3: dependencies: private "^0.1.6" -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - dependencies: - is-equal-shallow "^0.1.3" - regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -6871,7 +6714,7 @@ repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" -repeat-string@^1.5.2, repeat-string@^1.6.1: +repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" @@ -7033,6 +6876,13 @@ rx-lite@*, rx-lite@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" +rxjs@^5.4.3: + version "5.5.12" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.12.tgz#6fa61b8a77c3d793dbaf270bee2f43f652d741cc" + integrity sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw== + dependencies: + symbol-observable "1.0.1" + rxjs@^6.1.0: version "6.3.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55" @@ -7289,6 +7139,14 @@ source-map-support@^0.5.6: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@^0.5.9: + version "0.5.10" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c" + integrity sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" @@ -7525,6 +7383,11 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" +symbol-observable@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" + integrity sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ= + symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" From de88920d855aaa874888e8ed28b50db098eef293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 15 Mar 2019 14:27:43 +0100 Subject: [PATCH 029/234] chore: remove legacy core/findPlugins (#235) Summary: --------- Now that we prepare 2.0 release, we can remove it. Also added `build-clean` to `postinstall` hook to avoid publishing extras when not using lerna. Test Plan: ---------- @grabbou --- package.json | 2 +- packages/cli/src/core/findPlugins.js | 12 ------------ yarn.lock | 7 +------ 3 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 packages/cli/src/core/findPlugins.js diff --git a/package.json b/package.json index 0ee2153c1..de4b3d899 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test": "jest", "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", - "postinstall": "yarn build", + "postinstall": "yarn build-clean && yarn build", "publish": "yarn build-clean && yarn build && lerna publish" }, "dependencies": { diff --git a/packages/cli/src/core/findPlugins.js b/packages/cli/src/core/findPlugins.js deleted file mode 100644 index bfcc7e1ba..000000000 --- a/packages/cli/src/core/findPlugins.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file exists only because RN 0.59.0 stable consumes it and we don't want - * to introduce a breaking change. - * See consumer: https://github.com/facebook/react-native/blob/7c73f2bb5a0f97902f469bc043681e79e161aac3/jest/hasteImpl.js#L28 - * @todo: remove in 2.0 - * - * @flow - */ - -import findPlugins from '../tools/findPlugins'; - -export default findPlugins; diff --git a/yarn.lock b/yarn.lock index 69b82318e..5efce960b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5572,15 +5572,10 @@ minimist@0.0.8: version "0.0.8" resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.1, minimist@^1.1.3: +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - minimist@~0.0.1: version "0.0.10" resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" From af7ac5e3fc6429371310a3c10580a53dcf70342b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 15 Mar 2019 14:29:33 +0100 Subject: [PATCH 030/234] v2.0.0 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 5a0ea8b21..a545eb4e8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "1.4.5", + "version": "2.0.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From e91b1f0292c33b849f366af482de133d4954f170 Mon Sep 17 00:00:00 2001 From: Ruslan Bikkinin Date: Fri, 15 Mar 2019 19:40:29 +0300 Subject: [PATCH 031/234] Bring back lost customDebugger function (#237) --- .../middleware/getDevToolsMiddleware.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js index 6a714c941..d6f09639b 100644 --- a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js @@ -8,6 +8,7 @@ */ import launchChrome from '../launchChrome'; import logger from '../../../tools/logger'; +import {exec} from 'child_process'; function launchChromeDevTools(port, args = '') { const debuggerURL = `http://localhost:${port}/debugger-ui${args}`; @@ -15,17 +16,33 @@ function launchChromeDevTools(port, args = '') { launchChrome(debuggerURL); } +function escapePath(pathname) { + // " Can escape paths with spaces in OS X, Windows, and *nix + return `"${pathname}"`; +} + function launchDevTools({port, watchFolders}, isChromeConnected) { // Explicit config always wins const customDebugger = process.env.REACT_DEBUGGER; if (customDebugger) { - customDebugger({watchFolders, customDebugger}); + startCustomDebugger({watchFolders, customDebugger}); } else if (!isChromeConnected()) { // Dev tools are not yet open; we need to open a session launchChromeDevTools(port); } } +function startCustomDebugger({watchFolders, customDebugger}) { + const folders = watchFolders.map(escapePath).join(' '); + const command = `${customDebugger} ${folders}`; + console.log('Starting custom debugger by executing:', command); + exec(command, function(error, stdout, stderr) { + if (error !== null) { + console.log('Error while starting custom debugger:', error); + } + }); +} + export default function getDevToolsMiddleware(options, isChromeConnected) { return function devToolsMiddleware(req, res, next) { if (req.url === '/launch-safari-devtools') { From 5bc821841c41212e5e37b4e06414b9cc05bbe863 Mon Sep 17 00:00:00 2001 From: empyrical Date: Sat, 16 Mar 2019 01:54:59 -0600 Subject: [PATCH 032/234] fix: throw an error if an invalid platform is passed to the bundle (#240) Summary: --------- This pull request adds a new error message to the `react-native bundle` command that will throw an error if an invalid platform is passed to the `--platform` command, instead of failing with cryptic Haste errors. The error message looks like this: ``` > react-native bundle --entry-file index.js --platform foo --bundle-output test.jsbundle Invalid platform (foo) selected. Available platforms are: ios, android, native If you are trying to bundle for an out-of-tree platform, it may not be installed. error Invalid platform selected. ``` Test Plan: ---------- If you provide a platform that is not installed to `react-native bundle`, it will throw this error. If you provide a valid platform, it will continue bundling without issue. --- .../cli/src/commands/bundle/buildBundle.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index fc9088354..f4d9fb406 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -11,6 +11,7 @@ import Server from 'metro/src/Server'; import outputBundle from 'metro/src/shared/output/bundle'; import path from 'path'; +import chalk from 'chalk'; import type {CommandLineArgs} from './bundleCommandLineArgs'; import type {ContextT} from '../../tools/types.flow'; import saveAssets from './saveAssets'; @@ -27,6 +28,24 @@ async function buildBundle( config: args.config, }); + if (config.resolver.platforms.indexOf(args.platform) === -1) { + logger.error( + `Invalid platform ${ + args.platform ? `"${chalk.bold(args.platform)}" ` : '' + }selected.`, + ); + + logger.info( + `Available platforms are: ${config.resolver.platforms + .map(x => `"${chalk.bold(x)}"`) + .join( + ', ', + )}. If you are trying to bundle for an out-of-tree platform, it may not be installed.`, + ); + + throw new Error('Bundling failed'); + } + // This is used by a bazillion of npm modules we don't control so we don't // have other choice than defining it as an env variable here. process.env.NODE_ENV = args.dev ? 'development' : 'production'; From ea33229c107e434ade69e94f40a0b9d7bfae3994 Mon Sep 17 00:00:00 2001 From: Matei Radu Date: Sat, 16 Mar 2019 15:09:33 +0100 Subject: [PATCH 033/234] Add verbose logging flag, debug logging for (un)link commands (#239) Summary: --------- This PR addresses #96 and: * Adds the `--verbose` flag to enable `DEBUG` logs * Adds `setVerbose(boolean)` to `tools/logger.js` so that it can enable/disable `DEBUG` logs * Adds debug logs for the (un)link commands * Adds Flow typings to `commands/link/android/unlinkAssets.js` I haven't added `DEBUG` logs to other parts of the CLI because: * I'm not that familiar with the other CLI commands * I'd like some feedback on what I've done so far before going on Also, would it be better to add debug logs in chunks, say one PR per command? I suspect this PR would become too big otherwise. Test Plan: ---------- These additions do not change any implementations but I ran the tests anyway, all green. I also ran it against two existing projects and a freshly created one: no changes in behavior. Screenshots: ---------- How the new flag is presented when using `--help`: Screenshot 2019-03-15 at 22 07 26 How `link packageName --verbose` looks like: Screenshot 2019-03-15 at 22 09 08 How `link packageName --verbose` looks like (module with assets): Screenshot 2019-03-15 at 22 33 28 How `unlink packageName --verbose` looks like: Screenshot 2019-03-15 at 22 09 34 Screenshot 2019-03-15 at 22 13 58 --- packages/cli/src/cliEntry.js | 5 ++++- .../src/commands/link/android/copyAssets.js | 3 +++ .../link/android/patches/applyPatch.js | 5 +++++ .../link/android/patches/revokePatch.js | 5 +++++ .../src/commands/link/android/unlinkAssets.js | 9 ++++++++- .../cli/src/commands/link/getProjectConfig.js | 3 +++ .../link/ios/addToHeaderSearchPaths.js | 2 ++ .../cli/src/commands/link/ios/copyAssets.js | 13 ++++++++----- .../commands/link/ios/registerNativeModule.js | 5 +++++ .../link/ios/removeFromHeaderSearchPaths.js | 2 ++ .../cli/src/commands/link/ios/unlinkAssets.js | 10 ++++++---- .../link/ios/unregisterNativeModule.js | 8 ++++++++ packages/cli/src/commands/link/link.js | 19 ++++++++++++++++++- .../cli/src/commands/link/pods/addPodEntry.js | 10 +++++++--- .../cli/src/commands/link/pods/readPodfile.js | 2 ++ .../src/commands/link/pods/removePodEntry.js | 3 +++ .../cli/src/commands/link/pods/savePodFile.js | 2 ++ .../link/pods/unregisterNativeModule.js | 2 ++ packages/cli/src/tools/logger.js | 11 ++++++++++- 19 files changed, 103 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index dcd9941c5..fab22bb7c 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -24,7 +24,8 @@ import pkgJson from '../package.json'; commander .option('--version', 'Print CLI version') .option('--projectRoot [string]', 'Path to the root of the project') - .option('--reactNativePath [string]', 'Path to React Native'); + .option('--reactNativePath [string]', 'Path to React Native') + .option('--verbose', 'Increase logging verbosity'); commander.on('command:*', () => { printUnknownCommand(commander.args.join(' ')); @@ -204,6 +205,8 @@ async function setupAndRun() { if (commander.args.length === 0 && commander.version === true) { console.log(pkgJson.version); } + + logger.setVerbose(commander.verbose); } export default { diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js index fb8f124db..1f475fcdb 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/cli/src/commands/link/android/copyAssets.js @@ -10,6 +10,7 @@ import fs from 'fs-extra'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; +import logger from '../../../tools/logger'; /** * Copies each file from an array of assets provided to targetPath directory @@ -23,8 +24,10 @@ export default function copyAssetsAndroid( ) { const assets = groupFilesByType(files); + logger.debug(`Assets path: ${project.assetsPath}`); (assets.font || []).forEach(asset => { const fontsDir = path.join(project.assetsPath, 'fonts'); + logger.debug(`Copying asset ${asset}`); // @todo: replace with fs.mkdirSync(path, {recursive}) + fs.copyFileSync // and get rid of fs-extra once we move to Node 10 fs.copySync(asset, path.join(fontsDir, path.basename(asset))); diff --git a/packages/cli/src/commands/link/android/patches/applyPatch.js b/packages/cli/src/commands/link/android/patches/applyPatch.js index eb8f0d863..704646ebd 100644 --- a/packages/cli/src/commands/link/android/patches/applyPatch.js +++ b/packages/cli/src/commands/link/android/patches/applyPatch.js @@ -8,8 +8,13 @@ */ import fs from 'fs'; +import logger from '../../../../tools/logger'; export default function applyPatch(file, patch) { + if (file) { + logger.debug(`Patching ${file}`); + } + fs.writeFileSync( file, fs diff --git a/packages/cli/src/commands/link/android/patches/revokePatch.js b/packages/cli/src/commands/link/android/patches/revokePatch.js index ed410953d..ca0fb753d 100644 --- a/packages/cli/src/commands/link/android/patches/revokePatch.js +++ b/packages/cli/src/commands/link/android/patches/revokePatch.js @@ -8,8 +8,13 @@ */ import fs from 'fs'; +import logger from '../../../../tools/logger'; export default function revokePatch(file, patch) { + if (file) { + logger.debug(`Patching ${file}`); + } + fs.writeFileSync( file, fs.readFileSync(file, 'utf8').replace(patch.patch, ''), diff --git a/packages/cli/src/commands/link/android/unlinkAssets.js b/packages/cli/src/commands/link/android/unlinkAssets.js index e1b39fd1d..c15aa4c2c 100644 --- a/packages/cli/src/commands/link/android/unlinkAssets.js +++ b/packages/cli/src/commands/link/android/unlinkAssets.js @@ -5,11 +5,13 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import fs from 'fs'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; +import logger from '../../../tools/logger'; /** * Copies each file from an array of assets provided to targetPath directory @@ -17,9 +19,13 @@ import groupFilesByType from '../groupFilesByType'; * For now, the only types of files that are handled are: * - Fonts (otf, ttf) - copied to targetPath/fonts under original name */ -export default function unlinkAssetsAndroid(files, project) { +export default function unlinkAssetsAndroid( + files: Array, + project: {assetsPath: string}, +) { const assets = groupFilesByType(files); + logger.debug(`Assets path: ${project.assetsPath}`); (assets.font || []).forEach(file => { const filePath = path.join( project.assetsPath, @@ -27,6 +33,7 @@ export default function unlinkAssetsAndroid(files, project) { path.basename(file), ); if (fs.existsSync(filePath)) { + logger.debug(`Removing asset ${filePath}`); fs.unlinkSync(filePath); } }); diff --git a/packages/cli/src/commands/link/getProjectConfig.js b/packages/cli/src/commands/link/getProjectConfig.js index f5095315a..9172f012b 100644 --- a/packages/cli/src/commands/link/getProjectConfig.js +++ b/packages/cli/src/commands/link/getProjectConfig.js @@ -9,6 +9,8 @@ import type { } from '../../tools/types.flow'; import getPackageConfiguration from '../../tools/getPackageConfiguration'; +import {getPlatformName} from '../../tools/getPlatforms'; +import logger from '../../tools/logger'; export default function getProjectConfig( ctx: ContextT, @@ -19,6 +21,7 @@ export default function getProjectConfig( const platformConfigs = {ios: undefined, android: undefined}; Object.keys(availablePlatforms).forEach(platform => { + logger.debug(`Getting project config for ${getPlatformName(platform)}...`); platformConfigs[platform] = availablePlatforms[platform].projectConfig( ctx.root, config[platform] || {}, diff --git a/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js index 280499253..83177ba74 100644 --- a/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js +++ b/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js @@ -8,7 +8,9 @@ */ import mapHeaderSearchPaths from './mapHeaderSearchPaths'; +import logger from '../../../tools/logger'; export default function addToHeaderSearchPaths(project, path) { + logger.debug(`Adding ${path} to header search paths`); mapHeaderSearchPaths(project, searchPaths => searchPaths.concat(path)); } diff --git a/packages/cli/src/commands/link/ios/copyAssets.js b/packages/cli/src/commands/link/ios/copyAssets.js index cf9fcd796..f3e89c161 100644 --- a/packages/cli/src/commands/link/ios/copyAssets.js +++ b/packages/cli/src/commands/link/ios/copyAssets.js @@ -14,6 +14,7 @@ import groupFilesByType from '../groupFilesByType'; import createGroupWithMessage from './createGroupWithMessage'; import getPlist from './getPlist'; import writePlist from './writePlist'; +import logger from '../../../tools/logger'; /** * This function works in a similar manner to its Android version, @@ -28,11 +29,13 @@ export default function linkAssetsIOS(files, projectConfig) { function addResourceFile(f) { return (f || []) - .map(asset => - project.addResourceFile(path.relative(projectConfig.sourceDir, asset), { - target: project.getFirstTarget().uuid, - }), - ) + .map(asset => { + logger.debug(`Linking asset ${asset}`); + return project.addResourceFile( + path.relative(projectConfig.sourceDir, asset), + {target: project.getFirstTarget().uuid}, + ); + }) .filter(file => file) // xcode returns false if file is already there .map(file => file.basename); } diff --git a/packages/cli/src/commands/link/ios/registerNativeModule.js b/packages/cli/src/commands/link/ios/registerNativeModule.js index d8d9e7551..943296aaf 100644 --- a/packages/cli/src/commands/link/ios/registerNativeModule.js +++ b/packages/cli/src/commands/link/ios/registerNativeModule.js @@ -20,6 +20,7 @@ import createGroupWithMessage from './createGroupWithMessage'; import addFileToProject from './addFileToProject'; import addProjectToLibraries from './addProjectToLibraries'; import addSharedLibraries from './addSharedLibraries'; +import logger from '../../../tools/logger'; /** * Register native module IOS adds given dependency to project by adding @@ -32,6 +33,7 @@ export default function registerNativeModuleIOS( dependencyConfig, projectConfig, ) { + logger.debug(`Reading ${projectConfig.pbxprojPath}`); const project = xcode.project(projectConfig.pbxprojPath).parseSync(); const dependencyProject = xcode .project(dependencyConfig.pbxprojPath) @@ -55,6 +57,7 @@ export default function registerNativeModuleIOS( if (!product.isTVOS) { for (i = 0; i < targets.length; i++) { if (!targets[i].isTVOS) { + logger.debug(`Adding ${product.name} to ${targets[i].target.name}`); project.addStaticLibrary(product.name, { target: targets[i].uuid, }); @@ -65,6 +68,7 @@ export default function registerNativeModuleIOS( if (product.isTVOS) { for (i = 0; i < targets.length; i++) { if (targets[i].isTVOS) { + logger.debug(`Adding ${product.name} to ${targets[i].target.name}`); project.addStaticLibrary(product.name, { target: targets[i].uuid, }); @@ -83,5 +87,6 @@ export default function registerNativeModuleIOS( ); } + logger.debug(`Writing changes to ${projectConfig.pbxprojPath}`); fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); } diff --git a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js b/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js index ee5333fb5..9db40a0be 100644 --- a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js +++ b/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js @@ -8,11 +8,13 @@ */ import mapHeaderSearchPaths from './mapHeaderSearchPaths'; +import logger from '../../../tools/logger'; /** * Given Xcode project and absolute path, it makes sure there are no headers referring to it */ export default function addToHeaderSearchPaths(project, path) { + logger.debug(`Removing ${path} from header search paths`); mapHeaderSearchPaths(project, searchPaths => searchPaths.filter(searchPath => searchPath !== path), ); diff --git a/packages/cli/src/commands/link/ios/unlinkAssets.js b/packages/cli/src/commands/link/ios/unlinkAssets.js index 546e1d371..f0da53423 100644 --- a/packages/cli/src/commands/link/ios/unlinkAssets.js +++ b/packages/cli/src/commands/link/ios/unlinkAssets.js @@ -15,6 +15,7 @@ import log from '../../../tools/logger'; import groupFilesByType from '../groupFilesByType'; import getPlist from './getPlist'; import writePlist from './writePlist'; +import logger from '../../../tools/logger'; /** * Unlinks assets from iOS project. Removes references for fonts from `Info.plist` @@ -41,12 +42,13 @@ export default function unlinkAssetsIOS(files, projectConfig) { const removeResourceFiles = (f = []) => (f || []) - .map(asset => - project.removeResourceFile( + .map(asset => { + logger.debug(`Unlinking asset ${asset}`); + return project.removeResourceFile( path.relative(projectConfig.sourceDir, asset), {target: project.getFirstTarget().uuid}, - ), - ) + ); + }) .map(file => file.basename); removeResourceFiles(assets.image); diff --git a/packages/cli/src/commands/link/ios/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/unregisterNativeModule.js index 6dbc11644..b0a1239af 100644 --- a/packages/cli/src/commands/link/ios/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/ios/unregisterNativeModule.js @@ -21,6 +21,7 @@ import removeProjectFromLibraries from './removeProjectFromLibraries'; import removeFromStaticLibraries from './removeFromStaticLibraries'; import removeFromHeaderSearchPaths from './removeFromHeaderSearchPaths'; import removeSharedLibraries from './removeSharedLibraries'; +import logger from '../../../tools/logger'; /** * Unregister native module IOS @@ -32,6 +33,7 @@ export default function unregisterNativeModule( projectConfig, iOSDependencies, ) { + logger.debug(`Reading ${projectConfig.pbxprojPath}`); const project = xcode.project(projectConfig.pbxprojPath).parseSync(); const dependencyProject = xcode .project(dependencyConfig.pbxprojPath) @@ -47,6 +49,11 @@ export default function unregisterNativeModule( removeProjectFromLibraries(libraries, file); getTargets(dependencyProject).forEach(target => { + logger.debug( + `Removing ${target.name} from ${ + project.getFirstTarget().firstTarget.name + }`, + ); removeFromStaticLibraries(project, target.name, { target: project.getFirstTarget().uuid, }); @@ -70,5 +77,6 @@ export default function unregisterNativeModule( ); } + logger.debug(`Writing changes to ${projectConfig.pbxprojPath}`); fs.writeFileSync(projectConfig.pbxprojPath, project.writeSync()); } diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 13d601077..b4538c9ce 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -20,7 +20,7 @@ import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; import findReactNativeScripts from '../../tools/findReactNativeScripts'; -import getPlatforms from '../../tools/getPlatforms'; +import getPlatforms, {getPlatformName} from '../../tools/getPlatforms'; type FlagsType = { platforms?: Array, @@ -37,9 +37,21 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { let project; try { platforms = getPlatforms(ctx.root); + logger.debug( + 'Available platforms: ' + + `${Object.getOwnPropertyNames(platforms) + .map(platform => getPlatformName(platform)) + .join(', ')}`, + ); if (opts.platforms) { platforms = pick(platforms, opts.platforms); } + logger.debug( + 'Targeted platforms: ' + + `${Object.getOwnPropertyNames(platforms) + .map(platform => getPlatformName(platform)) + .join(', ')}`, + ); project = getProjectConfig(ctx, platforms); } catch (err) { logger.error( @@ -62,9 +74,14 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { } if (rawPackageName === undefined) { + logger.debug( + 'No package name provided, will attemp to link all possible packages.', + ); return linkAll(ctx, platforms, project); } + logger.debug(`Package to link: ${rawPackageName}`); + // Trim the version / tag out of the package name (eg. package@latest) const packageName = rawPackageName.replace(/^(.+?)(@.+?)$/gi, '$1'); diff --git a/packages/cli/src/commands/link/pods/addPodEntry.js b/packages/cli/src/commands/link/pods/addPodEntry.js index 25ce4875e..e1040759d 100644 --- a/packages/cli/src/commands/link/pods/addPodEntry.js +++ b/packages/cli/src/commands/link/pods/addPodEntry.js @@ -7,6 +7,8 @@ * @format */ +import logger from '../../../tools/logger'; + export default function addPodEntry( podLines, linesToAddEntry, @@ -20,11 +22,13 @@ export default function addPodEntry( } if (Array.isArray(linesToAddEntry)) { - linesToAddEntry.map(({line, indentation}, idx) => - podLines.splice(line + idx, 0, getLineToAdd(newEntry, indentation)), - ); + linesToAddEntry.map(({line, indentation}, idx) => { + logger.debug(`Adding ${podName} to Pod file"`); + podLines.splice(line + idx, 0, getLineToAdd(newEntry, indentation)); + }); } else { const {line, indentation} = linesToAddEntry; + logger.debug(`Adding ${podName} to Pod file"`); podLines.splice(line, 0, getLineToAdd(newEntry, indentation)); } } diff --git a/packages/cli/src/commands/link/pods/readPodfile.js b/packages/cli/src/commands/link/pods/readPodfile.js index 42fc6be4a..8dd419325 100644 --- a/packages/cli/src/commands/link/pods/readPodfile.js +++ b/packages/cli/src/commands/link/pods/readPodfile.js @@ -8,8 +8,10 @@ */ import fs from 'fs'; +import logger from '../../../tools/logger'; export default function readPodfile(podfilePath) { + logger.debug(`Reading ${podfilePath}`); const podContent = fs.readFileSync(podfilePath, 'utf8'); return podContent.split(/\r?\n/g); } diff --git a/packages/cli/src/commands/link/pods/removePodEntry.js b/packages/cli/src/commands/link/pods/removePodEntry.js index 1de92fe9b..eafa7b34f 100644 --- a/packages/cli/src/commands/link/pods/removePodEntry.js +++ b/packages/cli/src/commands/link/pods/removePodEntry.js @@ -7,11 +7,14 @@ * @format */ +import logger from '../../../tools/logger'; + export default function removePodEntry(podfileContent, podName) { // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1'] const podRegex = new RegExp( `\\n( |\\t)*pod\\s+("|')${podName}("|')(,\\s*(:[a-z]+\\s*=>)?\\s*(("|').*?("|')|\\[[\\s\\S]*?\\]))*\\n`, 'g', ); + logger.debug(`Removing ${podName} from Pod file`); return podfileContent.replace(podRegex, '\n'); } diff --git a/packages/cli/src/commands/link/pods/savePodFile.js b/packages/cli/src/commands/link/pods/savePodFile.js index 5148cc774..4cfaba26e 100644 --- a/packages/cli/src/commands/link/pods/savePodFile.js +++ b/packages/cli/src/commands/link/pods/savePodFile.js @@ -8,8 +8,10 @@ */ import fs from 'fs'; +import logger from '../../../tools/logger'; export default function savePodFile(podfilePath, podLines) { const newPodfile = podLines.join('\n'); + logger.debug(`Writing changes to ${podfilePath}`); fs.writeFileSync(podfilePath, newPodfile); } diff --git a/packages/cli/src/commands/link/pods/unregisterNativeModule.js b/packages/cli/src/commands/link/pods/unregisterNativeModule.js index 9e42b5e6f..96abbd0e5 100644 --- a/packages/cli/src/commands/link/pods/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/pods/unregisterNativeModule.js @@ -9,6 +9,7 @@ import fs from 'fs'; import removePodEntry from './removePodEntry'; +import logger from '../../../tools/logger'; /** * Unregister native module IOS with CocoaPods @@ -16,5 +17,6 @@ import removePodEntry from './removePodEntry'; export default function unregisterNativeModule(dependencyConfig, iOSProject) { const podContent = fs.readFileSync(iOSProject.podfile, 'utf8'); const removed = removePodEntry(podContent, dependencyConfig.podspec); + logger.debug(`Writing changes to ${iOSProject.podfile}`); fs.writeFileSync(iOSProject.podfile, removed); } diff --git a/packages/cli/src/tools/logger.js b/packages/cli/src/tools/logger.js index 35aeff681..42e6e262f 100644 --- a/packages/cli/src/tools/logger.js +++ b/packages/cli/src/tools/logger.js @@ -5,6 +5,8 @@ import chalk from 'chalk'; const SEPARATOR = ', '; +let verbose = false; + const formatMessages = (messages: Array) => chalk.reset(messages.join(SEPARATOR)); @@ -25,13 +27,19 @@ const error = (...messages: Array) => { }; const debug = (...messages: Array) => { - console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`); + if (verbose) { + console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`); + } }; const log = (...messages: Array) => { console.log(`${formatMessages(messages)}`); }; +const setVerbose = (level: boolean) => { + verbose = level; +}; + export default { success, info, @@ -39,4 +47,5 @@ export default { error, debug, log, + setVerbose, }; From 6a5e6e6b43917a6ef67b4763fc9480b6faf4fb2e Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Sun, 17 Mar 2019 10:30:57 +0100 Subject: [PATCH 034/234] Refactor: Rework PackageManager implementation (#243) Summary: --------- Removed nasty `class`, and replaced it with grouped methods. `projectDir` is always the same in `cli` lifecycle, so we set it once on the start. Based on the presence of `yarn.lock` we decide either to use yarn or not to use it. `preferYarn` is overriding this behavior, and can later be used in `init` command which lacks correct `projectDir`. Test Plan: ---------- - [x] - Unit tests passing - [x] - Manual testing --- packages/cli/src/cliEntry.js | 3 + packages/cli/src/commands/init/init.js | 11 +-- packages/cli/src/commands/install/install.js | 4 +- .../cli/src/commands/install/uninstall.js | 4 +- .../upgrade/__tests__/upgrade.test.js | 12 ++- packages/cli/src/commands/upgrade/upgrade.js | 7 +- packages/cli/src/tools/PackageManager.js | 81 +++++++++---------- .../tools/__tests__/PackageManager-test.js | 66 +++++++-------- packages/cli/src/tools/generator/templates.js | 15 ++-- packages/cli/src/tools/yarn.js | 9 +-- 10 files changed, 94 insertions(+), 118 deletions(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index fab22bb7c..e7779fca4 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -19,6 +19,7 @@ import init from './commands/init/init'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; import findPlugins from './tools/findPlugins'; +import {setProjectDir} from './tools/PackageManager'; import pkgJson from '../package.json'; commander @@ -189,6 +190,8 @@ async function setupAndRun() { root, }; + setProjectDir(ctx.root); + const commands = getCommands(ctx.root); commands.forEach(command => addCommand(command, ctx)); diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index d663dc617..c248a7c43 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -13,7 +13,7 @@ import path from 'path'; import process from 'process'; import printRunInstructions from '../../tools/generator/printRunInstructions'; import {createProjectFromTemplate} from '../../tools/generator/templates'; -import PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/PackageManager'; import logger from '../../tools/logger'; /** @@ -52,11 +52,6 @@ function generateProject(destinationRoot, newProjectName, options) { const pkgJson = require('react-native/package.json'); const reactVersion = pkgJson.peerDependencies.react; - const packageManager = new PackageManager({ - projectDir: destinationRoot, - forceNpm: options.npm, - }); - createProjectFromTemplate( destinationRoot, newProjectName, @@ -65,10 +60,10 @@ function generateProject(destinationRoot, newProjectName, options) { ); logger.info('Adding required dependencies'); - packageManager.install([`react@${reactVersion}`]); + PackageManager.install([`react@${reactVersion}`]); logger.info('Adding required dev dependencies'); - packageManager.installDev([ + PackageManager.installDev([ '@babel/core', '@babel/runtime', 'jest', diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index cb514c606..bd9097a0c 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -9,14 +9,14 @@ import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/PackageManager'; import link from '../link/link'; async function install(args: Array, ctx: ContextT) { const name = args[0]; logger.info(`Installing "${name}"...`); - new PackageManager({projectDir: ctx.root}).install([name]); + PackageManager.install([name]); logger.info(`Linking "${name}"...`); await link.func([name], ctx, {platforms: undefined}); diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index 4300387b1..654c594a8 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -9,7 +9,7 @@ import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/PackageManager'; import link from '../link/unlink'; async function uninstall(args: Array, ctx: ContextT) { @@ -19,7 +19,7 @@ async function uninstall(args: Array, ctx: ContextT) { await link.func([name], ctx); logger.info(`Uninstalling "${name}"...`); - new PackageManager({projectDir: ctx.root}).uninstall([name]); + PackageManager.uninstall([name]); logger.success(`Successfully uninstalled and unlinked "${name}"`); } diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 2730bb013..2935afcd0 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -32,13 +32,11 @@ jest.mock( () => ({name: 'TestApp', dependencies: {'react-native': '^0.57.8'}}), {virtual: true}, ); -jest.mock('../../../tools/PackageManager', () => - jest.fn(() => ({ - install: args => { - mockPushLog('$ yarn add', ...args); - }, - })), -); +jest.mock('../../../tools/PackageManager', () => ({ + install: args => { + mockPushLog('$ yarn add', ...args); + }, +})); jest.mock('../helpers', () => ({ ...jest.requireActual('../helpers'), fetch: jest.fn(() => Promise.resolve('patch')), diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index d49a1f31b..b30dbf6f5 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -6,7 +6,7 @@ import semver from 'semver'; import execa from 'execa'; import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/PackageManager'; import {fetch} from './helpers'; import legacyUpgrade from './legacyUpgrade'; @@ -109,12 +109,13 @@ const installDeps = async (newVersion, projectDir) => { `Installing "react-native@${newVersion}" and its peer dependencies...`, ); const peerDeps = await getRNPeerDeps(newVersion); - const pm = new PackageManager({projectDir}); const deps = [ `react-native@${newVersion}`, ...Object.keys(peerDeps).map(module => `${module}@${peerDeps[module]}`), ]; - await pm.install(deps, {silent: true}); + PackageManager.install(deps, { + silent: true, + }); await execa('git', ['add', 'package.json']); try { await execa('git', ['add', 'yarn.lock']); diff --git a/packages/cli/src/tools/PackageManager.js b/packages/cli/src/tools/PackageManager.js index bcc8de4a4..b1426e62d 100644 --- a/packages/cli/src/tools/PackageManager.js +++ b/packages/cli/src/tools/PackageManager.js @@ -1,53 +1,52 @@ // @flow import {execSync} from 'child_process'; -import yarn from './yarn'; +import {getYarnVersionIfAvailable, isProjectUsingYarn} from './yarn'; -type PackageManagerOptions = { - forceNpm?: boolean, - projectDir: string, -}; +type Options = {| + preferYarn?: boolean, + silent?: boolean, +|}; -export default class PackageManager { - options: PackageManagerOptions; +let projectDir; - constructor(options: PackageManagerOptions) { - this.options = options; - } +function executeCommand(command: string, options?: Options) { + return execSync(command, { + stdio: options && options.silent ? 'pipe' : 'inherit', + }); +} - executeCommand(command: string, options?: {silent: boolean}) { - return execSync(command, { - stdio: options && options.silent ? 'pipe' : 'inherit', - }); +function shouldUseYarn(options?: Options) { + if (options && options.preferYarn !== undefined) { + return options.preferYarn && getYarnVersionIfAvailable(); } - shouldCallYarn() { - return ( - !this.options.forceNpm && - yarn.getYarnVersionIfAvailable() && - yarn.isGlobalCliUsingYarn(this.options.projectDir) - ); - } + return isProjectUsingYarn(projectDir) && getYarnVersionIfAvailable(); +} - install(packageNames: Array, options?: {silent: boolean}) { - return this.shouldCallYarn() - ? this.executeCommand(`yarn add ${packageNames.join(' ')}`, options) - : this.executeCommand( - `npm install ${packageNames.join(' ')} --save --save-exact`, - options, - ); - } +export function setProjectDir(dir: string) { + projectDir = dir; +} - installDev(packageNames: Array) { - return this.shouldCallYarn() - ? this.executeCommand(`yarn add -D ${packageNames.join(' ')}`) - : this.executeCommand( - `npm install ${packageNames.join(' ')} --save-dev --save-exact`, - ); - } +export function install(packageNames: Array, options?: Options) { + return shouldUseYarn(options) + ? executeCommand(`yarn add ${packageNames.join(' ')}`, options) + : executeCommand( + `npm install ${packageNames.join(' ')} --save --save-exact`, + options, + ); +} - uninstall(packageNames: Array) { - return this.shouldCallYarn() - ? this.executeCommand(`yarn remove ${packageNames.join(' ')}`) - : this.executeCommand(`npm uninstall ${packageNames.join(' ')} --save`); - } +export function installDev(packageNames: Array, options?: Options) { + return shouldUseYarn(options) + ? executeCommand(`yarn add -D ${packageNames.join(' ')}`, options) + : executeCommand( + `npm install ${packageNames.join(' ')} --save-dev --save-exact`, + options, + ); +} + +export function uninstall(packageNames: Array, options?: Options) { + return shouldUseYarn(options) + ? executeCommand(`yarn remove ${packageNames.join(' ')}`, options) + : executeCommand(`npm uninstall ${packageNames.join(' ')} --save`, options); } diff --git a/packages/cli/src/tools/__tests__/PackageManager-test.js b/packages/cli/src/tools/__tests__/PackageManager-test.js index 97bb96318..92a47c24b 100644 --- a/packages/cli/src/tools/__tests__/PackageManager-test.js +++ b/packages/cli/src/tools/__tests__/PackageManager-test.js @@ -1,11 +1,11 @@ // @flow import ChildProcess from 'child_process'; -import PackageManager from '../PackageManager'; -import yarn from '../yarn'; +import * as PackageManager from '../PackageManager'; +import * as yarn from '../yarn'; -const PROJECT_DIR = '/project/directory'; const PACKAGES = ['react', 'react-native']; const EXEC_OPTS = {stdio: 'inherit'}; +const PROJECT_ROOT = '/some/dir'; beforeEach(() => { jest.spyOn(ChildProcess, 'execSync').mockImplementation(() => {}); @@ -16,13 +16,10 @@ describe('yarn', () => { jest .spyOn(yarn, 'getYarnVersionIfAvailable') .mockImplementation(() => true); - jest.spyOn(yarn, 'isGlobalCliUsingYarn').mockImplementation(() => true); }); it('should install', () => { - const packageManager = new PackageManager({projectDir: PROJECT_DIR}); - - packageManager.install(PACKAGES); + PackageManager.install(PACKAGES, {preferYarn: true}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'yarn add react react-native', @@ -31,9 +28,7 @@ describe('yarn', () => { }); it('should installDev', () => { - const packageManager = new PackageManager({projectDir: PROJECT_DIR}); - - packageManager.installDev(PACKAGES); + PackageManager.installDev(PACKAGES, {preferYarn: true}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'yarn add -D react react-native', @@ -42,9 +37,7 @@ describe('yarn', () => { }); it('should uninstall', () => { - const packageManager = new PackageManager({projectDir: PROJECT_DIR}); - - packageManager.uninstall(PACKAGES); + PackageManager.uninstall(PACKAGES, {preferYarn: true}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'yarn remove react react-native', @@ -55,12 +48,7 @@ describe('yarn', () => { describe('npm', () => { it('should install', () => { - const packageManager = new PackageManager({ - projectDir: PROJECT_DIR, - forceNpm: true, - }); - - packageManager.install(PACKAGES); + PackageManager.install(PACKAGES, {preferYarn: false}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save --save-exact', @@ -69,12 +57,7 @@ describe('npm', () => { }); it('should installDev', () => { - const packageManager = new PackageManager({ - projectDir: PROJECT_DIR, - forceNpm: true, - }); - - packageManager.installDev(PACKAGES); + PackageManager.installDev(PACKAGES, {preferYarn: false}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save-dev --save-exact', @@ -83,12 +66,7 @@ describe('npm', () => { }); it('should uninstall', () => { - const packageManager = new PackageManager({ - projectDir: PROJECT_DIR, - forceNpm: true, - }); - - packageManager.uninstall(PACKAGES); + PackageManager.uninstall(PACKAGES, {preferYarn: false}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm uninstall react react-native --save', @@ -99,9 +77,7 @@ describe('npm', () => { it('should use npm if yarn is not available', () => { jest.spyOn(yarn, 'getYarnVersionIfAvailable').mockImplementation(() => false); - const packageManager = new PackageManager({projectDir: PROJECT_DIR}); - - packageManager.install(PACKAGES); + PackageManager.install(PACKAGES, {preferYarn: true}); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save --save-exact', @@ -109,14 +85,28 @@ it('should use npm if yarn is not available', () => { ); }); -it('should use npm if global cli is not using yarn', () => { - jest.spyOn(yarn, 'isGlobalCliUsingYarn').mockImplementation(() => false); - const packageManager = new PackageManager({projectDir: PROJECT_DIR}); +it('should use npm if project is not using yarn', () => { + jest.spyOn(yarn, 'isProjectUsingYarn').mockImplementation(() => false); - packageManager.install(PACKAGES); + PackageManager.setProjectDir(PROJECT_ROOT); + PackageManager.install(PACKAGES); expect(ChildProcess.execSync).toHaveBeenCalledWith( 'npm install react react-native --save --save-exact', EXEC_OPTS, ); + expect(yarn.isProjectUsingYarn).toHaveBeenCalledWith(PROJECT_ROOT); +}); + +it('should use yarn if project is using yarn', () => { + jest.spyOn(yarn, 'isProjectUsingYarn').mockImplementation(() => false); + + PackageManager.setProjectDir(PROJECT_ROOT); + PackageManager.install(PACKAGES); + + expect(ChildProcess.execSync).toHaveBeenCalledWith( + 'yarn add react react-native', + EXEC_OPTS, + ); + expect(yarn.isProjectUsingYarn).toHaveBeenCalledWith(PROJECT_ROOT); }); diff --git a/packages/cli/src/tools/generator/templates.js b/packages/cli/src/tools/generator/templates.js index 85d426e82..b771efa72 100644 --- a/packages/cli/src/tools/generator/templates.js +++ b/packages/cli/src/tools/generator/templates.js @@ -13,7 +13,7 @@ import fs from 'fs'; import path from 'path'; import copyProjectTemplateAndReplace from './copyProjectTemplateAndReplace'; import logger from '../logger'; -import PackageManager from '../PackageManager'; +import * as PackageManager from '../PackageManager'; /** * @param destPath Create the new project at this path. @@ -72,9 +72,8 @@ function createFromRemoteTemplate( // Check if the template exists logger.info(`Fetching template ${installPackage}...`); - const packageManager = new PackageManager({projectDir: destinationRoot}); try { - packageManager.install([installPackage]); + PackageManager.install([installPackage]); const templatePath = path.resolve('node_modules', templateName); copyProjectTemplateAndReplace(templatePath, destPath, newProjectName, { // Every template contains a dummy package.json file included @@ -92,7 +91,7 @@ function createFromRemoteTemplate( } finally { // Clean up the temp files try { - packageManager.uninstall([templateName]); + PackageManager.uninstall([templateName]); } catch (err) { // Not critical but we still want people to know and report // if this the clean up fails. @@ -125,9 +124,7 @@ function installTemplateDependencies(templatePath, destinationRoot) { const dependenciesToInstall = Object.keys(dependencies).map( depName => `${depName}@${dependencies[depName]}`, ); - new PackageManager({projectDir: destinationRoot}).install( - dependenciesToInstall, - ); + PackageManager.install(dependenciesToInstall); logger.info("Linking native dependencies into the project's build files..."); execSync('react-native link', {stdio: 'inherit'}); } @@ -157,9 +154,7 @@ function installTemplateDevDependencies(templatePath, destinationRoot) { const dependenciesToInstall = Object.keys(dependencies).map( depName => `${depName}@${dependencies[depName]}`, ); - new PackageManager({projectDir: destinationRoot}).installDev( - dependenciesToInstall, - ); + PackageManager.installDev(dependenciesToInstall); } export {createProjectFromTemplate}; diff --git a/packages/cli/src/tools/yarn.js b/packages/cli/src/tools/yarn.js index 38317daca..bdefbee58 100644 --- a/packages/cli/src/tools/yarn.js +++ b/packages/cli/src/tools/yarn.js @@ -17,7 +17,7 @@ import logger from './logger'; * Use Yarn if available, it's much faster than the npm client. * Return the version of yarn installed on the system, null if yarn is not available. */ -function getYarnVersionIfAvailable() { +export function getYarnVersionIfAvailable() { let yarnVersion; try { // execSync returns a Buffer -> convert to string @@ -48,11 +48,6 @@ function getYarnVersionIfAvailable() { * Let's be safe and not mix yarn and npm in a single project. * @param projectDir e.g. /Users/martin/AwesomeApp */ -function isGlobalCliUsingYarn(projectDir) { +export function isProjectUsingYarn(projectDir) { return fs.existsSync(path.join(projectDir, 'yarn.lock')); } - -export default { - getYarnVersionIfAvailable, - isGlobalCliUsingYarn, -}; From 38795473ea8f1ce1c10e3a1493ba6a9176c01cbb Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Sun, 17 Mar 2019 18:04:27 +0100 Subject: [PATCH 035/234] refactor: don't add purge as remote when upgrading (#245) --- packages/cli/src/commands/upgrade/__tests__/upgrade.test.js | 6 ------ packages/cli/src/commands/upgrade/upgrade.js | 6 ------ 2 files changed, 12 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 2935afcd0..2ae9d7df9 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -126,8 +126,6 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git -$ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way @@ -141,7 +139,6 @@ $ execa git add yarn.lock $ execa git add package-lock.json info Running \\"git status\\" to check what changed... $ execa git status -$ execa git remote remove tmp-rn-diff-purge success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" `); expect( @@ -177,8 +174,6 @@ test('cleans up if patching fails,', async () => { expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git -$ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way @@ -187,7 +182,6 @@ error Automatically applying diff failed [fs] unlink tmp-upgrade-rn.patch $ execa git status -s error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading -$ execa git remote remove tmp-rn-diff-purge info You may find these resources helpful: • Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 • Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index b30dbf6f5..aead25ac8 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -178,8 +178,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } - const rnDiffGitAddress = `${rnDiffPurgeUrl}.git`; - const tmpRemote = 'tmp-rn-diff-purge'; const tmpPatchFile = 'tmp-upgrade-rn.patch'; const projectDir = ctx.root; const {version: currentVersion} = require(path.join( @@ -215,8 +213,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { try { fs.writeFileSync(tmpPatchFile, patch); - await execa('git', ['remote', 'add', tmpRemote, rnDiffGitAddress]); - await execa('git', ['fetch', '--no-tags', tmpRemote]); patchSuccess = await applyPatch(currentVersion, newVersion, tmpPatchFile); } catch (error) { throw new Error(error.stderr || error); @@ -245,8 +241,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { logger.info('Running "git status" to check what changed...'); await execa('git', ['status'], {stdio: 'inherit'}); } - await execa('git', ['remote', 'remove', tmpRemote]); - if (!patchSuccess) { if (stdout) { logger.warn( From 872d91a48dd7938f69b9efe352d566e5fdea99eb Mon Sep 17 00:00:00 2001 From: Sunny Luo Date: Wed, 20 Mar 2019 21:41:16 +0800 Subject: [PATCH 036/234] feat: Add hint for browser extensions that may break debug (#253) * Add hint for browser extensions that may break debug * Update getSecurityHeadersMiddleware.js * Fix lint error --- .../server/middleware/getSecurityHeadersMiddleware.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js b/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js index d5cf6b145..38de1c232 100644 --- a/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js @@ -16,7 +16,13 @@ export default function getSecurityHeadersMiddleware(req, res, next) { req.headers.origin && req.headers.origin !== `http://localhost:${address.port}` ) { - next(new Error('Unauthorized')); + next( + new Error( + 'Unauthorized request from ' + + req.headers.origin + + '. This may happen because of a conflicting browser extension. Please try to disable it and try again.', + ), + ); return; } From c6d46b30d2adfd2ca7157fa8401f1cbcb2fea2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chudziak?= Date: Thu, 21 Mar 2019 10:42:53 +0000 Subject: [PATCH 037/234] feat: Add `eslint` to react native project template. (#229) * chore: add eslint to RN template * Change .eslintrc to .eslintrc.js --- packages/cli/src/commands/init/init.js | 3 +++ .../cli/src/tools/generator/copyProjectTemplateAndReplace.js | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index c248a7c43..0eb95f9f3 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -66,6 +66,8 @@ function generateProject(destinationRoot, newProjectName, options) { PackageManager.installDev([ '@babel/core', '@babel/runtime', + '@react-native-community/eslint-config', + 'eslint', 'jest', 'babel-jest', 'metro-react-native-babel-preset', @@ -84,6 +86,7 @@ function addJestToPackageJson(destinationRoot) { const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath)); packageJSON.scripts.test = 'jest'; + packageJSON.scripts.lint = 'eslint .'; packageJSON.jest = { preset: 'react-native', }; diff --git a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js index dd8ca4b98..d582904ba 100644 --- a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js +++ b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js @@ -127,6 +127,7 @@ function translateFilePath(filePath) { .replace('_gitignore', '.gitignore') .replace('_gitattributes', '.gitattributes') .replace('_babelrc', '.babelrc') + .replace('_eslintrc.js', '.eslintrc.js') .replace('_flowconfig', '.flowconfig') .replace('_buckconfig', '.buckconfig') .replace('_watchmanconfig', '.watchmanconfig'); From 88d7459695e62a5a226e70b2caf9bfadf0311f2a Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Fri, 22 Mar 2019 18:22:12 +0100 Subject: [PATCH 038/234] fix: pass `--projectRoot` argument to Metro (#259) --- packages/cli/src/commands/server/runServer.js | 1 + packages/cli/src/tools/loadMetroConfig.js | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 08ae78990..8b20376c1 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -51,6 +51,7 @@ async function runServer(argv: Array, ctx: ContextT, args: Args) { port: args.port, resetCache: args.resetCache, watchFolders: args.watchFolders, + projectRoot: ctx.root, sourceExts: args.sourceExts, reporter, }); diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 3d15e59d3..286b5bce1 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -73,6 +73,7 @@ export const getDefaultConfig = (ctx: ContextT) => { export type ConfigOptionsT = {| maxWorkers?: number, port?: number, + projectRoot?: string, resetCache?: boolean, watchFolders?: string[], sourceExts?: string[], @@ -85,20 +86,8 @@ export type ConfigOptionsT = {| * * This allows the CLI to always overwrite the file settings. */ -export default (async function load( - ctx: ContextT, - // $FlowFixMe - troubles with empty object being inexact - options?: ConfigOptionsT = {}, -) { +export default function load(ctx: ContextT, options?: ConfigOptionsT) { const defaultConfig = getDefaultConfig(ctx); - const config = await loadConfig( - { - cwd: ctx.root, - ...options, - }, - defaultConfig, - ); - - return config; -}); + return loadConfig({cwd: ctx.root, ...options}, defaultConfig); +} From 590ce4ad977ea1a29701c6af97f618da21dc62c9 Mon Sep 17 00:00:00 2001 From: Basit Ali Date: Sat, 23 Mar 2019 13:39:14 +0500 Subject: [PATCH 039/234] fix: set project directory to install packages in init command (#262) Fixes https://github.com/react-native-community/react-native-cli/issues/260 and https://github.com/facebook/react-native/issues/24103 by setting project directory on PackageManager which is needed to check for yarn.lock file. Summary: --------- I'm not sure how to test this but creating new projects fail with the exception ``` info Adding required dependencies internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7) at isProjectUsingYarn (/path/to/app/node_modules/@react-native-community/cli/build/tools/yarn.js:101:51) at shouldUseYarn (/path/to/app/node_modules/@react-native-community/cli/build/tools/PackageManager.js:36:39) at Object.install (/path/to/app/node_modules/@react-native-community/cli/build/tools/PackageManager.js:44:10) at generateProject (/path/to/app/node_modules/@react-native-community/cli/build/commands/init/init.js:111:18) at Object.init (/path/to/app/node_modules/@react-native-community/cli/build/commands/init/init.js:94:3) at run (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:302:7) at createProject (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:249:3) at init (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:200:5) ``` The error seems to be stemming from passing `undefined` for `projectDir` to `path.join`. Added a line to fix this. Test Plan: ---------- `react-native init TestProject` should not fail. --- packages/cli/src/commands/init/init.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 0eb95f9f3..86df93c25 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -52,6 +52,7 @@ function generateProject(destinationRoot, newProjectName, options) { const pkgJson = require('react-native/package.json'); const reactVersion = pkgJson.peerDependencies.react; + PackageManager.setProjectDir(destinationRoot); createProjectFromTemplate( destinationRoot, newProjectName, From 75ccf8e56d1576f019812f846dd4340ee4a119cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 28 Mar 2019 14:06:30 +0100 Subject: [PATCH 040/234] chore: setup e2e tests (#264) * chore: setup e2e tests * add flowfixmes * use test.each * add docs to install/uninstall * remove dead code --- .flowconfig | 3 - e2e/__tests__/install.test.js | 34 ++ e2e/__tests__/uninstall.test.js | 55 +++ e2e/helpers.js | 149 ++++++ e2e/jest.config.js | 4 + flow-typed/npm/execa_v1.0.x.js | 103 +++++ package.json | 12 +- packages/cli/README.md | 52 +++ packages/cli/src/commands/upgrade/upgrade.js | 2 + yarn.lock | 454 ++++++++++++++++++- 10 files changed, 848 insertions(+), 20 deletions(-) create mode 100644 e2e/__tests__/install.test.js create mode 100644 e2e/__tests__/uninstall.test.js create mode 100644 e2e/helpers.js create mode 100644 e2e/jest.config.js create mode 100644 flow-typed/npm/execa_v1.0.x.js diff --git a/.flowconfig b/.flowconfig index c825f0b86..be12bc31a 100644 --- a/.flowconfig +++ b/.flowconfig @@ -63,6 +63,3 @@ unclear-type unsafe-getters-setters untyped-import untyped-type-import - -[version] -^0.94.0 diff --git a/e2e/__tests__/install.test.js b/e2e/__tests__/install.test.js new file mode 100644 index 000000000..49de1eac4 --- /dev/null +++ b/e2e/__tests__/install.test.js @@ -0,0 +1,34 @@ +// @flow +import path from 'path'; +import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; + +const DIR = getTempDirectory('command-install-test'); +const pkg = 'react-native-config'; + +beforeEach(() => { + cleanup(DIR); + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'package.json': '{}', + }); +}); +afterEach(() => cleanup(DIR)); + +test.each(['yarn', 'npm'])('install module with %s', pm => { + if (pm === 'yarn') { + writeFiles(DIR, {'yarn.lock': ''}); + } + const {stdout, code} = run(DIR, ['install', pkg]); + + expect(stdout).toContain(`Installing "${pkg}"`); + expect(stdout).toContain(`Linking "${pkg}"`); + // TODO – this behavior is a bug, linking should fail/warn without native deps + // to link. Not a high priority since we're changing how link works + expect(stdout).toContain(`Successfully installed and linked "${pkg}"`); + expect(require(path.join(DIR, 'package.json'))).toMatchObject({ + dependencies: { + [pkg]: expect.any(String), + }, + }); + expect(code).toBe(0); +}); diff --git a/e2e/__tests__/uninstall.test.js b/e2e/__tests__/uninstall.test.js new file mode 100644 index 000000000..1c9f6df05 --- /dev/null +++ b/e2e/__tests__/uninstall.test.js @@ -0,0 +1,55 @@ +// @flow +import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; + +const DIR = getTempDirectory('command-uninstall-test'); +const pkg = 'react-native-config'; + +beforeEach(() => { + cleanup(DIR); + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native-config/package.json': '{}', + 'package.json': `{ + "dependencies": { + "react-native-config": "*" + } + }`, + }); +}); +afterEach(() => cleanup(DIR)); + +test('uninstall fails when package is not defined', () => { + writeFiles(DIR, { + 'package.json': `{ + "dependencies": {} + }`, + }); + const {stderr, code} = run(DIR, ['uninstall']); + + expect(stderr).toContain('missing required argument'); + expect(code).toBe(1); +}); + +test('uninstall fails when package is not installed', () => { + writeFiles(DIR, { + 'package.json': `{ + "dependencies": {} + }`, + }); + const {stderr, code} = run(DIR, ['uninstall', pkg]); + + expect(stderr).toContain(`Project "${pkg}" is not a react-native library`); + expect(code).toBe(1); +}); + +test.each(['yarn', 'npm'])('uninstall module with %s', pm => { + if (pm === 'yarn') { + writeFiles(DIR, {'yarn.lock': ''}); + } + const {stdout, code} = run(DIR, ['uninstall', pkg]); + + expect(stdout).toContain(`Unlinking "${pkg}"`); + expect(stdout).toContain(`Uninstalling "${pkg}"`); + expect(stdout).toContain(`Successfully uninstalled and unlinked "${pkg}"`); + expect(code).toBe(0); +}); diff --git a/e2e/helpers.js b/e2e/helpers.js new file mode 100644 index 000000000..da4dca334 --- /dev/null +++ b/e2e/helpers.js @@ -0,0 +1,149 @@ +// @flow +import fs from 'fs'; +import os from 'os'; +import path from 'path'; +import {createDirectory} from 'jest-util'; +import rimraf from 'rimraf'; +import execa from 'execa'; +import {Writable} from 'readable-stream'; + +const CLI_PATH = path.resolve(__dirname, '../packages/cli/build/bin.js'); + +type RunOptions = { + nodeOptions?: string, + nodePath?: string, + timeout?: number, // kill the process after X milliseconds +}; + +export function run( + dir: string, + args?: Array, + options: RunOptions = {}, +) { + return spawnCli(dir, args, options); +} + +// Runs cli until a given output is achieved, then kills it with `SIGTERM` +export async function runUntil( + dir: string, + args: Array | void, + text: string, + options: RunOptions = {}, +) { + const spawnPromise = spawnCliAsync(dir, args, {timeout: 30000, ...options}); + + spawnPromise.stderr.pipe( + new Writable({ + write(chunk, _encoding, callback) { + const output = chunk.toString('utf8'); + + if (output.includes(text)) { + spawnPromise.kill(); + } + + callback(); + }, + }), + ); + + return spawnPromise; +} + +export const makeTemplate = ( + str: string, +): ((values?: Array) => string) => (values?: Array) => + str.replace(/\$(\d+)/g, (_match, number) => { + if (!Array.isArray(values)) { + throw new Error('Array of values must be passed to the template.'); + } + return values[number - 1]; + }); + +export const cleanup = (directory: string) => rimraf.sync(directory); + +/** + * Creates a nested directory with files and their contents + * writeFiles( + * '/home/tmp', + * { + * 'package.json': '{}', + * 'dir/file.js': 'module.exports = "x";', + * } + * ); + */ +export const writeFiles = ( + directory: string, + files: {[filename: string]: string}, +) => { + createDirectory(directory); + Object.keys(files).forEach(fileOrPath => { + const dirname = path.dirname(fileOrPath); + + if (dirname !== '/') { + createDirectory(path.join(directory, dirname)); + } + fs.writeFileSync( + path.resolve(directory, ...fileOrPath.split('/')), + files[fileOrPath], + ); + }); +}; + +export const copyDir = (src: string, dest: string) => { + const srcStat = fs.lstatSync(src); + if (srcStat.isDirectory()) { + if (!fs.existsSync(dest)) { + fs.mkdirSync(dest); + } + fs.readdirSync(src).map(filePath => + copyDir(path.join(src, filePath), path.join(dest, filePath)), + ); + } else { + fs.writeFileSync(dest, fs.readFileSync(src)); + } +}; + +export const getTempDirectory = (name: string) => + path.resolve(os.tmpdir(), name); + +function spawnCli(dir: string, args?: Array, options: RunOptions = {}) { + const {spawnArgs, spawnOptions} = getCliArguments({dir, args, options}); + + return execa.sync(process.execPath, spawnArgs, spawnOptions); +} + +function spawnCliAsync( + dir: string, + args?: Array, + options: RunOptions = {}, +) { + const {spawnArgs, spawnOptions} = getCliArguments({dir, args, options}); + + return execa(process.execPath, spawnArgs, spawnOptions); +} + +function getCliArguments({dir, args, options}) { + const isRelative = !path.isAbsolute(dir); + + if (isRelative) { + dir = path.resolve(__dirname, dir); + } + + const env = Object.assign({}, process.env, {FORCE_COLOR: '0'}); + + if (options.nodeOptions) { + env.NODE_OPTIONS = options.nodeOptions; + } + if (options.nodePath) { + env.NODE_PATH = options.nodePath; + } + + const spawnArgs = [CLI_PATH, ...(args || [])]; + const spawnOptions = { + cwd: dir, + env, + reject: false, + timeout: options.timeout || 0, + }; + return {spawnArgs, spawnOptions}; +} diff --git a/e2e/jest.config.js b/e2e/jest.config.js new file mode 100644 index 000000000..dcda2ee7b --- /dev/null +++ b/e2e/jest.config.js @@ -0,0 +1,4 @@ +module.exports = { + testEnvironment: 'node', + testPathIgnorePatterns: ['/(?:.+?)/__tests__/'], +}; diff --git a/flow-typed/npm/execa_v1.0.x.js b/flow-typed/npm/execa_v1.0.x.js new file mode 100644 index 000000000..d49b7a7b0 --- /dev/null +++ b/flow-typed/npm/execa_v1.0.x.js @@ -0,0 +1,103 @@ +// flow-typed signature: 613ee1ec7d728b6a312fcff21a7b2669 +// flow-typed version: 3163f7a6e3/execa_v1.0.x/flow_>=v0.75.x + +declare module 'execa' { + + declare type StdIoOption = + | 'pipe' + | 'ipc' + | 'ignore' + | 'inherit' + | stream$Stream + | number; + + declare type CommonOptions = {| + argv0?: string, + cleanup?: boolean, + cwd?: string, + detached?: boolean, + encoding?: string, + env?: {[string]: string}, + extendEnv?: boolean, + gid?: number, + killSignal?: string | number, + localDir?: string, + maxBuffer?: number, + preferLocal?: boolean, + reject?: boolean, + shell?: boolean | string, + stderr?: ?StdIoOption, + stdin?: ?StdIoOption, + stdio?: 'pipe' | 'ignore' | 'inherit' | $ReadOnlyArray, + stdout?: ?StdIoOption, + stripEof?: boolean, + timeout?: number, + uid?: number, + windowsVerbatimArguments?: boolean, + |}; + + declare type SyncOptions = {| + ...CommonOptions, + input?: string | Buffer, + |}; + + declare type Options = {| + ...CommonOptions, + input?: string | Buffer | stream$Readable, + |}; + + declare type SyncResult = {| + stdout: string, + stderr: string, + code: number, + failed: boolean, + signal: ?string, + cmd: string, + timedOut: boolean, + |}; + + declare type Result = {| + ...SyncResult, + killed: boolean, + |}; + + declare interface ThenableChildProcess extends child_process$ChildProcess { + then( + onfulfilled?: ?((value: Result) => R | Promise), + onrejected?: ?((reason: ExecaError) => E | Promise), + ): Promise; + + catch( + onrejected?: ?((reason: ExecaError) => E | Promise) + ): Promise; + } + + declare interface ExecaError extends ErrnoError { + stdout: string; + stderr: string; + failed: boolean; + signal: ?string; + cmd: string; + timedOut: boolean; + } + + declare interface Execa { + (file: string, args?: $ReadOnlyArray, options?: $ReadOnly): ThenableChildProcess; + (file: string, options?: $ReadOnly): ThenableChildProcess; + + stdout(file: string, args?: $ReadOnlyArray, options?: $ReadOnly): Promise; + stdout(file: string, options?: $ReadOnly): Promise; + + stderr(file: string, args?: $ReadOnlyArray, options?: $ReadOnly): Promise; + stderr(file: string, options?: $ReadOnly): Promise; + + shell(command: string, options?: $ReadOnly): ThenableChildProcess; + + sync(file: string, args?: $ReadOnlyArray, options?: $ReadOnly): SyncResult; + sync(file: string, options?: $ReadOnly): SyncResult; + + shellSync(command: string, options?: $ReadOnly): SyncResult; + } + + declare module.exports: Execa; +} diff --git a/package.json b/package.json index de4b3d899..f1710c7a4 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "babel-jest": "^24.0.0", "chalk": "^2.4.2", "eslint": "^5.10.0", - "flow-bin": "^0.94.0", + "execa": "^1.0.0", + "flow-bin": "^0.95.1", + "flow-typed": "^2.5.1", "glob": "^7.1.3", "jest": "^24.0.0", "lerna": "^3.10.6", @@ -39,12 +41,16 @@ "node": true }, "rules": { - "prettier/prettier": [2, "fb"] + "prettier/prettier": [ + 2, + "fb" + ] } }, "jest": { "projects": [ - "packages/*" + "packages/*", + "e2e" ] } } diff --git a/packages/cli/README.md b/packages/cli/README.md index 2639cde0c..f4158203a 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -25,8 +25,44 @@ CLI comes with a set of commands and flags you can pass to them. _Note: This document is still under development and doesn't represent the full API area._ +### `bundle` + +### `dependencies` + +### `eject` + +### `info` + +### `install` + +Usage: + +```sh +react-native install +``` + +Installs single package from npm and then links native dependencies. If `install` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. + +### `library` + +### `link` + +### `log-android` + +### `log-ios` + +### `ram-bundle` + +### `run-android` + ### `run-ios` +Usage: + +```sh +react-native run-ios [options] +``` + Builds your app and starts it on iOS simulator. #### Options @@ -78,3 +114,19 @@ Do not use `xcpretty` even if installed. Runs packager on specified port Default: `process.env.RCT_METRO_PORT || 8081` + +### `server` + +### `uninstall` + +Usage: + +```sh +react-native uninstall +``` + +Unlinks single package native dependencies and then uninstalls it from `package.json`. If `uninstall` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. + +### `unlink` + +### `upgrade` diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index aead25ac8..8d2e69b8c 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -19,6 +19,7 @@ const rnDiffPurgeUrl = const getLatestRNVersion = async (): Promise => { logger.info('No version passed. Fetching latest...'); + // $FlowFixMe - this is public API const {stdout} = await execa('npm', ['info', 'react-native', 'version']); return stdout; }; @@ -26,6 +27,7 @@ const getLatestRNVersion = async (): Promise => { const getRNPeerDeps = async ( version: string, ): Promise<{[key: string]: string}> => { + // $FlowFixMe - this is public API const {stdout} = await execa('npm', [ 'info', `react-native@${version}`, diff --git a/yarn.lock b/yarn.lock index 5efce960b..a9f2ce1a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1623,6 +1623,21 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== +"@octokit/rest@^15.2.6": + version "15.18.1" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.18.1.tgz#ec7fb0f8775ef64dc095fae6635411d3fbff9b62" + integrity sha512-g2tecjp2TEtYV8bKAFvfQtu+W29HM7ektmWmw8zrMy9/XCKDEYRErR2YvvhN9+IxkLC4O3lDqYP4b6WgsL6Utw== + dependencies: + before-after-hook "^1.1.0" + btoa-lite "^1.0.0" + debug "^3.1.0" + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.0" + lodash "^4.17.4" + node-fetch "^2.1.1" + universal-user-agent "^2.0.0" + url-template "^2.0.8" + "@react-native-community/eslint-config@^0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.2.tgz#042224762e00ef06b45693a14be78ebda5fb7def" @@ -1702,6 +1717,11 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" +ajv-keywords@^3.0.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.0.tgz#4b831e7b531415a7cc518cd404e73f6193c6349d" + integrity sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw== + ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" @@ -1711,6 +1731,16 @@ ajv@^5.3.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ajv@^6.0.1: + version "6.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" + integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ajv@^6.5.3: version "6.5.5" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1" @@ -1941,6 +1971,15 @@ babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" +babel-polyfill@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + dependencies: + babel-runtime "^6.26.0" + core-js "^2.5.0" + regenerator-runtime "^0.10.5" + babel-preset-fbjs@^3.1.2: version "3.2.0" resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.2.0.tgz#c0e6347d3e0379ed84b3c2434d3467567aa05297" @@ -1982,6 +2021,14 @@ babel-preset-jest@^24.0.0: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" babel-plugin-jest-hoist "^24.0.0" +babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -2014,6 +2061,16 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" +before-after-hook@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.4.0.tgz#2b6bf23dca4f32e628fd2747c10a37c74a4b484d" + integrity sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg== + +big-integer@^1.6.17: + version "1.6.43" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.43.tgz#8ac15bf13e93e509500859061233e19d8d0d99d1" + integrity sha512-9dULc9jsKmXl0Aeunug8wbF+58n+hQoFjqClN7WeZwGLh0XJUWyJJ9Ee+Ep+Ql/J9fRsTVaeThp8MhiCCrY0Jg== + big-integer@^1.6.7: version "1.6.36" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.36.tgz#78631076265d4ae3555c04f85e7d9d2f3a071a36" @@ -2029,6 +2086,14 @@ bin-links@^1.1.2: graceful-fs "^4.1.11" write-file-atomic "^2.3.0" +binary@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79" + integrity sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk= + dependencies: + buffers "~0.1.1" + chainsaw "~0.1.0" + block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" @@ -2041,6 +2106,11 @@ bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.3: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== +bluebird@~3.4.1: + version "3.4.7" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" + integrity sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM= + bplist-creator@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.0.7.tgz#37df1536092824b87c42f957b01344117372ae45" @@ -2100,6 +2170,11 @@ bser@^2.0.0: dependencies: node-int64 "^0.4.0" +btoa-lite@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" + integrity sha1-M3dm2hWAEhD92VbCLpxokaudAzc= + buffer-crc32@^0.2.13: version "0.2.13" resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" @@ -2108,6 +2183,21 @@ buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" +buffer-indexof-polyfill@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.1.tgz#a9fb806ce8145d5428510ce72f278bb363a638bf" + integrity sha1-qfuAbOgUXVQoUQznLyeLs2OmOL8= + +buffer-shims@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" + integrity sha1-mXjOMXOIxkmth5MCjDR37wRKi1E= + +buffers@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" + integrity sha1-skV5w77U1tOWru5tmorn9Ugqt7s= + builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -2225,6 +2315,11 @@ camelcase@^2.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= + camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" @@ -2249,6 +2344,13 @@ caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" +chainsaw@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/chainsaw/-/chainsaw-0.1.0.tgz#5eab50b28afe58074d0d58291388828b5e5fbc98" + integrity sha1-XqtQsor+WAdNDVgpE4iCi15fvJg= + dependencies: + traverse ">=0.3.0 <0.4" + chalk@^1.1.1: version "1.1.3" resolved "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -2284,6 +2386,11 @@ chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" +charenc@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= + chownr@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" @@ -2379,6 +2486,11 @@ colors@0.6.x: version "0.6.2" resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" +colors@^1.1.2: + version "1.3.3" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.3.tgz#39e005d546afe01e01f9c4ca8fa50f686a01205d" + integrity sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg== + columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" @@ -2587,7 +2699,7 @@ copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" -core-js@^2.2.2, core-js@^2.5.7: +core-js@^2.2.2, core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.7: version "2.6.5" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== @@ -2636,6 +2748,11 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +crypt@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= + cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.4" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.4.tgz#8cd52e8a3acfd68d3aed38ee0a640177d2f9d797" @@ -2747,6 +2864,13 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" +decompress-response@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= + dependencies: + mimic-response "^1.0.0" + dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -2900,6 +3024,18 @@ dot-prop@^4.2.0: dependencies: is-obj "^1.0.0" +duplexer2@~0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= + dependencies: + readable-stream "^2.0.2" + +duplexer3@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= + duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" @@ -3456,10 +3592,31 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.94.0: - version "0.94.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.94.0.tgz#b5d58fe7559705b73a18229f97edfc3ab6ffffcb" - integrity sha512-DYF7r9CJ/AksfmmB4+q+TyLMoeQPRnqtF1Pk7KY3zgfkB/nVuA3nXyzqgsIPIvnMSiFEXQcFK4z+iPxSLckZhQ== +flow-bin@^0.95.1: + version "0.95.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.95.1.tgz#633113831ccff4b7ee70a2730f63fc43b69ba85f" + integrity sha512-06IOC/pqPMNRYtC6AMZEWYR9Fi6UdBC7gImGinPuNUpPZFnP5E9/0cBCl3DWrH4zz/gSM2HdDilU7vPGpYIr2w== + +flow-typed@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/flow-typed/-/flow-typed-2.5.1.tgz#0ff565cc94d2af8c557744ba364b6f14726a6b9f" + integrity sha1-D/VlzJTSr4xVd0S6NktvFHJqa58= + dependencies: + "@octokit/rest" "^15.2.6" + babel-polyfill "^6.26.0" + colors "^1.1.2" + fs-extra "^5.0.0" + glob "^7.1.2" + got "^7.1.0" + md5 "^2.1.0" + mkdirp "^0.5.1" + rimraf "^2.6.2" + semver "^5.5.0" + table "^4.0.2" + through "^2.3.8" + unzipper "^0.8.11" + which "^1.3.0" + yargs "^4.2.0" flush-write-stream@^1.0.0: version "1.0.3" @@ -3511,6 +3668,15 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" +fs-extra@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" + integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -3556,7 +3722,7 @@ fsevents@^1.2.3: nan "^2.9.2" node-pre-gyp "^0.10.0" -fstream@^1.0.0, fstream@^1.0.2: +fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= @@ -3744,6 +3910,26 @@ globby@^8.0.1: pify "^3.0.0" slash "^1.0.0" +got@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" + integrity sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw== + dependencies: + decompress-response "^3.2.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + is-plain-obj "^1.1.0" + is-retry-allowed "^1.0.0" + is-stream "^1.0.0" + isurl "^1.0.0-alpha5" + lowercase-keys "^1.0.0" + p-cancelable "^0.3.0" + p-timeout "^1.1.1" + safe-buffer "^5.0.1" + timed-out "^4.0.0" + url-parse-lax "^1.0.0" + url-to-options "^1.0.1" + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" @@ -3783,10 +3969,22 @@ has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" +has-symbol-support-x@^1.4.1: + version "1.4.2" + resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" + integrity sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw== + has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" +has-to-string-tag-x@^1.2.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" + integrity sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== + dependencies: + has-symbol-support-x "^1.4.1" + has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -3869,7 +4067,7 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-proxy-agent@^2.2.1: +https-proxy-agent@^2.2.0, https-proxy-agent@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ== @@ -3969,7 +4167,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: +inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -4082,7 +4280,7 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" -is-buffer@^1.1.5: +is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -4208,6 +4406,11 @@ is-obj@^1.0.0: resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= +is-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" + integrity sha1-iVJojF7C/9awPsyF52ngKQMINHA= + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -4245,7 +4448,12 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-stream@^1.0.1, is-stream@^1.1.0: +is-retry-allowed@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" + integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ= + +is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4397,6 +4605,14 @@ istanbul-reports@^2.0.3: dependencies: handlebars "^4.0.11" +isurl@^1.0.0-alpha5: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" + integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== + dependencies: + has-to-string-tag-x "^1.2.0" + is-object "^1.0.1" + jest-changed-files@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.0.0.tgz#c02c09a8cc9ca93f513166bc773741bd39898ff7" @@ -5047,6 +5263,11 @@ libnpmteam@^1.0.1: get-stream "^4.0.0" npm-registry-fetch "^3.8.0" +listenercount@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/listenercount/-/listenercount-1.0.1.tgz#84c8a72ab59c4725321480c975e6508342e70937" + integrity sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc= + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -5104,6 +5325,11 @@ lodash._reinterpolate@~3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.assign@^4.0.3, lodash.assign@^4.0.6: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" + integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -5132,7 +5358,7 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: +lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -5150,6 +5376,11 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" +lowercase-keys@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== + lru-cache@^4.0.1: version "4.1.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" @@ -5172,6 +5403,11 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +macos-release@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.1.0.tgz#c87935891fbeb0dba7537913fc66f469fee9d662" + integrity sha512-8TCbwvN1mfNxbBv0yBtfyIFMo3m1QsNbKHv7PYIp/abRBKVQBXN7ecu3aeGGgT18VC/Tf397LBDGZF9KBGJFFw== + make-dir@^1.0.0, make-dir@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -5227,6 +5463,15 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +md5@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" + integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk= + dependencies: + charenc "~0.0.1" + crypt "~0.0.1" + is-buffer "~1.1.1" + mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" @@ -5548,6 +5793,11 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +mimic-response@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -5732,6 +5982,11 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-fetch@^2.1.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" + integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== + node-fetch@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.1.tgz#1fe551e0ded6c45b3b3b937d0fb46f76df718d1e" @@ -6020,6 +6275,13 @@ os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= + dependencies: + lcid "^1.0.0" + os-locale@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" @@ -6036,6 +6298,14 @@ os-locale@^3.0.0: lcid "^2.0.0" mem "^4.0.0" +os-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.0.0.tgz#e1434dbfddb8e74b44c98b56797d951b7648a5d9" + integrity sha512-7c74tib2FsdFbQ3W+qj8Tyd1R3Z6tuVRNNxXjJcZ4NgjIEQU9N/prVMqcW29XZPXGACqaXN3jq58/6hoaoXH6g== + dependencies: + macos-release "^2.0.0" + windows-release "^3.1.0" + os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -6047,6 +6317,11 @@ osenv@0, osenv@^0.1.4, osenv@^0.1.5: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-cancelable@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" + integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== + p-defer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" @@ -6112,6 +6387,13 @@ p-reduce@^1.0.0: resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= +p-timeout@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" + integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y= + dependencies: + p-finally "^1.0.0" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" @@ -6324,6 +6606,11 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" +prepend-http@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= + prettier@1.13.6: version "1.13.6" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" @@ -6349,6 +6636,11 @@ private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M= + process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" @@ -6609,7 +6901,7 @@ read@1, read@1.0.x, read@~1.0.1: dependencies: mute-stream "~0.0.4" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@~2.3.6: version "2.3.6" resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" dependencies: @@ -6621,6 +6913,19 @@ read@1, read@1.0.x, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@~2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" + integrity sha1-ZvqLcg4UOLNkaB8q0aY8YYRIydA= + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" @@ -6663,6 +6968,16 @@ regenerate@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" +regenerator-runtime@^0.10.5: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + regenerator-transform@^0.13.3: version "0.13.3" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb" @@ -6984,7 +7299,7 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.5: +setimmediate@^1.0.5, setimmediate@~1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -7292,6 +7607,11 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -7387,6 +7707,18 @@ symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" +table@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" + integrity sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg== + dependencies: + ajv "^6.0.1" + ajv-keywords "^3.0.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + table@^5.0.2: version "5.1.0" resolved "https://registry.yarnpkg.com/table/-/table-5.1.0.tgz#69a54644f6f01ad1628f8178715b408dc6bf11f7" @@ -7484,10 +7816,15 @@ through2@^2.0.0, through2@^2.0.2: readable-stream "~2.3.6" xtend "~4.0.1" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "http://registry.npmjs.org/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" +timed-out@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -7537,6 +7874,11 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" +"traverse@>=0.3.0 <0.4": + version "0.3.9" + resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" + integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk= + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -7654,6 +7996,13 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +universal-user-agent@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.0.3.tgz#9f6f09f9cc33de867bb720d84c08069b14937c6c" + integrity sha512-eRHEHhChCBHrZsA4WEhdgiOKgdvgrMIHwnwnqD0r5C6AO8kwKcG7qSku3iXdhvHL3YvsS9ZkSGN8h/hIpoFC8g== + dependencies: + os-name "^3.0.0" + universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -7670,6 +8019,21 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +unzipper@^0.8.11: + version "0.8.14" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.8.14.tgz#ade0524cd2fc14d11b8de258be22f9d247d3f79b" + integrity sha512-8rFtE7EP5ssOwGpN2dt1Q4njl0N1hUXJ7sSPz0leU2hRdq6+pra57z4YPBlVqm40vcgv6ooKZEAx48fMTv9x4w== + dependencies: + big-integer "^1.6.17" + binary "~0.3.0" + bluebird "~3.4.1" + buffer-indexof-polyfill "~1.0.0" + duplexer2 "~0.1.4" + fstream "~1.0.10" + listenercount "~1.0.1" + readable-stream "~2.1.5" + setimmediate "~1.0.4" + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -7680,6 +8044,23 @@ urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" +url-parse-lax@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" + integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= + dependencies: + prepend-http "^1.0.1" + +url-template@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" + integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= + +url-to-options@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" + integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k= + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" @@ -7800,6 +8181,11 @@ whatwg-url@^7.0.0: tr46 "^1.0.1" webidl-conversions "^4.0.2" +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= + which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -7816,6 +8202,18 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2 || 2" +window-size@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" + integrity sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU= + +windows-release@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/windows-release/-/windows-release-3.1.0.tgz#8d4a7e266cbf5a233f6c717dac19ce00af36e12e" + integrity sha512-hBb7m7acFgQPQc222uEQTmdcGLeBmQLNLFIh0rDk3CwFOBrfjefLzEfEfmpMq8Af/n/GnFf3eYf203FY1PmudA== + dependencies: + execa "^0.10.0" + winston@0.8.x: version "0.8.3" resolved "http://registry.npmjs.org/winston/-/winston-0.8.3.tgz#64b6abf4cd01adcaefd5009393b1d8e8bec19db0" @@ -7979,6 +8377,14 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-2.4.1.tgz#85568de3cf150ff49fa51825f03a8c880ddcc5c4" + integrity sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ= + dependencies: + camelcase "^3.0.0" + lodash.assign "^4.0.6" + yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" @@ -8020,6 +8426,26 @@ yargs@^12.0.2: y18n "^3.2.1 || ^4.0.0" yargs-parser "^10.1.0" +yargs@^4.2.0: + version "4.8.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-4.8.1.tgz#c0c42924ca4aaa6b0e6da1739dfb216439f9ddc0" + integrity sha1-wMQpJMpKqmsObaFznfshZDn53cA= + dependencies: + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + lodash.assign "^4.0.3" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.1" + which-module "^1.0.0" + window-size "^0.2.0" + y18n "^3.2.1" + yargs-parser "^2.4.1" + yargs@^9.0.0: version "9.0.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" From 08fd51181dce40f87552085773515fbb61546fcb Mon Sep 17 00:00:00 2001 From: Apo Date: Thu, 28 Mar 2019 21:07:50 +0800 Subject: [PATCH 041/234] [General] [Fixed] - Fixes Xcode 10.2 simulator not found issue (#274) --- packages/cli/src/commands/runIOS/findMatchingSimulator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/runIOS/findMatchingSimulator.js b/packages/cli/src/commands/runIOS/findMatchingSimulator.js index 0cbdf6466..c46a25c75 100644 --- a/packages/cli/src/commands/runIOS/findMatchingSimulator.js +++ b/packages/cli/src/commands/runIOS/findMatchingSimulator.js @@ -50,7 +50,7 @@ function findMatchingSimulator(simulators, simulatorString) { } // Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc) - if (!version.startsWith('iOS') && !version.startsWith('tvOS')) { + if (!version.includes('iOS') && !version.includes('tvOS')) { continue; } if (simulatorVersion && !version.endsWith(simulatorVersion)) { From 60d93dc1665e0510a3538b35983c212ca0f56c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 28 Mar 2019 14:09:27 +0100 Subject: [PATCH 042/234] feat: upgrade envinfo for better output of info command (#265) * feat: upgrade envinfo for better output * remove --packages options --- .../npm/{jest_v23.x.x.js => jest_v24.x.x.js} | 691 +++++++++--------- packages/cli/package.json | 2 +- .../src/commands/info/__tests__/info.test.js | 29 + packages/cli/src/commands/info/info.js | 75 +- yarn.lock | 7 +- 5 files changed, 412 insertions(+), 392 deletions(-) rename flow-typed/npm/{jest_v23.x.x.js => jest_v24.x.x.js} (67%) create mode 100644 packages/cli/src/commands/info/__tests__/info.test.js diff --git a/flow-typed/npm/jest_v23.x.x.js b/flow-typed/npm/jest_v24.x.x.js similarity index 67% rename from flow-typed/npm/jest_v23.x.x.js rename to flow-typed/npm/jest_v24.x.x.js index 95835f5f2..1c1d6d9a2 100644 --- a/flow-typed/npm/jest_v23.x.x.js +++ b/flow-typed/npm/jest_v24.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 78c200acffbcc16bba9478f5396c3a00 -// flow-typed version: b2980740dd/jest_v23.x.x/flow_>=v0.39.x +// flow-typed signature: 833075a5cefc49eb523160a5fca9d8b6 +// flow-typed version: 325925f1b7/jest_v24.x.x/flow_>=v0.39.x type JestMockFn, TReturn> = { (...args: TArguments): TReturn, @@ -22,7 +22,7 @@ type JestMockFn, TReturn> = { * An array that contains all the object results that have been * returned by this mock function call */ - results: Array<{ isThrow: boolean, value: TReturn }> + results: Array<{ isThrow: boolean, value: TReturn }>, }, /** * Resets all information stored in the mockFn.mock.calls and @@ -84,7 +84,9 @@ type JestMockFn, TReturn> = { /** * Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value)) */ - mockResolvedValueOnce(value: TReturn): JestMockFn>, + mockResolvedValueOnce( + value: TReturn + ): JestMockFn>, /** * Sugar for jest.fn().mockImplementation(() => Promise.reject(value)) */ @@ -92,14 +94,14 @@ type JestMockFn, TReturn> = { /** * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value)) */ - mockRejectedValueOnce(value: TReturn): JestMockFn> + mockRejectedValueOnce(value: TReturn): JestMockFn>, }; type JestAsymmetricEqualityType = { /** * A custom Jasmine equality tester */ - asymmetricMatch(value: mixed): boolean + asymmetricMatch(value: mixed): boolean, }; type JestCallsType = { @@ -109,24 +111,25 @@ type JestCallsType = { count(): number, first(): mixed, mostRecent(): mixed, - reset(): void + reset(): void, }; type JestClockType = { install(): void, mockDate(date: Date): void, tick(milliseconds?: number): void, - uninstall(): void + uninstall(): void, }; type JestMatcherResult = { message?: string | (() => string), - pass: boolean + pass: boolean, }; -type JestMatcher = (actual: any, expected: any) => - | JestMatcherResult - | Promise; +type JestMatcher = ( + actual: any, + expected: any +) => JestMatcherResult | Promise; type JestPromiseType = { /** @@ -138,7 +141,7 @@ type JestPromiseType = { * Use resolves to unwrap the value of a fulfilled promise so any other * matcher can be chained. If the promise is rejected the assertion fails. */ - resolves: JestExpectType + resolves: JestExpectType, }; /** @@ -158,10 +161,10 @@ type JestStyledComponentsMatcherValue = | typeof undefined; type JestStyledComponentsMatcherOptions = { - media?: string; - modifier?: string; - supports?: string; -} + media?: string, + modifier?: string, + supports?: string, +}; type JestStyledComponentsMatchersType = { toHaveStyleRule( @@ -182,24 +185,27 @@ type EnzymeMatchersType = { toBeChecked(): void, toBeDisabled(): void, toBeEmptyRender(): void, - toContainMatchingElement(selector: string): void; - toContainMatchingElements(n: number, selector: string): void; - toContainExactlyOneMatchingElement(selector: string): void; + toContainMatchingElement(selector: string): void, + toContainMatchingElements(n: number, selector: string): void, + toContainExactlyOneMatchingElement(selector: string): void, toContainReact(element: React$Element): void, toExist(): void, toHaveClassName(className: string): void, toHaveHTML(html: string): void, - toHaveProp: ((propKey: string, propValue?: any) => void) & ((props: Object) => void), + toHaveProp: ((propKey: string, propValue?: any) => void) & + ((props: {}) => void), toHaveRef(refName: string): void, - toHaveState: ((stateKey: string, stateValue?: any) => void) & ((state: Object) => void), - toHaveStyle: ((styleKey: string, styleValue?: any) => void) & ((style: Object) => void), + toHaveState: ((stateKey: string, stateValue?: any) => void) & + ((state: {}) => void), + toHaveStyle: ((styleKey: string, styleValue?: any) => void) & + ((style: {}) => void), toHaveTagName(tagName: string): void, toHaveText(text: string): void, toHaveValue(value: any): void, toIncludeText(text: string): void, toMatchElement( element: React$Element, - options?: {| ignoreProps?: boolean, verbose?: boolean |}, + options?: {| ignoreProps?: boolean, verbose?: boolean |} ): void, toMatchSelector(selector: string): void, // 7.x @@ -219,7 +225,10 @@ type DomTestingLibraryType = { toHaveFocus(): void, toHaveFormValues(expectedValues: { [name: string]: any }): void, toHaveStyle(css: string): void, - toHaveTextContent(content: string | RegExp, options?: { normalizeWhitespace: boolean }): void, + toHaveTextContent( + content: string | RegExp, + options?: { normalizeWhitespace: boolean } + ): void, toBeInTheDOM(): void, }; @@ -235,7 +244,7 @@ type JestJQueryMatchersType = { toHaveText(text: string | RegExp): void, toHaveData(key: string, val?: any): void, toHaveValue(val: any): void, - toHaveCss(css: {[key: string]: any}): void, + toHaveCss(css: { [key: string]: any }): void, toBeChecked(): void, toBeDisabled(): void, toBeEmpty(): void, @@ -246,409 +255,407 @@ type JestJQueryMatchersType = { toBeInDom(): void, toBeMatchedBy(sel: string): void, toHaveDescendant(sel: string): void, - toHaveDescendantWithText(sel: string, text: string | RegExp): void + toHaveDescendantWithText(sel: string, text: string | RegExp): void, }; - // Jest Extended Matchers: https://github.com/jest-community/jest-extended type JestExtendedMatchersType = { /** - * Note: Currently unimplemented - * Passing assertion - * - * @param {String} message - */ + * Note: Currently unimplemented + * Passing assertion + * + * @param {String} message + */ // pass(message: string): void; - /** - * Note: Currently unimplemented - * Failing assertion - * - * @param {String} message - */ + /** + * Note: Currently unimplemented + * Failing assertion + * + * @param {String} message + */ // fail(message: string): void; - /** - * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty. - */ - toBeEmpty(): void; + /** + * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty. + */ + toBeEmpty(): void, - /** - * Use .toBeOneOf when checking if a value is a member of a given Array. - * @param {Array.<*>} members - */ - toBeOneOf(members: any[]): void; + /** + * Use .toBeOneOf when checking if a value is a member of a given Array. + * @param {Array.<*>} members + */ + toBeOneOf(members: any[]): void, - /** - * Use `.toBeNil` when checking a value is `null` or `undefined`. - */ - toBeNil(): void; + /** + * Use `.toBeNil` when checking a value is `null` or `undefined`. + */ + toBeNil(): void, - /** - * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`. - * @param {Function} predicate - */ - toSatisfy(predicate: (n: any) => boolean): void; + /** + * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`. + * @param {Function} predicate + */ + toSatisfy(predicate: (n: any) => boolean): void, - /** - * Use `.toBeArray` when checking if a value is an `Array`. - */ - toBeArray(): void; + /** + * Use `.toBeArray` when checking if a value is an `Array`. + */ + toBeArray(): void, - /** - * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x. - * @param {Number} x - */ - toBeArrayOfSize(x: number): void; + /** + * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x. + * @param {Number} x + */ + toBeArrayOfSize(x: number): void, - /** - * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. - * @param {Array.<*>} members - */ - toIncludeAllMembers(members: any[]): void; + /** + * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. + * @param {Array.<*>} members + */ + toIncludeAllMembers(members: any[]): void, - /** - * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set. - * @param {Array.<*>} members - */ - toIncludeAnyMembers(members: any[]): void; + /** + * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set. + * @param {Array.<*>} members + */ + toIncludeAnyMembers(members: any[]): void, - /** - * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. - * @param {Function} predicate - */ - toSatisfyAll(predicate: (n: any) => boolean): void; + /** + * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. + * @param {Function} predicate + */ + toSatisfyAll(predicate: (n: any) => boolean): void, - /** - * Use `.toBeBoolean` when checking if a value is a `Boolean`. - */ - toBeBoolean(): void; + /** + * Use `.toBeBoolean` when checking if a value is a `Boolean`. + */ + toBeBoolean(): void, - /** - * Use `.toBeTrue` when checking a value is equal (===) to `true`. - */ - toBeTrue(): void; + /** + * Use `.toBeTrue` when checking a value is equal (===) to `true`. + */ + toBeTrue(): void, - /** - * Use `.toBeFalse` when checking a value is equal (===) to `false`. - */ - toBeFalse(): void; + /** + * Use `.toBeFalse` when checking a value is equal (===) to `false`. + */ + toBeFalse(): void, - /** - * Use .toBeDate when checking if a value is a Date. - */ - toBeDate(): void; + /** + * Use .toBeDate when checking if a value is a Date. + */ + toBeDate(): void, - /** - * Use `.toBeFunction` when checking if a value is a `Function`. - */ - toBeFunction(): void; + /** + * Use `.toBeFunction` when checking if a value is a `Function`. + */ + toBeFunction(): void, - /** - * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`. - * - * Note: Required Jest version >22 - * Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same - * - * @param {Mock} mock - */ - toHaveBeenCalledBefore(mock: JestMockFn): void; + /** + * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`. + * + * Note: Required Jest version >22 + * Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same + * + * @param {Mock} mock + */ + toHaveBeenCalledBefore(mock: JestMockFn): void, - /** - * Use `.toBeNumber` when checking if a value is a `Number`. - */ - toBeNumber(): void; + /** + * Use `.toBeNumber` when checking if a value is a `Number`. + */ + toBeNumber(): void, - /** - * Use `.toBeNaN` when checking a value is `NaN`. - */ - toBeNaN(): void; + /** + * Use `.toBeNaN` when checking a value is `NaN`. + */ + toBeNaN(): void, - /** - * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`. - */ - toBeFinite(): void; + /** + * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`. + */ + toBeFinite(): void, - /** - * Use `.toBePositive` when checking if a value is a positive `Number`. - */ - toBePositive(): void; + /** + * Use `.toBePositive` when checking if a value is a positive `Number`. + */ + toBePositive(): void, - /** - * Use `.toBeNegative` when checking if a value is a negative `Number`. - */ - toBeNegative(): void; + /** + * Use `.toBeNegative` when checking if a value is a negative `Number`. + */ + toBeNegative(): void, - /** - * Use `.toBeEven` when checking if a value is an even `Number`. - */ - toBeEven(): void; + /** + * Use `.toBeEven` when checking if a value is an even `Number`. + */ + toBeEven(): void, - /** - * Use `.toBeOdd` when checking if a value is an odd `Number`. - */ - toBeOdd(): void; + /** + * Use `.toBeOdd` when checking if a value is an odd `Number`. + */ + toBeOdd(): void, - /** - * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive). - * - * @param {Number} start - * @param {Number} end - */ - toBeWithin(start: number, end: number): void; + /** + * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive). + * + * @param {Number} start + * @param {Number} end + */ + toBeWithin(start: number, end: number): void, - /** - * Use `.toBeObject` when checking if a value is an `Object`. - */ - toBeObject(): void; + /** + * Use `.toBeObject` when checking if a value is an `Object`. + */ + toBeObject(): void, - /** - * Use `.toContainKey` when checking if an object contains the provided key. - * - * @param {String} key - */ - toContainKey(key: string): void; + /** + * Use `.toContainKey` when checking if an object contains the provided key. + * + * @param {String} key + */ + toContainKey(key: string): void, - /** - * Use `.toContainKeys` when checking if an object has all of the provided keys. - * - * @param {Array.} keys - */ - toContainKeys(keys: string[]): void; + /** + * Use `.toContainKeys` when checking if an object has all of the provided keys. + * + * @param {Array.} keys + */ + toContainKeys(keys: string[]): void, - /** - * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. - * - * @param {Array.} keys - */ - toContainAllKeys(keys: string[]): void; + /** + * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. + * + * @param {Array.} keys + */ + toContainAllKeys(keys: string[]): void, - /** - * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. - * - * @param {Array.} keys - */ - toContainAnyKeys(keys: string[]): void; + /** + * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. + * + * @param {Array.} keys + */ + toContainAnyKeys(keys: string[]): void, - /** - * Use `.toContainValue` when checking if an object contains the provided value. - * - * @param {*} value - */ - toContainValue(value: any): void; + /** + * Use `.toContainValue` when checking if an object contains the provided value. + * + * @param {*} value + */ + toContainValue(value: any): void, - /** - * Use `.toContainValues` when checking if an object contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainValues(values: any[]): void; + /** + * Use `.toContainValues` when checking if an object contains all of the provided values. + * + * @param {Array.<*>} values + */ + toContainValues(values: any[]): void, - /** - * Use `.toContainAllValues` when checking if an object only contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainAllValues(values: any[]): void; + /** + * Use `.toContainAllValues` when checking if an object only contains all of the provided values. + * + * @param {Array.<*>} values + */ + toContainAllValues(values: any[]): void, - /** - * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. - * - * @param {Array.<*>} values - */ - toContainAnyValues(values: any[]): void; + /** + * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. + * + * @param {Array.<*>} values + */ + toContainAnyValues(values: any[]): void, - /** - * Use `.toContainEntry` when checking if an object contains the provided entry. - * - * @param {Array.} entry - */ - toContainEntry(entry: [string, string]): void; + /** + * Use `.toContainEntry` when checking if an object contains the provided entry. + * + * @param {Array.} entry + */ + toContainEntry(entry: [string, string]): void, - /** - * Use `.toContainEntries` when checking if an object contains all of the provided entries. - * - * @param {Array.>} entries - */ - toContainEntries(entries: [string, string][]): void; + /** + * Use `.toContainEntries` when checking if an object contains all of the provided entries. + * + * @param {Array.>} entries + */ + toContainEntries(entries: [string, string][]): void, - /** - * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. - * - * @param {Array.>} entries - */ - toContainAllEntries(entries: [string, string][]): void; + /** + * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. + * + * @param {Array.>} entries + */ + toContainAllEntries(entries: [string, string][]): void, - /** - * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. - * - * @param {Array.>} entries - */ - toContainAnyEntries(entries: [string, string][]): void; + /** + * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. + * + * @param {Array.>} entries + */ + toContainAnyEntries(entries: [string, string][]): void, - /** - * Use `.toBeExtensible` when checking if an object is extensible. - */ - toBeExtensible(): void; + /** + * Use `.toBeExtensible` when checking if an object is extensible. + */ + toBeExtensible(): void, - /** - * Use `.toBeFrozen` when checking if an object is frozen. - */ - toBeFrozen(): void; + /** + * Use `.toBeFrozen` when checking if an object is frozen. + */ + toBeFrozen(): void, - /** - * Use `.toBeSealed` when checking if an object is sealed. - */ - toBeSealed(): void; + /** + * Use `.toBeSealed` when checking if an object is sealed. + */ + toBeSealed(): void, - /** - * Use `.toBeString` when checking if a value is a `String`. - */ - toBeString(): void; + /** + * Use `.toBeString` when checking if a value is a `String`. + */ + toBeString(): void, - /** - * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings. - * - * @param {String} string - */ - toEqualCaseInsensitive(string: string): void; + /** + * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings. + * + * @param {String} string + */ + toEqualCaseInsensitive(string: string): void, - /** - * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix. - * - * @param {String} prefix - */ - toStartWith(prefix: string): void; + /** + * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix. + * + * @param {String} prefix + */ + toStartWith(prefix: string): void, - /** - * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix. - * - * @param {String} suffix - */ - toEndWith(suffix: string): void; + /** + * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix. + * + * @param {String} suffix + */ + toEndWith(suffix: string): void, - /** - * Use `.toInclude` when checking if a `String` includes the given `String` substring. - * - * @param {String} substring - */ - toInclude(substring: string): void; + /** + * Use `.toInclude` when checking if a `String` includes the given `String` substring. + * + * @param {String} substring + */ + toInclude(substring: string): void, - /** - * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times. - * - * @param {String} substring - * @param {Number} times - */ - toIncludeRepeated(substring: string, times: number): void; + /** + * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times. + * + * @param {String} substring + * @param {Number} times + */ + toIncludeRepeated(substring: string, times: number): void, - /** - * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. - * - * @param {Array.} substring - */ - toIncludeMultiple(substring: string[]): void; + /** + * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. + * + * @param {Array.} substring + */ + toIncludeMultiple(substring: string[]): void, }; interface JestExpectType { - not: - & JestExpectType - & EnzymeMatchersType - & DomTestingLibraryType - & JestJQueryMatchersType - & JestStyledComponentsMatchersType - & JestExtendedMatchersType, + not: JestExpectType & + EnzymeMatchersType & + DomTestingLibraryType & + JestJQueryMatchersType & + JestStyledComponentsMatchersType & + JestExtendedMatchersType; /** * If you have a mock function, you can use .lastCalledWith to test what * arguments it was last called with. */ - lastCalledWith(...args: Array): void, + lastCalledWith(...args: Array): void; /** * toBe just checks that a value is what you expect. It uses === to check * strict equality. */ - toBe(value: any): void, + toBe(value: any): void; /** * Use .toBeCalledWith to ensure that a mock function was called with * specific arguments. */ - toBeCalledWith(...args: Array): void, + toBeCalledWith(...args: Array): void; /** * Using exact equality with floating point numbers is a bad idea. Rounding * means that intuitive things fail. */ - toBeCloseTo(num: number, delta: any): void, + toBeCloseTo(num: number, delta: any): void; /** * Use .toBeDefined to check that a variable is not undefined. */ - toBeDefined(): void, + toBeDefined(): void; /** * Use .toBeFalsy when you don't care what a value is, you just want to * ensure a value is false in a boolean context. */ - toBeFalsy(): void, + toBeFalsy(): void; /** * To compare floating point numbers, you can use toBeGreaterThan. */ - toBeGreaterThan(number: number): void, + toBeGreaterThan(number: number): void; /** * To compare floating point numbers, you can use toBeGreaterThanOrEqual. */ - toBeGreaterThanOrEqual(number: number): void, + toBeGreaterThanOrEqual(number: number): void; /** * To compare floating point numbers, you can use toBeLessThan. */ - toBeLessThan(number: number): void, + toBeLessThan(number: number): void; /** * To compare floating point numbers, you can use toBeLessThanOrEqual. */ - toBeLessThanOrEqual(number: number): void, + toBeLessThanOrEqual(number: number): void; /** * Use .toBeInstanceOf(Class) to check that an object is an instance of a * class. */ - toBeInstanceOf(cls: Class<*>): void, + toBeInstanceOf(cls: Class<*>): void; /** * .toBeNull() is the same as .toBe(null) but the error messages are a bit * nicer. */ - toBeNull(): void, + toBeNull(): void; /** * Use .toBeTruthy when you don't care what a value is, you just want to * ensure a value is true in a boolean context. */ - toBeTruthy(): void, + toBeTruthy(): void; /** * Use .toBeUndefined to check that a variable is undefined. */ - toBeUndefined(): void, + toBeUndefined(): void; /** * Use .toContain when you want to check that an item is in a list. For * testing the items in the list, this uses ===, a strict equality check. */ - toContain(item: any): void, + toContain(item: any): void; /** * Use .toContainEqual when you want to check that an item is in a list. For * testing the items in the list, this matcher recursively checks the * equality of all fields, rather than checking for object identity. */ - toContainEqual(item: any): void, + toContainEqual(item: any): void; /** * Use .toEqual when you want to check that two objects have the same value. * This matcher recursively checks the equality of all fields, rather than * checking for object identity. */ - toEqual(value: any): void, + toEqual(value: any): void; /** * Use .toHaveBeenCalled to ensure that a mock function got called. */ - toHaveBeenCalled(): void, + toHaveBeenCalled(): void; toBeCalled(): void; /** * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact * number of times. */ - toHaveBeenCalledTimes(number: number): void, + toHaveBeenCalledTimes(number: number): void; toBeCalledTimes(number: number): void; /** * @@ -684,46 +691,46 @@ interface JestExpectType { * Use .toHaveBeenCalledWith to ensure that a mock function was called with * specific arguments. */ - toHaveBeenCalledWith(...args: Array): void, - toBeCalledWith(...args: Array): void, + toHaveBeenCalledWith(...args: Array): void; + toBeCalledWith(...args: Array): void; /** * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called * with specific arguments. */ - toHaveBeenLastCalledWith(...args: Array): void, - lastCalledWith(...args: Array): void, + toHaveBeenLastCalledWith(...args: Array): void; + lastCalledWith(...args: Array): void; /** * Check that an object has a .length property and it is set to a certain * numeric value. */ - toHaveLength(number: number): void, + toHaveLength(number: number): void; /** * */ - toHaveProperty(propPath: string, value?: any): void, + toHaveProperty(propPath: string, value?: any): void; /** * Use .toMatch to check that a string matches a regular expression or string. */ - toMatch(regexpOrString: RegExp | string): void, + toMatch(regexpOrString: RegExp | string): void; /** * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object. */ - toMatchObject(object: Object | Array): void, + toMatchObject(object: Object | Array): void; /** * Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object. */ - toStrictEqual(value: any): void, + toStrictEqual(value: any): void; /** * This ensures that an Object matches the most recent snapshot. */ - toMatchSnapshot(propertyMatchers?: any, name?: string): void, + toMatchSnapshot(propertyMatchers?: any, name?: string): void; /** * This ensures that an Object matches the most recent snapshot. */ - toMatchSnapshot(name: string): void, + toMatchSnapshot(name: string): void; - toMatchInlineSnapshot(snapshot?: string): void, - toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void, + toMatchInlineSnapshot(snapshot?: string): void; + toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void; /** * Use .toThrow to test that a function throws when it is called. * If you want to test that a specific error gets thrown, you can provide an @@ -732,14 +739,14 @@ interface JestExpectType { * * Alias: .toThrowError */ - toThrow(message?: string | Error | Class | RegExp): void, - toThrowError(message?: string | Error | Class | RegExp): void, + toThrow(message?: string | Error | Class | RegExp): void; + toThrowError(message?: string | Error | Class | RegExp): void; /** * Use .toThrowErrorMatchingSnapshot to test that a function throws a error * matching the most recent snapshot when it is called. */ - toThrowErrorMatchingSnapshot(): void, - toThrowErrorMatchingInlineSnapshot(snapshot?: string): void, + toThrowErrorMatchingSnapshot(): void; + toThrowErrorMatchingInlineSnapshot(snapshot?: string): void; } type JestObjectType = { @@ -780,6 +787,10 @@ type JestObjectType = { * Removes any pending timers from the timer system. */ clearAllTimers(): void, + /** + * Returns the number of fake timers still left to run. + */ + getTimerCount(): number, /** * The same as `mock` but not moved to the top of the expectation by * babel-jest. @@ -835,6 +846,14 @@ type JestObjectType = { * useful to isolate modules where local state might conflict between tests. */ resetModules(): JestObjectType, + + /** + * Creates a sandbox registry for the modules that are loaded inside the + * callback function. This is useful to isolate specific modules for every + * test so that local module state doesn't conflict between tests. + */ + isolateModules(fn: () => void): JestObjectType, + /** * Exhausts the micro-task queue (usually interfaced in node via * process.nextTick). @@ -893,16 +912,20 @@ type JestObjectType = { * Creates a mock function similar to jest.fn but also tracks calls to * object[methodName]. */ - spyOn(object: Object, methodName: string, accessType?: "get" | "set"): JestMockFn, + spyOn( + object: Object, + methodName: string, + accessType?: 'get' | 'set' + ): JestMockFn, /** * Set the default timeout interval for tests and before/after hooks in milliseconds. * Note: The default timeout interval is 5 seconds if this method is not called. */ - setTimeout(timeout: number): JestObjectType + setTimeout(timeout: number): JestObjectType, }; type JestSpyType = { - calls: JestCallsType + calls: JestCallsType, }; /** Runs this function after every test inside this context */ @@ -1006,6 +1029,13 @@ declare var it: { timeout?: number ): void, + /** + * Highlight planned tests in the summary output + * + * @param {String} Name of Test to do + */ + todo(name: string): void, + /** * Run the test concurrently * @@ -1088,7 +1118,7 @@ type JestPrettyFormatPlugin = { serialize: JestPrettyFormatPrint, indent: JestPrettyFormatIndent, opts: JestPrettyFormatOptions, - colors: JestPrettyFormatColors, + colors: JestPrettyFormatColors ) => string, test: any => boolean, }; @@ -1098,14 +1128,15 @@ type JestPrettyFormatPlugins = Array; /** The expect function is used every time you want to test a value */ declare var expect: { /** The object that you want to make assertions against */ - (value: any): - & JestExpectType - & JestPromiseType - & EnzymeMatchersType - & DomTestingLibraryType - & JestJQueryMatchersType - & JestStyledComponentsMatchersType - & JestExtendedMatchersType, + ( + value: any + ): JestExpectType & + JestPromiseType & + EnzymeMatchersType & + DomTestingLibraryType & + JestJQueryMatchersType & + JestStyledComponentsMatchersType & + JestExtendedMatchersType, /** Add additional Jasmine matchers to Jest's roster */ extend(matchers: { [name: string]: JestMatcher }): void, @@ -1151,5 +1182,5 @@ declare var jasmine: { methodNames: Array ): { [methodName: string]: JestSpyType }, objectContaining(value: Object): Object, - stringMatching(value: string): string + stringMatching(value: string): string, }; diff --git a/packages/cli/package.json b/packages/cli/package.json index a545eb4e8..fb4e5aca0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -24,7 +24,7 @@ "compression": "^1.7.1", "connect": "^3.6.5", "denodeify": "^1.2.1", - "envinfo": "^5.7.0", + "envinfo": "^7.1.0", "errorhandler": "^1.5.0", "escape-string-regexp": "^1.0.5", "execa": "^1.0.0", diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js new file mode 100644 index 000000000..9683acbae --- /dev/null +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -0,0 +1,29 @@ +// @flow +import info from '../info'; +import logger from '../../../tools/logger'; + +jest.mock('../../../tools/logger', () => ({ + info: jest.fn(), + error: jest.fn(), + log: jest.fn(), +})); + +const ctx = {reactNativePath: '', root: ''}; + +beforeEach(() => { + jest.resetAllMocks(); +}); + +test('prints output without arguments', async () => { + await info.func([], ctx, {}); + expect(logger.info).toHaveBeenCalledWith( + 'Fetching system and libraries information...', + ); + const output = (logger.log: any).mock.calls[0][0]; + // Checking on output that should be present on all OSes. + // TODO: move to e2e tests and adjust expectations to include npm packages + expect(output).toContain('System:'); + expect(output).toContain('Binaries:'); +}); + +test.todo('prints output with --packages'); diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index aef9b2e64..8d35f83c0 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -4,40 +4,29 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import envinfo from 'envinfo'; import logger from '../../tools/logger'; +import type {ContextT} from '../../tools/types.flow'; -const info = function getInfo(argv, ctx, options) { +const info = async function getInfo( + argv: Array, + ctx: ContextT, + options: {}, +) { try { - envinfo - .run( - { - System: ['OS', 'CPU', 'Memory', 'Shell'], - Binaries: ['Node', 'Yarn', 'npm', 'Watchman'], - IDEs: ['Xcode', 'Android Studio'], - SDKs: ['iOS SDK', 'Android SDK'], - npmPackages: - (typeof options.packages === 'string' && - !options.packages.includes('*')) || - !options.packages - ? ['react', 'react-native'].concat( - (options.packages || '').split(','), - ) - : options.packages, - npmGlobalPackages: '*react-native*', - }, - { - clipboard: !!options.clipboard, - title: 'React Native Environment Info', - }, - ) - .then(logger.info) - .catch(err => { - logger.error(`Unable to print environment info.\n${err}`); - }); + logger.info('Fetching system and libraries information...'); + const output = await envinfo.run({ + System: ['OS', 'CPU', 'Memory', 'Shell'], + Binaries: ['Node', 'Yarn', 'npm', 'Watchman'], + IDEs: ['Xcode', 'Android Studio'], + SDKs: ['iOS SDK', 'Android SDK'], + npmPackages: ['react', 'react-native', '@react-native-community/cli'], + npmGlobalPackages: '*react-native*', + }); + logger.log(output.trim()); } catch (err) { logger.error(`Unable to print environment info.\n${err}`); } @@ -46,35 +35,5 @@ const info = function getInfo(argv, ctx, options) { export default { name: 'info', description: 'Get relevant version info about OS, toolchain and libraries', - options: [ - { - command: '--packages [string]', - description: - 'Which packages from your package.json to include, in addition to the default React Native and React versions.', - }, - { - command: '--clipboard [boolean]', - description: - 'Automagically copy the environment report output to the clipboard', - }, - ], - examples: [ - { - desc: 'Get standard version info', - cmd: 'react-native info', - }, - { - desc: 'Get standard version info & specified package versions', - cmd: 'react-native info --packages jest,eslint', - }, - { - desc: 'Get standard version info & globbed package versions', - cmd: 'react-native info --packages "*react*"', - }, - { - desc: 'Get standard version info & all package versions', - cmd: 'react-native info --packages', - }, - ], func: info, }; diff --git a/yarn.lock b/yarn.lock index a9f2ce1a4..1b1a75700 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3083,9 +3083,10 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -envinfo@^5.7.0: - version "5.11.1" - resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-5.11.1.tgz#a1c2cb55196931b2ac6d4110fa7f0003697ad9df" +envinfo@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.1.0.tgz#c64f80bbf5faaafc962eef76c0d871c6c672eec0" + integrity sha512-38LJhrmyQafVInoYlaEDxomIfjtK+HUtp1JsInWdKtpxk0MlTU60fqYHg0LrKgxxJuq6H89ddw4IkxfQejZ77g== err-code@^1.0.0: version "1.1.2" From 43e37dd946a9296231577923c46435703295f015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 28 Mar 2019 17:18:23 +0100 Subject: [PATCH 043/234] chore: update deps to avoid security warnings (#270) Summary: --------- Upgrading deps. Test Plan: ---------- Green CI --- .eslintrc.js | 22 + package.json | 22 +- packages/cli/src/tools/isPackagerRunning.js | 19 +- yarn.lock | 2277 ++++++++++++------- 4 files changed, 1429 insertions(+), 911 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..aabf2157e --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,22 @@ +module.exports = { + extends: '@react-native-community', + env: { + node: true, + }, + rules: { + 'prettier/prettier': [2, 'fb'], + }, + settings: { + react: { + version: 'latest', + }, + }, + overrides: [ + { + files: ['**/__mocks__/**', '**/__fixtures__/**', 'testSetup.js'], + env: { + jest: true, + }, + }, + ], +}; diff --git a/package.json b/package.json index f1710c7a4..57046bfb0 100644 --- a/package.json +++ b/package.json @@ -19,34 +19,20 @@ "@babel/plugin-transform-strict-mode": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-flow": "^7.0.0", - "@react-native-community/eslint-config": "^0.0.2", - "babel-jest": "^24.0.0", + "@react-native-community/eslint-config": "^0.0.3", + "babel-jest": "^24.5.0", "chalk": "^2.4.2", "eslint": "^5.10.0", "execa": "^1.0.0", "flow-bin": "^0.95.1", "flow-typed": "^2.5.1", "glob": "^7.1.3", - "jest": "^24.0.0", - "lerna": "^3.10.6", + "jest": "^24.5.0", + "lerna": "^3.13.1", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", "string-length": "^2.0.0" }, - "eslintConfig": { - "extends": "@react-native-community", - "env": { - "es6": true, - "jest": true, - "node": true - }, - "rules": { - "prettier/prettier": [ - 2, - "fb" - ] - } - }, "jest": { "projects": [ "packages/*", diff --git a/packages/cli/src/tools/isPackagerRunning.js b/packages/cli/src/tools/isPackagerRunning.js index 97f92550d..393fdf817 100644 --- a/packages/cli/src/tools/isPackagerRunning.js +++ b/packages/cli/src/tools/isPackagerRunning.js @@ -4,28 +4,27 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import fetch from 'node-fetch'; /** * Indicates whether or not the packager is running. It returns a promise that - * when fulfilled can returns one out of these possible values: + * returns one of these possible values: * - `running`: the packager is running - * - `not_running`: the packager nor any process is running on the expected - * port. - * - `unrecognized`: one other process is running on the port we expect the - * packager to be running. + * - `not_running`: the packager nor any process is running on the expected port. + * - `unrecognized`: one other process is running on the port we expect the packager to be running. */ -function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || 8081) { +function isPackagerRunning( + packagerPort: string = process.env.RCT_METRO_PORT || '8081', +): Promise<'running' | 'not_running' | 'unrecognized'> { return fetch(`http://localhost:${packagerPort}/status`).then( res => res .text() - .then( - body => - body === 'packager-status:running' ? 'running' : 'unrecognized', + .then(body => + body === 'packager-status:running' ? 'running' : 'unrecognized', ), () => 'not_running', ); diff --git a/yarn.lock b/yarn.lock index 1b1a75700..9adb4ff67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -250,6 +250,11 @@ version "7.1.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.3.tgz#2c92469bac2b7fbff810b67fca07bd138b48af77" +"@babel/parser@^7.1.0": + version "7.4.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.2.tgz#b4521a400cb5a871eab3890787b4bc1326d38d91" + integrity sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g== + "@babel/parser@^7.1.5": version "7.1.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.5.tgz#20b7d5e7e1811ba996f8a868962ea7dd2bfcd2fc" @@ -1018,52 +1023,208 @@ lodash "^4.17.10" to-fast-properties "^2.0.0" -"@lerna/add@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.10.6.tgz#6f2c6b26eb905c40fef4180f3ffa34ad9dbb860b" - integrity sha512-FxQ5Bmyb5fF+3BQiNffM6cTeGCrl4uaAuGvxFIWF6Pgz6U14tUc1e16xgKDvVb1CurzJgIV5sLOT5xmCOqv1kA== +"@babel/types@^7.3.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.0.tgz#670724f77d24cce6cc7d8cf64599d511d164894c" + integrity sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.11" + to-fast-properties "^2.0.0" + +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + +"@jest/console@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.3.0.tgz#7bd920d250988ba0bf1352c4493a48e1cb97671e" + integrity sha512-NaCty/OOei6rSDcbPdMiCbYCI0KGFGPgGO6B09lwWt5QTxnkuhKYET9El5u5z1GAcSxkQmSMtM63e24YabCWqA== + dependencies: + "@jest/source-map" "^24.3.0" + "@types/node" "*" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.5.0.tgz#2cefc6a69e9ebcae1da8f7c75f8a257152ba1ec0" + integrity sha512-RDZArRzAs51YS7dXG1pbXbWGxK53rvUu8mCDYsgqqqQ6uSOaTjcVyBl2Jce0exT2rSLk38ca7az7t2f3b0/oYQ== + dependencies: + "@jest/console" "^24.3.0" + "@jest/reporters" "^24.5.0" + "@jest/test-result" "^24.5.0" + "@jest/transform" "^24.5.0" + "@jest/types" "^24.5.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.5.0" + jest-config "^24.5.0" + jest-haste-map "^24.5.0" + jest-message-util "^24.5.0" + jest-regex-util "^24.3.0" + jest-resolve-dependencies "^24.5.0" + jest-runner "^24.5.0" + jest-runtime "^24.5.0" + jest-snapshot "^24.5.0" + jest-util "^24.5.0" + jest-validate "^24.5.0" + jest-watcher "^24.5.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + pirates "^4.0.1" + realpath-native "^1.1.0" + rimraf "^2.5.4" + strip-ansi "^5.0.0" + +"@jest/environment@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.5.0.tgz#a2557f7808767abea3f9e4cc43a172122a63aca8" + integrity sha512-tzUHR9SHjMXwM8QmfHb/EJNbF0fjbH4ieefJBvtwO8YErLTrecc1ROj0uo2VnIT6SlpEGZnvdCK6VgKYBo8LsA== + dependencies: + "@jest/fake-timers" "^24.5.0" + "@jest/transform" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/node" "*" + jest-mock "^24.5.0" + +"@jest/fake-timers@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.5.0.tgz#4a29678b91fd0876144a58f8d46e6c62de0266f0" + integrity sha512-i59KVt3QBz9d+4Qr4QxsKgsIg+NjfuCjSOWj3RQhjF5JNy+eVJDhANQ4WzulzNCHd72srMAykwtRn5NYDGVraw== + dependencies: + "@jest/types" "^24.5.0" + "@types/node" "*" + jest-message-util "^24.5.0" + jest-mock "^24.5.0" + +"@jest/reporters@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.5.0.tgz#9363a210d0daa74696886d9cb294eb8b3ad9b4d9" + integrity sha512-vfpceiaKtGgnuC3ss5czWOihKOUSyjJA4M4udm6nH8xgqsuQYcyDCi4nMMcBKsHXWgz9/V5G7iisnZGfOh1w6Q== + dependencies: + "@jest/environment" "^24.5.0" + "@jest/test-result" "^24.5.0" + "@jest/transform" "^24.5.0" + "@jest/types" "^24.5.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-api "^2.1.1" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-source-maps "^3.0.1" + jest-haste-map "^24.5.0" + jest-resolve "^24.5.0" + jest-runtime "^24.5.0" + jest-util "^24.5.0" + jest-worker "^24.4.0" + node-notifier "^5.2.1" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" + integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.5.0.tgz#ab66fb7741a04af3363443084e72ea84861a53f2" + integrity sha512-u66j2vBfa8Bli1+o3rCaVnVYa9O8CAFZeqiqLVhnarXtreSXG33YQ6vNYBogT7+nYiFNOohTU21BKiHlgmxD5A== + dependencies: + "@jest/console" "^24.3.0" + "@jest/types" "^24.5.0" + "@types/istanbul-lib-coverage" "^1.1.0" + +"@jest/transform@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.5.0.tgz#6709fc26db918e6af63a985f2cc3c464b4cf99d9" + integrity sha512-XSsDz1gdR/QMmB8UCKlweAReQsZrD/DK7FuDlNo/pE8EcKMrfi2kqLRk8h8Gy/PDzgqJj64jNEzOce9pR8oj1w== dependencies: - "@lerna/bootstrap" "3.10.6" - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/npm-conf" "3.7.0" - "@lerna/validation-error" "3.6.0" + "@babel/core" "^7.1.0" + "@jest/types" "^24.5.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.5.0" + jest-regex-util "^24.3.0" + jest-util "^24.5.0" + micromatch "^3.1.10" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.5.0": + version "24.5.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.5.0.tgz#feee214a4d0167b0ca447284e95a57aa10b3ee95" + integrity sha512-kN7RFzNMf2R8UDadPOl6ReyI+MT8xfqRuAnuVL+i4gwjv/zubdDK+EDeLHYwq1j0CSSR2W/MmgaRlMZJzXdmVA== + dependencies: + "@types/istanbul-lib-coverage" "^1.1.0" + "@types/yargs" "^12.0.9" + +"@lerna/add@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.13.1.tgz#2cd7838857edb3b43ed73e3c21f69a20beb9b702" + integrity sha512-cXk42YbuhzEnADCK8Qte5laC9Qo03eJLVnr0qKY85jQUM/T4URe3IIUemqpg0CpVATrB+Vz+iNdeqw9ng1iALw== + dependencies: + "@lerna/bootstrap" "3.13.1" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/npm-conf" "3.13.0" + "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - libnpm "^2.0.1" + npm-package-arg "^6.1.0" p-map "^1.2.0" + pacote "^9.5.0" semver "^5.5.0" -"@lerna/batch-packages@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.10.6.tgz#2d6dfc9be13ea4da49244dd84bfcd46c3d62f4d0" - integrity sha512-sInr3ZQJFMh9Zq+ZUoVjX8R67j9ViRkVy0uEMsOfG+jZlXj1lRPRMPRiRgU0jXSYEwCdwuAB5pTd9tTx0VCJUw== - dependencies: - "@lerna/package-graph" "3.10.6" - "@lerna/validation-error" "3.6.0" - libnpm "^2.0.1" - -"@lerna/bootstrap@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.10.6.tgz#d250baa9cfe9026c4f78e6cf7c9761a90b24e363" - integrity sha512-qbGjAxRpV/eiI9CboUIpsPPGpSogs8mN2/iDaAUBTaWVFVz/YyU64nui84Gll0kbdaHOyPput+kk2S8NCSCCdg== - dependencies: - "@lerna/batch-packages" "3.10.6" - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/has-npm-version" "3.10.0" - "@lerna/npm-install" "3.10.0" - "@lerna/package-graph" "3.10.6" - "@lerna/pulse-till-done" "3.7.1" - "@lerna/rimraf-dir" "3.10.0" - "@lerna/run-lifecycle" "3.10.5" - "@lerna/run-parallel-batches" "3.0.0" - "@lerna/symlink-binary" "3.10.0" - "@lerna/symlink-dependencies" "3.10.0" - "@lerna/validation-error" "3.6.0" +"@lerna/batch-packages@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.13.0.tgz#697fde5be28822af9d9dca2f750250b90a89a000" + integrity sha512-TgLBTZ7ZlqilGnzJ3xh1KdAHcySfHytgNRTdG9YomfriTU6kVfp1HrXxKJYVGs7ClPUNt2CTFEOkw0tMBronjw== + dependencies: + "@lerna/package-graph" "3.13.0" + "@lerna/validation-error" "3.13.0" + npmlog "^4.1.2" + +"@lerna/bootstrap@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.13.1.tgz#f2edd7c8093c8b139e78b0ca5f845f23efd01f08" + integrity sha512-mKdi5Ds5f82PZwEFyB9/W60I3iELobi1i87sTeVrbJh/um7GvqpSPy7kG/JPxyOdMpB2njX6LiJgw+7b6BEPWw== + dependencies: + "@lerna/batch-packages" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/has-npm-version" "3.13.0" + "@lerna/npm-install" "3.13.0" + "@lerna/package-graph" "3.13.0" + "@lerna/pulse-till-done" "3.13.0" + "@lerna/rimraf-dir" "3.13.0" + "@lerna/run-lifecycle" "3.13.0" + "@lerna/run-parallel-batches" "3.13.0" + "@lerna/symlink-binary" "3.13.0" + "@lerna/symlink-dependencies" "3.13.0" + "@lerna/validation-error" "3.13.0" dedent "^0.7.0" get-port "^3.2.0" - libnpm "^2.0.1" multimatch "^2.1.0" + npm-package-arg "^6.1.0" + npmlog "^4.1.2" p-finally "^1.0.0" p-map "^1.2.0" p-map-series "^1.0.0" @@ -1071,124 +1232,127 @@ read-package-tree "^5.1.6" semver "^5.5.0" -"@lerna/changed@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.10.6.tgz#48fed2e6c890b39a71f1dac29e42a6f853956d71" - integrity sha512-nZDVq/sKdhgoAg1BVnpqjqUUz5+zedG+AnU+6mjEN2f23YVtRCsW55N4I9eEdW2pxXUaCY85Hj/HPSA74BYaFg== +"@lerna/changed@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.13.1.tgz#dc92476aad43c932fe741969bbd0bcf6146a4c52" + integrity sha512-BRXitEJGOkoudbxEewW7WhjkLxFD+tTk4PrYpHLyCBk63pNTWtQLRE6dc1hqwh4emwyGncoyW6RgXfLgMZgryw== dependencies: - "@lerna/collect-updates" "3.10.1" - "@lerna/command" "3.10.6" - "@lerna/listable" "3.10.6" - "@lerna/output" "3.6.0" - "@lerna/version" "3.10.6" + "@lerna/collect-updates" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/listable" "3.13.0" + "@lerna/output" "3.13.0" + "@lerna/version" "3.13.1" -"@lerna/check-working-tree@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.10.0.tgz#5ed9f2c5c942bee92afcd8cb5361be44ed0251e3" - integrity sha512-NdIPhDgEtGHfeGjB9F0oAoPLywgMpjnJhLLwTNQkelDHo2xNAVpG8kV+A2UJ+cU5UXCZA4RZFxKNmw86rO+Drw== +"@lerna/check-working-tree@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.13.0.tgz#1ddcd4d9b1aceb65efaaa4cd1333a66706d67c9c" + integrity sha512-dsdO15NXX5To+Q53SYeCrBEpiqv4m5VkaPZxbGQZNwoRen1MloXuqxSymJANQn+ZLEqarv5V56gydebeROPH5A== dependencies: - "@lerna/describe-ref" "3.10.0" - "@lerna/validation-error" "3.6.0" + "@lerna/describe-ref" "3.13.0" + "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.3.0.tgz#71184a763105b6c8ece27f43f166498d90fe680f" - integrity sha512-q2d/OPlNX/cBXB6Iz1932RFzOmOHq6ZzPjqebkINNaTojHWuuRpvJJY4Uz3NGpJ3kEtPDvBemkZqUBTSO5wb1g== +"@lerna/child-process@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.13.0.tgz#84e35adf3217a6983edd28080657b9596a052674" + integrity sha512-0iDS8y2jiEucD4fJHEzKoc8aQJgm7s+hG+0RmDNtfT0MM3n17pZnf5JOMtS1FJp+SEXOjMKQndyyaDIPFsnp6A== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.10.6.tgz#31e4a12a722e57ca7adc0c9bc30ba70d55572bb8" - integrity sha512-MuL8HOwnyvVtr6GOiAN/Ofjbx+BJdCrtjrM1Uuh8FFnbnZTPVf+0MPxL2jVzPMo0PmoIrX3fvlwvzKNk/lH0Ug== +"@lerna/clean@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.13.1.tgz#9a7432efceccd720a51da5c76f849fc59c5a14ce" + integrity sha512-myGIaXv7RUO2qCFZXvx8SJeI+eN6y9SUD5zZ4/LvNogbOiEIlujC5lUAqK65rAHayQ9ltSa/yK6Xv510xhZXZQ== dependencies: - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/prompt" "3.6.0" - "@lerna/pulse-till-done" "3.7.1" - "@lerna/rimraf-dir" "3.10.0" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/prompt" "3.13.0" + "@lerna/pulse-till-done" "3.13.0" + "@lerna/rimraf-dir" "3.13.0" p-map "^1.2.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" -"@lerna/cli@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.10.6.tgz#3ec601d18d0dbaefdee4668d81ce4c4a9488ecf7" - integrity sha512-GtmzJztjrcb5k1Qi/GKNs8xbQBgRpEBoPpt1Udgo23GkepVrQQo45QjM9hyqOhJ6LrV/lfXAv111kDBN/43jLw== +"@lerna/cli@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.13.0.tgz#3d7b357fdd7818423e9681a7b7f2abd106c8a266" + integrity sha512-HgFGlyCZbYaYrjOr3w/EsY18PdvtsTmDfpUQe8HwDjXlPeCCUgliZjXLOVBxSjiOvPeOSwvopwIHKWQmYbwywg== dependencies: - "@lerna/global-options" "3.10.6" + "@lerna/global-options" "3.13.0" dedent "^0.7.0" - libnpm "^2.0.1" + npmlog "^4.1.2" yargs "^12.0.1" -"@lerna/collect-updates@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.10.1.tgz#3ad60aa31826c0c0cfdf8bf41e58e6c5c86aeb3a" - integrity sha512-vb0wEJ8k63G+2CR/ud1WeVHNJ21Fs6Ew6lbdGZXnF4ZvaFWxWJZpoHeWwzjhMdJ75QdTzUaIhTG1hnH9faQNMw== +"@lerna/collect-updates@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.13.0.tgz#f0828d84ff959ff153d006765659ffc4d68cdefc" + integrity sha512-uR3u6uTzrS1p46tHQ/mlHog/nRJGBqskTHYYJbgirujxm6FqNh7Do+I1Q/7zSee407G4lzsNxZdm8IL927HemQ== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/describe-ref" "3.10.0" - libnpm "^2.0.1" + "@lerna/child-process" "3.13.0" + "@lerna/describe-ref" "3.13.0" minimatch "^3.0.4" + npmlog "^4.1.2" slash "^1.0.0" -"@lerna/command@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.10.6.tgz#709bd1c66220da67f65dbe1fc88bb7ba5bb85446" - integrity sha512-jPZswMZXOpAaIuSF5hrz+eaWQzbDrvwbrkCoRJKfiAHx7URAkE6MQe9DeAnqrTKMqwfg0RciSrZLc8kWYfrzCQ== +"@lerna/command@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.13.1.tgz#b60dda2c0d9ffbb6030d61ddf7cceedc1e8f7e6e" + integrity sha512-SYWezxX+iheWvzRoHCrbs8v5zHPaxAx3kWvZhqi70vuGsdOVAWmaG4IvHLn11ztS+Vpd5PM+ztBWSbnykpLFKQ== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/package-graph" "3.10.6" - "@lerna/project" "3.10.0" - "@lerna/validation-error" "3.6.0" - "@lerna/write-log-file" "3.6.0" + "@lerna/child-process" "3.13.0" + "@lerna/package-graph" "3.13.0" + "@lerna/project" "3.13.1" + "@lerna/validation-error" "3.13.0" + "@lerna/write-log-file" "3.13.0" dedent "^0.7.0" execa "^1.0.0" is-ci "^1.0.10" - libnpm "^2.0.1" lodash "^4.17.5" + npmlog "^4.1.2" -"@lerna/conventional-commits@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.10.0.tgz#284cc16bd3c387f841ff6bec42bcadaa2d13d8e4" - integrity sha512-8FvO0eR8g/tEgkb6eRVYaD39TsqMKsOXp17EV48jciciEqcrF/d1Ypu6ilK1GDp6R/1m2mbjt/b52a/qrO+xaw== +"@lerna/conventional-commits@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.13.0.tgz#877aa225ca34cca61c31ea02a5a6296af74e1144" + integrity sha512-BeAgcNXuocmLhPxnmKU2Vy8YkPd/Uo+vu2i/p3JGsUldzrPC8iF3IDxH7fuXpEFN2Nfogu7KHachd4tchtOppA== dependencies: - "@lerna/validation-error" "3.6.0" - conventional-changelog-angular "^5.0.2" - conventional-changelog-core "^3.1.5" + "@lerna/validation-error" "3.13.0" + conventional-changelog-angular "^5.0.3" + conventional-changelog-core "^3.1.6" conventional-recommended-bump "^4.0.4" fs-extra "^7.0.0" get-stream "^4.0.0" - libnpm "^2.0.1" + npm-package-arg "^6.1.0" + npmlog "^4.1.2" + pify "^3.0.0" semver "^5.5.0" -"@lerna/create-symlink@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.6.0.tgz#f1815cde2fc9d8d2315dfea44ee880f2f1bc65f1" - integrity sha512-YG3lTb6zylvmGqKU+QYA3ylSnoLn+FyLH5XZmUsD0i85R884+EyJJeHx/zUk+yrL2ZwHS4RBUgJfC24fqzgPoA== +"@lerna/create-symlink@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.13.0.tgz#e01133082fe040779712c960683cb3a272b67809" + integrity sha512-PTvg3jAAJSAtLFoZDsuTMv1wTOC3XYIdtg54k7uxIHsP8Ztpt+vlilY/Cni0THAqEMHvfiToel76Xdta4TU21Q== dependencies: cmd-shim "^2.0.2" fs-extra "^7.0.0" - libnpm "^2.0.1" + npmlog "^4.1.2" -"@lerna/create@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.10.6.tgz#85c7398cad912516c0ac6054a5c0c4145ab6cadb" - integrity sha512-OddQtGBHM2/eJONggLWoTE6275XGbnJ6dIVF+fLsKS93o4GC6g+qcc6Y7lUWHm5bfpeOwNOVKwj0tvqBZ6MgoA== +"@lerna/create@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.13.1.tgz#2c1284cfdc59f0d2b88286d78bc797f4ab330f79" + integrity sha512-pLENMXgTkQuvKxAopjKeoLOv9fVUCnpTUD7aLrY5d95/1xqSZlnsOcQfUYcpMf3GpOvHc8ILmI5OXkPqjAf54g== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/command" "3.10.6" - "@lerna/npm-conf" "3.7.0" - "@lerna/validation-error" "3.6.0" - camelcase "^4.1.0" + "@lerna/child-process" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/npm-conf" "3.13.0" + "@lerna/validation-error" "3.13.0" + camelcase "^5.0.0" dedent "^0.7.0" fs-extra "^7.0.0" globby "^8.0.1" init-package-json "^1.10.3" - libnpm "^2.0.1" + npm-package-arg "^6.1.0" p-reduce "^1.0.0" + pacote "^9.5.0" pify "^3.0.0" semver "^5.5.0" slash "^1.0.0" @@ -1196,404 +1360,427 @@ validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.10.0.tgz#266380feece6013ab9674f52bd35bf0be5b0460d" - integrity sha512-fouh3FQS07QxJJp/mW8LkGnH0xMRAzpBlejtZaiRwfDkW2kd6EuHaj8I/2/p21Wsprcvuu4dqmyia2YS1xFb/w== - dependencies: - "@lerna/child-process" "3.3.0" - libnpm "^2.0.1" - -"@lerna/diff@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.10.6.tgz#b4c5a50d8c7e79619376e2c913ec1c627dfd0cdf" - integrity sha512-0MqFhosjrqsIdXiKIu7t3CiJELqiU9mkjFBhYPB7JruAzpPwjMXJnC6/Ur5/7LXJYYVpqGQwZI9ZaZlOYJhhrw== - dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/command" "3.10.6" - "@lerna/validation-error" "3.6.0" - libnpm "^2.0.1" - -"@lerna/exec@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.10.6.tgz#5564b614b7e39c1f034f5e0736c9e020945f2f12" - integrity sha512-cdHqaRBMYceJu8rZLO8b4ZeR27O+xKPHgzi13OOOfBJQjrTuacjMWyHgmpy8jWc/0f7QnTl4VsHks7VJ3UK+vw== - dependencies: - "@lerna/batch-packages" "3.10.6" - "@lerna/child-process" "3.3.0" - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/run-parallel-batches" "3.0.0" - "@lerna/validation-error" "3.6.0" - -"@lerna/filter-options@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.10.6.tgz#e05a8b8de6efc16c47c83f0ac58291008efba4b8" - integrity sha512-r/dQbqN+RGFKZNn+DyWehswFmAkny/fkdMB2sRM2YVe7zRTtSl95YxD9DtdYnpJTG/jbOVICS/L5QJakrI6SSw== - dependencies: - "@lerna/collect-updates" "3.10.1" - "@lerna/filter-packages" "3.10.0" +"@lerna/describe-ref@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.13.0.tgz#fb4c3863fd6bcccad67ce7b183887a5fc1942bb6" + integrity sha512-UJefF5mLxLae9I2Sbz5RLYGbqbikRuMqdgTam0MS5OhXnyuuKYBUpwBshCURNb1dPBXTQhSwc7+oUhORx8ojCg== + dependencies: + "@lerna/child-process" "3.13.0" + npmlog "^4.1.2" + +"@lerna/diff@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.13.1.tgz#5c734321b0f6c46a3c87f55c99afef3b01d46520" + integrity sha512-cKqmpONO57mdvxtp8e+l5+tjtmF04+7E+O0QEcLcNUAjC6UR2OSM77nwRCXDukou/1h72JtWs0jjcdYLwAmApg== + dependencies: + "@lerna/child-process" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/validation-error" "3.13.0" + npmlog "^4.1.2" + +"@lerna/exec@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.13.1.tgz#4439e90fb0877ec38a6ef933c86580d43eeaf81b" + integrity sha512-I34wEP9lrAqqM7tTXLDxv/6454WFzrnXDWpNDbiKQiZs6SIrOOjmm6I4FiQsx+rU3o9d+HkC6tcUJRN5mlJUgA== + dependencies: + "@lerna/batch-packages" "3.13.0" + "@lerna/child-process" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/run-parallel-batches" "3.13.0" + "@lerna/validation-error" "3.13.0" + +"@lerna/filter-options@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.13.0.tgz#976e3d8b9fcd47001ab981d276565c1e9f767868" + integrity sha512-SRp7DCo9zrf+7NkQxZMkeyO1GRN6GICoB9UcBAbXhLbWisT37Cx5/6+jh49gYB63d/0/WYHSEPMlheUrpv1Srw== + dependencies: + "@lerna/collect-updates" "3.13.0" + "@lerna/filter-packages" "3.13.0" dedent "^0.7.0" -"@lerna/filter-packages@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.10.0.tgz#75f9a08184fc4046da2057e0218253cd6f493f05" - integrity sha512-3Acdj+jbany6LnQSuImU4ttcK5ULHSVug8Gh/EvwTewKCDpHAuoI3eyuzZOnSBdMvDOjE03uIESQK0dNNsn6Ow== +"@lerna/filter-packages@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.13.0.tgz#f5371249e7e1a15928e5e88c544a242e0162c21c" + integrity sha512-RWiZWyGy3Mp7GRVBn//CacSnE3Kw82PxE4+H6bQ3pDUw/9atXn7NRX+gkBVQIYeKamh7HyumJtyOKq3Pp9BADQ== dependencies: - "@lerna/validation-error" "3.6.0" - libnpm "^2.0.1" + "@lerna/validation-error" "3.13.0" multimatch "^2.1.0" + npmlog "^4.1.2" -"@lerna/get-npm-exec-opts@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-3.6.0.tgz#ea595eb28d1f34ba61a92ee8391f374282b4b76e" - integrity sha512-ruH6KuLlt75aCObXfUIdVJqmfVq7sgWGq5mXa05vc1MEqxTIiU23YiJdWzofQOOUOACaZkzZ4K4Nu7wXEg4Xgg== +"@lerna/get-npm-exec-opts@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-3.13.0.tgz#d1b552cb0088199fc3e7e126f914e39a08df9ea5" + integrity sha512-Y0xWL0rg3boVyJk6An/vurKzubyJKtrxYv2sj4bB8Mc5zZ3tqtv0ccbOkmkXKqbzvNNF7VeUt1OJ3DRgtC/QZw== dependencies: - libnpm "^2.0.1" + npmlog "^4.1.2" -"@lerna/get-packed@3.7.0": - version "3.7.0" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.7.0.tgz#549c7738f7be5e3b1433e82ed9cda9123bcd1ed5" - integrity sha512-yuFtjsUZIHjeIvIYQ/QuytC+FQcHwo3peB+yGBST2uWCLUCR5rx6knoQcPzbxdFDCuUb5IFccFGd3B1fHFg3RQ== +"@lerna/get-packed@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.13.0.tgz#335e40d77f3c1855aa248587d3e0b2d8f4b06e16" + integrity sha512-EgSim24sjIjqQDC57bgXD9l22/HCS93uQBbGpkzEOzxAVzEgpZVm7Fm1t8BVlRcT2P2zwGnRadIvxTbpQuDPTg== dependencies: fs-extra "^7.0.0" ssri "^6.0.1" tar "^4.4.8" -"@lerna/global-options@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.10.6.tgz#c491a64b0be47eca4ffc875011958a5ee70a9a3e" - integrity sha512-k5Xkq1M/uREFC2R9uwN5gcvIgjj4iOXo0YyeEXCMWBiW3j2GL9xN4d1MmAIcrYlAzVYh6kLlWaFWl/rNIneHIw== +"@lerna/github-client@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.13.1.tgz#cb9bf9f01685a0cee0fac63f287f6c3673e45aa3" + integrity sha512-iPLUp8FFoAKGURksYEYZzfuo9TRA+NepVlseRXFaWlmy36dCQN20AciINpoXiXGoHcEUHXUKHQvY3ARFdMlf3w== + dependencies: + "@lerna/child-process" "3.13.0" + "@octokit/plugin-enterprise-rest" "^2.1.1" + "@octokit/rest" "^16.16.0" + git-url-parse "^11.1.2" + npmlog "^4.1.2" + +"@lerna/global-options@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" + integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.10.0.tgz#d3a73c0fedd2f2e9c6fbe166c41809131dc939d2" - integrity sha512-N4RRYxGeivuaKgPDzrhkQOQs1Sg4tOnxnEe3akfqu1wDA4Ng5V6Y2uW3DbkAjFL3aNJhWF5Vbf7sBsGtfgDQ8w== +"@lerna/has-npm-version@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.13.0.tgz#6e1f7e9336cce3e029066f0175f06dd9d51ad09f" + integrity sha512-Oqu7DGLnrMENPm+bPFGOHnqxK8lCnuYr6bk3g/CoNn8/U0qgFvHcq6Iv8/Z04TsvleX+3/RgauSD2kMfRmbypg== dependencies: - "@lerna/child-process" "3.3.0" + "@lerna/child-process" "3.13.0" semver "^5.5.0" -"@lerna/import@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.10.6.tgz#36b65854857e8ab5dfd98a1caea4d365ecc06578" - integrity sha512-LlGxhfDhovoNoBJLF3PYd3j/G2GFTnfLh0V38+hBQ6lomMNJbjkACfiLVomQxPWWpYLk0GTlpWYR8YGv6L7Ifw== +"@lerna/import@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.13.1.tgz#69d641341a38b79bd379129da1c717d51dd728c7" + integrity sha512-A1Vk1siYx1XkRl6w+zkaA0iptV5TIynVlHPR9S7NY0XAfhykjztYVvwtxarlh6+VcNrO9We6if0+FXCrfDEoIg== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/command" "3.10.6" - "@lerna/prompt" "3.6.0" - "@lerna/pulse-till-done" "3.7.1" - "@lerna/validation-error" "3.6.0" + "@lerna/child-process" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/prompt" "3.13.0" + "@lerna/pulse-till-done" "3.13.0" + "@lerna/validation-error" "3.13.0" dedent "^0.7.0" fs-extra "^7.0.0" p-map-series "^1.0.0" -"@lerna/init@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.10.6.tgz#b5c5166b2ddf00ea0f2742a1f53f59221478cf9a" - integrity sha512-RIlEx+ofWLYRNjxCkkV3G0XQPM+/KA5RXRDb5wKQLYO1f+tZAaHoUh8fHDIvxGf/ohY/OIjYYGSsU+ysimfwiQ== +"@lerna/init@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.13.1.tgz#0392c822abb3d63a75be4916c5e761cfa7b34dda" + integrity sha512-M59WACqim8WkH5FQEGOCEZ89NDxCKBfFTx4ZD5ig3LkGyJ8RdcJq5KEfpW/aESuRE9JrZLzVr0IjKbZSxzwEMA== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/command" "3.10.6" + "@lerna/child-process" "3.13.0" + "@lerna/command" "3.13.1" fs-extra "^7.0.0" p-map "^1.2.0" write-json-file "^2.3.0" -"@lerna/link@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.10.6.tgz#4201cabbfc27bebaf1a400f8cfbd238f285dd3c7" - integrity sha512-dwD6qftRWitgLDYbqtDrgO7c8uF5C0fHVew5M6gU5m9tBJidqd7cDwHv/bXboLEI63U7tt5y6LY+wEpYUFsBRw== +"@lerna/link@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.13.1.tgz#7d8ed4774bfa198d1780f790a14abb8722a3aad1" + integrity sha512-N3h3Fj1dcea+1RaAoAdy4g2m3fvU7m89HoUn5X/Zcw5n2kPoK8kTO+NfhNAatfRV8VtMXst8vbNrWQQtfm0FFw== dependencies: - "@lerna/command" "3.10.6" - "@lerna/package-graph" "3.10.6" - "@lerna/symlink-dependencies" "3.10.0" + "@lerna/command" "3.13.1" + "@lerna/package-graph" "3.13.0" + "@lerna/symlink-dependencies" "3.13.0" p-map "^1.2.0" slash "^1.0.0" -"@lerna/list@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.10.6.tgz#7c43c09301ea01528f4dab3b22666f021e8ba9a5" - integrity sha512-3ElQBj2dOB4uUkpsjC1bxdeZwEzRBuV1pBBs5E1LncwsZf7D9D99Z32fuZsDaCHpEMgHAD4/j8juI3/7m5dkaQ== +"@lerna/list@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.13.1.tgz#f9513ed143e52156c10ada4070f903c5847dcd10" + integrity sha512-635iRbdgd9gNvYLLIbYdQCQLr+HioM5FGJLFS0g3DPGygr6iDR8KS47hzCRGH91LU9NcM1mD1RoT/AChF+QbiA== dependencies: - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/listable" "3.10.6" - "@lerna/output" "3.6.0" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/listable" "3.13.0" + "@lerna/output" "3.13.0" -"@lerna/listable@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.10.6.tgz#cea92de89d9f293c6d63e00be662bed03f85c496" - integrity sha512-F7ZuvesSgeuMiJf99eOum5p1MQGQStykcmHH1ek+LQRMiGGF1o3PkBxPvHTZBADGOFarek8bFA5TVmRAMX7NIw== +"@lerna/listable@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.13.0.tgz#babc18442c590b549cf0966d20d75fea066598d4" + integrity sha512-liYJ/WBUYP4N4MnSVZuLUgfa/jy3BZ02/1Om7xUY09xGVSuNVNEeB8uZUMSC+nHqFHIsMPZ8QK9HnmZb1E/eTA== dependencies: - "@lerna/batch-packages" "3.10.6" + "@lerna/batch-packages" "3.13.0" chalk "^2.3.1" columnify "^1.5.4" -"@lerna/log-packed@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.6.0.tgz#bed96c2bdd47f076d9957d0c6069b2edc1518145" - integrity sha512-T/J41zMkzpWB5nbiTRS5PmYTFn74mJXe6RQA2qhkdLi0UqnTp97Pux1loz3jsJf2yJtiQUnyMM7KuKIAge0Vlw== +"@lerna/log-packed@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.13.0.tgz#497b5f692a8d0e3f669125da97b0dadfd9e480f3" + integrity sha512-Rmjrcz+6aM6AEcEVWmurbo8+AnHOvYtDpoeMMJh9IZ9SmZr2ClXzmD7wSvjTQc8BwOaiWjjC/ukcT0UYA2m7wg== dependencies: byte-size "^4.0.3" columnify "^1.5.4" has-unicode "^2.0.1" - libnpm "^2.0.1" + npmlog "^4.1.2" -"@lerna/npm-conf@3.7.0": - version "3.7.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.7.0.tgz#f101d4fdf07cefcf1161bcfaf3c0f105b420a450" - integrity sha512-+WSMDfPKcKzMfqq283ydz9RRpOU6p9wfx0wy4hVSUY/6YUpsyuk8SShjcRtY8zTM5AOrxvFBuuV90H4YpZ5+Ng== +"@lerna/npm-conf@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.13.0.tgz#6b434ed75ff757e8c14381b9bbfe5d5ddec134a7" + integrity sha512-Jg2kANsGnhg+fbPEzE0X9nX5oviEAvWj0nYyOkcE+cgWuT7W0zpnPXC4hA4C5IPQGhwhhh0IxhWNNHtjTuw53g== dependencies: config-chain "^1.1.11" pify "^3.0.0" -"@lerna/npm-dist-tag@3.8.5": - version "3.8.5" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.8.5.tgz#5ce22a72576badc8cb6baf85550043d63e66ea44" - integrity sha512-VO57yKTB4NC2LZuTd4w0LmlRpoFm/gejQ1gqqLGzSJuSZaBXmieElFovzl21S07cqiy7FNVdz75x7/a6WCZ6XA== +"@lerna/npm-dist-tag@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.13.0.tgz#49ecbe0e82cbe4ad4a8ea6de112982bf6c4e6cd4" + integrity sha512-mcuhw34JhSRFrbPn0vedbvgBTvveG52bR2lVE3M3tfE8gmR/cKS/EJFO4AUhfRKGCTFn9rjaSEzlFGYV87pemQ== dependencies: figgy-pudding "^3.5.1" - libnpm "^2.0.1" + npm-package-arg "^6.1.0" + npm-registry-fetch "^3.9.0" + npmlog "^4.1.2" -"@lerna/npm-install@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.10.0.tgz#fcd6688a3a2cd0e702a03c54c22eb7ae8b3dacb0" - integrity sha512-/6/XyLY9/4jaMPBOVYUr4wZxQURIfwoELY0qCQ8gZ5zv4cOiFiiCUxZ0i4fxqFtD7nJ084zq1DsZW0aH0CIWYw== +"@lerna/npm-install@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.13.0.tgz#88f4cc39f4f737c8a8721256b915ea1bcc6a7227" + integrity sha512-qNyfts//isYQxore6fsPorNYJmPVKZ6tOThSH97tP0aV91zGMtrYRqlAoUnDwDdAjHPYEM16hNujg2wRmsqqIw== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/get-npm-exec-opts" "3.6.0" + "@lerna/child-process" "3.13.0" + "@lerna/get-npm-exec-opts" "3.13.0" fs-extra "^7.0.0" - libnpm "^2.0.1" + npm-package-arg "^6.1.0" + npmlog "^4.1.2" signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.10.5": - version "3.10.5" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.10.5.tgz#b2eb47cd7f3d1cdbfe32a13140017348ffe0e204" - integrity sha512-6wpgTfu5A5jJeB8RnH2n01HzfaB4Y9aKC0Tq0AAkw37PZ12LTgEL9I+ZZPqhUVFIFLB8/Ekpnj3AcKznJLG5xQ== +"@lerna/npm-publish@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.13.0.tgz#5c74808376e778865ffdc5885fe83935e15e60c3" + integrity sha512-y4WO0XTaf9gNRkI7as6P2ItVDOxmYHwYto357fjybcnfXgMqEA94c3GJ++jU41j0A9vnmYC6/XxpTd9sVmH9tA== dependencies: - "@lerna/run-lifecycle" "3.10.5" + "@lerna/run-lifecycle" "3.13.0" figgy-pudding "^3.5.1" fs-extra "^7.0.0" - libnpm "^2.0.1" + libnpmpublish "^1.1.1" + npmlog "^4.1.2" + pify "^3.0.0" + read-package-json "^2.0.13" -"@lerna/npm-run-script@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.10.0.tgz#49a9204eddea136da15a8d8d9eba2c3175b77ddd" - integrity sha512-c21tBXLF1Wje4tx/Td9jKIMrlZo/8QQiyyadjdKpwyyo7orSMsVNXGyJwvZ4JVVDcwC3GPU6HQvkt63v7rcyaw== +"@lerna/npm-run-script@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.13.0.tgz#e5997f045402b9948bdc066033ebb36bf94fc9e4" + integrity sha512-hiL3/VeVp+NFatBjkGN8mUdX24EfZx9rQlSie0CMgtjc7iZrtd0jCguLomSCRHYjJuvqgbp+LLYo7nHVykfkaQ== dependencies: - "@lerna/child-process" "3.3.0" - "@lerna/get-npm-exec-opts" "3.6.0" - libnpm "^2.0.1" + "@lerna/child-process" "3.13.0" + "@lerna/get-npm-exec-opts" "3.13.0" + npmlog "^4.1.2" -"@lerna/output@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/output/-/output-3.6.0.tgz#a69384bc685cf3b21aa1bfc697eb2b9db3333d0b" - integrity sha512-9sjQouf6p7VQtVCRnzoTGlZyURd48i3ha3WBHC/UBJnHZFuXMqWVPKNuvnMf2kRXDyoQD+2mNywpmEJg5jOnRg== +"@lerna/output@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/output/-/output-3.13.0.tgz#3ded7cc908b27a9872228a630d950aedae7a4989" + integrity sha512-7ZnQ9nvUDu/WD+bNsypmPG5MwZBwu86iRoiW6C1WBuXXDxM5cnIAC1m2WxHeFnjyMrYlRXM9PzOQ9VDD+C15Rg== dependencies: - libnpm "^2.0.1" + npmlog "^4.1.2" -"@lerna/pack-directory@3.10.5": - version "3.10.5" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.10.5.tgz#9bdabceacb74e1f54e47bae925e193978f2aae51" - integrity sha512-Ulj24L9XdgjJIxBr6ZjRJEoBULVH3c10lqunUdW41bswXhzhirRtQIxv0+5shngNjDwgMmJfOBcuCVKPSez4tg== +"@lerna/pack-directory@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.13.1.tgz#5ad4d0945f86a648f565e24d53c1e01bb3a912d1" + integrity sha512-kXnyqrkQbCIZOf1054N88+8h0ItC7tUN5v9ca/aWpx298gsURpxUx/1TIKqijL5TOnHMyIkj0YJmnH/PyBVLKA== dependencies: - "@lerna/get-packed" "3.7.0" - "@lerna/package" "3.7.2" - "@lerna/run-lifecycle" "3.10.5" + "@lerna/get-packed" "3.13.0" + "@lerna/package" "3.13.0" + "@lerna/run-lifecycle" "3.13.0" figgy-pudding "^3.5.1" - libnpm "^2.0.1" - npm-packlist "^1.1.12" + npm-packlist "^1.4.1" + npmlog "^4.1.2" tar "^4.4.8" temp-write "^3.4.0" -"@lerna/package-graph@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.10.6.tgz#8940d1ed7003100117cb1b618f7690585c00db81" - integrity sha512-mpIOJbhi+xLqT9BcUrLVD4We8WUdousQf/QndbEWl8DWAW1ethtRHVsCm9ufdBB3F9nj4PH/hqnDWWwqE+rS4w== +"@lerna/package-graph@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.13.0.tgz#607062f8d2ce22b15f8d4a0623f384736e67f760" + integrity sha512-3mRF1zuqFE1HEFmMMAIggXy+f+9cvHhW/jzaPEVyrPNLKsyfJQtpTNzeI04nfRvbAh+Gd2aNksvaW/w3xGJnnw== dependencies: - "@lerna/validation-error" "3.6.0" - libnpm "^2.0.1" + "@lerna/validation-error" "3.13.0" + npm-package-arg "^6.1.0" semver "^5.5.0" -"@lerna/package@3.7.2": - version "3.7.2" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.7.2.tgz#03c69fd7fb965c372c8c969165a2f7d6dfe2dfcb" - integrity sha512-8A5hN2CekM1a0Ix4VUO/g+REo+MsnXb8lnQ0bGjr1YGWzSL5NxYJ0Z9+0pwTfDpvRDYlFYO0rMVwBUW44b4dUw== +"@lerna/package@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.13.0.tgz#4baeebc49a57fc9b31062cc59f5ee38384429fc8" + integrity sha512-kSKO0RJQy093BufCQnkhf1jB4kZnBvL7kK5Ewolhk5gwejN+Jofjd8DGRVUDUJfQ0CkW1o6GbUeZvs8w8VIZDg== dependencies: - libnpm "^2.0.1" load-json-file "^4.0.0" + npm-package-arg "^6.1.0" write-pkg "^3.1.0" -"@lerna/project@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.10.0.tgz#98272bf2eb93e9b21850edae568d696bf7fdebda" - integrity sha512-9QRl8aGHuyU4zVEELQmNPnJTlS7XHqX7w9I9isCXdnilKc2R0MyvUs21lj6Yyt6xTuQnqD158TR9tbS4QufYQQ== +"@lerna/project@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.13.1.tgz#bce890f60187bd950bcf36c04b5260642e295e79" + integrity sha512-/GoCrpsCCTyb9sizk1+pMBrIYchtb+F1uCOn3cjn9yenyG/MfYEnlfrbV5k/UDud0Ei75YBLbmwCbigHkAKazQ== dependencies: - "@lerna/package" "3.7.2" - "@lerna/validation-error" "3.6.0" - cosmiconfig "^5.0.2" + "@lerna/package" "3.13.0" + "@lerna/validation-error" "3.13.0" + cosmiconfig "^5.1.0" dedent "^0.7.0" dot-prop "^4.2.0" glob-parent "^3.1.0" globby "^8.0.1" - libnpm "^2.0.1" load-json-file "^4.0.0" + npmlog "^4.1.2" p-map "^1.2.0" resolve-from "^4.0.0" write-json-file "^2.3.0" -"@lerna/prompt@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.6.0.tgz#b17cc464dec9d830619723e879dc747367378217" - integrity sha512-nyAjPMolJ/ZRAAVcXrUH89C4n1SiWvLh4xWNvWYKLcf3PI5yges35sDFP/HYrM4+cEbkNFuJCRq6CxaET4PRsg== +"@lerna/prompt@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.13.0.tgz#53571462bb3f5399cc1ca6d335a411fe093426a5" + integrity sha512-P+lWSFokdyvYpkwC3it9cE0IF2U5yy2mOUbGvvE4iDb9K7TyXGE+7lwtx2thtPvBAfIb7O13POMkv7df03HJeA== dependencies: inquirer "^6.2.0" - libnpm "^2.0.1" - -"@lerna/publish@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.10.6.tgz#bebd0d8fd820e1e63f6e9e6673aa41e9c4c61b3b" - integrity sha512-Wrmgf82rtZWdHSrTzZGOi1/QbkPJduUSmVMhZsdnLC814WHrNGYKbayvFBOo1RAAJ4EKggZ2ReOWXKhg/IZYUw== - dependencies: - "@lerna/batch-packages" "3.10.6" - "@lerna/check-working-tree" "3.10.0" - "@lerna/child-process" "3.3.0" - "@lerna/collect-updates" "3.10.1" - "@lerna/command" "3.10.6" - "@lerna/describe-ref" "3.10.0" - "@lerna/log-packed" "3.6.0" - "@lerna/npm-conf" "3.7.0" - "@lerna/npm-dist-tag" "3.8.5" - "@lerna/npm-publish" "3.10.5" - "@lerna/output" "3.6.0" - "@lerna/pack-directory" "3.10.5" - "@lerna/prompt" "3.6.0" - "@lerna/pulse-till-done" "3.7.1" - "@lerna/run-lifecycle" "3.10.5" - "@lerna/run-parallel-batches" "3.0.0" - "@lerna/validation-error" "3.6.0" - "@lerna/version" "3.10.6" + npmlog "^4.1.2" + +"@lerna/publish@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.13.1.tgz#217e401dcb5824cdd6d36555a36303fb7520c514" + integrity sha512-KhCJ9UDx76HWCF03i5TD7z5lX+2yklHh5SyO8eDaLptgdLDQ0Z78lfGj3JhewHU2l46FztmqxL/ss0IkWHDL+g== + dependencies: + "@lerna/batch-packages" "3.13.0" + "@lerna/check-working-tree" "3.13.0" + "@lerna/child-process" "3.13.0" + "@lerna/collect-updates" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/describe-ref" "3.13.0" + "@lerna/log-packed" "3.13.0" + "@lerna/npm-conf" "3.13.0" + "@lerna/npm-dist-tag" "3.13.0" + "@lerna/npm-publish" "3.13.0" + "@lerna/output" "3.13.0" + "@lerna/pack-directory" "3.13.1" + "@lerna/prompt" "3.13.0" + "@lerna/pulse-till-done" "3.13.0" + "@lerna/run-lifecycle" "3.13.0" + "@lerna/run-parallel-batches" "3.13.0" + "@lerna/validation-error" "3.13.0" + "@lerna/version" "3.13.1" figgy-pudding "^3.5.1" fs-extra "^7.0.0" - libnpm "^2.0.1" + libnpmaccess "^3.0.1" + npm-package-arg "^6.1.0" + npm-registry-fetch "^3.9.0" + npmlog "^4.1.2" p-finally "^1.0.0" p-map "^1.2.0" p-pipe "^1.2.0" p-reduce "^1.0.0" + pacote "^9.5.0" semver "^5.5.0" -"@lerna/pulse-till-done@3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@lerna/pulse-till-done/-/pulse-till-done-3.7.1.tgz#a9e55380fa18f6896a3e5b23621a4227adfb8f85" - integrity sha512-MzpesZeW3Mc+CiAq4zUt9qTXI9uEBBKrubYHE36voQTSkHvu/Rox6YOvfUr+U7P6k8frFPeCgGpfMDTLhiqe6w== +"@lerna/pulse-till-done@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/pulse-till-done/-/pulse-till-done-3.13.0.tgz#c8e9ce5bafaf10d930a67d7ed0ccb5d958fe0110" + integrity sha512-1SOHpy7ZNTPulzIbargrgaJX387csN7cF1cLOGZiJQA6VqnS5eWs2CIrG8i8wmaUavj2QlQ5oEbRMVVXSsGrzA== dependencies: - libnpm "^2.0.1" + npmlog "^4.1.2" -"@lerna/resolve-symlink@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.6.0.tgz#985344796b704ff32afa923901e795e80741b86e" - integrity sha512-TVOAEqHJSQVhNDMFCwEUZPaOETqHDQV1TQWQfC8ZlOqyaUQ7veZUbg0yfG7RPNzlSpvF0ZaGFeR0YhYDAW03GA== +"@lerna/resolve-symlink@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" + integrity sha512-Lc0USSFxwDxUs5JvIisS8JegjA6SHSAWJCMvi2osZx6wVRkEDlWG2B1JAfXUzCMNfHoZX0/XX9iYZ+4JIpjAtg== dependencies: fs-extra "^7.0.0" - libnpm "^2.0.1" + npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.10.0.tgz#2d9435054ab7bbc5519db0a2654c5d8cacd27f98" - integrity sha512-RSKSfxPURc58ERCD/PuzorR86lWEvIWNclXYGvIYM76yNGrWiDF44pGHQvB4J+Lxa5M+52ZtZC/eOC7A7YCH4g== +"@lerna/rimraf-dir@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.13.0.tgz#bb1006104b4aabcb6985624273254648f872b278" + integrity sha512-kte+pMemulre8cmPqljxIYjCmdLByz8DgHBHXB49kz2EiPf8JJ+hJFt0PzEubEyJZ2YE2EVAx5Tv5+NfGNUQyQ== dependencies: - "@lerna/child-process" "3.3.0" - libnpm "^2.0.1" + "@lerna/child-process" "3.13.0" + npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.10.5": - version "3.10.5" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.10.5.tgz#ea4422bb70c0f8d4382ecb2a626c8ba0ca88550b" - integrity sha512-YPmXviaxVlhcKM6IkDTIpTq24mxOuMCilo+MTr1RLoafgB9ZTmP2AHRiFt/sy14wOsq2Zqr0wJyj8KFlDYLTkA== +"@lerna/run-lifecycle@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.13.0.tgz#d8835ee83425edee40f687a55f81b502354d3261" + integrity sha512-oyiaL1biZdjpmjh6X/5C4w07wNFyiwXSSHH5GQB4Ay4BPwgq9oNhCcxRoi0UVZlZ1YwzSW8sTwLgj8emkIo3Yg== dependencies: - "@lerna/npm-conf" "3.7.0" + "@lerna/npm-conf" "3.13.0" figgy-pudding "^3.5.1" - libnpm "^2.0.1" + npm-lifecycle "^2.1.0" + npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.0.0.tgz#468704934084c74991d3124d80607857d4dfa840" - integrity sha512-Mj1ravlXF7AkkewKd9YFq9BtVrsStNrvVLedD/b2wIVbNqcxp8lS68vehXVOzoL/VWNEDotvqCQtyDBilCodGw== +"@lerna/run-parallel-batches@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.13.0.tgz#0276bb4e7cd0995297db82d134ca2bd08d63e311" + integrity sha512-bICFBR+cYVF1FFW+Tlm0EhWDioTUTM6dOiVziDEGE1UZha1dFkMYqzqdSf4bQzfLS31UW/KBd/2z8jy2OIjEjg== dependencies: p-map "^1.2.0" p-map-series "^1.0.0" -"@lerna/run@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.10.6.tgz#4c159a719b0ec010409dfe8f9535c9a3c3f3e06a" - integrity sha512-KS2lWbu/8WUUscQPi9U8sPO6yYpzf/0GmODjpruR1nRi1u/tuncdjTiG+hjGAeFC1BD7YktT9Za6imIpE8RXmA== - dependencies: - "@lerna/batch-packages" "3.10.6" - "@lerna/command" "3.10.6" - "@lerna/filter-options" "3.10.6" - "@lerna/npm-run-script" "3.10.0" - "@lerna/output" "3.6.0" - "@lerna/run-parallel-batches" "3.0.0" - "@lerna/timer" "3.5.0" - "@lerna/validation-error" "3.6.0" +"@lerna/run@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.13.1.tgz#87e174c1d271894ddd29adc315c068fb7b1b0117" + integrity sha512-nv1oj7bsqppWm1M4ifN+/IIbVu9F4RixrbQD2okqDGYne4RQPAXyb5cEZuAzY/wyGTWWiVaZ1zpj5ogPWvH0bw== + dependencies: + "@lerna/batch-packages" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/filter-options" "3.13.0" + "@lerna/npm-run-script" "3.13.0" + "@lerna/output" "3.13.0" + "@lerna/run-parallel-batches" "3.13.0" + "@lerna/timer" "3.13.0" + "@lerna/validation-error" "3.13.0" p-map "^1.2.0" -"@lerna/symlink-binary@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.10.0.tgz#5acdde86dfd50c9270d7d2a93bade203cff41b3d" - integrity sha512-6mQsG+iVjBo8cD8s24O+YgFrwDyUGfUQbK4ryalAXFHI817Zd4xlI3tjg3W99whCt6rt6D0s1fpf8eslMN6dSw== +"@lerna/symlink-binary@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.13.0.tgz#36a9415d468afcb8105750296902f6f000a9680d" + integrity sha512-obc4Y6jxywkdaCe+DB0uTxYqP0IQ8mFWvN+k/YMbwH4G2h7M7lCBWgPy8e7xw/50+1II9tT2sxgx+jMus1sTJg== dependencies: - "@lerna/create-symlink" "3.6.0" - "@lerna/package" "3.7.2" + "@lerna/create-symlink" "3.13.0" + "@lerna/package" "3.13.0" fs-extra "^7.0.0" p-map "^1.2.0" -"@lerna/symlink-dependencies@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.10.0.tgz#a20226e8e97af6a6bc4b416bfc28c0c5e3ba9ddd" - integrity sha512-vGpg5ydwGgQCuWNX5y7CRL38mGpuLhf1GRq9wMm7IGwnctEsdSNqvvE+LDgqtwEZASu5+vffYUkL0VlFXl8uWA== +"@lerna/symlink-dependencies@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.13.0.tgz#76c23ecabda7824db98a0561364f122b457509cf" + integrity sha512-7CyN5WYEPkbPLbqHBIQg/YiimBzb5cIGQB0E9IkLs3+racq2vmUNQZn38LOaazQacAA83seB+zWSxlI6H+eXSg== dependencies: - "@lerna/create-symlink" "3.6.0" - "@lerna/resolve-symlink" "3.6.0" - "@lerna/symlink-binary" "3.10.0" + "@lerna/create-symlink" "3.13.0" + "@lerna/resolve-symlink" "3.13.0" + "@lerna/symlink-binary" "3.13.0" fs-extra "^7.0.0" p-finally "^1.0.0" p-map "^1.2.0" p-map-series "^1.0.0" -"@lerna/timer@3.5.0": - version "3.5.0" - resolved "https://registry.yarnpkg.com/@lerna/timer/-/timer-3.5.0.tgz#8dee6acf002c55de64678c66ef37ca52143f1b9b" - integrity sha512-TAb99hqQN6E3JBGtG9iyZNPq1/DbmqgBOeNrKtdJsGvIeX/NGLgUDWMrj2h04V4O+jpBFmSf6HIld6triKmxCA== +"@lerna/timer@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/timer/-/timer-3.13.0.tgz#bcd0904551db16e08364d6c18e5e2160fc870781" + integrity sha512-RHWrDl8U4XNPqY5MQHkToWS9jHPnkLZEt5VD+uunCKTfzlxGnRCr3/zVr8VGy/uENMYpVP3wJa4RKGY6M0vkRw== -"@lerna/validation-error@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/validation-error/-/validation-error-3.6.0.tgz#550cf66bb2ef88edc02e36017b575a7a9100d5d8" - integrity sha512-MWltncGO5VgMS0QedTlZCjFUMF/evRjDMMHrtVorkIB2Cp5xy0rkKa8iDBG43qpUWeG1giwi58yUlETBcWfILw== - dependencies: - libnpm "^2.0.1" - -"@lerna/version@3.10.6": - version "3.10.6" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.10.6.tgz#c31c2bb1aabbdc851407534155567b5cdf48e0fb" - integrity sha512-77peW2ROlHHl1e/tHBUmhpb8tsO6CIdlx34XapZhUuIVykrkOuqVFFxqMecrGG8SJe0e3l1G+Fah7bJTQcG0kw== - dependencies: - "@lerna/batch-packages" "3.10.6" - "@lerna/check-working-tree" "3.10.0" - "@lerna/child-process" "3.3.0" - "@lerna/collect-updates" "3.10.1" - "@lerna/command" "3.10.6" - "@lerna/conventional-commits" "3.10.0" - "@lerna/output" "3.6.0" - "@lerna/prompt" "3.6.0" - "@lerna/run-lifecycle" "3.10.5" - "@lerna/validation-error" "3.6.0" +"@lerna/validation-error@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/validation-error/-/validation-error-3.13.0.tgz#c86b8f07c5ab9539f775bd8a54976e926f3759c3" + integrity sha512-SiJP75nwB8GhgwLKQfdkSnDufAaCbkZWJqEDlKOUPUvVOplRGnfL+BPQZH5nvq2BYSRXsksXWZ4UHVnQZI/HYA== + dependencies: + npmlog "^4.1.2" + +"@lerna/version@3.13.1": + version "3.13.1" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.13.1.tgz#5e919d13abb13a663dcc7922bb40931f12fb137b" + integrity sha512-WpfKc5jZBBOJ6bFS4atPJEbHSiywQ/Gcd+vrwaEGyQHWHQZnPTvhqLuq3q9fIb9sbuhH5pSY6eehhuBrKqTnjg== + dependencies: + "@lerna/batch-packages" "3.13.0" + "@lerna/check-working-tree" "3.13.0" + "@lerna/child-process" "3.13.0" + "@lerna/collect-updates" "3.13.0" + "@lerna/command" "3.13.1" + "@lerna/conventional-commits" "3.13.0" + "@lerna/github-client" "3.13.1" + "@lerna/output" "3.13.0" + "@lerna/prompt" "3.13.0" + "@lerna/run-lifecycle" "3.13.0" + "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" - libnpm "^2.0.1" minimatch "^3.0.4" + npmlog "^4.1.2" p-map "^1.2.0" p-pipe "^1.2.0" p-reduce "^1.0.0" @@ -1602,12 +1789,12 @@ slash "^1.0.0" temp-write "^3.4.0" -"@lerna/write-log-file@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@lerna/write-log-file/-/write-log-file-3.6.0.tgz#b8d5a7efc84fa93cbd67d724d11120343b2a849a" - integrity sha512-OkLK99V6sYXsJsYg+O9wtiFS3z6eUPaiz2e6cXJt80mfIIdI1t2dnmyua0Ib5cZWExQvx2z6Y32Wlf0MnsoNsA== +"@lerna/write-log-file@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@lerna/write-log-file/-/write-log-file-3.13.0.tgz#b78d9e4cfc1349a8be64d91324c4c8199e822a26" + integrity sha512-RibeMnDPvlL8bFYW5C8cs4mbI3AHfQef73tnJCQ/SgrXZHehmHnsyWUiE7qDQCAo+B1RfTapvSyFF69iPj326A== dependencies: - libnpm "^2.0.1" + npmlog "^4.1.2" write-file-atomic "^2.3.0" "@mrmlnc/readdir-enhanced@^2.2.1": @@ -1623,6 +1810,33 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== +"@octokit/endpoint@^3.2.0": + version "3.2.3" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-3.2.3.tgz#bd9aea60cd94ce336656b57a5c9cb7f10be8f4f3" + integrity sha512-yUPCt4vMIOclox13CUxzuKiPJIFo46b/6GhUnUTw5QySczN1L0DtSxgmIZrZV4SAb9EyAqrceoyrWoYVnfF2AA== + dependencies: + deepmerge "3.2.0" + is-plain-object "^2.0.4" + universal-user-agent "^2.0.1" + url-template "^2.0.8" + +"@octokit/plugin-enterprise-rest@^2.1.1": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-2.2.2.tgz#c0e22067a043e19f96ff9c7832e2a3019f9be75c" + integrity sha512-CTZr64jZYhGWNTDGlSJ2mvIlFsm9OEO3LqWn9I/gmoHI4jRBp4kpHoFYNemG4oA75zUAcmbuWblb7jjP877YZw== + +"@octokit/request@2.4.2": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-2.4.2.tgz#87c36e820dd1e43b1629f4f35c95b00cd456320b" + integrity sha512-lxVlYYvwGbKSHXfbPk5vxEA8w4zHOH1wobado4a9EfsyD3Cbhuhus1w0Ye9Ro0eMubGO8kNy5d+xNFisM3Tvaw== + dependencies: + "@octokit/endpoint" "^3.2.0" + deprecation "^1.0.1" + is-plain-object "^2.0.4" + node-fetch "^2.3.0" + once "^1.4.0" + universal-user-agent "^2.0.1" + "@octokit/rest@^15.2.6": version "15.18.1" resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.18.1.tgz#ec7fb0f8775ef64dc095fae6635411d3fbff9b62" @@ -1638,20 +1852,90 @@ universal-user-agent "^2.0.0" url-template "^2.0.8" -"@react-native-community/eslint-config@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.2.tgz#042224762e00ef06b45693a14be78ebda5fb7def" - integrity sha512-oKtMR046Ptfjvzd67MPm7Q8a5H8MeMsKB7E5bKgcMoybdZBmrsqo3Fn49FCKwc6yHd4KUkTyQihE4Fgk9jaanA== - dependencies: - babel-eslint "9.0.0" - eslint-plugin-eslint-comments "^3.0.1" - eslint-plugin-flowtype "2.43.0" - eslint-plugin-jest "21.8.0" - eslint-plugin-prettier "2.6.0" - eslint-plugin-react "7.8.2" - eslint-plugin-react-hooks "^1.0.1" - eslint-plugin-react-native "3.5.0" - prettier "1.13.6" +"@octokit/rest@^16.16.0": + version "16.20.0" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.20.0.tgz#54462b6e540b5d40063850d370ce8e084cf127d6" + integrity sha512-tN5j64P6QymlMzKo94DG1LRNHCwMnLg5poZlVhsCfkHhEWKpofZ1qBDr2/0w6qDLav4EA1XXMmZdNpvGhc9BDQ== + dependencies: + "@octokit/request" "2.4.2" + before-after-hook "^1.4.0" + btoa-lite "^1.0.0" + deprecation "^1.0.1" + lodash.get "^4.4.2" + lodash.set "^4.3.2" + lodash.uniq "^4.5.0" + octokit-pagination-methods "^1.1.0" + once "^1.4.0" + universal-user-agent "^2.0.0" + url-template "^2.0.8" + +"@react-native-community/eslint-config@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.3.tgz#bf9be8434caa18f85b570cf4e28366f2a7f1ea91" + integrity sha512-YmCiqoiqgSW8YpWYWLwG4WYwVIwvkhfH97COxbin71CuCr5muZPlmhHOFwo2gIQzUvt1ewFb1shtUi1X8TAVhA== + dependencies: + babel-eslint "10.0.1" + eslint-plugin-eslint-comments "^3.1.1" + eslint-plugin-flowtype "2.50.3" + eslint-plugin-jest "22.4.1" + eslint-plugin-prettier "2.6.2" + eslint-plugin-react "7.12.4" + eslint-plugin-react-hooks "^1.5.1" + eslint-plugin-react-native "3.6.0" + prettier "1.16.4" + +"@types/babel__core@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" + integrity sha512-wJTeJRt7BToFx3USrCDs2BhEi4ijBInTQjOIukj6a/5tEkwpFMVZ+1ppgmE+Q/FQyc5P/VWUbx7I9NELrKruHA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" + integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" + integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + dependencies: + "@babel/types" "^7.3.0" + +"@types/istanbul-lib-coverage@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" + integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== + +"@types/node@*": + version "11.11.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" + integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": + version "12.0.10" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.10.tgz#17a8ec65cd8e88f51b418ceb271af18d3137df67" + integrity sha512-WsVzTPshvCSbHThUduGGxbmnwcpkgSctHGHTqzWyFg4lYAuV5qXlyFPOsP3OWqCINfmg/8VXP+zJaa4OxEsBQQ== JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" @@ -1790,11 +2074,11 @@ append-transform@^1.0.0: dependencies: default-require-extensions "^2.0.0" -aproba@^1.0.3, aproba@^1.1.1, aproba@^1.1.2: +aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" -"aproba@^1.1.2 || 2", aproba@^2.0.0: +aproba@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== @@ -1911,7 +2195,7 @@ async@0.2.x, async@~0.2.9: version "0.2.10" resolved "http://registry.npmjs.org/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" -async@^2.4.0, async@^2.5.0, async@^2.6.1: +async@^2.4.0, async@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" dependencies: @@ -1933,10 +2217,10 @@ aws4@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" -babel-eslint@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220" - integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g== +babel-eslint@10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" + integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== dependencies: "@babel/code-frame" "^7.0.0" "@babel/parser" "^7.0.0" @@ -1945,13 +2229,18 @@ babel-eslint@9.0.0: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babel-jest@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.0.0.tgz#8a0c767f03f4a595fb921afdab13ff126edd00da" - integrity sha512-YGKRbZUjoRmNIAyG7x4wYxUyHvHPFpYXj6Mx1A5cslhaQOUgP/+LF3wtFgMuOQkIpjbVNBufmOnVY0QVwB5v9Q== +babel-jest@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.5.0.tgz#0ea042789810c2bec9065f7c8ab4dc18e1d28559" + integrity sha512-0fKCXyRwxFTJL0UXDJiT2xYxO9Lu2vBd9n+cC+eDjESzcVG3s2DRGAxbzJX21fceB1WYoBjAh8pQ83dKcl003g== dependencies: + "@jest/transform" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.0.0" + babel-preset-jest "^24.3.0" + chalk "^2.4.2" + slash "^2.0.0" babel-plugin-istanbul@^5.1.0: version "5.1.0" @@ -1962,10 +2251,12 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.0.0" test-exclude "^5.0.0" -babel-plugin-jest-hoist@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.0.0.tgz#3adf030b6fd67e4311479a54b24077bdfc226ec9" - integrity sha512-ipefE7YWNyRNVaV/MonUb/I5nef53ZRFR74P9meMGmJxqt8s1BJmfhw11YeIMbcjXN4fxtWUaskZZe8yreXE1Q== +babel-plugin-jest-hoist@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.3.0.tgz#f2e82952946f6e40bb0a75d266a3790d854c8b5b" + integrity sha512-nWh4N1mVH55Tzhx2isvUN5ebM5CDUvIpXPZYMRazQughie/EqGnbR+czzoQlhUmJG9pPJmYDRhvocotb2THl1w== + dependencies: + "@types/babel__traverse" "^7.0.6" babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" @@ -2013,13 +2304,13 @@ babel-preset-fbjs@^3.1.2: "@babel/plugin-transform-template-literals" "^7.0.0" babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" -babel-preset-jest@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.0.0.tgz#d23782e5e036cff517859640a80960bd628bd82b" - integrity sha512-ECMMOLvNDCmsn3geBa3JkwzylcfpThMpAdfreONQm8EmXcs4tXUpXZDQPxiIMg7nMobTuAC2zDGIKrbrBXW2Vg== +babel-preset-jest@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.3.0.tgz#db88497e18869f15b24d9c0e547d8e0ab950796d" + integrity sha512-VGTV2QYBa/Kn3WCOKdfS31j9qomaXSgJqi65B6o05/1GsJyj9LVhSljM9ro4S+IBGj/ENhNBuH9bpqzztKAQSw== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.0.0" + babel-plugin-jest-hoist "^24.3.0" babel-runtime@^6.26.0: version "6.26.0" @@ -2061,7 +2352,7 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -before-after-hook@^1.1.0: +before-after-hook@^1.1.0, before-after-hook@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.4.0.tgz#2b6bf23dca4f32e628fd2747c10a37c74a4b484d" integrity sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg== @@ -2075,17 +2366,6 @@ big-integer@^1.6.7: version "1.6.36" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.36.tgz#78631076265d4ae3555c04f85e7d9d2f3a071a36" -bin-links@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-1.1.2.tgz#fb74bd54bae6b7befc6c6221f25322ac830d9757" - integrity sha512-8eEHVgYP03nILphilltWjeIjMbKyJo3wvp9K816pHbhP301ismzw15mxAAEVQ/USUwcP++1uNrbERbp8lOA6Fg== - dependencies: - bluebird "^3.5.0" - cmd-shim "^2.0.2" - gentle-fs "^2.0.0" - graceful-fs "^4.1.11" - write-file-atomic "^2.3.0" - binary@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79" @@ -2101,7 +2381,7 @@ block-stream@*: dependencies: inherits "~2.0.0" -bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.3: +bluebird@^3.5.1, bluebird@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== @@ -2340,6 +2620,13 @@ capture-exit@^1.2.0: dependencies: rsvp "^3.3.3" +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -2594,20 +2881,20 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" -conventional-changelog-angular@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.2.tgz#39d945635e03b6d0c9d4078b1df74e06163dc66a" - integrity sha512-yx7m7lVrXmt4nKWQgWZqxSALEiAKZhOAcbxdUaU9575mB0CzXVbgrgpfSnSP7OqWDUTYGD0YVJ0MSRdyOPgAwA== +conventional-changelog-angular@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.3.tgz#299fdd43df5a1f095283ac16aeedfb0a682ecab0" + integrity sha512-YD1xzH7r9yXQte/HF9JBuEDfvjxxwDGGwZU1+ndanbY0oFgA+Po1T9JDSpPLdP0pZT6MhCAsdvFKC4TJ4MTJTA== dependencies: compare-func "^1.3.1" q "^1.5.1" -conventional-changelog-core@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.1.5.tgz#c2edf928539308b54fe1b90a2fc731abc021852c" - integrity sha512-iwqAotS4zk0wA4S84YY1JCUG7X3LxaRjJxuUo6GI4dZuIy243j5nOg/Ora35ExT4DOiw5dQbMMQvw2SUjh6moQ== +conventional-changelog-core@^3.1.6: + version "3.1.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.1.6.tgz#ac1731a461c50d150d29c1ad4f33143293bcd32f" + integrity sha512-5teTAZOtJ4HLR6384h50nPAaKdDr+IaU0rnD2Gg2C3MS7hKsEPH8pZxrDNqam9eOSPQg9tET6uZY79zzgSz+ig== dependencies: - conventional-changelog-writer "^4.0.2" + conventional-changelog-writer "^4.0.3" conventional-commits-parser "^3.0.1" dateformat "^3.0.0" get-pkg-repo "^1.0.0" @@ -2626,15 +2913,15 @@ conventional-changelog-preset-loader@^2.0.2: resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.0.2.tgz#81d1a07523913f3d17da3a49f0091f967ad345b0" integrity sha512-pBY+qnUoJPXAXXqVGwQaVmcye05xi6z231QM98wHWamGAmu/ghkBprQAwmF5bdmyobdVxiLhPY3PrCfSeUNzRQ== -conventional-changelog-writer@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.2.tgz#eb493ed84269e7a663da36e49af51c54639c9a67" - integrity sha512-d8/FQY/fix2xXEBUhOo8u3DCbyEw3UOQgYHxLsPDw+wHUDma/GQGAGsGtoH876WyNs32fViHmTOUrgRKVLvBug== +conventional-changelog-writer@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.3.tgz#916a2b302d0bb5ef18efd236a034c13fb273cde1" + integrity sha512-bIlpSiQtQZ1+nDVHEEh798Erj2jhN/wEjyw9sfxY9es6h7pREE5BNJjfv0hXGH/FTrAsEpHUq4xzK99eePpwuA== dependencies: compare-func "^1.3.1" conventional-commits-filter "^2.0.1" dateformat "^3.0.0" - handlebars "^4.0.2" + handlebars "^4.1.0" json-stringify-safe "^5.0.1" lodash "^4.2.1" meow "^4.0.0" @@ -2712,22 +2999,22 @@ core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cosmiconfig@^5.0.2: - version "5.0.7" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.7.tgz#39826b292ee0d78eda137dfa3173bd1c21a43b04" - integrity sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA== +cosmiconfig@^5.0.5: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" dependencies: - import-fresh "^2.0.0" is-directory "^0.3.1" js-yaml "^3.9.0" parse-json "^4.0.0" -cosmiconfig@^5.0.5: - version "5.0.6" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" +cosmiconfig@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.0.tgz#45038e4d28a7fe787203aede9c25bca4a08b12c8" + integrity sha512-nxt+Nfc3JAqf4WIWd0jXLjTJZmsPLrA9DDc4nRw2KFJQJK7DNooqSXrNI7tzLG50CF8axczly5UV929tBmh/7g== dependencies: + import-fresh "^2.0.0" is-directory "^0.3.1" - js-yaml "^3.9.0" + js-yaml "^3.13.0" parse-json "^4.0.0" cross-spawn@^5.0.1: @@ -2830,7 +3117,7 @@ debug@^4.0.1: dependencies: ms "^2.1.1" -debug@^4.1.0: +debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -2888,6 +3175,11 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +deepmerge@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" + integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== + default-require-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-2.0.0.tgz#f5f8fbb18a7d6d50b21f641f649ebb522cfe24f7" @@ -2955,6 +3247,11 @@ depd@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" +deprecation@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-1.0.1.tgz#2df79b79005752180816b7b6e079cbd80490d711" + integrity sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg== + destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" @@ -2985,6 +3282,11 @@ diff-sequences@^24.0.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.0.0.tgz#cdf8e27ed20d8b8d3caccb4e0c0d8fe31a173013" integrity sha512-46OkIuVGBBnrC0soO/4LHu5LHGHx0uhP65OVz8XOrAJpqiCB2aVIuESvjI1F9oqebuvY8lekS1pt6TN7vt7qsw== +diff-sequences@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" + integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== + dir-glob@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" @@ -2993,7 +3295,7 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" -doctrine@^2.0.2, doctrine@^2.1.0: +doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== @@ -3106,6 +3408,18 @@ errorhandler@^1.5.0: accepts "~1.3.3" escape-html "~1.0.3" +es-abstract@^1.11.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" + integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-keys "^1.0.12" + es-abstract@^1.5.1, es-abstract@^1.7.0: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" @@ -3116,7 +3430,7 @@ es-abstract@^1.5.1, es-abstract@^1.7.0: is-callable "^1.1.3" is-regex "^1.0.4" -es-to-primitive@^1.1.1: +es-to-primitive@^1.1.1, es-to-primitive@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" dependencies: @@ -3155,7 +3469,7 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-plugin-eslint-comments@^3.0.1: +eslint-plugin-eslint-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.1.tgz#32ff0afba8a48e17073817e6d03fbc5622f735b7" integrity sha512-GZDKhOFqJLKlaABX+kdoLskcTINMrVOWxGca54KcFb1QCPd0CLmqgAMRxkkUfGSmN+5NJUMGh7NGccIMcWPSfQ== @@ -3163,52 +3477,55 @@ eslint-plugin-eslint-comments@^3.0.1: escape-string-regexp "^1.0.5" ignore "^5.0.5" -eslint-plugin-flowtype@2.43.0: - version "2.43.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.43.0.tgz#47cdac5f01cda53f1c3e8477f0c83fee66a1606e" - integrity sha512-gFlHd3b6L28Mm8nbNoK6YtWgJ6STngf8GY3RA5DfeUYU3mRYJcHZ4c70bsBoERnCZy+nGHyus+aJ4jkimSnu5g== +eslint-plugin-flowtype@2.50.3: + version "2.50.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.50.3.tgz#61379d6dce1d010370acd6681740fd913d68175f" + integrity sha512-X+AoKVOr7Re0ko/yEXyM5SSZ0tazc6ffdIOocp2fFUlWoDt7DV0Bz99mngOkAFLOAWjqRA5jPwqUCbrx13XoxQ== dependencies: - lodash "^4.15.0" + lodash "^4.17.10" -eslint-plugin-jest@21.8.0: - version "21.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.8.0.tgz#4f3155e2898c1efb0ce548f3e084e07db5e21c07" - integrity sha512-u8+tOrVHHAv9SetdzCghLaBrHyaBLx+6surC+A+VfLy7CfXixTvQnJmD/Ym8mDE6e7wPDZWWgsqb3FGAWh7NTw== +eslint-plugin-jest@22.4.1: + version "22.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz#a5fd6f7a2a41388d16f527073b778013c5189a9c" + integrity sha512-gcLfn6P2PrFAVx3AobaOzlIEevpAEf9chTpFZz7bYfc7pz8XRv7vuKTIE4hxPKZSha6XWKKplDQ0x9Pq8xX2mg== -eslint-plugin-prettier@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" - integrity sha512-floiaI4F7hRkTrFe8V2ItOK97QYrX75DjmdzmVITZoAP6Cn06oEDPQRsO6MlHEP/u2SxI3xQ52Kpjw6j5WGfeQ== +eslint-plugin-prettier@2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad" + integrity sha512-tGek5clmW5swrAx1mdPYM8oThrBE83ePh7LeseZHBWfHVGrHPhKn7Y5zgRMbU/9D5Td9K4CEmUPjGxA7iw98Og== dependencies: fast-diff "^1.1.1" jest-docblock "^21.0.0" -eslint-plugin-react-hooks@^1.0.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.4.0.tgz#ad86001e05519368e55a888b1b31004b8e2ae8f6" - integrity sha512-fMGlzztW/5hSQT0UBnlPwulao0uF8Kyp0Uv6PA81lzmcDz2LBtthkWQaE8Wz2F2kEe7mSRDgK8ABEFK1ipeDxw== +eslint-plugin-react-hooks@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f" + integrity sha512-lHBVRIaz5ibnIgNG07JNiAuBUeKhEf8l4etNx5vfAEwqQ5tcuK3jV9yjmopPgQDagQb7HwIuQVsE3IVcGrRnag== eslint-plugin-react-native-globals@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react-native-globals/-/eslint-plugin-react-native-globals-0.1.2.tgz#ee1348bc2ceb912303ce6bdbd22e2f045ea86ea2" integrity sha512-9aEPf1JEpiTjcFAmmyw8eiIXmcNZOqaZyHO77wgm0/dWfT/oxC1SrIq8ET38pMxHYrcB6Uew+TzUVsBeczF88g== -eslint-plugin-react-native@3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-3.5.0.tgz#78a5d6aadb11f85d1b114488d1fddfa2bf4fc1fb" - integrity sha512-L0qwiBQbG3MVMQk4XVCyyX+9nqJjr9YUmqpJ98Gb+uAmD+xlxT33rDL9ZBQgzMzBxDcUW6WiPcll8j9uXpyLyQ== +eslint-plugin-react-native@3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-3.6.0.tgz#7cad3b7c6159df6d26fe3252c6c5417a17f27b4b" + integrity sha512-BEQcHZ06hZSBYWFVuNEq0xuui5VEsWpHDsZGBtfadHfCRqRMUrkYPgdDb3bpc60qShHE83kqIv59uKdinEg91Q== dependencies: eslint-plugin-react-native-globals "^0.1.1" -eslint-plugin-react@7.8.2: - version "7.8.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.8.2.tgz#e95c9c47fece55d2303d1a67c9d01b930b88a51d" - integrity sha512-H3ne8ob4Bn6NXSN9N9twsn7t8dyHT5bF/ibQepxIHi6JiPIdC2gXlfYvZYucbdrWio4FxBq7Z4mSauQP+qmMkQ== +eslint-plugin-react@7.12.4: + version "7.12.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz#b1ecf26479d61aee650da612e425c53a99f48c8c" + integrity sha512-1puHJkXJY+oS1t467MjbqjvX53uQ05HXwjqDgdbGBqf5j9eeydI54G3KwiJmWciQ0HTBacIKw2jgwSBSH3yfgQ== dependencies: - doctrine "^2.0.2" - has "^1.0.1" + array-includes "^3.0.3" + doctrine "^2.1.0" + has "^1.0.3" jsx-ast-utils "^2.0.1" - prop-types "^15.6.0" + object.fromentries "^2.0.0" + prop-types "^15.6.2" + resolve "^1.9.0" eslint-scope@3.7.1: version "3.7.1" @@ -3327,6 +3644,11 @@ exec-sh@^0.2.0: dependencies: merge "^1.2.0" +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== + execa@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" @@ -3380,16 +3702,17 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.0.0.tgz#71f71d88a4202746fc79849bb4c6498008b5ef03" - integrity sha512-qDHRU4lGsme0xjg8dXp/RQhvO9XIo9FWqVo7dTHDPBwzy25JGEHAWFsnpmRYErB50tgi/6euo3ir5e/kF9LUTA== +expect@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.5.0.tgz#492fb0df8378d8474cc84b827776b069f46294ed" + integrity sha512-p2Gmc0CLxOgkyA93ySWmHFYHUPFIHG6XZ06l7WArWAsrqYVaVEkOU5NtT5i68KUyGKbkQgDCkiT65bWmdoL6Bw== dependencies: + "@jest/types" "^24.5.0" ansi-styles "^3.2.0" - jest-get-type "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" + jest-get-type "^24.3.0" + jest-matcher-utils "^24.5.0" + jest-message-util "^24.5.0" + jest-regex-util "^24.3.0" extend-shallow@^2.0.1: version "2.0.1" @@ -3560,11 +3883,6 @@ find-cache-dir@^1.0.0: make-dir "^1.0.0" pkg-dir "^2.0.0" -find-npm-prefix@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/find-npm-prefix/-/find-npm-prefix-1.0.2.tgz#8d8ce2c78b3b4b9e66c8acc6a37c231eb841cfdf" - integrity sha512-KEftzJ+H90x6pcKtdXZEPsQse8/y/UnvzRKrOSQFprnrGaFuJ62fVkP34Iu2IYuMvyauCyoLTNkJZgrrGA2wkA== - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -3693,15 +4011,6 @@ fs-minipass@^1.2.5: dependencies: minipass "^2.2.1" -fs-vacuum@^1.2.10: - version "1.2.10" - resolved "https://registry.yarnpkg.com/fs-vacuum/-/fs-vacuum-1.2.10.tgz#b7629bec07a4031a2548fdf99f5ecf1cc8b31e36" - integrity sha1-t2Kb7AekAxolSP35n17PHMizHjY= - dependencies: - graceful-fs "^4.1.2" - path-is-inside "^1.0.1" - rimraf "^2.5.2" - fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -3759,20 +4068,6 @@ genfun@^5.0.0: resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" integrity sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA== -gentle-fs@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/gentle-fs/-/gentle-fs-2.0.1.tgz#585cfd612bfc5cd52471fdb42537f016a5ce3687" - integrity sha512-cEng5+3fuARewXktTEGbwsktcldA+YsnUEaXZwcK/3pjSE1X9ObnTs+/8rYf8s+RnIcQm2D5x3rwpN7Zom8Bew== - dependencies: - aproba "^1.1.2" - fs-vacuum "^1.2.10" - graceful-fs "^4.1.11" - iferr "^0.1.5" - mkdirp "^0.5.1" - path-is-inside "^1.0.2" - read-cmd-shim "^1.0.1" - slide "^1.1.6" - get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -3845,6 +4140,21 @@ git-semver-tags@^2.0.2: meow "^4.0.0" semver "^5.5.0" +git-up@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" + integrity sha512-LFTZZrBlrCrGCG07/dm1aCjjpL1z9L3+5aEeI9SBhAqSc+kiA9Or1bgZhQFNppJX6h/f5McrvJt1mQXTFm6Qrw== + dependencies: + is-ssh "^1.3.0" + parse-url "^5.0.0" + +git-url-parse@^11.1.2: + version "11.1.2" + resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-11.1.2.tgz#aff1a897c36cc93699270587bea3dbcbbb95de67" + integrity sha512-gZeLVGY8QVKMIkckncX+iCq2/L8PlwncvDFKiWkBn9EtCfYDbliRTTp6qzyQ1VMdITUfq7293zDzfpjdiGASSQ== + dependencies: + git-up "^4.0.0" + gitconfiglocal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" @@ -3939,11 +4249,12 @@ growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" -handlebars@^4.0.11, handlebars@^4.0.2: - version "4.0.12" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.12.tgz#2c15c8a96d46da5e266700518ba8cb8d919d5bc5" +handlebars@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.1.tgz#6e4e41c18ebe7719ae4d38e5aca3d32fa3dd23d3" + integrity sha512-3Zhi6C0euYZL5sM0Zcy7lInLXKQ+YLcF/olbN010mzGQ4XVm50JeyBnMqofHh696GrciGruC7kCcApPDJvVgwA== dependencies: - async "^2.5.0" + neo-async "^2.6.0" optimist "^0.6.1" source-map "^0.6.1" optionalDependencies: @@ -4017,7 +4328,7 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" -has@^1.0.1: +has@^1.0.1, has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" dependencies: @@ -4172,7 +4483,7 @@ inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, i version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -ini@^1.3.2, ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" @@ -4454,6 +4765,13 @@ is-retry-allowed@^1.0.0: resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ= +is-ssh@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.3.1.tgz#f349a8cadd24e65298037a522cf7520f2e81a0f3" + integrity sha512-0eRIASHZt1E68/ixClI8bp2YK2wmBPVWEismTs6M+M099jKgrzl/3E976zIbImSIob48N2/XGe9y7ZiYdImSlg== + dependencies: + protocols "^1.1.0" + is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4518,22 +4836,23 @@ isstream@0.1.x, isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -istanbul-api@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-2.0.8.tgz#5621503c5595e5adbbacd5ce257090417c7f55da" - integrity sha512-ITCccemErW+BhZotmyQ/ktlYTAp9r7oWfz1oxxMpgKQVTUw0NAYRbKLbOSNaInipecIKul7U7O5BfCQBBRZa3w== +istanbul-api@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-2.1.1.tgz#194b773f6d9cbc99a9258446848b0f988951c4d0" + integrity sha512-kVmYrehiwyeBAk/wE71tW6emzLiHGjYIiDrc8sfyty4F8M02/lrgXSm+R1kXysmF20zArvmZXjlE/mg24TVPJw== dependencies: async "^2.6.1" compare-versions "^3.2.1" fileset "^2.0.3" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-hook "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-report "^2.0.3" - istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.0.3" + istanbul-lib-coverage "^2.0.3" + istanbul-lib-hook "^2.0.3" + istanbul-lib-instrument "^3.1.0" + istanbul-lib-report "^2.0.4" + istanbul-lib-source-maps "^3.0.2" + istanbul-reports "^2.1.1" js-yaml "^3.12.0" make-dir "^1.3.0" + minimatch "^3.0.4" once "^1.4.0" istanbul-lib-coverage@^2.0.1: @@ -4546,10 +4865,15 @@ istanbul-lib-coverage@^2.0.2: resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz#d5db9a7a4bb8fdbd62ec746226385987b73a8f43" integrity sha512-4CsY730KHy12ya/YNKubrMlb7EZZVsEPhXntyRY/Cbs7HN5HdznLbI4UbvIGHgocxHx3VkGe7l6IN1lipetuGg== -istanbul-lib-hook@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-2.0.2.tgz#9ddd28aeac10f3bb6a4d02325e72b35044d17d3a" - integrity sha512-m0MwviQ0Av6qBNDkvKdLBxxuK6ffXo8761gE2bfT+/b+dhg8LUyQhp1nFh795LO12DpiSocuCPIRwILCsN1//Q== +istanbul-lib-coverage@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#0b891e5ad42312c2b9488554f603795f9a2211ba" + integrity sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw== + +istanbul-lib-hook@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-2.0.3.tgz#e0e581e461c611be5d0e5ef31c5f0109759916fb" + integrity sha512-CLmEqwEhuCYtGcpNVJjLV1DQyVnIqavMLFHV/DP+np/g3qvdxu3gsPqYoJMXm15sN84xOlckFB3VNvRbf5yEgA== dependencies: append-transform "^1.0.0" @@ -4579,14 +4903,27 @@ istanbul-lib-instrument@^3.0.1: istanbul-lib-coverage "^2.0.2" semver "^5.5.0" -istanbul-lib-report@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.3.tgz#8e22534766e9cc8e20ae96283331b4405da9dce9" - integrity sha512-25gX27Mbd3MjM41hwGl5lWcQEqaPaMP79YDFS20xuTUujItNmHgTBS3WRZvzyzLE0IAKaL+JpLrryou2WlZNMw== +istanbul-lib-instrument@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz#a2b5484a7d445f1f311e93190813fa56dfb62971" + integrity sha512-ooVllVGT38HIk8MxDj/OIHXSYvH+1tq/Vb38s8ixt9GoJadXska4WkGY+0wkmtYCZNYtaARniH/DixUGGLZ0uA== dependencies: - istanbul-lib-coverage "^2.0.2" + "@babel/generator" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/template" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + istanbul-lib-coverage "^2.0.3" + semver "^5.5.0" + +istanbul-lib-report@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.4.tgz#bfd324ee0c04f59119cb4f07dab157d09f24d7e4" + integrity sha512-sOiLZLAWpA0+3b5w5/dq0cjm2rrNdAfHWaGhmn7XEFW6X++IV9Ohn+pnELAl9K3rfpaeBfbmH9JU5sejacdLeA== + dependencies: + istanbul-lib-coverage "^2.0.3" make-dir "^1.3.0" - supports-color "^5.4.0" + supports-color "^6.0.0" istanbul-lib-source-maps@^3.0.1: version "3.0.1" @@ -4599,13 +4936,24 @@ istanbul-lib-source-maps@^3.0.1: rimraf "^2.6.2" source-map "^0.6.1" -istanbul-reports@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.0.3.tgz#332eda684c9ee891f199dfba305c3e776f55fc16" - integrity sha512-qpQ5ZWBkOatTxmTelS+HV5ybPSq7EeXmwXrPbGv7ebP+9DJOtveUcv6hCncZE4IxSAEkdmLEh3xo31SCttbApQ== +istanbul-lib-source-maps@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz#f1e817229a9146e8424a28e5d69ba220fda34156" + integrity sha512-JX4v0CiKTGp9fZPmoxpu9YEkPbEqCqBbO3403VabKjH+NRXo72HafD5UgnjTEqHL2SAjaZK1XDuDOkn6I5QVfQ== dependencies: - handlebars "^4.0.11" - + debug "^4.1.1" + istanbul-lib-coverage "^2.0.3" + make-dir "^1.3.0" + rimraf "^2.6.2" + source-map "^0.6.1" + +istanbul-reports@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.1.1.tgz#72ef16b4ecb9a4a7bd0e2001e00f95d1eec8afa9" + integrity sha512-FzNahnidyEPBCI0HcufJoSEoKykesRlFcSzQqjH9x0+LC8tnnE/p/90PBLu8iZTxr8yYZNyTtiAujUqyN+CIxw== + dependencies: + handlebars "^4.1.0" + isurl@^1.0.0-alpha5: version "1.0.0" resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" @@ -4614,79 +4962,55 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -jest-changed-files@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.0.0.tgz#c02c09a8cc9ca93f513166bc773741bd39898ff7" - integrity sha512-nnuU510R9U+UX0WNb5XFEcsrMqriSiRLeO9KWDFgPrpToaQm60prfQYpxsXigdClpvNot5bekDY440x9dNGnsQ== +jest-changed-files@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.5.0.tgz#4075269ee115d87194fd5822e642af22133cf705" + integrity sha512-Ikl29dosYnTsH9pYa1Tv9POkILBhN/TLZ37xbzgNsZ1D2+2n+8oEZS2yP1BrHn/T4Rs4Ggwwbp/x8CKOS5YJOg== dependencies: + "@jest/types" "^24.5.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.0.0.tgz#691fd4f7bce2574c1865db6844a43b56e60ce2a4" - integrity sha512-mElnFipLaGxo1SiQ1CLvuaz3eX07MJc4HcyKrApSJf8xSdY1/EwaHurKwu1g2cDiwIgY8uHj7UcF5OYbtiBOWg== +jest-cli@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.5.0.tgz#598139d3446d1942fb7dc93944b9ba766d756d4b" + integrity sha512-P+Jp0SLO4KWN0cGlNtC7JV0dW1eSFR7eRpoOucP2UM0sqlzp/bVHeo71Omonvigrj9AvCKy7NtQANtqJ7FXz8g== dependencies: - ansi-escapes "^3.0.0" + "@jest/core" "^24.5.0" + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" chalk "^2.0.1" exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.1.15" import-local "^2.0.0" is-ci "^2.0.0" - istanbul-api "^2.0.8" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-source-maps "^3.0.1" - jest-changed-files "^24.0.0" - jest-config "^24.0.0" - jest-environment-jsdom "^24.0.0" - jest-get-type "^24.0.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve-dependencies "^24.0.0" - jest-runner "^24.0.0" - jest-runtime "^24.0.0" - jest-snapshot "^24.0.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - jest-watcher "^24.0.0" - jest-worker "^24.0.0" - micromatch "^3.1.10" - node-notifier "^5.2.1" - p-each-series "^1.0.0" - pirates "^4.0.0" + jest-config "^24.5.0" + jest-util "^24.5.0" + jest-validate "^24.5.0" prompts "^2.0.1" - realpath-native "^1.0.0" - rimraf "^2.5.4" - slash "^2.0.0" - string-length "^2.0.0" - strip-ansi "^5.0.0" - which "^1.2.12" + realpath-native "^1.1.0" yargs "^12.0.2" -jest-config@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.0.0.tgz#878abe03c060c74a0ec30d3cd5dd1897873e030e" - integrity sha512-9/soqWL5YSq1ZJtgVJ5YYPCL1f9Mi2lVCp5+OXuYBOaN8DHSFRCSWip0rQ6N+mPTOEIAlCvcUH8zaPOwK4hePg== +jest-config@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.5.0.tgz#404d1bc6bb81aed6bd1890d07e2dca9fbba2e121" + integrity sha512-t2UTh0Z2uZhGBNVseF8wA2DS2SuBiLOL6qpLq18+OZGfFUxTM7BzUVKyHFN/vuN+s/aslY1COW95j1Rw81huOQ== dependencies: "@babel/core" "^7.1.0" - babel-jest "^24.0.0" + "@jest/types" "^24.5.0" + babel-jest "^24.5.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.0.0" - jest-environment-node "^24.0.0" - jest-get-type "^24.0.0" - jest-jasmine2 "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.0.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" + jest-environment-jsdom "^24.5.0" + jest-environment-node "^24.5.0" + jest-get-type "^24.3.0" + jest-jasmine2 "^24.5.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.5.0" + jest-util "^24.5.0" + jest-validate "^24.5.0" micromatch "^3.1.10" - pretty-format "^24.0.0" - realpath-native "^1.0.2" - uuid "^3.3.2" + pretty-format "^24.5.0" + realpath-native "^1.1.0" jest-diff@^24.0.0: version "24.0.0" @@ -4698,51 +5022,73 @@ jest-diff@^24.0.0: jest-get-type "^24.0.0" pretty-format "^24.0.0" +jest-diff@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.5.0.tgz#a2d8627964bb06a91893c0fbcb28ab228c257652" + integrity sha512-mCILZd9r7zqL9Uh6yNoXjwGQx0/J43OD2vvWVKwOEOLZliQOsojXwqboubAQ+Tszrb6DHGmNU7m4whGeB9YOqw== + dependencies: + chalk "^2.0.1" + diff-sequences "^24.3.0" + jest-get-type "^24.3.0" + pretty-format "^24.5.0" + jest-docblock@^21.0.0: version "21.2.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== -jest-docblock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.0.0.tgz#54d77a188743e37f62181a91a01eb9222289f94e" - integrity sha512-KfAKZ4SN7CFOZpWg4i7g7MSlY0M+mq7K0aMqENaG2vHuhC9fc3vkpU/iNN9sOus7v3h3Y48uEjqz3+Gdn2iptA== +jest-docblock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" + integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== dependencies: detect-newline "^2.1.0" -jest-each@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.0.0.tgz#10987a06b21c7ffbfb7706c89d24c52ed864be55" - integrity sha512-gFcbY4Cu55yxExXMkjrnLXov3bWO3dbPAW7HXb31h/DNWdNc/6X8MtxGff8nh3/MjkF9DpVqnj0KsPKuPK0cpA== +jest-each@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.5.0.tgz#da14d017a1b7d0f01fb458d338314cafe7f72318" + integrity sha512-6gy3Kh37PwIT5sNvNY2VchtIFOOBh8UCYnBlxXMb5sr5wpJUDPTUATX2Axq1Vfk+HWTMpsYPeVYp4TXx5uqUBw== dependencies: + "@jest/types" "^24.5.0" chalk "^2.0.1" - jest-get-type "^24.0.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" - -jest-environment-jsdom@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.0.0.tgz#5affa0654d6e44cd798003daa1a8701dbd6e4d11" - integrity sha512-1YNp7xtxajTRaxbylDc2pWvFnfDTH5BJJGyVzyGAKNt/lEULohwEV9zFqTgG4bXRcq7xzdd+sGFws+LxThXXOw== - dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + jest-get-type "^24.3.0" + jest-util "^24.5.0" + pretty-format "^24.5.0" + +jest-environment-jsdom@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.5.0.tgz#1c3143063e1374100f8c2723a8b6aad23b6db7eb" + integrity sha512-62Ih5HbdAWcsqBx2ktUnor/mABBo1U111AvZWcLKeWN/n/gc5ZvDBKe4Og44fQdHKiXClrNGC6G0mBo6wrPeGQ== + dependencies: + "@jest/environment" "^24.5.0" + "@jest/fake-timers" "^24.5.0" + "@jest/types" "^24.5.0" + jest-mock "^24.5.0" + jest-util "^24.5.0" jsdom "^11.5.1" -jest-environment-node@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.0.0.tgz#330948980656ed8773ce2e04eb597ed91e3c7190" - integrity sha512-62fOFcaEdU0VLaq8JL90TqwI7hLn0cOKOl8vY2n477vRkCJRojiRRtJVRzzCcgFvs6gqU97DNqX5R0BrBP6Rxg== +jest-environment-node@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.5.0.tgz#763eebdf529f75b60aa600c6cf8cb09873caa6ab" + integrity sha512-du6FuyWr/GbKLsmAbzNF9mpr2Iu2zWSaq/BNHzX+vgOcts9f2ayXBweS7RAhr+6bLp6qRpMB6utAMF5Ygktxnw== dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + "@jest/environment" "^24.5.0" + "@jest/fake-timers" "^24.5.0" + "@jest/types" "^24.5.0" + jest-mock "^24.5.0" + jest-util "^24.5.0" jest-get-type@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.0.0.tgz#36e72930b78e33da59a4f63d44d332188278940b" integrity sha512-z6/Eyf6s9ZDGz7eOvl+fzpuJmN9i0KyTt1no37/dHu8galssxz5ZEgnc1KaV8R31q1khxyhB4ui/X5ZjjPk77w== -jest-haste-map@24.0.0, jest-haste-map@^24.0.0: +jest-get-type@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.3.0.tgz#582cfd1a4f91b5cdad1d43d2932f816d543c65da" + integrity sha512-HYF6pry72YUlVcvUx3sEpMRwXEWGEPlJ0bSPVnB3b3n++j4phUEoSPcS6GC0pPJ9rpyPSe4cb5muFo6D39cXow== + +jest-haste-map@24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0.tgz#e9ef51b2c9257384b4d6beb83bd48c65b37b5e6e" integrity sha512-CcViJyUo41IQqttLxXVdI41YErkzBKbE6cS6dRAploCeutePYfUimWd3C9rQEWhX0YBOQzvNsC0O9nYxK2nnxQ== @@ -4756,29 +5102,49 @@ jest-haste-map@24.0.0, jest-haste-map@^24.0.0: micromatch "^3.1.10" sane "^3.0.0" -jest-jasmine2@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.0.0.tgz#7d87be9d8b32d34ac5980ad646b7ae7f99e33a19" - integrity sha512-q1xEV9KHM0bgfBj3yrkrjRF5kxpNDkWPCwVfSPN1DC+pD6J5wrM9/u2BgzhKhALXiaZUUhJ+f/OcEC0Gwpw90A== +jest-haste-map@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.5.0.tgz#3f17d0c548b99c0c96ed2893f9c0ccecb2eb9066" + integrity sha512-mb4Yrcjw9vBgSvobDwH8QUovxApdimGcOkp+V1ucGGw4Uvr3VzZQBJhNm1UY3dXYm4XXyTW2G7IBEZ9pM2ggRQ== + dependencies: + "@jest/types" "^24.5.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.4.0" + jest-util "^24.5.0" + jest-worker "^24.4.0" + micromatch "^3.1.10" + sane "^4.0.3" + +jest-jasmine2@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.5.0.tgz#e6af4d7f73dc527d007cca5a5b177c0bcc29d111" + integrity sha512-sfVrxVcx1rNUbBeyIyhkqZ4q+seNKyAG6iM0S2TYBdQsXjoFDdqWFfsUxb6uXSsbimbXX/NMkJIwUZ1uT9+/Aw== dependencies: "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.5.0" + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.0.0" + expect "^24.5.0" is-generator-fn "^2.0.0" - jest-each "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-snapshot "^24.0.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" + jest-each "^24.5.0" + jest-matcher-utils "^24.5.0" + jest-message-util "^24.5.0" + jest-runtime "^24.5.0" + jest-snapshot "^24.5.0" + jest-util "^24.5.0" + pretty-format "^24.5.0" + throat "^4.0.0" -jest-leak-detector@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.0.0.tgz#78280119fd05ee98317daee62cddb3aa537a31c6" - integrity sha512-ZYHJYFeibxfsDSKowjDP332pStuiFT2xfc5R67Rjm/l+HFJWJgNIOCOlQGeXLCtyUn3A23+VVDdiCcnB6dTTrg== +jest-leak-detector@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.5.0.tgz#21ae2b3b0da252c1171cd494f75696d65fb6fa89" + integrity sha512-LZKBjGovFRx3cRBkqmIg+BZnxbrLqhQl09IziMk3oeh1OV81Hg30RUIx885mq8qBv1PA0comB9bjKcuyNO1bCQ== dependencies: - pretty-format "^24.0.0" + pretty-format "^24.5.0" jest-matcher-utils@^24.0.0: version "24.0.0" @@ -4790,6 +5156,16 @@ jest-matcher-utils@^24.0.0: jest-get-type "^24.0.0" pretty-format "^24.0.0" +jest-matcher-utils@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.5.0.tgz#5995549dcf09fa94406e89526e877b094dad8770" + integrity sha512-QM1nmLROjLj8GMGzg5VBra3I9hLpjMPtF1YqzQS3rvWn2ltGZLrGAO1KQ9zUCVi5aCvrkbS5Ndm2evIP9yZg1Q== + dependencies: + chalk "^2.0.1" + jest-diff "^24.5.0" + jest-get-type "^24.3.0" + pretty-format "^24.5.0" + jest-message-util@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.0.0.tgz#a07a141433b2c992dbaec68d4cbfe470ba289619" @@ -4801,23 +5177,45 @@ jest-message-util@^24.0.0: slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.0.0.tgz#9a4b53e01d66a0e780f7d857462d063e024c617d" - integrity sha512-sQp0Hu5fcf5NZEh1U9eIW2qD0BwJZjb63Yqd98PQJFvf/zzUTBoUAwv/Dc/HFeNHIw1f3hl/48vNn+j3STaI7A== +jest-message-util@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.5.0.tgz#181420a65a7ef2e8b5c2f8e14882c453c6d41d07" + integrity sha512-6ZYgdOojowCGiV0D8WdgctZEAe+EcFU+KrVds+0ZjvpZurUW2/oKJGltJ6FWY2joZwYXN5VL36GPV6pNVRqRnQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" -jest-regex-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.0.0.tgz#4feee8ec4a358f5bee0a654e94eb26163cb9089a" - integrity sha512-Jv/uOTCuC+PY7WpJl2mpoI+WbY2ut73qwwO9ByJJNwOCwr1qWhEW2Lyi2S9ZewUdJqeVpEBisdEVZSI+Zxo58Q== +jest-mock@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.5.0.tgz#976912c99a93f2a1c67497a9414aa4d9da4c7b76" + integrity sha512-ZnAtkWrKf48eERgAOiUxVoFavVBziO2pAi2MfZ1+bGXVkDfxWLxU0//oJBkgwbsv6OAmuLBz4XFFqvCFMqnGUw== + dependencies: + "@jest/types" "^24.5.0" -jest-resolve-dependencies@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.0.0.tgz#86540611d660bdcaab8b87d069247d3832811d94" - integrity sha512-CJGS5ME2g5wL16o3Y22ga9p5ntNT5CUYX40/0lYj9ic9jB5YHm/qMKTgbFt9kowEBiMOFpXy15dWtBTEU54+zg== +jest-pnp-resolver@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" + integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== + +jest-regex-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" + integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== + +jest-resolve-dependencies@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.5.0.tgz#1a0dae9cdd41349ca4a84148b3e78da2ba33fd4b" + integrity sha512-dRVM1D+gWrFfrq2vlL5P9P/i8kB4BOYqYf3S7xczZ+A6PC3SgXYSErX/ScW/469pWMboM1uAhgLF+39nXlirCQ== dependencies: - jest-regex-util "^24.0.0" - jest-snapshot "^24.0.0" + "@jest/types" "^24.5.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.5.0" jest-resolve@^24.0.0: version "24.0.0" @@ -4828,51 +5226,69 @@ jest-resolve@^24.0.0: chalk "^2.0.1" realpath-native "^1.0.0" -jest-runner@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.0.0.tgz#00b280d52d23286111a8ed0362ed958283f7f0e3" - integrity sha512-XefXm2XimKtwdfi2am4364GfCmLD1tOjiRtDexY65diCXt4Rw23rxj2wiW7p9s8Nh9dzJQNmrheqZ5rzvn762g== +jest-resolve@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.5.0.tgz#8c16ba08f60a1616c3b1cd7afb24574f50a24d04" + integrity sha512-ZIfGqLX1Rg8xJpQqNjdoO8MuxHV1q/i2OO1hLXjgCWFWs5bsedS8UrOdgjUqqNae6DXA+pCyRmdcB7lQEEbXew== dependencies: + "@jest/types" "^24.5.0" + browser-resolve "^1.11.3" + chalk "^2.0.1" + jest-pnp-resolver "^1.2.1" + realpath-native "^1.1.0" + +jest-runner@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.5.0.tgz#9be26ece4fd4ab3dfb528b887523144b7c5ffca8" + integrity sha512-oqsiS9TkIZV5dVkD+GmbNfWBRPIvxqmlTQ+AQUJUQ07n+4xTSDc40r+aKBynHw9/tLzafC00DIbJjB2cOZdvMA== + dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.5.0" + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" + chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.0.0" - jest-docblock "^24.0.0" - jest-haste-map "^24.0.0" - jest-jasmine2 "^24.0.0" - jest-leak-detector "^24.0.0" - jest-message-util "^24.0.0" - jest-runtime "^24.0.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" + jest-config "^24.5.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.5.0" + jest-jasmine2 "^24.5.0" + jest-leak-detector "^24.5.0" + jest-message-util "^24.5.0" + jest-resolve "^24.5.0" + jest-runtime "^24.5.0" + jest-util "^24.5.0" + jest-worker "^24.4.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.0.0.tgz#bc80756f5458c2c8e4db86f44b687ff692026c13" - integrity sha512-UeVoTGiij8upcqfyBlJvImws7IGY+ZWtgVpt1h4VmVbyei39tVGia/20VoP3yvodS6FdjTwBj+JzVNuoh/9UTw== - dependencies: - "@babel/core" "^7.1.0" - babel-plugin-istanbul "^5.1.0" +jest-runtime@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.5.0.tgz#3a76e0bfef4db3896d5116e9e518be47ba771aa2" + integrity sha512-GTFHzfLdwpaeoDPilNpBrorlPoNZuZrwKKzKJs09vWwHo+9TOsIIuszK8cWOuKC7ss07aN1922Ge8fsGdsqCuw== + dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.5.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/yargs" "^12.0.2" chalk "^2.0.1" - convert-source-map "^1.4.0" exit "^0.1.2" - fast-json-stable-stringify "^2.0.0" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.0.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.0.0" - jest-snapshot "^24.0.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - micromatch "^3.1.10" - realpath-native "^1.0.0" + jest-config "^24.5.0" + jest-haste-map "^24.5.0" + jest-message-util "^24.5.0" + jest-mock "^24.5.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.5.0" + jest-snapshot "^24.5.0" + jest-util "^24.5.0" + jest-validate "^24.5.0" + realpath-native "^1.1.0" slash "^2.0.0" - strip-bom "3.0.0" - write-file-atomic "^2.4.2" + strip-bom "^3.0.0" yargs "^12.0.2" jest-serializer@24.0.0, jest-serializer@^24.0.0: @@ -4880,6 +5296,11 @@ jest-serializer@24.0.0, jest-serializer@^24.0.0: resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0.tgz#522c44a332cdd194d8c0531eb06a1ee5afb4256b" integrity sha512-9FKxQyrFgHtx3ozU+1a8v938ILBE7S8Ko3uiAVjT8Yfi2o91j/fj81jacCQZ/Ihjiff/VsUCXVgQ+iF1XdImOw== +jest-serializer@^24.4.0: + version "24.4.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" + integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== + jest-snapshot@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.0.0.tgz#fb447a753a3271660b3d89d068698014eb14c414" @@ -4896,6 +5317,24 @@ jest-snapshot@^24.0.0: pretty-format "^24.0.0" semver "^5.5.0" +jest-snapshot@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.5.0.tgz#e5d224468a759fd19e36f01217aac912f500f779" + integrity sha512-eBEeJb5ROk0NcpodmSKnCVgMOo+Qsu5z9EDl3tGffwPzK1yV37mjGWF2YeIz1NkntgTzP+fUL4s09a0+0dpVWA== + dependencies: + "@babel/types" "^7.0.0" + "@jest/types" "^24.5.0" + chalk "^2.0.1" + expect "^24.5.0" + jest-diff "^24.5.0" + jest-matcher-utils "^24.5.0" + jest-message-util "^24.5.0" + jest-resolve "^24.5.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^24.5.0" + semver "^5.5.0" + jest-util@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.0.0.tgz#fd38fcafd6dedbd0af2944d7a227c0d91b68f7d6" @@ -4910,25 +5349,49 @@ jest-util@^24.0.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.0.0.tgz#aa8571a46983a6538328fef20406b4a496b6c020" - integrity sha512-vMrKrTOP4BBFIeOWsjpsDgVXATxCspC9S1gqvbJ3Tnn/b9ACsJmteYeVx9830UMV28Cob1RX55x96Qq3Tfad4g== +jest-util@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.5.0.tgz#9d9cb06d9dcccc8e7cc76df91b1635025d7baa84" + integrity sha512-Xy8JsD0jvBz85K7VsTIQDuY44s+hYJyppAhcsHsOsGisVtdhar6fajf2UOf2mEVEgh15ZSdA0zkCuheN8cbr1Q== + dependencies: + "@jest/console" "^24.3.0" + "@jest/fake-timers" "^24.5.0" + "@jest/source-map" "^24.3.0" + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/node" "*" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + +jest-validate@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.5.0.tgz#62fd93d81214c070bb2d7a55f329a79d8057c7de" + integrity sha512-gg0dYszxjgK2o11unSIJhkOFZqNRQbWOAB2/LOUdsd2LfD9oXiMeuee8XsT0iRy5EvSccBgB4h/9HRbIo3MHgQ== dependencies: + "@jest/types" "^24.5.0" camelcase "^5.0.0" chalk "^2.0.1" - jest-get-type "^24.0.0" + jest-get-type "^24.3.0" leven "^2.1.0" - pretty-format "^24.0.0" + pretty-format "^24.5.0" -jest-watcher@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.0.0.tgz#20d44244d10b0b7312410aefd256c1c1eef68890" - integrity sha512-GxkW2QrZ4YxmW1GUWER05McjVDunBlKMFfExu+VsGmXJmpej1saTEKvONdx5RJBlVdpPI5x6E3+EDQSIGgl53g== +jest-watcher@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.5.0.tgz#da7bd9cb5967e274889b42078c8f501ae1c47761" + integrity sha512-/hCpgR6bg0nKvD3nv4KasdTxuhwfViVMHUATJlnGCD0r1QrmIssimPbmc5KfAQblAVxkD8xrzuij9vfPUk1/rA== dependencies: + "@jest/test-result" "^24.5.0" + "@jest/types" "^24.5.0" + "@types/node" "*" + "@types/yargs" "^12.0.9" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.0.0" + jest-util "^24.5.0" string-length "^2.0.0" jest-worker@24.0.0, jest-worker@^24.0.0: @@ -4939,13 +5402,22 @@ jest-worker@24.0.0, jest-worker@^24.0.0: merge-stream "^1.0.1" supports-color "^6.1.0" -jest@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.0.0.tgz#b8e2c8e6274e1092c7f56e57762a1fdc7800201e" - integrity sha512-1Z2EblP4BnERbWZGtipGb9zjHDq7nCHgCY7V57F5SYaFRJV4DE1HKoOz+CRC5OrAThN9OVhRlUhTzsTFArg2iQ== +jest-worker@^24.4.0: + version "24.4.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.4.0.tgz#fbc452b0120bb5c2a70cdc88fa132b48eeb11dd0" + integrity sha512-BH9X/klG9vxwoO99ZBUbZFfV8qO0XNZ5SIiCyYK2zOuJBl6YJVAeNIQjcoOVNu4HGEHeYEKsUWws8kSlSbZ9YQ== + dependencies: + "@types/node" "*" + merge-stream "^1.0.1" + supports-color "^6.1.0" + +jest@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.5.0.tgz#38f11ae2c2baa2f86c2bc4d8a91d2b51612cd19a" + integrity sha512-lxL+Fq5/RH7inxxmfS2aZLCf8MsS+YCUBfeiNO6BWz/MmjhDGaIEA/2bzEf9q4Q0X+mtFHiinHFvQ0u+RvW/qQ== dependencies: import-local "^2.0.0" - jest-cli "^24.0.0" + jest-cli "^24.5.0" js-levenshtein@^1.1.3: version "1.1.4" @@ -4955,9 +5427,10 @@ js-levenshtein@^1.1.3: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" -js-yaml@^3.12.0, js-yaml@^3.9.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" +js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.9.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" + integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -5131,28 +5604,28 @@ left-pad@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" -lerna@^3.10.6: - version "3.10.6" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.10.6.tgz#d4d0566a0ef78855e22ec85c7120137f6a583040" - integrity sha512-qdoyEpozHKQQnrpaDWbhiFG85/CBAyz2rkcj78JQVl2g400n9FFqS2Zweol5wusRnUzmpQKxFFll4P9DzIzSIA== - dependencies: - "@lerna/add" "3.10.6" - "@lerna/bootstrap" "3.10.6" - "@lerna/changed" "3.10.6" - "@lerna/clean" "3.10.6" - "@lerna/cli" "3.10.6" - "@lerna/create" "3.10.6" - "@lerna/diff" "3.10.6" - "@lerna/exec" "3.10.6" - "@lerna/import" "3.10.6" - "@lerna/init" "3.10.6" - "@lerna/link" "3.10.6" - "@lerna/list" "3.10.6" - "@lerna/publish" "3.10.6" - "@lerna/run" "3.10.6" - "@lerna/version" "3.10.6" +lerna@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.13.1.tgz#feaff562176f304bd82329ca29ce46ab6c033463" + integrity sha512-7kSz8LLozVsoUNTJzJzy+b8TnV9YdviR2Ee2PwGZSlVw3T1Rn7kOAPZjEi+3IWnOPC96zMPHVmjCmzQ4uubalw== + dependencies: + "@lerna/add" "3.13.1" + "@lerna/bootstrap" "3.13.1" + "@lerna/changed" "3.13.1" + "@lerna/clean" "3.13.1" + "@lerna/cli" "3.13.0" + "@lerna/create" "3.13.1" + "@lerna/diff" "3.13.1" + "@lerna/exec" "3.13.1" + "@lerna/import" "3.13.1" + "@lerna/init" "3.13.1" + "@lerna/link" "3.13.1" + "@lerna/list" "3.13.1" + "@lerna/publish" "3.13.1" + "@lerna/run" "3.13.1" + "@lerna/version" "3.13.1" import-local "^1.0.0" - libnpm "^2.0.1" + npmlog "^4.1.2" leven@^2.1.0: version "2.1.0" @@ -5165,32 +5638,6 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -libnpm@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/libnpm/-/libnpm-2.0.1.tgz#a48fcdee3c25e13c77eb7c60a0efe561d7fb0d8f" - integrity sha512-qTKoxyJvpBxHZQB6k0AhSLajyXq9ZE/lUsZzuHAplr2Bpv9G+k4YuYlExYdUCeVRRGqcJt8hvkPh4tBwKoV98w== - dependencies: - bin-links "^1.1.2" - bluebird "^3.5.3" - find-npm-prefix "^1.0.2" - libnpmaccess "^3.0.1" - libnpmconfig "^1.2.1" - libnpmhook "^5.0.2" - libnpmorg "^1.0.0" - libnpmpublish "^1.1.0" - libnpmsearch "^2.0.0" - libnpmteam "^1.0.1" - lock-verify "^2.0.2" - npm-lifecycle "^2.1.0" - npm-logical-tree "^1.2.1" - npm-package-arg "^6.1.0" - npm-profile "^4.0.1" - npm-registry-fetch "^3.8.0" - npmlog "^4.1.2" - pacote "^9.2.3" - read-package-json "^2.0.13" - stringify-package "^1.0.0" - libnpmaccess@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-3.0.1.tgz#5b3a9de621f293d425191aa2e779102f84167fa8" @@ -5201,39 +5648,10 @@ libnpmaccess@^3.0.1: npm-package-arg "^6.1.0" npm-registry-fetch "^3.8.0" -libnpmconfig@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/libnpmconfig/-/libnpmconfig-1.2.1.tgz#c0c2f793a74e67d4825e5039e7a02a0044dfcbc0" - integrity sha512-9esX8rTQAHqarx6qeZqmGQKBNZR5OIbl/Ayr0qQDy3oXja2iFVQQI81R6GZ2a02bSNZ9p3YOGX1O6HHCb1X7kA== - dependencies: - figgy-pudding "^3.5.1" - find-up "^3.0.0" - ini "^1.3.5" - -libnpmhook@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/libnpmhook/-/libnpmhook-5.0.2.tgz#d12817b0fb893f36f1d5be20017f2aea25825d94" - integrity sha512-vLenmdFWhRfnnZiNFPNMog6CK7Ujofy2TWiM2CrpZUjBRIhHkJeDaAbJdYCT6W4lcHtyrJR8yXW8KFyq6UAp1g== - dependencies: - aproba "^2.0.0" - figgy-pudding "^3.4.1" - get-stream "^4.0.0" - npm-registry-fetch "^3.8.0" - -libnpmorg@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/libnpmorg/-/libnpmorg-1.0.0.tgz#979b868c48ba28c5820e3bb9d9e73c883c16a232" - integrity sha512-o+4eVJBoDGMgRwh2lJY0a8pRV2c/tQM/SxlqXezjcAg26Qe9jigYVs+Xk0vvlYDWCDhP0g74J8UwWeAgsB7gGw== - dependencies: - aproba "^2.0.0" - figgy-pudding "^3.4.1" - get-stream "^4.0.0" - npm-registry-fetch "^3.8.0" - -libnpmpublish@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-1.1.0.tgz#773bd6fc9ed247e4a41a68ebd69fdc096ea630a3" - integrity sha512-mQ3LT2EWlpJ6Q8mgHTNqarQVCgcY32l6xadPVPMcjWLtVLz7II4WlWkzlbYg1nHGAf+xyABDwS+3aNUiRLkyaA== +libnpmpublish@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-1.1.1.tgz#ff0c6bb0b4ad2bda2ad1f5fba6760a4af37125f0" + integrity sha512-nefbvJd/wY38zdt+b9SHL6171vqBrMtZ56Gsgfd0duEKb/pB8rDT4/ObUQLrHz1tOfht1flt2zM+UGaemzAG5g== dependencies: aproba "^2.0.0" figgy-pudding "^3.5.1" @@ -5245,25 +5663,6 @@ libnpmpublish@^1.1.0: semver "^5.5.1" ssri "^6.0.1" -libnpmsearch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/libnpmsearch/-/libnpmsearch-2.0.0.tgz#de05af47ada81554a5f64276a69599070d4a5685" - integrity sha512-vd+JWbTGzOSfiOc+72MU6y7WqmBXn49egCCrIXp27iE/88bX8EpG64ST1blWQI1bSMUr9l1AKPMVsqa2tS5KWA== - dependencies: - figgy-pudding "^3.5.1" - get-stream "^4.0.0" - npm-registry-fetch "^3.8.0" - -libnpmteam@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/libnpmteam/-/libnpmteam-1.0.1.tgz#ff704b1b6c06ea674b3b1101ac3e305f5114f213" - integrity sha512-gDdrflKFCX7TNwOMX1snWojCoDE5LoRWcfOC0C/fqF7mBq8Uz9zWAX4B2RllYETNO7pBupBaSyBDkTAC15cAMg== - dependencies: - aproba "^2.0.0" - figgy-pudding "^3.4.1" - get-stream "^4.0.0" - npm-registry-fetch "^3.8.0" - listenercount@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/listenercount/-/listenercount-1.0.1.tgz#84c8a72ab59c4725321480c975e6508342e70937" @@ -5313,14 +5712,6 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lock-verify@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lock-verify/-/lock-verify-2.0.2.tgz#148e4f85974915c9e3c34d694b7de9ecb18ee7a8" - integrity sha512-QNVwK0EGZBS4R3YQ7F1Ox8p41Po9VGl2QG/2GsuvTbkJZYSsPeWHKMbbH6iZMCHWSMww5nrJroZYnGzI4cePuw== - dependencies: - npm-package-arg "^5.1.2 || 6" - semver "^5.4.1" - lodash._reinterpolate@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -5336,6 +5727,16 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= + +lodash.set@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" + integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -5359,7 +5760,12 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: +lodash.uniq@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= + +lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -5963,6 +6369,11 @@ negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" +neo-async@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" + integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5983,7 +6394,7 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^2.1.1: +node-fetch@^2.1.1, node-fetch@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== @@ -6078,6 +6489,11 @@ normalize-path@^2.1.1: dependencies: remove-trailing-separator "^1.0.1" +normalize-url@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" + integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== + npm-bundled@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" @@ -6096,12 +6512,7 @@ npm-lifecycle@^2.1.0: umask "^1.1.0" which "^1.3.1" -npm-logical-tree@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/npm-logical-tree/-/npm-logical-tree-1.2.1.tgz#44610141ca24664cad35d1e607176193fd8f5b88" - integrity sha512-AJI/qxDB2PWI4LG1CYN579AY1vCiNyWfkiquCsJWqntRu/WwimVrC8yXeILBFHDwxfOejxewlmnvW9XXjMlYIg== - -"npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", "npm-package-arg@^5.1.2 || 6", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: +"npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" integrity sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA== @@ -6126,6 +6537,14 @@ npm-packlist@^1.1.6: ignore-walk "^3.0.1" npm-bundled "^1.0.1" +npm-packlist@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.1.tgz#19064cdf988da80ea3cee45533879d90192bbfbc" + integrity sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + npm-pick-manifest@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" @@ -6135,15 +6554,6 @@ npm-pick-manifest@^2.2.3: npm-package-arg "^6.0.0" semver "^5.4.1" -npm-profile@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-4.0.1.tgz#d350f7a5e6b60691c7168fbb8392c3603583f5aa" - integrity sha512-NQ1I/1Q7YRtHZXkcuU1/IyHeLy6pd+ScKg4+DQHdfsm769TGq6HPrkbuNJVJS4zwE+0mvvmeULzQdWn2L2EsVA== - dependencies: - aproba "^1.1.2 || 2" - figgy-pudding "^3.4.1" - npm-registry-fetch "^3.8.0" - npm-registry-fetch@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-3.8.0.tgz#aa7d9a7c92aff94f48dba0984bdef4bd131c88cc" @@ -6156,6 +6566,18 @@ npm-registry-fetch@^3.8.0: make-fetch-happen "^4.0.1" npm-package-arg "^6.1.0" +npm-registry-fetch@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-3.9.0.tgz#44d841780e2833f06accb34488f8c7450d1a6856" + integrity sha512-srwmt8YhNajAoSAaDWndmZgx89lJwIZ1GWxOuckH4Coek4uHv5S+o/l9FLQe/awA+JwTnj4FJHldxhlXdZEBmw== + dependencies: + JSONStream "^1.3.4" + bluebird "^3.5.1" + figgy-pudding "^3.4.1" + lru-cache "^4.1.3" + make-fetch-happen "^4.0.1" + npm-package-arg "^6.1.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -6209,6 +6631,16 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" +object.fromentries@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab" + integrity sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA== + dependencies: + define-properties "^1.1.2" + es-abstract "^1.11.0" + function-bind "^1.1.1" + has "^1.0.1" + object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" @@ -6222,6 +6654,11 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" +octokit-pagination-methods@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" + integrity sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ== + on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" @@ -6410,10 +6847,10 @@ p-waterfall@^1.0.0: dependencies: p-reduce "^1.0.0" -pacote@^9.2.3: - version "9.4.0" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-9.4.0.tgz#af979abdeb175cd347c3e33be3241af1ed254807" - integrity sha512-WQ1KL/phGMkedYEQx9ODsjj7xvwLSpdFJJdEXrLyw5SILMxcTNt5DTxT2Z93fXuLFYJBlZJdnwdalrQdB/rX5w== +pacote@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-9.5.0.tgz#85f3013a3f6dd51c108b0ccabd3de8102ddfaeda" + integrity sha512-aUplXozRbzhaJO48FaaeClmN+2Mwt741MC6M3bevIGZwdCaP7frXzbUOfOWa91FPHoLITzG0hYaKY363lxO3bg== dependencies: bluebird "^3.5.3" cacache "^11.3.2" @@ -6470,6 +6907,24 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.1.tgz#0ec769704949778cb3b8eda5e994c32073a1adff" + integrity sha512-d7yhga0Oc+PwNXDvQ0Jv1BuWkLVPXcAoQ/WREgd6vNNoKYaW52KI+RdOFjI63wjkmps9yUE8VS4veP+AgpQ/hA== + dependencies: + is-ssh "^1.3.0" + protocols "^1.4.0" + +parse-url@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-5.0.1.tgz#99c4084fc11be14141efa41b3d117a96fcb9527f" + integrity sha512-flNUPP27r3vJpROi0/R3/2efgKkyXqnXwyP1KQ2U0SfFRgdizOdWfvrrvJg1LuOoxs7GQhmxJlq23IpQ/BkByg== + dependencies: + is-ssh "^1.3.0" + normalize-url "^3.3.0" + parse-path "^4.0.0" + protocols "^1.4.0" + parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -6509,7 +6964,7 @@ path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" -path-parse@^1.0.5: +path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -6563,6 +7018,13 @@ pirates@^4.0.0: dependencies: node-modules-regexp "^1.0.0" +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -6612,10 +7074,10 @@ prepend-http@^1.0.1: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= -prettier@1.13.6: - version "1.13.6" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" - integrity sha512-p5eqCNiohWZN++7aJXUVj0JgLqHCPLf9GLIcLBHGNWs4Y9FJOPs6+KNO2WT0udJIQJTbeZFrJkjzjcb8fkAYYQ== +prettier@1.16.4: + version "1.16.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" + integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== pretty-format@24.0.0-alpha.6: version "24.0.0-alpha.6" @@ -6633,6 +7095,16 @@ pretty-format@^24.0.0: ansi-regex "^4.0.0" ansi-styles "^3.2.0" +pretty-format@^24.5.0: + version "24.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.5.0.tgz#cc69a0281a62cd7242633fc135d6930cd889822d" + integrity sha512-/3RuSghukCf8Riu5Ncve0iI+BzVkbRU5EeUoArKARZobREycuH5O4waxvaNIloEXdb0qwgmEAed5vTpX1HNROQ== + dependencies: + "@jest/types" "^24.5.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -6698,7 +7170,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.6.0: +prop-types@^15.6.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -6712,6 +7184,11 @@ proto-list@~1.2.1: resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= +protocols@^1.1.0, protocols@^1.4.0: + version "1.4.7" + resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.7.tgz#95f788a4f0e979b291ffefcf5636ad113d037d32" + integrity sha512-Fx65lf9/YDn3hUX08XUc0J8rSux36rEsyiv21ZGUC1mOyeM3lTRpZLcrm8aAolzS4itwVfm7TAPyxC2E5zd6xg== + protoduck@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/protoduck/-/protoduck-5.0.1.tgz#03c3659ca18007b69a50fd82a7ebcc516261151f" @@ -6795,6 +7272,11 @@ react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.3.tgz#4ad8b029c2a718fc0cfc746c8d4e1b7221e5387d" integrity sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA== +react-is@^16.8.4: + version "16.8.5" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.5.tgz#c54ac229dd66b5afe0de5acbe47647c3da692ff8" + integrity sha512-sudt2uq5P/2TznPV4Wtdi+Lnq3yaYW8LfvPKLM9BKD8jJNBkxMVyB0C9/GmVhLw7Jbdmndk/73n7XQGeN9A3QQ== + react-proxy@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a" @@ -6937,12 +7419,19 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -realpath-native@^1.0.0, realpath-native@^1.0.2: +realpath-native@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.2.tgz#cd51ce089b513b45cf9b1516c82989b51ccc6560" dependencies: util.promisify "^1.0.0" +realpath-native@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== + dependencies: + util.promisify "^1.0.0" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -7123,6 +7612,13 @@ resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: dependencies: path-parse "^1.0.5" +resolve@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" + integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== + dependencies: + path-parse "^1.0.6" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -7143,7 +7639,7 @@ revalidator@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b" -rimraf@2, rimraf@^2.5.2, rimraf@^2.6.2: +rimraf@2, rimraf@^2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -7164,6 +7660,11 @@ rsvp@^3.3.3: version "3.6.2" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" +rsvp@^4.8.4: + version "4.8.4" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" + integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -7230,6 +7731,21 @@ sane@^3.0.0: optionalDependencies: fsevents "^1.2.3" +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -7619,11 +8135,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringify-package@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.0.tgz#e02828089333d7d45cd8c287c30aa9a13375081b" - integrity sha512-JIQqiWmLiEozOC0b0BtxZ/AOUtdUZHCBPgqIZ2kSJJqGwgb9neo44XdTHUC4HZSGqi03hOeB7W/E8rAlKnGe9g== - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -7642,10 +8153,6 @@ strip-ansi@^5.0.0: dependencies: ansi-regex "^4.0.0" -strip-bom@3.0.0, strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -7653,6 +8160,10 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + strip-eof@^1.0.0: version "1.0.0" resolved "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" @@ -7686,13 +8197,13 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^5.3.0, supports-color@^5.4.0: +supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" dependencies: has-flag "^3.0.0" -supports-color@^6.1.0: +supports-color@^6.0.0, supports-color@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== @@ -7997,7 +8508,7 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" -universal-user-agent@^2.0.0: +universal-user-agent@^2.0.0, universal-user-agent@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.0.3.tgz#9f6f09f9cc33de867bb720d84c08069b14937c6c" integrity sha512-eRHEHhChCBHrZsA4WEhdgiOKgdvgrMIHwnwnqD0r5C6AO8kwKcG7qSku3iXdhvHL3YvsS9ZkSGN8h/hIpoFC8g== @@ -8191,7 +8702,7 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@1, which@^1.2.12, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: @@ -8246,6 +8757,15 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write-file-atomic@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" + integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + write-file-atomic@^1.2.0: version "1.3.4" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" @@ -8262,15 +8782,6 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-file-atomic@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.2.tgz#a7181706dfba17855d221140a9c06e15fcdd87b9" - integrity sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g== - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - signal-exit "^3.0.2" - write-json-file@^2.2.0, write-json-file@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.3.0.tgz#2b64c8a33004d54b8698c76d585a77ceb61da32f" From 8e0ed9e6097504edd331f422ae5ca78bb5880ff8 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Thu, 28 Mar 2019 21:29:09 +0100 Subject: [PATCH 044/234] Refactor: Remove eject (#275) Summary: --------- Since `create-react-native-app` is deprecated this functionality is no longer needed. --- packages/cli/README.md | 3 - packages/cli/src/commands/eject/eject.js | 97 ------------------- packages/cli/src/commands/index.js | 2 - packages/cli/src/commands/link/link.js | 14 --- .../cli/src/tools/findReactNativeScripts.js | 26 ----- 5 files changed, 142 deletions(-) delete mode 100644 packages/cli/src/commands/eject/eject.js delete mode 100644 packages/cli/src/tools/findReactNativeScripts.js diff --git a/packages/cli/README.md b/packages/cli/README.md index f4158203a..18289bedb 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -8,7 +8,6 @@ CLI comes with a set of commands and flags you can pass to them. - [`bundle`](#bundle) - [`dependencies`](#dependencies) -- [`eject`](#eject) - [`info`](#info) - [`install`](#install) - [`library`](#library) @@ -29,8 +28,6 @@ _Note: This document is still under development and doesn't represent the full A ### `dependencies` -### `eject` - ### `info` ### `install` diff --git a/packages/cli/src/commands/eject/eject.js b/packages/cli/src/commands/eject/eject.js deleted file mode 100644 index 32144fbd7..000000000 --- a/packages/cli/src/commands/eject/eject.js +++ /dev/null @@ -1,97 +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 - */ - -import path from 'path'; -import fs from 'fs'; -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 - * difficult to maintain, this new script allows an `app.json` to be defined for the project, which - * is used to configure the native app. - * - * The `app.json` config may contain the following keys: - * - * - `name` - The short name used for the project, should be TitleCase - * - `displayName` - The app's name on the home screen - */ - -function eject() { - const doesIOSExist = fs.existsSync(path.resolve('ios')); - const doesAndroidExist = fs.existsSync(path.resolve('android')); - if (doesIOSExist && doesAndroidExist) { - logger.error( - 'Both the iOS and Android folders already exist! Please delete `ios` and/or `android` ' + - 'before ejecting.', - ); - process.exit(1); - } - - let appConfig = null; - try { - appConfig = require(path.resolve('app.json')); - } catch (e) { - logger.error( - 'Eject requires an `app.json` config file to be located at ' + - `${path.resolve( - 'app.json', - )}, and it must at least specify a \`name\` for the project ` + - "name, and a `displayName` for the app's home screen label.", - ); - process.exit(1); - } - - const appName = appConfig.name; - if (!appName) { - logger.error( - 'App `name` must be defined in the `app.json` config file to define the project name. ' + - 'It must not contain any spaces or dashes.', - ); - process.exit(1); - } - - const displayName = appConfig.displayName; - if (!displayName) { - logger.error( - 'App `displayName` must be defined in the `app.json` config file, to define the label ' + - 'of the app on the home screen.', - ); - process.exit(1); - } - - const templateOptions = {displayName}; - - if (!doesIOSExist) { - logger.info('Generating the iOS folder.'); - copyProjectTemplateAndReplace( - path.resolve('node_modules', 'react-native', 'template', 'ios'), - path.resolve('ios'), - appName, - templateOptions, - ); - } - - if (!doesAndroidExist) { - logger.info('Generating the Android folder.'); - copyProjectTemplateAndReplace( - path.resolve('node_modules', 'react-native', 'template', 'android'), - path.resolve('android'), - appName, - templateOptions, - ); - } -} - -export default { - name: 'eject', - description: 'Re-create the iOS and Android folders and native code', - func: eject, - options: [], -}; diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index fded7f655..04d882097 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -19,7 +19,6 @@ 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'; @@ -40,7 +39,6 @@ const loadLocalCommands: Array = [ library, bundle, ramBundle, - eject, link, unlink, install, diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index b4538c9ce..c57f950ac 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -19,7 +19,6 @@ import getProjectConfig from './getProjectConfig'; import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; -import findReactNativeScripts from '../../tools/findReactNativeScripts'; import getPlatforms, {getPlatformName} from '../../tools/getPlatforms'; type FlagsType = { @@ -59,19 +58,6 @@ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { ); return Promise.reject(err); } - const hasProjectConfig = Object.keys(platforms).reduce( - (acc, key) => acc || key in project, - false, - ); - if (!hasProjectConfig && findReactNativeScripts()) { - throw new Error( - '`react-native link [package]` can not be used in Create React Native App projects. ' + - 'If you need to include a library that relies on custom native code, ' + - 'you might have to eject first. ' + - 'See https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md ' + - 'for more information.', - ); - } if (rawPackageName === undefined) { logger.debug( diff --git a/packages/cli/src/tools/findReactNativeScripts.js b/packages/cli/src/tools/findReactNativeScripts.js deleted file mode 100644 index 876b9dcae..000000000 --- a/packages/cli/src/tools/findReactNativeScripts.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -import path from 'path'; -import fs from 'fs'; - -function findReactNativeScripts(): ?string { - const executablePath = path.resolve( - 'node_modules', - '.bin', - 'react-native-scripts', - ); - if (fs.existsSync(executablePath)) { - return executablePath; - } - return null; -} - -export default findReactNativeScripts; From a76fcd4c1d7ae53cfbb7d719abd4db385c3b4182 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 1 Apr 2019 18:10:37 +0200 Subject: [PATCH 045/234] Standardise configuration mechanism (#254) Summary: --------- This pull requests brings a new way of configuring the CLI and drops never properly standardised and documented "rnpm" configuration. This is done in order to support new "auto-linking" feature and consolidate the configuration into a single place, that is easy to customise by developers. ### Highlights Given the scope of this PR, it's hard to write down every tiny detail. I've tried to leave as many comments as possible throughout the code to make it easier for you to navigate and understand some of the code patterns. Please see the highlighted changes below: - We now use `cosmiconfig` to load user preferences. We do that by taking "react-native" out of "package.json" and reading "react-native.config.js". We still read "rnpm" for legacy purposes and print appropriate deprecation messages along the instructions on what to do in order to upgrade. Jest validation library makes this kind of things super easy. - We validate the provided configuration by user using Jest validation library. This gives instant feedback whether the configuration is correct or not. - We now read configuration in a single place (happens in main CLI file) and pass it down to commands. Previously, we used to call `findPlugins` multiple times w/o cache, causing expensive globs to be performed. - Project configuration is lazy. We won't glob node_modules and/or look for native files unless you explicitly read for that package configuration. - Better support for out-of-tree-platforms - no need to define "haste" yourself, we are able to infer it from other properties. The files are also better organised now, causing less of maintenance pain with "linkConfig" - We consider our automatically generated configuration a set of defaults. Users can override settings for the project and each of the dependencies. Useful, especially with auto-linking feature to disable certain packages from it or when you don't want to link particular platform automatically. This has been historically really hard to implement - Global flags (e.g. "reactNativePath") can now be defined in configuration, instead of passing every time around. This fixes issues with "packager.sh" script (starting automatically Metro when running from Xcode) when run from RNTester.xcodeproj ### Next steps Once this PR is merged, we can concurrently start working/merging other "auto-linking" PRs. In the meantime, I'll submit a PR to move regular "link" (soon to be considered a legacy) to use the new configuration format as well. The new configuration has been designed in the way to still include previous configuration keys to support "link" and other community packages. For now, we print handy deprecation messages to help migrate the community from "rnpm" to "react-native" configuration. When "link" gets deprecated/removed forever in favour of "auto-linking", we should revisit the configuration and eventually, remove extraneous keys out of it. With "auto-linking", we don't need majority of it. Test Plan: ---------- Run `react-native config` to output the configuration. --- packages/cli/package.json | 3 + packages/cli/src/cliEntry.js | 52 +---- packages/cli/src/commands/config/config.js | 11 + packages/cli/src/commands/index.js | 28 +-- .../src/commands/info/__tests__/info.test.js | 12 +- .../src/commands/link/getDependencyConfig.js | 1 + .../cli/src/commands/link/getProjectConfig.js | 1 + packages/cli/src/commands/link/linkAll.js | 8 +- .../upgrade/__tests__/upgrade.test.js | 7 + .../__tests__/__snapshots__/index.js.snap | 152 ++++++++++++++ .../cli/src/tools/config/__tests__/index.js | 197 ++++++++++++++++++ .../cli/src/tools/config/findDependencies.js | 34 +++ packages/cli/src/tools/config/index.js | 118 +++++++++++ .../src/tools/config/readConfigFromDisk.js | 105 ++++++++++ .../tools/config/resolveReactNativePath.js | 21 ++ packages/cli/src/tools/config/schema.js | 122 +++++++++++ packages/cli/src/tools/config/types.flow.js | 76 +++++++ packages/cli/src/tools/errors.js | 43 ++++ packages/cli/src/tools/getLegacyConfig.js | 62 ------ packages/cli/src/tools/loadMetroConfig.js | 9 +- packages/cli/src/tools/types.flow.js | 31 ++- yarn.lock | 38 +++- 22 files changed, 984 insertions(+), 147 deletions(-) create mode 100644 packages/cli/src/commands/config/config.js create mode 100644 packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap create mode 100644 packages/cli/src/tools/config/__tests__/index.js create mode 100644 packages/cli/src/tools/config/findDependencies.js create mode 100644 packages/cli/src/tools/config/index.js create mode 100644 packages/cli/src/tools/config/readConfigFromDisk.js create mode 100644 packages/cli/src/tools/config/resolveReactNativePath.js create mode 100644 packages/cli/src/tools/config/schema.js create mode 100644 packages/cli/src/tools/config/types.flow.js delete mode 100644 packages/cli/src/tools/getLegacyConfig.js diff --git a/packages/cli/package.json b/packages/cli/package.json index fb4e5aca0..a8c4e693a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -23,6 +23,8 @@ "commander": "^2.19.0", "compression": "^1.7.1", "connect": "^3.6.5", + "cosmiconfig": "^5.1.0", + "deepmerge": "^3.2.0", "denodeify": "^1.2.1", "envinfo": "^7.1.0", "errorhandler": "^1.5.0", @@ -32,6 +34,7 @@ "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", + "joi": "^14.3.1", "lodash": "^4.17.5", "metro": "^0.53.1", "metro-config": "^0.53.1", diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index e7779fca4..1b69ccee7 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -10,10 +10,10 @@ import chalk from 'chalk'; import childProcess from 'child_process'; import commander from 'commander'; -import minimist from 'minimist'; import path from 'path'; + 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'; @@ -21,11 +21,10 @@ import logger from './tools/logger'; import findPlugins from './tools/findPlugins'; import {setProjectDir} from './tools/PackageManager'; import pkgJson from '../package.json'; +import loadConfig from './tools/config'; commander .option('--version', 'Print CLI version') - .option('--projectRoot [string]', 'Path to the root of the project') - .option('--reactNativePath [string]', 'Path to React Native') .option('--verbose', 'Increase logging verbosity'); commander.on('command:*', () => { @@ -117,15 +116,6 @@ const addCommand = (command: CommandT, ctx: ContextT) => { opt.default, ), ); - - /** - * We want every command (like "start", "link") to accept below options. - * To achieve that we append them to regular options of each command here. - * This way they'll be displayed in the commands --help menus. - */ - cmd - .option('--projectRoot [string]', 'Path to the root of the project') - .option('--reactNativePath [string]', 'Path to React Native'); }; async function run() { @@ -156,43 +146,11 @@ async function setupAndRun() { } } - /** - * At this point, commander arguments are not parsed yet because we need to - * add all the commands and their options. That's why we resort to using - * minimist for parsing some global options. - */ - const options = minimist(process.argv.slice(2)); - - const root = options.projectRoot - ? path.resolve(options.projectRoot) - : process.cwd(); - - const reactNativePath = options.reactNativePath - ? path.resolve(options.reactNativePath) - : (() => { - try { - return path.dirname( - // $FlowIssue: Wrong `require.resolve` type definition - require.resolve('react-native/package.json', { - paths: [root], - }), - ); - } catch (_ignored) { - throw new Error( - 'Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies.', - ); - } - })(); - - const ctx = { - ...getLegacyConfig(root), - reactNativePath, - root, - }; + const ctx = loadConfig(); setProjectDir(ctx.root); - const commands = getCommands(ctx.root); + const commands = getCommands(ctx); commands.forEach(command => addCommand(command, ctx)); diff --git a/packages/cli/src/commands/config/config.js b/packages/cli/src/commands/config/config.js new file mode 100644 index 000000000..51fd05243 --- /dev/null +++ b/packages/cli/src/commands/config/config.js @@ -0,0 +1,11 @@ +/** + * @flow + */ +import {type ContextT} from '../../tools/types.flow'; +export default { + name: 'config', + description: 'Print CLI configuration', + func: async (argv: string[], ctx: ContextT) => { + console.log(JSON.stringify(ctx, null, 2)); + }, +}; diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index 04d882097..c3fc82f76 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -4,7 +4,6 @@ import path from 'path'; -import findPlugins from '../tools/findPlugins'; import logger from '../tools/logger'; import type { @@ -13,6 +12,8 @@ import type { LocalCommandT, } from '../tools/types.flow'; +import {type ContextT} from '../tools/types.flow'; + import server from './server/server'; import runIOS from './runIOS/runIOS'; import runAndroid from './runAndroid/runAndroid'; @@ -27,6 +28,7 @@ import upgrade from './upgrade/upgrade'; import logAndroid from './logAndroid/logAndroid'; import logIOS from './logIOS/logIOS'; import info from './info/info'; +import config from './config/config'; /** * List of built-in commands @@ -47,6 +49,7 @@ const loadLocalCommands: Array = [ logAndroid, logIOS, info, + config, ]; /** @@ -55,10 +58,11 @@ const loadLocalCommands: Array = [ * This checks all CLI plugins for presence of 3rd party packages that define commands * and loads them */ -const loadProjectCommands = (root: string): Array => { - const plugins = findPlugins(root); - - return plugins.commands.reduce((acc: Array, pathToCommands) => { +const loadProjectCommands = ({ + root, + commands, +}: ContextT): Array => { + return commands.reduce((acc: Array, cmdPath: string) => { /** * `pathToCommand` is a path to a file where commands are defined, relative to `node_modules` * folder. @@ -67,12 +71,12 @@ const loadProjectCommands = (root: string): Array => { * into consideration. */ const name = - pathToCommands[0] === '@' - ? pathToCommands + cmdPath[0] === '@' + ? cmdPath .split(path.sep) .slice(0, 2) .join(path.sep) - : pathToCommands.split(path.sep)[0]; + : cmdPath.split(path.sep)[0]; const pkg = require(path.join(root, 'node_modules', name, 'package.json')); @@ -81,7 +85,7 @@ const loadProjectCommands = (root: string): Array => { | Array = require(path.join( root, 'node_modules', - pathToCommands, + cmdPath, )); if (Array.isArray(requiredCommands)) { @@ -90,14 +94,14 @@ const loadProjectCommands = (root: string): Array => { ); } - return acc.concat({...requiredCommands}); + return acc.concat({...requiredCommands, pkg}); }, []); }; /** * Loads all the commands inside a given `root` folder */ -export function getCommands(root: string): Array { +export function getCommands(ctx: ContextT): Array { return [ ...loadLocalCommands, { @@ -111,6 +115,6 @@ export function getCommands(root: string): Array { ); }, }, - ...loadProjectCommands(root), + ...loadProjectCommands(ctx), ]; } diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js index 9683acbae..7b19753b0 100644 --- a/packages/cli/src/commands/info/__tests__/info.test.js +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -8,7 +8,17 @@ jest.mock('../../../tools/logger', () => ({ log: jest.fn(), })); -const ctx = {reactNativePath: '', root: ''}; +const ctx = { + root: '', + reactNativePath: '', + dependencies: {}, + platforms: {}, + commands: [], + haste: { + platforms: [], + providesModuleNodeModules: [], + }, +}; beforeEach(() => { jest.resetAllMocks(); diff --git a/packages/cli/src/commands/link/getDependencyConfig.js b/packages/cli/src/commands/link/getDependencyConfig.js index 3cc2e1af2..7983691c2 100644 --- a/packages/cli/src/commands/link/getDependencyConfig.js +++ b/packages/cli/src/commands/link/getDependencyConfig.js @@ -28,6 +28,7 @@ export default function getDependencyConfig( Object.keys(availablePlatforms).forEach(platform => { platformConfigs[platform] = availablePlatforms[platform].dependencyConfig( folder, + // $FlowIssue: Flow can't match platform config with its appropriate config function config[platform] || {}, ); }); diff --git a/packages/cli/src/commands/link/getProjectConfig.js b/packages/cli/src/commands/link/getProjectConfig.js index 9172f012b..d3b40c169 100644 --- a/packages/cli/src/commands/link/getProjectConfig.js +++ b/packages/cli/src/commands/link/getProjectConfig.js @@ -24,6 +24,7 @@ export default function getProjectConfig( logger.debug(`Getting project config for ${getPlatformName(platform)}...`); platformConfigs[platform] = availablePlatforms[platform].projectConfig( ctx.root, + // $FlowIssue: Flow can't match platform config with its appropriate config function config[platform] || {}, ); }); diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 333185dac..9ba413763 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -33,19 +33,19 @@ function linkAll( const projectAssets = getAssets(context.root); const dependencies = getProjectDependencies(context.root); - const depenendenciesConfig = dependencies.map(dependnecy => - getDependencyConfig(context, platforms, dependnecy), + const dependenciesConfig = dependencies.map(dependency => + getDependencyConfig(context, platforms, dependency), ); const assets = dedupeAssets( - depenendenciesConfig.reduce( + dependenciesConfig.reduce( (acc, dependency) => acc.concat(dependency.assets), projectAssets, ), ); const tasks = flatten( - depenendenciesConfig.map(config => [ + dependenciesConfig.map(config => [ () => promisify(config.commands.prelink || commandStub), () => linkDependency(platforms, project, config), () => promisify(config.commands.postlink || commandStub), diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 2ae9d7df9..aa1569a17 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -55,6 +55,13 @@ const olderVersion = '0.56.0'; const ctx = { root: '/project/root', reactNativePath: '', + commands: [], + platforms: {}, + dependencies: {}, + haste: { + providesModuleNodeModules: [], + platforms: [], + }, }; const opts = { legacy: false, diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap new file mode 100644 index 000000000..aaa2e0cb7 --- /dev/null +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap @@ -0,0 +1,152 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should deep merge project configuration with default values 1`] = ` +Object { + "commands": Array [], + "dependencies": Object { + "react-native-test": Object { + "assets": Array [], + "hooks": Object {}, + "params": Array [], + "platforms": Object { + "android": null, + "ios": Object { + "folder": "<>/node_modules/react-native-test", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspec": null, + "projectName": "HelloWorld.xcodeproj", + "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "./abc", + }, + }, + }, + }, + "haste": Object { + "platforms": Array [], + "providesModuleNodeModules": Array [], + }, + "platforms": Object { + "android": Object {}, + "ios": Object {}, + }, + "reactNativePath": ".", + "root": "<>", +} +`; + +exports[`should have a valid structure by default 1`] = ` +Object { + "commands": Array [], + "dependencies": Object {}, + "haste": Object { + "platforms": Array [], + "providesModuleNodeModules": Array [], + }, + "platforms": Object { + "android": Object {}, + "ios": Object {}, + }, + "reactNativePath": ".", + "root": "<>", +} +`; + +exports[`should load an out-of-tree "windows" platform that ships with a dependency 1`] = ` +Object { + "haste": Object { + "platforms": Array [ + "windows", + ], + "providesModuleNodeModules": Array [ + "react-native-windows", + ], + }, + "platforms": Object { + "android": Object {}, + "ios": Object {}, + "windows": Object {}, + }, +} +`; + +exports[`should load commands from "react-native-foo" and "react-native-bar" packages 1`] = ` +Array [ + "react-native-foo/command-foo.js", + "react-native-bar/command-bar.js", +] +`; + +exports[`should read \`rnpm\` config from a dependency and transform it to a new format 1`] = ` +Object { + "assets": Array [], + "hooks": Object {}, + "params": Array [], + "platforms": Object { + "android": null, + "ios": Object { + "folder": "<>/node_modules/react-native-foo", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/node_modules/react-native-foo/customLocation/customProject.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspec": null, + "projectName": "customProject.xcodeproj", + "projectPath": "<>/node_modules/react-native-foo/customLocation/customProject.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "<>/node_modules/react-native-foo/customLocation", + }, + }, +} +`; + +exports[`should read a config of a dependency and use it to load other settings 1`] = ` +Object { + "assets": Array [], + "hooks": Object {}, + "params": Array [], + "platforms": Object { + "android": null, + "ios": Object { + "folder": "<>/node_modules/react-native-test", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspec": null, + "projectName": "customProject.xcodeproj", + "projectPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "<>/node_modules/react-native-test/customLocation", + }, + }, +} +`; + +exports[`should return dependencies from package.json 1`] = ` +Object { + "react-native-test": Object { + "assets": Array [], + "hooks": Object {}, + "params": Array [], + "platforms": Object { + "android": null, + "ios": Object { + "folder": "<>/node_modules/react-native-test", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspec": null, + "projectName": "HelloWorld.xcodeproj", + "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "<>/node_modules/react-native-test/ios", + }, + }, + }, +} +`; diff --git a/packages/cli/src/tools/config/__tests__/index.js b/packages/cli/src/tools/config/__tests__/index.js new file mode 100644 index 000000000..be2173b51 --- /dev/null +++ b/packages/cli/src/tools/config/__tests__/index.js @@ -0,0 +1,197 @@ +/** + * @flow + */ + +import loadConfig from '../'; + +import { + cleanup, + writeFiles, + getTempDirectory, +} from '../../../../../../e2e/helpers'; + +const DIR = getTempDirectory('resolve_config_path_test'); + +// Removes string from all key/values within an object +const removeString = (config, str) => + JSON.parse( + JSON.stringify(config).replace(new RegExp(str, 'g'), '<>'), + ); + +beforeEach(() => { + cleanup(DIR); + jest.resetModules(); +}); + +afterEach(() => cleanup(DIR)); + +test('should have a valid structure by default', () => { + writeFiles(DIR, { + 'package.json': `{ + "react-native": { + "reactNativePath": "." + } + }`, + }); + const config = loadConfig(DIR); + expect(removeString(config, DIR)).toMatchSnapshot(); +}); + +test('should return dependencies from package.json', () => { + writeFiles(DIR, { + 'node_modules/react-native-test/package.json': '{}', + 'node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj': + '', + 'package.json': `{ + "dependencies": { + "react-native-test": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {dependencies} = loadConfig(DIR); + expect(removeString(dependencies, DIR)).toMatchSnapshot(); +}); + +test('should read a config of a dependency and use it to load other settings', () => { + writeFiles(DIR, { + 'node_modules/react-native-test/package.json': `{ + "react-native": { + "dependency": { + "platforms": { + "ios": { + "project": "./customLocation/customProject.xcodeproj" + } + } + } + } + }`, + 'package.json': `{ + "dependencies": { + "react-native-test": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {dependencies} = loadConfig(DIR); + expect( + removeString(dependencies['react-native-test'], DIR), + ).toMatchSnapshot(); +}); + +test('should deep merge project configuration with default values', () => { + writeFiles(DIR, { + 'node_modules/react-native-test/package.json': '{}', + 'node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj': + '', + 'package.json': `{ + "dependencies": { + "react-native-test": "0.0.1" + }, + "react-native": { + "reactNativePath": ".", + "dependencies": { + "react-native-test": { + "platforms": { + "ios": { + "sourceDir": "./abc" + } + } + } + } + } + }`, + }); + const config = loadConfig(DIR); + expect(removeString(config, DIR)).toMatchSnapshot(); +}); + +test('should read `rnpm` config from a dependency and transform it to a new format', () => { + writeFiles(DIR, { + 'node_modules/react-native-foo/package.json': `{ + "name": "react-native-foo", + "rnpm": { + "ios": { + "project": "./customLocation/customProject.xcodeproj" + } + } + }`, + 'package.json': `{ + "dependencies": { + "react-native-foo": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {dependencies} = loadConfig(DIR); + expect(removeString(dependencies['react-native-foo'], DIR)).toMatchSnapshot(); +}); + +test('should load commands from "react-native-foo" and "react-native-bar" packages', () => { + writeFiles(DIR, { + 'node_modules/react-native-foo/package.json': `{ + "react-native": { + "commands": [ + "./command-foo.js" + ] + } + }`, + 'node_modules/react-native-bar/package.json': `{ + "react-native": { + "commands": [ + "./command-bar.js" + ] + } + }`, + 'package.json': `{ + "dependencies": { + "react-native-foo": "0.0.1", + "react-native-bar": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {commands} = loadConfig(DIR); + expect(removeString(commands, DIR)).toMatchSnapshot(); +}); + +test('should load an out-of-tree "windows" platform that ships with a dependency', () => { + writeFiles(DIR, { + 'node_modules/react-native-windows/platform.js': ` + module.exports = {"windows": {}}; + `, + 'node_modules/react-native-windows/package.json': `{ + "name": "react-native-windows", + "rnpm": { + "haste": { + "platforms": [ + "windows" + ], + "providesModuleNodeModules": [ + "react-native-windows" + ] + }, + "plugin": "./plugin.js", + "platform": "./platform.js" + } + }`, + 'package.json': `{ + "dependencies": { + "react-native-windows": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {haste, platforms} = loadConfig(DIR); + expect(removeString({haste, platforms}, DIR)).toMatchSnapshot(); +}); diff --git a/packages/cli/src/tools/config/findDependencies.js b/packages/cli/src/tools/config/findDependencies.js new file mode 100644 index 000000000..7fda35955 --- /dev/null +++ b/packages/cli/src/tools/config/findDependencies.js @@ -0,0 +1,34 @@ +/** + * @flow + */ + +import path from 'path'; + +const pluginRe = new RegExp( + [ + '^react-native-', + '^@(.*)/react-native-', + '^@react-native(.*)/(?!rnpm-plugin-)', + ].join('|'), +); + +/** + * Returns an array of dependencies from project's package.json that + * are likely to be React Native packages (see regular expression above) + */ +export default function findDependencies(root: string): Array { + let pjson; + + try { + pjson = require(path.join(root, 'package.json')); + } catch (e) { + return []; + } + + const deps = [ + ...Object.keys(pjson.dependencies || {}), + ...Object.keys(pjson.devDependencies || {}), + ]; + + return deps.filter(dependency => pluginRe.test(dependency)); +} diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js new file mode 100644 index 000000000..f6920a8c5 --- /dev/null +++ b/packages/cli/src/tools/config/index.js @@ -0,0 +1,118 @@ +/** + * @flow + */ +import dedent from 'dedent'; +import path from 'path'; +import merge from 'deepmerge'; + +import findDependencies from './findDependencies'; +import { + readProjectConfigFromDisk, + readDependencyConfigFromDisk, + readLegacyDependencyConfigFromDisk, +} from './readConfigFromDisk'; + +import {type ProjectConfigT, type RawProjectConfigT} from './types.flow'; + +/** + * Built-in platforms + */ +import * as ios from '../ios'; +import * as android from '../android'; +import resolveReactNativePath from './resolveReactNativePath'; + +/** + * Loads CLI configuration + */ +function loadConfig(projectRoot: string = process.cwd()): ProjectConfigT { + const inferredProjectConfig = findDependencies(projectRoot).reduce( + (acc: RawProjectConfigT, dependencyName) => { + const root = path.join(projectRoot, 'node_modules', dependencyName); + + const config = + readLegacyDependencyConfigFromDisk(root) || + readDependencyConfigFromDisk(root); + + return { + ...acc, + dependencies: { + ...acc.dependencies, + // $FlowIssue: Computed getters are not yet supported. + get [dependencyName]() { + return { + platforms: Object.keys(acc.platforms).reduce( + (dependency, platform) => { + dependency[platform] = acc.platforms[ + platform + ].dependencyConfig( + root, + config.dependency.platforms[platform], + ); + return dependency; + }, + {}, + ), + assets: config.dependency.assets, + hooks: config.dependency.hooks, + params: config.dependency.params, + }; + }, + }, + commands: acc.commands.concat( + config.commands.map(pathToCommand => + path.join(dependencyName, pathToCommand), + ), + ), + platforms: { + ...acc.platforms, + ...config.platforms, + }, + haste: { + providesModuleNodeModules: acc.haste.providesModuleNodeModules.concat( + Object.keys(config.platforms).length > 0 ? dependencyName : [], + ), + platforms: [...acc.haste.platforms, ...Object.keys(config.platforms)], + }, + }; + }, + ({ + root: projectRoot, + reactNativePath: resolveReactNativePath(projectRoot), + dependencies: {}, + commands: [], + platforms: { + ios, + android, + }, + haste: { + providesModuleNodeModules: [], + platforms: [], + }, + }: RawProjectConfigT), + ); + + const config: RawProjectConfigT = merge( + inferredProjectConfig, + readProjectConfigFromDisk(projectRoot), + ); + + if (config.reactNativePath === null) { + throw new Error(dedent` + Unable to find React Native files. Make sure "react-native" module is installed + in your project dependencies. + + If you are using React Native from a non-standard location, consider setting: + { + "react-native": { + "reactNativePath": "./path/to/react-native" + } + } + in your \`package.json\`. + `); + } + + // $FlowIssue: `reactNativePath: null` is never null at this point + return config; +} + +export default loadConfig; diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js new file mode 100644 index 000000000..11ebc7915 --- /dev/null +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -0,0 +1,105 @@ +/** + * @flow + * + * Loads and validates a project configuration + */ +import Joi from 'joi'; +import cosmiconfig from 'cosmiconfig'; +import path from 'path'; + +import {type DependencyConfigT, type ProjectConfigT} from './types.flow'; + +import {JoiError} from '../errors'; + +import * as schema from './schema'; +import logger from '../logger'; + +/** + * Places to look for the new configuration + */ +const searchPlaces = ['react-native.config.js', 'package.json']; + +/** + * Reads a project configuration as defined by the user in the current + * workspace. + */ +export function readProjectConfigFromDisk(rootFolder: string): ProjectConfigT { + const explorer = cosmiconfig('react-native', {searchPlaces}); + + const {config} = explorer.searchSync(rootFolder) || {config: undefined}; + + const result = Joi.validate(config, schema.projectConfig); + + if (result.error) { + throw new JoiError(result.error); + } + + return result.value; +} + +/** + * Reads a dependency configuration as defined by the developer + * inside `node_modules`. + */ +export function readDependencyConfigFromDisk( + rootFolder: string, +): DependencyConfigT { + const explorer = cosmiconfig('react-native', { + stopDir: rootFolder, + searchPlaces, + }); + + const {config} = explorer.searchSync(rootFolder) || {config: undefined}; + + const result = Joi.validate(config, schema.dependencyConfig); + + if (result.error) { + throw new JoiError(result.error); + } + + return result.value; +} + +/** + * Reads a legacy configuaration from a `package.json` "rnpm" key. + */ +export function readLegacyDependencyConfigFromDisk( + rootFolder: string, +): ?DependencyConfigT { + const {rnpm: config, name} = require(path.join(rootFolder, 'package.json')); + + if (!config) { + return undefined; + } + + const transformedConfig = { + dependency: { + platforms: { + ios: config.ios, + android: config.android, + }, + assets: config.assets, + hooks: config.commands, + params: config.params, + }, + commands: [].concat(config.plugin || []), + platforms: config.platform + ? require(path.join(rootFolder, config.platform)) + : undefined, + }; + + // @todo: paste a link to documentation that explains the migration steps + logger.warn( + `Package '${path.basename( + name, + )}' is using deprecated "rnpm" config that will stop working from next release. Consider upgrading to the new config format.`, + ); + + const result = Joi.validate(transformedConfig, schema.dependencyConfig); + + if (result.error) { + throw new JoiError(result.error); + } + + return result.value; +} diff --git a/packages/cli/src/tools/config/resolveReactNativePath.js b/packages/cli/src/tools/config/resolveReactNativePath.js new file mode 100644 index 000000000..422a10249 --- /dev/null +++ b/packages/cli/src/tools/config/resolveReactNativePath.js @@ -0,0 +1,21 @@ +/** + * @flow + */ +import path from 'path'; + +/** + * Finds path to React Native inside `node_modules` or throws + * an error otherwise. + */ +export default function resolveReactNativePath(root: string) { + try { + return path.dirname( + // $FlowIssue: Wrong `require.resolve` type definition + require.resolve('react-native/package.json', { + paths: [root], + }), + ); + } catch (_ignored) { + return null; + } +} diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js new file mode 100644 index 000000000..93f058cb9 --- /dev/null +++ b/packages/cli/src/tools/config/schema.js @@ -0,0 +1,122 @@ +/** + * @flow + */ +import t from 'joi'; + +const map = (key, value) => + t + .object() + .unknown(true) + .pattern(key, value); + +/** + * Schema for DependencyConfigT + */ +export const dependencyConfig = t + .object({ + dependency: t + .object({ + platforms: map(t.string(), t.any()) + .keys({ + ios: t + .object({ + project: t.string(), + sharedLibraries: t.array().items(t.string()), + libraryFolder: t.string(), + }) + .default({}), + android: t + .object({ + sourceDir: t.string(), + manifestPath: t.string(), + packageImportPath: t.string(), + packageInstance: t.string(), + }) + .default({}), + }) + .default(), + assets: t + .array() + .items(t.string()) + .default([]), + hooks: map(t.string(), t.string()).default(), + params: t + .array() + .items( + t.object({ + name: t.string(), + type: t.string(), + message: t.string(), + }), + ) + .default([]), + }) + .default(), + platforms: map( + t.string(), + t.object({ + dependencyConfig: t.func(), + projectConfig: t.func(), + linkConfig: t.func(), + }), + ).default(), + commands: t + .array() + .items(t.string()) + .default([]), + }) + .default(); + +/** + * Schema for ProjectConfigT + */ +export const projectConfig = t + .object({ + dependencies: map( + t.string(), + t + .object({ + platforms: map(t.string(), t.any()).keys({ + ios: t + .object({ + sourceDir: t.string(), + folder: t.string(), + pbxprojPath: t.string(), + podfile: t.string(), + podspec: t.string(), + projectPath: t.string(), + projectName: t.string(), + libraryFolder: t.string(), + sharedLibraries: t.array().items(t.string()), + }) + .allow(null), + android: t + .object({ + sourceDir: t.string(), + folder: t.string(), + packageImportPath: t.string(), + packageInstance: t.string(), + }) + .allow(null), + }), + assets: t.array().items(t.string()), + hooks: map(t.string(), t.string()), + params: t.array().items( + t.object({ + name: t.string(), + type: t.string(), + message: t.string(), + }), + ), + }) + .allow(null), + ), + commands: t.array().items(t.string()), + haste: t.object({ + providesModuleNodeModules: t.array().items(t.string()), + platforms: t.array().items(t.string()), + }), + reactNativePath: t.string(), + root: t.string(), + }) + .default({}); diff --git a/packages/cli/src/tools/config/types.flow.js b/packages/cli/src/tools/config/types.flow.js new file mode 100644 index 000000000..01901b934 --- /dev/null +++ b/packages/cli/src/tools/config/types.flow.js @@ -0,0 +1,76 @@ +/** + * @flow + */ + +import type { + AndroidConfigParamsT, + IOSConfigParamsT, + InquirerPromptT, + DependencyConfigAndroidT, + DependencyConfigIOST, +} from '../types.flow'; + +/** + * A map of hooks to run pre/post some of the CLI actions + */ +type HooksT = { + [key: string]: string, + prelink?: string, + postlink?: string, +}; + +/** + * A map with additional platforms that ship with a dependency. + */ +export type PlatformsT = { + [key: string]: { + dependencyConfig?: Function, + projectConfig?: Function, + linkConfig?: Function, + }, +}; + +export type DependencyConfigT = { + dependency: { + platforms: { + android?: AndroidConfigParamsT, + ios?: IOSConfigParamsT, + [key: string]: any, + }, + assets: string[], + hooks: HooksT, + params: InquirerPromptT[], + }, + commands: string[], + platforms: PlatformsT, +}; + +type _ProjectConfigT = { + root: string, + dependencies: { + [key: string]: { + platforms: { + android: DependencyConfigAndroidT | null, + ios: DependencyConfigIOST | null, + [key: string]: any, + }, + assets: string[], + hooks: HooksT, + params: InquirerPromptT[], + }, + }, + platforms: PlatformsT, + commands: string[], + haste: { + platforms: Array, + providesModuleNodeModules: Array, + }, +}; + +export type RawProjectConfigT = _ProjectConfigT & { + reactNativePath: string | null, +}; + +export type ProjectConfigT = _ProjectConfigT & { + reactNativePath: string, +}; diff --git a/packages/cli/src/tools/errors.js b/packages/cli/src/tools/errors.js index 278d35cc2..82bd9090c 100644 --- a/packages/cli/src/tools/errors.js +++ b/packages/cli/src/tools/errors.js @@ -2,6 +2,7 @@ * @flow */ import chalk from 'chalk'; +import dedent from 'dedent'; export class ProcessError extends Error { constructor(msg: string, processError: string) { @@ -9,3 +10,45 @@ export class ProcessError extends Error { Error.captureStackTrace(this, ProcessError); } } + +type JoiErrorT = { + details: Array<{ + message: string, + path: string[], + type: string, + context: { + key: string, + label: string, + value: Object, + }, + }>, +}; + +export class JoiError extends Error { + constructor(joiError: JoiErrorT) { + super( + joiError.details + .map(error => { + const name = error.path.join('.'); + const value = JSON.stringify(error.context.value); + switch (error.type) { + case 'object.allowUnknown': + return dedent` + Unknown option ${name} with value "${value}" was found. + This is either a typing error or a user mistake. Fixing it will remove this message. + `; + case 'object.base': + case 'string.base': + const expectedType = error.type.replace('.base', ''); + const actualType = typeof error.context.value; + return dedent` + Option ${name} must be a ${expectedType}, instead got ${actualType} + `; + default: + return error.message; + } + }) + .join(), + ); + } +} diff --git a/packages/cli/src/tools/getLegacyConfig.js b/packages/cli/src/tools/getLegacyConfig.js deleted file mode 100644 index 2b5386f8e..000000000 --- a/packages/cli/src/tools/getLegacyConfig.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @flow - */ -import path from 'path'; -import util from 'util'; - -import getPlatforms from './getPlatforms'; -import getPackageConfiguration from './getPackageConfiguration'; -import getHooks from './getHooks'; -import getAssets from './getAssets'; -import getParams from './getParams'; - -const generateDeprecationMessage = api => - `${api} is deprecated and will be removed soon. Please check release notes on how to upgrade`; - -/** - * Gets legacy configuration to support existing plugins while they migrate - * to the new API - * - * This file will be removed from the next version. - */ -export default (root: string) => ({ - getPlatformConfig: util.deprecate( - () => getPlatforms(root), - generateDeprecationMessage('getPlatformConfig()'), - ), - getProjectConfig: util.deprecate(() => { - const platforms = getPlatforms(root); - - const rnpm = getPackageConfiguration(root); - - const config = { - ...rnpm, - assets: getAssets(root), - }; - - Object.keys(platforms).forEach(key => { - config[key] = platforms[key].projectConfig(root, rnpm[key] || {}); - }); - - return config; - }, generateDeprecationMessage('getProjectConfig()')), - getDependencyConfig: util.deprecate((packageName: string) => { - const platforms = getPlatforms(root); - const folder = path.join(process.cwd(), 'node_modules', packageName); - - const rnpm = getPackageConfiguration(folder); - - const config = { - ...rnpm, - assets: getAssets(folder), - commands: getHooks(folder), - params: getParams(folder), - }; - - Object.keys(platforms).forEach(key => { - config[key] = platforms[key].dependencyConfig(folder, rnpm[key] || {}); - }); - - return config; - }, generateDeprecationMessage('getDependencyConfig()')), -}); diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 286b5bce1..608b73c48 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -5,8 +5,7 @@ import path from 'path'; import {createBlacklist} from 'metro'; import {loadConfig} from 'metro-config'; -import type {ContextT} from './types.flow'; -import findPlugins from './findPlugins'; +import {type ContextT} from './types.flow'; import findSymlinkedModules from './findSymlinkedModules'; const resolveSymlinksForRoots = roots => @@ -32,16 +31,14 @@ const getBlacklistRE = () => createBlacklist([/.*\/__fixtures__\/.*/]); * Otherwise, a.native.js will not load on Windows or other platforms */ export const getDefaultConfig = (ctx: ContextT) => { - const plugins = findPlugins(ctx.root); - return { resolver: { resolverMainFields: ['react-native', 'browser', 'main'], blacklistRE: getBlacklistRE(), - platforms: ['ios', 'android', 'native', ...plugins.haste.platforms], + platforms: ['ios', 'android', 'native', ...ctx.haste.platforms], providesModuleNodeModules: [ 'react-native', - ...plugins.haste.providesModuleNodeModules, + ...ctx.haste.providesModuleNodeModules, ], hasteImplModulePath: path.join(ctx.reactNativePath, 'jest/hasteImpl'), }, diff --git a/packages/cli/src/tools/types.flow.js b/packages/cli/src/tools/types.flow.js index 495c26190..32682a3e2 100644 --- a/packages/cli/src/tools/types.flow.js +++ b/packages/cli/src/tools/types.flow.js @@ -2,10 +2,9 @@ * @flow */ -export type ContextT = { - root: string, - reactNativePath: string, -}; +import {type ProjectConfigT as ConfigT} from './config/types.flow'; + +export type ContextT = ConfigT; export type LocalCommandT = { name: string, @@ -69,13 +68,18 @@ export type PlatformConfigT = { }, }; -/** - * The following types will be useful when we type `link` itself. For now, - * they can be treated as aliases. - */ -export type AndroidConfigParamsT = {}; +export type AndroidConfigParamsT = { + sourceDir?: string, + manifestPath?: string, + packageImportPath?: string, + packageInstance?: string, +}; -export type IOSConfigParamsT = {}; +export type IOSConfigParamsT = { + project?: string, + sharedLibraries?: string[], + libraryFolder?: string, +}; export type ProjectConfigIOST = {}; @@ -142,4 +146,11 @@ export type PackageConfigurationT = { params?: InquirerPromptT[], android: AndroidConfigParamsT, ios: IOSConfigParamsT, + + plugin?: string | Array, + platform?: string, + haste?: { + platforms?: Array, + providesModuleNodeModules?: Array, + }, }; diff --git a/yarn.lock b/yarn.lock index 9adb4ff67..5c7505665 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3175,7 +3175,7 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" -deepmerge@3.2.0: +deepmerge@3.2.0, deepmerge@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== @@ -4334,6 +4334,11 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" +hoek@6.x.x: + version "6.1.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c" + integrity sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ== + home-or-tmp@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" @@ -4811,6 +4816,13 @@ isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isemail@3.x.x: + version "3.2.0" + resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c" + integrity sha512-zKqkK+O+dGqevc93KNsbZ/TqTUFd46MwWjYOoMrjIMZ51eU7DtQG3Wmd9SQQT7i7RVnuTPEiYEWHU3MSbxC1Tg== + dependencies: + punycode "2.x.x" + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -5419,6 +5431,15 @@ jest@^24.5.0: import-local "^2.0.0" jest-cli "^24.5.0" +joi@^14.3.1: + version "14.3.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c" + integrity sha512-LQDdM+pkOrpAn4Lp+neNIFV3axv1Vna3j38bisbQhETPMANYRbFJFUyOZcOClYvM/hppMhGWuKSFEK9vjrB+bQ== + dependencies: + hoek "6.x.x" + isemail "3.x.x" + topo "3.x.x" + js-levenshtein@^1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.4.tgz#3a56e3cbf589ca0081eb22cd9ba0b1290a16d26e" @@ -7228,14 +7249,14 @@ pumpify@^1.3.3: inherits "^2.0.3" pump "^2.0.0" +punycode@2.x.x, punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -8373,6 +8394,13 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" +topo@3.x.x: + version "3.0.3" + resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c" + integrity sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ== + dependencies: + hoek "6.x.x" + tough-cookie@>=2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" From 05fc3f6ecd14936256ed02a4867fdb0a621cb5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Apr 2019 18:31:10 +0200 Subject: [PATCH 046/234] fix: set correct peer dep of RN 0.60 for CLI@2.x (#280) --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index a8c4e693a..7fa336b42 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -58,7 +58,7 @@ "xmldoc": "^0.4.0" }, "peerDependencies": { - "react-native": "^0.59.0" + "react-native": "^0.60.0" }, "devDependencies": { "snapshot-diff": "^0.5.0" From 30f430fc3f7d028ddc757182a0370061b2a229f4 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Mon, 1 Apr 2019 17:36:46 +0100 Subject: [PATCH 047/234] fix: sort modules in debugger delta patcher to match source map order (#279) Summary: --------- Context: https://github.com/facebook/metro/issues/380, https://github.com/facebook/react-native/issues/23955 Fixes a discrepancy between the order of modules in the source map and in the actual bundle, caused by a change in Metro (see details in https://github.com/facebook/metro/issues/380#issuecomment-478633831). Consequently fixes React Native remote JS debugging. Test Plan: ---------- 1. Made the same change in my checkout of the repro code from https://github.com/facebook/metro/issues/380 and verified debugging works. 2. Added unit tests. --- .../server/debugger-ui/DeltaPatcher.js | 5 +- .../__tests__/DeltaPatcher-test.js | 51 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js b/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js index ed950295f..25c9f3690 100644 --- a/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js +++ b/packages/cli/src/commands/server/debugger-ui/DeltaPatcher.js @@ -119,7 +119,10 @@ getAllModules() { return [].concat( [this._lastBundle.pre], - Array.from(this._lastBundle.modules.values()), + // Sort modules so they match the source map emitted by Metro >= 0.51.0 + Array.from(this._lastBundle.modules.entries()) + .sort(([id1], [id2]) => id1 - id2) + .map(([id, contents]) => contents), [this._lastBundle.post], ); } diff --git a/packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js b/packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js index 2bd9db339..caae8e599 100644 --- a/packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js +++ b/packages/cli/src/commands/server/debugger-ui/__tests__/DeltaPatcher-test.js @@ -108,4 +108,55 @@ describe('DeltaPatcher', () => { expect(dp.getLastNumModifiedFiles()).toBe(2); expect(dp.getAllModules()).toEqual(['pre2', '__d(4);', '__d(5);', 'post2']); }); + + it('should sort modules after receiving an unsorted base bundle', () => { + const dp = new window.DeltaPatcher(); + global.Date = jest.fn(); + dp.applyDelta({ + base: true, + revisionId: 'rev0', + pre: 'pre0', + post: 'post0', + modules: [[2, '__d(2);'], [3, '__d(3);'], [0, '__d(0);'], [1, '__d(1);']], + }); + expect(dp.getLastRevisionId()).toBe('rev0'); + expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); + expect(dp.getLastNumModifiedFiles()).toBe(4); + expect(dp.getAllModules()).toEqual([ + 'pre0', + '__d(0);', + '__d(1);', + '__d(2);', + '__d(3);', + 'post0', + ]); + }); + + it('should sort modules after receiving an unsorted delta bundle', () => { + const dp = new window.DeltaPatcher(); + dp.applyDelta({ + base: true, + revisionId: 'rev0', + pre: 'pre0', + post: 'post0', + modules: [[2, '__d(2);'], [1, '__d(1);'], [0, '__d(0);']], + }); + global.Date = jest.fn(); + dp.applyDelta({ + base: false, + revisionId: 'rev1', + modules: [[3, '__d(3);'], [1, '__d(1.1);']], + deleted: [0], + }); + expect(dp.getLastRevisionId()).toBe('rev1'); + expect(dp.getLastModifiedDate()).toBe(global.Date.mock.instances[0]); + expect(dp.getLastNumModifiedFiles()).toBe(3); + expect(dp.getAllModules()).toEqual([ + 'pre0', + '__d(1.1);', + '__d(2);', + '__d(3);', + 'post0', + ]); + }); }); From ecbafd63501a6448689036a3607c15561927860e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Apr 2019 16:51:28 +0200 Subject: [PATCH 048/234] fix: flaky tests; upgrade Jest to 24.6 (#282) Summary: --------- While working on #241 we discovered some flaky tests. This diff aims to fix those. It also updates Jest to 24.6 which comes with pretty nice perf improvements. Test Plan: ---------- Green CI --- .circleci/config.yml | 2 +- e2e/jest.config.js | 1 + e2e/testSetup.js | 1 + jest.config.js | 4 + package.json | 11 +- .../src/commands/info/__tests__/info.test.js | 2 +- .../android/makeSettingsPatch-test.js | 3 +- .../upgrade/__tests__/upgrade.test.js | 18 +- .../tools/__tests__/PackageManager-test.js | 6 +- .../src/tools/__tests__/makeCommand-test.js | 4 + packages/cli/testSetup.js | 2 + yarn.lock | 605 +++++++++--------- 12 files changed, 334 insertions(+), 325 deletions(-) create mode 100644 e2e/testSetup.js create mode 100644 jest.config.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 84e4ac74e..53e390b7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,7 +38,7 @@ jobs: steps: - attach_workspace: at: ~/react-native-cli - - run: yarn test + - run: yarn test:ci - store_artifacts: path: coverage destination: coverage diff --git a/e2e/jest.config.js b/e2e/jest.config.js index dcda2ee7b..a4a44922a 100644 --- a/e2e/jest.config.js +++ b/e2e/jest.config.js @@ -1,4 +1,5 @@ module.exports = { testEnvironment: 'node', testPathIgnorePatterns: ['/(?:.+?)/__tests__/'], + setupFiles: ['./testSetup.js'], }; diff --git a/e2e/testSetup.js b/e2e/testSetup.js new file mode 100644 index 000000000..09ffd355d --- /dev/null +++ b/e2e/testSetup.js @@ -0,0 +1 @@ +jest.setTimeout(60000); diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..fca02fb79 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,4 @@ +module.exports = { + testEnvironment: 'node', + projects: ['/packages/*', '/e2e'], +}; diff --git a/package.json b/package.json index 57046bfb0..3aca1c3ff 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build-clean": "rm -rf ./packages/*/build", "watch": "node ./scripts/watch.js", "test": "jest", + "test:ci": "jest -i", "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", "postinstall": "yarn build-clean && yarn build", @@ -20,23 +21,17 @@ "@babel/preset-env": "^7.0.0", "@babel/preset-flow": "^7.0.0", "@react-native-community/eslint-config": "^0.0.3", - "babel-jest": "^24.5.0", + "babel-jest": "^24.6.0", "chalk": "^2.4.2", "eslint": "^5.10.0", "execa": "^1.0.0", "flow-bin": "^0.95.1", "flow-typed": "^2.5.1", "glob": "^7.1.3", - "jest": "^24.5.0", + "jest": "^24.6.0", "lerna": "^3.13.1", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", "string-length": "^2.0.0" - }, - "jest": { - "projects": [ - "packages/*", - "e2e" - ] } } diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js index 7b19753b0..12dc9383f 100644 --- a/packages/cli/src/commands/info/__tests__/info.test.js +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -34,6 +34,6 @@ test('prints output without arguments', async () => { // TODO: move to e2e tests and adjust expectations to include npm packages expect(output).toContain('System:'); expect(output).toContain('Binaries:'); -}); +}, 20000); test.todo('prints output with --packages'); diff --git a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js b/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js index 2fc77b2fc..d21bd0b6f 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js +++ b/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js @@ -41,7 +41,8 @@ project(':test').projectDir = new File(rootProject.projectDir, '../node_modules/ // Simulate Windows environment on POSIX filesystem // TODO: scope this test to Windows-only once we setup CI on Windows - it('includes project with correct path on Windows', () => { + // as changing path to be windows-specific breaks global path mock + it.skip('includes project with correct path on Windows', () => { jest.resetModules(); jest.doMock('path', () => { const path = jest.requireActual('path'); diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index aa1569a17..e136fa6d7 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -3,6 +3,7 @@ import execa from 'execa'; import path from 'path'; import fs from 'fs'; import snapshotDiff from 'snapshot-diff'; +import stripAnsi from 'strip-ansi'; import upgrade from '../upgrade'; import {fetch} from '../helpers'; import logger from '../../../tools/logger'; @@ -74,7 +75,7 @@ const samplePatch = jest let logs = []; const mockPushLog = (...args) => logs.push(args.map(x => (Array.isArray(x) ? x.join(' ') : x)).join(' ')); -const flushOutput = () => logs.join('\n'); +const flushOutput = () => stripAnsi(logs.join('\n')); beforeEach(() => { jest.clearAllMocks(); @@ -85,6 +86,13 @@ beforeEach(() => { logs = []; }); +afterEach(() => { + // $FlowFixMe + fs.writeFileSync = jest.requireMock('fs').writeFileSync; + // $FlowFixMe + fs.unlinkSync = jest.requireMock('fs').unlinkSync; +}); + test('uses latest version of react-native when none passed', async () => { await upgrade.func([], ctx, opts); expect(execa).toBeCalledWith('npm', ['info', 'react-native', 'version']); @@ -184,14 +192,14 @@ test('cleans up if patching fails,', async () => { $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way -error: .flowconfig: does not exist in index +error: .flowconfig: does not exist in index error Automatically applying diff failed [fs] unlink tmp-upgrade-rn.patch $ execa git status -s error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading info You may find these resources helpful: -• Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 -• Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 -• Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" +• Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 +• Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 +• Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" `); }); diff --git a/packages/cli/src/tools/__tests__/PackageManager-test.js b/packages/cli/src/tools/__tests__/PackageManager-test.js index 92a47c24b..33c4ce210 100644 --- a/packages/cli/src/tools/__tests__/PackageManager-test.js +++ b/packages/cli/src/tools/__tests__/PackageManager-test.js @@ -10,6 +10,9 @@ const PROJECT_ROOT = '/some/dir'; beforeEach(() => { jest.spyOn(ChildProcess, 'execSync').mockImplementation(() => {}); }); +afterEach(() => { + (ChildProcess.execSync: any).mockRestore(); +}); describe('yarn', () => { beforeEach(() => { @@ -99,7 +102,8 @@ it('should use npm if project is not using yarn', () => { }); it('should use yarn if project is using yarn', () => { - jest.spyOn(yarn, 'isProjectUsingYarn').mockImplementation(() => false); + jest.spyOn(yarn, 'getYarnVersionIfAvailable').mockImplementation(() => true); + jest.spyOn(yarn, 'isProjectUsingYarn').mockImplementation(() => true); PackageManager.setProjectDir(PROJECT_ROOT); PackageManager.install(PACKAGES); diff --git a/packages/cli/src/tools/__tests__/makeCommand-test.js b/packages/cli/src/tools/__tests__/makeCommand-test.js index 6eee9758e..6a058a1bb 100644 --- a/packages/cli/src/tools/__tests__/makeCommand-test.js +++ b/packages/cli/src/tools/__tests__/makeCommand-test.js @@ -18,6 +18,10 @@ jest.setMock('child_process', { const {makeCommand} = require('../getHooks'); +afterAll(() => { + jest.restoreAllMocks(); +}); + describe('makeCommand', () => { const command = makeCommand('echo'); diff --git a/packages/cli/testSetup.js b/packages/cli/testSetup.js index 7a043b8b8..36c5620d0 100644 --- a/packages/cli/testSetup.js +++ b/packages/cli/testSetup.js @@ -1,2 +1,4 @@ // @flow jest.mock('./src/tools/logger'); + +jest.setTimeout(20000); diff --git a/yarn.lock b/yarn.lock index 5c7505665..745260fc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1040,42 +1040,41 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@jest/console@^24.3.0": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.3.0.tgz#7bd920d250988ba0bf1352c4493a48e1cb97671e" - integrity sha512-NaCty/OOei6rSDcbPdMiCbYCI0KGFGPgGO6B09lwWt5QTxnkuhKYET9El5u5z1GAcSxkQmSMtM63e24YabCWqA== +"@jest/console@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.6.0.tgz#63225e6889f3865ab5b7a0d8797e8aed417c4e0b" + integrity sha512-nNZbwtZwW6dr7bvZpRBCdBNvZYi+jr6lfnubSOCELk/Km/5csDmGdqeS4qKwGKIVlHTyZ95MYExYevpdh26tDA== dependencies: "@jest/source-map" "^24.3.0" - "@types/node" "*" chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.5.0.tgz#2cefc6a69e9ebcae1da8f7c75f8a257152ba1ec0" - integrity sha512-RDZArRzAs51YS7dXG1pbXbWGxK53rvUu8mCDYsgqqqQ6uSOaTjcVyBl2Jce0exT2rSLk38ca7az7t2f3b0/oYQ== +"@jest/core@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.6.0.tgz#148c2dc60be7daef1e148bf8c0a01bb1391609df" + integrity sha512-rZ/5295Geou6o1+vp2+G+p7nV6wITrCR7KSnZc+Dru8QbWAR+M9SPb0BHiRTzQvfVQFkk0AkbTw1GWjCRUX/GA== dependencies: - "@jest/console" "^24.3.0" - "@jest/reporters" "^24.5.0" - "@jest/test-result" "^24.5.0" - "@jest/transform" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/console" "^24.6.0" + "@jest/reporters" "^24.6.0" + "@jest/test-result" "^24.6.0" + "@jest/transform" "^24.6.0" + "@jest/types" "^24.6.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.5.0" - jest-config "^24.5.0" - jest-haste-map "^24.5.0" - jest-message-util "^24.5.0" + jest-changed-files "^24.6.0" + jest-config "^24.6.0" + jest-haste-map "^24.6.0" + jest-message-util "^24.6.0" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.5.0" - jest-runner "^24.5.0" - jest-runtime "^24.5.0" - jest-snapshot "^24.5.0" - jest-util "^24.5.0" - jest-validate "^24.5.0" - jest-watcher "^24.5.0" + jest-resolve-dependencies "^24.6.0" + jest-runner "^24.6.0" + jest-runtime "^24.6.0" + jest-snapshot "^24.6.0" + jest-util "^24.6.0" + jest-validate "^24.6.0" + jest-watcher "^24.6.0" micromatch "^3.1.10" p-each-series "^1.0.0" pirates "^4.0.1" @@ -1083,36 +1082,34 @@ rimraf "^2.5.4" strip-ansi "^5.0.0" -"@jest/environment@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.5.0.tgz#a2557f7808767abea3f9e4cc43a172122a63aca8" - integrity sha512-tzUHR9SHjMXwM8QmfHb/EJNbF0fjbH4ieefJBvtwO8YErLTrecc1ROj0uo2VnIT6SlpEGZnvdCK6VgKYBo8LsA== - dependencies: - "@jest/fake-timers" "^24.5.0" - "@jest/transform" "^24.5.0" - "@jest/types" "^24.5.0" - "@types/node" "*" - jest-mock "^24.5.0" - -"@jest/fake-timers@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.5.0.tgz#4a29678b91fd0876144a58f8d46e6c62de0266f0" - integrity sha512-i59KVt3QBz9d+4Qr4QxsKgsIg+NjfuCjSOWj3RQhjF5JNy+eVJDhANQ4WzulzNCHd72srMAykwtRn5NYDGVraw== - dependencies: - "@jest/types" "^24.5.0" - "@types/node" "*" - jest-message-util "^24.5.0" - jest-mock "^24.5.0" - -"@jest/reporters@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.5.0.tgz#9363a210d0daa74696886d9cb294eb8b3ad9b4d9" - integrity sha512-vfpceiaKtGgnuC3ss5czWOihKOUSyjJA4M4udm6nH8xgqsuQYcyDCi4nMMcBKsHXWgz9/V5G7iisnZGfOh1w6Q== - dependencies: - "@jest/environment" "^24.5.0" - "@jest/test-result" "^24.5.0" - "@jest/transform" "^24.5.0" - "@jest/types" "^24.5.0" +"@jest/environment@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.6.0.tgz#6dea095baee2ce23ed05328468f945291f30ed30" + integrity sha512-LccuUfnREDNFbKmMWrtzUJu6fwU1E6ddYlYSDuClEQvboMKQQMUuCSYXvRUQFtDdeVjUfxkHqfSVvBzuph0b7w== + dependencies: + "@jest/fake-timers" "^24.6.0" + "@jest/transform" "^24.6.0" + "@jest/types" "^24.6.0" + jest-mock "^24.6.0" + +"@jest/fake-timers@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.6.0.tgz#4eb0b47539883742e9f969e983770230f5a57d7b" + integrity sha512-92nYqkZceki6knls7F6/FrPxKXnQl0QjYXbjLk/EFfp6xcg4ETLQSAur7pMZsiAzazAgQag/XDvMmKwMbunAeg== + dependencies: + "@jest/types" "^24.6.0" + jest-message-util "^24.6.0" + jest-mock "^24.6.0" + +"@jest/reporters@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.6.0.tgz#2b4d75255743cbc448ba0a4890912e1e148417b4" + integrity sha512-fx20elfvGcuImjQZrNPS1fl/uj3mjuSf0vQFUoAPhQDarMzSbekLfRH8ZWt4ir1kpE36dLdFeFkeB8dhaTueIA== + dependencies: + "@jest/environment" "^24.6.0" + "@jest/test-result" "^24.6.0" + "@jest/transform" "^24.6.0" + "@jest/types" "^24.6.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -1120,11 +1117,11 @@ istanbul-lib-coverage "^2.0.2" istanbul-lib-instrument "^3.0.1" istanbul-lib-source-maps "^3.0.1" - jest-haste-map "^24.5.0" - jest-resolve "^24.5.0" - jest-runtime "^24.5.0" - jest-util "^24.5.0" - jest-worker "^24.4.0" + jest-haste-map "^24.6.0" + jest-resolve "^24.6.0" + jest-runtime "^24.6.0" + jest-util "^24.6.0" + jest-worker "^24.6.0" node-notifier "^5.2.1" slash "^2.0.0" source-map "^0.6.0" @@ -1139,42 +1136,42 @@ graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.5.0.tgz#ab66fb7741a04af3363443084e72ea84861a53f2" - integrity sha512-u66j2vBfa8Bli1+o3rCaVnVYa9O8CAFZeqiqLVhnarXtreSXG33YQ6vNYBogT7+nYiFNOohTU21BKiHlgmxD5A== +"@jest/test-result@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.6.0.tgz#fd56c12b031601c282eede8a5ec1317ebe63bd11" + integrity sha512-k6pdgBBJIDbBgQGZgt8IbQC/KrOAC+fsSZrHw62R54FnfoYzuDqnrbB/AfPJS8T4RjDsWvnAHgXLH866yG10Pg== dependencies: - "@jest/console" "^24.3.0" - "@jest/types" "^24.5.0" - "@types/istanbul-lib-coverage" "^1.1.0" + "@jest/console" "^24.6.0" + "@jest/types" "^24.6.0" + "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/transform@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.5.0.tgz#6709fc26db918e6af63a985f2cc3c464b4cf99d9" - integrity sha512-XSsDz1gdR/QMmB8UCKlweAReQsZrD/DK7FuDlNo/pE8EcKMrfi2kqLRk8h8Gy/PDzgqJj64jNEzOce9pR8oj1w== +"@jest/transform@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.6.0.tgz#dc7a00591651b89c2582602fe5c4ce47a5398148" + integrity sha512-aC7Yff2XREV1C/RQCoP1WzO3NU4EtmImIJXnNm4tTgaLoGGv1HJuXziyd5v7zOjBzn96793rF0iLHlFT4w4ErA== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" babel-plugin-istanbul "^5.1.0" chalk "^2.0.1" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.15" - jest-haste-map "^24.5.0" + jest-haste-map "^24.6.0" jest-regex-util "^24.3.0" - jest-util "^24.5.0" + jest-util "^24.6.0" micromatch "^3.1.10" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.5.0": - version "24.5.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.5.0.tgz#feee214a4d0167b0ca447284e95a57aa10b3ee95" - integrity sha512-kN7RFzNMf2R8UDadPOl6ReyI+MT8xfqRuAnuVL+i4gwjv/zubdDK+EDeLHYwq1j0CSSR2W/MmgaRlMZJzXdmVA== +"@jest/types@^24.6.0": + version "24.6.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.6.0.tgz#cf018e56f3ef45e81119fd613fc20a9819f4eddd" + integrity sha512-hnCMhUokUm6A4HPE9j3pNG9N+bSFfhqje3EbIrW6YjUW2SXuyZxy1QsJdaICo1oN1o2vVSx6qlVqQYkmWVsjiA== dependencies: - "@types/istanbul-lib-coverage" "^1.1.0" + "@types/istanbul-lib-coverage" "^2.0.0" "@types/yargs" "^12.0.9" "@lerna/add@3.13.1": @@ -1917,15 +1914,10 @@ dependencies: "@babel/types" "^7.3.0" -"@types/istanbul-lib-coverage@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" - integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== - -"@types/node@*": - version "11.11.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" - integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== +"@types/istanbul-lib-coverage@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.0.tgz#1eb8c033e98cf4e1a4cedcaf8bcafe8cb7591e85" + integrity sha512-eAtOAFZefEnfJiRFQBGw1eYqa5GTLCZ1y86N0XSI/D6EB+E8z6VPV/UL7Gi5UEclFqoQk+6NRqEDsfmDLXn8sg== "@types/stack-utils@^1.0.1": version "1.0.1" @@ -2229,16 +2221,16 @@ babel-eslint@10.0.1: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babel-jest@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.5.0.tgz#0ea042789810c2bec9065f7c8ab4dc18e1d28559" - integrity sha512-0fKCXyRwxFTJL0UXDJiT2xYxO9Lu2vBd9n+cC+eDjESzcVG3s2DRGAxbzJX21fceB1WYoBjAh8pQ83dKcl003g== +babel-jest@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.6.0.tgz#58aa1e6a3d72fdd986644a92529f0ec7d2f1cf61" + integrity sha512-HpI/orChKlJZbWC2p52ghWeK+UYqU9ql+zYw+ctOr3vIuPZowcSL13RwReW5ZeYKxsRr8dZmQozGvPX93Gw1tw== dependencies: - "@jest/transform" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/transform" "^24.6.0" + "@jest/types" "^24.6.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.3.0" + babel-preset-jest "^24.6.0" chalk "^2.4.2" slash "^2.0.0" @@ -2251,10 +2243,10 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.0.0" test-exclude "^5.0.0" -babel-plugin-jest-hoist@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.3.0.tgz#f2e82952946f6e40bb0a75d266a3790d854c8b5b" - integrity sha512-nWh4N1mVH55Tzhx2isvUN5ebM5CDUvIpXPZYMRazQughie/EqGnbR+czzoQlhUmJG9pPJmYDRhvocotb2THl1w== +babel-plugin-jest-hoist@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" + integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== dependencies: "@types/babel__traverse" "^7.0.6" @@ -2304,13 +2296,13 @@ babel-preset-fbjs@^3.1.2: "@babel/plugin-transform-template-literals" "^7.0.0" babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" -babel-preset-jest@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.3.0.tgz#db88497e18869f15b24d9c0e547d8e0ab950796d" - integrity sha512-VGTV2QYBa/Kn3WCOKdfS31j9qomaXSgJqi65B6o05/1GsJyj9LVhSljM9ro4S+IBGj/ENhNBuH9bpqzztKAQSw== +babel-preset-jest@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" + integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.3.0" + babel-plugin-jest-hoist "^24.6.0" babel-runtime@^6.26.0: version "6.26.0" @@ -3702,16 +3694,16 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.5.0.tgz#492fb0df8378d8474cc84b827776b069f46294ed" - integrity sha512-p2Gmc0CLxOgkyA93ySWmHFYHUPFIHG6XZ06l7WArWAsrqYVaVEkOU5NtT5i68KUyGKbkQgDCkiT65bWmdoL6Bw== +expect@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.6.0.tgz#0db9c0acd939d939426f7eef272dc69682b71bb0" + integrity sha512-kxe6ALQboiWfbAvY+ApKyQ42ZGksLPfUhF0Nf0k04aBcLjVxwwn47Uz9Kbv4pELUuzJaU7tvWbvzRpNrIXfcQw== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" ansi-styles "^3.2.0" jest-get-type "^24.3.0" - jest-matcher-utils "^24.5.0" - jest-message-util "^24.5.0" + jest-matcher-utils "^24.6.0" + jest-message-util "^24.6.0" jest-regex-util "^24.3.0" extend-shallow@^2.0.1: @@ -4974,54 +4966,54 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -jest-changed-files@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.5.0.tgz#4075269ee115d87194fd5822e642af22133cf705" - integrity sha512-Ikl29dosYnTsH9pYa1Tv9POkILBhN/TLZ37xbzgNsZ1D2+2n+8oEZS2yP1BrHn/T4Rs4Ggwwbp/x8CKOS5YJOg== +jest-changed-files@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.6.0.tgz#37ff2a60a6057dedc068f26e9ed9b77fb21df828" + integrity sha512-Om7dJrGPcH6mMdEjMZ5XxRhCLk6qe1NVSJKOIn4twrtH7s8Nd++qULEH9bhRsdNduR2cMQOQwJ9GIVucWEKrsQ== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.5.0.tgz#598139d3446d1942fb7dc93944b9ba766d756d4b" - integrity sha512-P+Jp0SLO4KWN0cGlNtC7JV0dW1eSFR7eRpoOucP2UM0sqlzp/bVHeo71Omonvigrj9AvCKy7NtQANtqJ7FXz8g== +jest-cli@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.6.0.tgz#af326435b6d331dd9868eed9b0b26d5113cb746e" + integrity sha512-0PDd5XgX/KXAAb00c5ATaCEjh7pw3r0D44K/7mqS9qT7ieawsjJe2bU7wDXkTOw4VhPtv9kK0FghIMqTruMDqg== dependencies: - "@jest/core" "^24.5.0" - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/core" "^24.6.0" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.5.0" - jest-util "^24.5.0" - jest-validate "^24.5.0" + jest-config "^24.6.0" + jest-util "^24.6.0" + jest-validate "^24.6.0" prompts "^2.0.1" realpath-native "^1.1.0" yargs "^12.0.2" -jest-config@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.5.0.tgz#404d1bc6bb81aed6bd1890d07e2dca9fbba2e121" - integrity sha512-t2UTh0Z2uZhGBNVseF8wA2DS2SuBiLOL6qpLq18+OZGfFUxTM7BzUVKyHFN/vuN+s/aslY1COW95j1Rw81huOQ== +jest-config@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.6.0.tgz#b8da6c4c2e37556b2a415174798eb7d256754dc1" + integrity sha512-NHXt65TlmwlJnTk2LbISFaL5h4sBLK2wDxw06H+ku9UwplEBYfbYg9//8PPDfx4XqF0QncegUD/bXeX0vJ9Euw== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.5.0" - babel-jest "^24.5.0" + "@jest/types" "^24.6.0" + babel-jest "^24.6.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.5.0" - jest-environment-node "^24.5.0" + jest-environment-jsdom "^24.6.0" + jest-environment-node "^24.6.0" jest-get-type "^24.3.0" - jest-jasmine2 "^24.5.0" + jest-jasmine2 "^24.6.0" jest-regex-util "^24.3.0" - jest-resolve "^24.5.0" - jest-util "^24.5.0" - jest-validate "^24.5.0" + jest-resolve "^24.6.0" + jest-util "^24.6.0" + jest-validate "^24.6.0" micromatch "^3.1.10" - pretty-format "^24.5.0" + pretty-format "^24.6.0" realpath-native "^1.1.0" jest-diff@^24.0.0: @@ -5034,15 +5026,15 @@ jest-diff@^24.0.0: jest-get-type "^24.0.0" pretty-format "^24.0.0" -jest-diff@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.5.0.tgz#a2d8627964bb06a91893c0fbcb28ab228c257652" - integrity sha512-mCILZd9r7zqL9Uh6yNoXjwGQx0/J43OD2vvWVKwOEOLZliQOsojXwqboubAQ+Tszrb6DHGmNU7m4whGeB9YOqw== +jest-diff@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.6.0.tgz#35858787c07f94ce51df9f865f375c3b4046c25a" + integrity sha512-r+W4NHYot9ywuiO8JJ3WeDxV+8Bu9vNg7YLWmjLx9RQOC7UtiPcODgvLJIckJ2QIwJ4B/EfjiaLGN24Kew/Y2w== dependencies: chalk "^2.0.1" diff-sequences "^24.3.0" jest-get-type "^24.3.0" - pretty-format "^24.5.0" + pretty-format "^24.6.0" jest-docblock@^21.0.0: version "21.2.0" @@ -5056,39 +5048,39 @@ jest-docblock@^24.3.0: dependencies: detect-newline "^2.1.0" -jest-each@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.5.0.tgz#da14d017a1b7d0f01fb458d338314cafe7f72318" - integrity sha512-6gy3Kh37PwIT5sNvNY2VchtIFOOBh8UCYnBlxXMb5sr5wpJUDPTUATX2Axq1Vfk+HWTMpsYPeVYp4TXx5uqUBw== +jest-each@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.6.0.tgz#945699a577fd2362b620ddf31ad1f7699badb2da" + integrity sha512-+LiF4T/sgpAE4j2p449rwHEJUGPcT+aBOo9mbMSqafnOWGY7R4D1O3DZBGtW7ObumSHj7ZuQkigu9vNQqw5oPQ== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" chalk "^2.0.1" jest-get-type "^24.3.0" - jest-util "^24.5.0" - pretty-format "^24.5.0" - -jest-environment-jsdom@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.5.0.tgz#1c3143063e1374100f8c2723a8b6aad23b6db7eb" - integrity sha512-62Ih5HbdAWcsqBx2ktUnor/mABBo1U111AvZWcLKeWN/n/gc5ZvDBKe4Og44fQdHKiXClrNGC6G0mBo6wrPeGQ== - dependencies: - "@jest/environment" "^24.5.0" - "@jest/fake-timers" "^24.5.0" - "@jest/types" "^24.5.0" - jest-mock "^24.5.0" - jest-util "^24.5.0" + jest-util "^24.6.0" + pretty-format "^24.6.0" + +jest-environment-jsdom@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.6.0.tgz#96307b56556fb3557dc90e488fdb901b7724c933" + integrity sha512-nRuKr5vKC9hXOGENgKja50SA0+wNEjsl73qqZV1jwzmMcdzOREuMZZ3jTLQT8/ScOo+SNo9q5YpAp0C+m34Rdw== + dependencies: + "@jest/environment" "^24.6.0" + "@jest/fake-timers" "^24.6.0" + "@jest/types" "^24.6.0" + jest-mock "^24.6.0" + jest-util "^24.6.0" jsdom "^11.5.1" -jest-environment-node@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.5.0.tgz#763eebdf529f75b60aa600c6cf8cb09873caa6ab" - integrity sha512-du6FuyWr/GbKLsmAbzNF9mpr2Iu2zWSaq/BNHzX+vgOcts9f2ayXBweS7RAhr+6bLp6qRpMB6utAMF5Ygktxnw== +jest-environment-node@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.6.0.tgz#51e5aa06da43cd0a9652e0072c8247844968c352" + integrity sha512-3JLQ7FVzOqzjCR3Knt7Nk+nYUaBEkS+H/paZDICzGpJidb/Z1tU4JJdM2G9umr08CyUNyH0LWiZ6yghlE2Kv3w== dependencies: - "@jest/environment" "^24.5.0" - "@jest/fake-timers" "^24.5.0" - "@jest/types" "^24.5.0" - jest-mock "^24.5.0" - jest-util "^24.5.0" + "@jest/environment" "^24.6.0" + "@jest/fake-timers" "^24.6.0" + "@jest/types" "^24.6.0" + jest-mock "^24.6.0" + jest-util "^24.6.0" jest-get-type@^24.0.0: version "24.0.0" @@ -5114,49 +5106,49 @@ jest-haste-map@24.0.0: micromatch "^3.1.10" sane "^3.0.0" -jest-haste-map@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.5.0.tgz#3f17d0c548b99c0c96ed2893f9c0ccecb2eb9066" - integrity sha512-mb4Yrcjw9vBgSvobDwH8QUovxApdimGcOkp+V1ucGGw4Uvr3VzZQBJhNm1UY3dXYm4XXyTW2G7IBEZ9pM2ggRQ== +jest-haste-map@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.6.0.tgz#c6aa40999129fd5cdb52af4ac6c1e8ab653c00d3" + integrity sha512-P0Lhy/vZ/4S7DzVS3KeWMT1FFQ9Qo3QdiqywPoG3FE74iNk44nGzwin3pYnR8dzrfd+SBmutdXLaIfywuU1XxQ== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" jest-serializer "^24.4.0" - jest-util "^24.5.0" - jest-worker "^24.4.0" + jest-util "^24.6.0" + jest-worker "^24.6.0" micromatch "^3.1.10" sane "^4.0.3" -jest-jasmine2@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.5.0.tgz#e6af4d7f73dc527d007cca5a5b177c0bcc29d111" - integrity sha512-sfVrxVcx1rNUbBeyIyhkqZ4q+seNKyAG6iM0S2TYBdQsXjoFDdqWFfsUxb6uXSsbimbXX/NMkJIwUZ1uT9+/Aw== +jest-jasmine2@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.6.0.tgz#e8aa40497d7739de84b93af4383fc62381526a06" + integrity sha512-Tx1EqstTsiQ92J5vjHB357W87BrNIKaBab2xgG0Ffu7ZJx9R+RnCKuyKzkIEMRcSso+A70f3Memfsqp7idi4sw== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.5.0" - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/environment" "^24.6.0" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.5.0" + expect "^24.6.0" is-generator-fn "^2.0.0" - jest-each "^24.5.0" - jest-matcher-utils "^24.5.0" - jest-message-util "^24.5.0" - jest-runtime "^24.5.0" - jest-snapshot "^24.5.0" - jest-util "^24.5.0" - pretty-format "^24.5.0" + jest-each "^24.6.0" + jest-matcher-utils "^24.6.0" + jest-message-util "^24.6.0" + jest-runtime "^24.6.0" + jest-snapshot "^24.6.0" + jest-util "^24.6.0" + pretty-format "^24.6.0" throat "^4.0.0" -jest-leak-detector@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.5.0.tgz#21ae2b3b0da252c1171cd494f75696d65fb6fa89" - integrity sha512-LZKBjGovFRx3cRBkqmIg+BZnxbrLqhQl09IziMk3oeh1OV81Hg30RUIx885mq8qBv1PA0comB9bjKcuyNO1bCQ== +jest-leak-detector@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.6.0.tgz#4e85938b754a7164271c1f8e3875f0321b37c43f" + integrity sha512-lBYsv8IyBjH4bVdMxT4tZRKwBMLIMl6tKyeQ9htSGkTatmnCI8cvRal/P1x8TJsxFvTo0HLhBUQdmkGWNMu2qg== dependencies: - pretty-format "^24.5.0" + pretty-format "^24.6.0" jest-matcher-utils@^24.0.0: version "24.0.0" @@ -5168,15 +5160,15 @@ jest-matcher-utils@^24.0.0: jest-get-type "^24.0.0" pretty-format "^24.0.0" -jest-matcher-utils@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.5.0.tgz#5995549dcf09fa94406e89526e877b094dad8770" - integrity sha512-QM1nmLROjLj8GMGzg5VBra3I9hLpjMPtF1YqzQS3rvWn2ltGZLrGAO1KQ9zUCVi5aCvrkbS5Ndm2evIP9yZg1Q== +jest-matcher-utils@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.6.0.tgz#8562d38a760238656806df2f77daeca9a0c5851a" + integrity sha512-bXC5aDKXd1t7FfRiEahVoDWuvZI7NMWPd5u8Mn6aPMmQ0k+wG8RmASKjfuCGUOQJ4egV2hTx3wBQ8aipz3qFoA== dependencies: chalk "^2.0.1" - jest-diff "^24.5.0" + jest-diff "^24.6.0" jest-get-type "^24.3.0" - pretty-format "^24.5.0" + pretty-format "^24.6.0" jest-message-util@^24.0.0: version "24.0.0" @@ -5189,26 +5181,26 @@ jest-message-util@^24.0.0: slash "^2.0.0" stack-utils "^1.0.1" -jest-message-util@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.5.0.tgz#181420a65a7ef2e8b5c2f8e14882c453c6d41d07" - integrity sha512-6ZYgdOojowCGiV0D8WdgctZEAe+EcFU+KrVds+0ZjvpZurUW2/oKJGltJ6FWY2joZwYXN5VL36GPV6pNVRqRnQ== +jest-message-util@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.6.0.tgz#585b8dd65c34a9d0e6f68b3feeb46918ee40b976" + integrity sha512-5VEaI9jAm78YlMqNa92670QU/+d4F5TK0eiKEVQ3KwYbVL1kp8RmHg/2oqiKC3LMulyzlIiaqZTnJPk3hcqxwQ== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.5.0.tgz#976912c99a93f2a1c67497a9414aa4d9da4c7b76" - integrity sha512-ZnAtkWrKf48eERgAOiUxVoFavVBziO2pAi2MfZ1+bGXVkDfxWLxU0//oJBkgwbsv6OAmuLBz4XFFqvCFMqnGUw== +jest-mock@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.6.0.tgz#fd21d9f0c4b77d6b1cbd320223a56c5ae294b86b" + integrity sha512-GoJKwJrQUlI0yYLUO6fhR+s+aBqgCBERCdA8nDbMuqntkuydwLtMcYJI05eEWXL4zsH5Hw4Z5wfiMLjZsZZ3QA== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -5220,14 +5212,14 @@ jest-regex-util@^24.3.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== -jest-resolve-dependencies@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.5.0.tgz#1a0dae9cdd41349ca4a84148b3e78da2ba33fd4b" - integrity sha512-dRVM1D+gWrFfrq2vlL5P9P/i8kB4BOYqYf3S7xczZ+A6PC3SgXYSErX/ScW/469pWMboM1uAhgLF+39nXlirCQ== +jest-resolve-dependencies@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.6.0.tgz#227c685b09a4a354615624069877de8070795daa" + integrity sha512-2QVOYOJVTI4sNcXAL1P22/qW7A2u2V7Y69OlVWAyUmN+XVoVjCbz7AwUCJjIOLyg5isxQqSJBPQC0tXUUGl0xA== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.5.0" + jest-snapshot "^24.6.0" jest-resolve@^24.0.0: version "24.0.0" @@ -5238,66 +5230,66 @@ jest-resolve@^24.0.0: chalk "^2.0.1" realpath-native "^1.0.0" -jest-resolve@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.5.0.tgz#8c16ba08f60a1616c3b1cd7afb24574f50a24d04" - integrity sha512-ZIfGqLX1Rg8xJpQqNjdoO8MuxHV1q/i2OO1hLXjgCWFWs5bsedS8UrOdgjUqqNae6DXA+pCyRmdcB7lQEEbXew== +jest-resolve@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.6.0.tgz#7ab8e6b274d5dac6df5c4911f0cd0af0124b44f7" + integrity sha512-d72QLxKtVb4M+3GRyxSWMQ2umgTktleqrgarSwpRkRECYE7xg55655cgPEj2cfhBjFkj6Pq4mAU2P3GRploMmQ== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.5.0.tgz#9be26ece4fd4ab3dfb528b887523144b7c5ffca8" - integrity sha512-oqsiS9TkIZV5dVkD+GmbNfWBRPIvxqmlTQ+AQUJUQ07n+4xTSDc40r+aKBynHw9/tLzafC00DIbJjB2cOZdvMA== +jest-runner@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.6.0.tgz#0ac88de5493333a2c8bd7254adfab8f547d37bef" + integrity sha512-CFvh7LT4ROqm6Nj0mynUSGA/6QXXoUHij+9GRE2YYp/oY5qntJPmwTXewrEH7bx5LBV8F3EEFSW0c5YavV5X6w== dependencies: - "@jest/console" "^24.3.0" - "@jest/environment" "^24.5.0" - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/console" "^24.6.0" + "@jest/environment" "^24.6.0" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.5.0" + jest-config "^24.6.0" jest-docblock "^24.3.0" - jest-haste-map "^24.5.0" - jest-jasmine2 "^24.5.0" - jest-leak-detector "^24.5.0" - jest-message-util "^24.5.0" - jest-resolve "^24.5.0" - jest-runtime "^24.5.0" - jest-util "^24.5.0" - jest-worker "^24.4.0" + jest-haste-map "^24.6.0" + jest-jasmine2 "^24.6.0" + jest-leak-detector "^24.6.0" + jest-message-util "^24.6.0" + jest-resolve "^24.6.0" + jest-runtime "^24.6.0" + jest-util "^24.6.0" + jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.5.0.tgz#3a76e0bfef4db3896d5116e9e518be47ba771aa2" - integrity sha512-GTFHzfLdwpaeoDPilNpBrorlPoNZuZrwKKzKJs09vWwHo+9TOsIIuszK8cWOuKC7ss07aN1922Ge8fsGdsqCuw== +jest-runtime@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.6.0.tgz#ec697c4a2b5e4128972c004a5dcfbbdd0979998b" + integrity sha512-DkMEP5ygtW1MSvjAEJ2euV8Z5UUm/G8RlJN2vH5kmsV+J/Snm32JD3LuaD8NuTeO7iKnUPEU70dFTtJsd8n5xg== dependencies: - "@jest/console" "^24.3.0" - "@jest/environment" "^24.5.0" + "@jest/console" "^24.6.0" + "@jest/environment" "^24.6.0" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.5.0" - "@jest/types" "^24.5.0" + "@jest/transform" "^24.6.0" + "@jest/types" "^24.6.0" "@types/yargs" "^12.0.2" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.5.0" - jest-haste-map "^24.5.0" - jest-message-util "^24.5.0" - jest-mock "^24.5.0" + jest-config "^24.6.0" + jest-haste-map "^24.6.0" + jest-message-util "^24.6.0" + jest-mock "^24.6.0" jest-regex-util "^24.3.0" - jest-resolve "^24.5.0" - jest-snapshot "^24.5.0" - jest-util "^24.5.0" - jest-validate "^24.5.0" + jest-resolve "^24.6.0" + jest-snapshot "^24.6.0" + jest-util "^24.6.0" + jest-validate "^24.6.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" @@ -5329,22 +5321,22 @@ jest-snapshot@^24.0.0: pretty-format "^24.0.0" semver "^5.5.0" -jest-snapshot@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.5.0.tgz#e5d224468a759fd19e36f01217aac912f500f779" - integrity sha512-eBEeJb5ROk0NcpodmSKnCVgMOo+Qsu5z9EDl3tGffwPzK1yV37mjGWF2YeIz1NkntgTzP+fUL4s09a0+0dpVWA== +jest-snapshot@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.6.0.tgz#ec68e0982c1e38cbaefd2cff2c9ac99fdfe5c206" + integrity sha512-G+1q27n6lOdzqpcmP5GnpCfwz4t0E/wasoyNdqvjb6gbLCdfo6Y5ZcPxiclYNOBtGATbbb3IVXeR+ey3aWjSFg== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" chalk "^2.0.1" - expect "^24.5.0" - jest-diff "^24.5.0" - jest-matcher-utils "^24.5.0" - jest-message-util "^24.5.0" - jest-resolve "^24.5.0" + expect "^24.6.0" + jest-diff "^24.6.0" + jest-matcher-utils "^24.6.0" + jest-message-util "^24.6.0" + jest-resolve "^24.6.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.5.0" + pretty-format "^24.6.0" semver "^5.5.0" jest-util@^24.0.0: @@ -5361,17 +5353,16 @@ jest-util@^24.0.0: slash "^2.0.0" source-map "^0.6.0" -jest-util@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.5.0.tgz#9d9cb06d9dcccc8e7cc76df91b1635025d7baa84" - integrity sha512-Xy8JsD0jvBz85K7VsTIQDuY44s+hYJyppAhcsHsOsGisVtdhar6fajf2UOf2mEVEgh15ZSdA0zkCuheN8cbr1Q== +jest-util@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.6.0.tgz#725a380e8f21fcdf53bd5bd5829ee78903ffc756" + integrity sha512-f7JbP/tfJuc955+PMvCI49Mn8wCPe+5CV4vSfc2Pi06jrSDGlsTj6mmc5+UF8ApzIQ7ficTUv4JXXcjplbm9TA== dependencies: - "@jest/console" "^24.3.0" - "@jest/fake-timers" "^24.5.0" + "@jest/console" "^24.6.0" + "@jest/fake-timers" "^24.6.0" "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" - "@types/node" "*" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5380,30 +5371,29 @@ jest-util@^24.5.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.5.0.tgz#62fd93d81214c070bb2d7a55f329a79d8057c7de" - integrity sha512-gg0dYszxjgK2o11unSIJhkOFZqNRQbWOAB2/LOUdsd2LfD9oXiMeuee8XsT0iRy5EvSccBgB4h/9HRbIo3MHgQ== +jest-validate@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.6.0.tgz#7ad68c68bf2639295cd727817f468e840e950507" + integrity sha512-iBbRzTCyjHidvRUor2KM8FeMAFDWok6/c39fGwRDaLwjlPhDVPy44RLZst8wMRSj1W/Ujdd570btK9SS71CKjw== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" camelcase "^5.0.0" chalk "^2.0.1" jest-get-type "^24.3.0" leven "^2.1.0" - pretty-format "^24.5.0" + pretty-format "^24.6.0" -jest-watcher@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.5.0.tgz#da7bd9cb5967e274889b42078c8f501ae1c47761" - integrity sha512-/hCpgR6bg0nKvD3nv4KasdTxuhwfViVMHUATJlnGCD0r1QrmIssimPbmc5KfAQblAVxkD8xrzuij9vfPUk1/rA== +jest-watcher@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.6.0.tgz#f66a49a4c89f60626730121d74e36dc006c53c2f" + integrity sha512-u9YFF8VjGh8vRwuNpuVUAwZFZno+lZuqayITjXkwEsWumuUNx0s9/6+DvB/AiQx/FxcpbXlMDNAflFa7vs7UHg== dependencies: - "@jest/test-result" "^24.5.0" - "@jest/types" "^24.5.0" - "@types/node" "*" + "@jest/test-result" "^24.6.0" + "@jest/types" "^24.6.0" "@types/yargs" "^12.0.9" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.5.0" + jest-util "^24.6.0" string-length "^2.0.0" jest-worker@24.0.0, jest-worker@^24.0.0: @@ -5414,22 +5404,21 @@ jest-worker@24.0.0, jest-worker@^24.0.0: merge-stream "^1.0.1" supports-color "^6.1.0" -jest-worker@^24.4.0: - version "24.4.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.4.0.tgz#fbc452b0120bb5c2a70cdc88fa132b48eeb11dd0" - integrity sha512-BH9X/klG9vxwoO99ZBUbZFfV8qO0XNZ5SIiCyYK2zOuJBl6YJVAeNIQjcoOVNu4HGEHeYEKsUWws8kSlSbZ9YQ== +jest-worker@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" + integrity sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ== dependencies: - "@types/node" "*" merge-stream "^1.0.1" supports-color "^6.1.0" -jest@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.5.0.tgz#38f11ae2c2baa2f86c2bc4d8a91d2b51612cd19a" - integrity sha512-lxL+Fq5/RH7inxxmfS2aZLCf8MsS+YCUBfeiNO6BWz/MmjhDGaIEA/2bzEf9q4Q0X+mtFHiinHFvQ0u+RvW/qQ== +jest@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.6.0.tgz#133e46c3f92450402e5b6737f5a07620c3f8201e" + integrity sha512-09Y/1FUQIGRVY2hdt0VpiL5mH0MGKeNM+Rhd1qWUZEBI/HwI6upHQR5XxlTm5d0BpXvhB/8bDpHu5ehL7JGi1g== dependencies: import-local "^2.0.0" - jest-cli "^24.5.0" + jest-cli "^24.6.0" joi@^14.3.1: version "14.3.1" @@ -7116,12 +7105,12 @@ pretty-format@^24.0.0: ansi-regex "^4.0.0" ansi-styles "^3.2.0" -pretty-format@^24.5.0: - version "24.5.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.5.0.tgz#cc69a0281a62cd7242633fc135d6930cd889822d" - integrity sha512-/3RuSghukCf8Riu5Ncve0iI+BzVkbRU5EeUoArKARZobREycuH5O4waxvaNIloEXdb0qwgmEAed5vTpX1HNROQ== +pretty-format@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.6.0.tgz#66124fe5ea5c4d473337a204ece220e8fdc9806c" + integrity sha512-xEeJZFqXgvzSEMxoZ3j4aTaax/pl1upVsfMstcIC048Id84Ve5aqX0WkAta/wFIBLDRz6Tbuj6HcoBXRNk7rtA== dependencies: - "@jest/types" "^24.5.0" + "@jest/types" "^24.6.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" From a121a3bb909103c90ca466b3d3e5a5019fd8c593 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Tue, 2 Apr 2019 18:11:43 +0200 Subject: [PATCH 049/234] feat: new `init` command, leave legacy (#241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: --------- New `init` command will exist in `@react-native-community/cli` and will deprecate current initialization flow. ### What has been done: - [x] - Added `init` command to `cli` (the previous implementation was partially existing in `global cli`) - [x] - Created a more friendly interface to create custom templates for initialization - [x] - Redesigned template to match custom template interface (https://github.com/Esemesek/react-native-new-template) - [x] - Added support to pass local repositories to `--version` and `--template` options through `file:` ### New template Structure: ``` . ├── package.json ├── template │   ├── App.js │   ├── __tests__ │   ├── android │   ├── babel.config.js │   ├── index.js │   ├── ios │   ├── metro.config.js │   ├── package.json │   └── yarn.lock └── template.config.js ``` * Root level `package.json` defines package * `template.config.js` is a configuration file. Not a lot of properties we can configure for now, but can be extended in the future. (https://github.com/Esemesek/react-native-new-template/blob/master/template.config.js - supported properties) * Directory with `template` which will be copied and processed during initialization process. In this structure it is called `template`, but it can be configured. ### Initalization You can try out this PR, by cloning repository, checkouting to `Esemesek/init` branch, building `cli` and then running command: ```sh node react-native-cli/packages/cli/buld init {projectName} --template react-native-new-template ``` To test intialization process without using custom template, `react-native` package you are using should contain update template. You can either create new version of `react-native` and publish it to local npm repository or use `--version file:{/absolute/path/to/update/react-native}` ### Example usage Init with custom version: ``` npx react-native init ProjectName --version 0.60.0 ``` Init with custom local version: ``` npx react-native init ProjectName --version file:///Users/username/local/version/of/react-native ``` Init with custom template: ``` npx react-native init ProjectName --template custom-template ``` Inite with custom local template: ``` npx react-native init ProjectName --template file:///Users/username/local/custom/template ``` > Note that `--template` needs to be valid absolute URL to react native or custom template Initialization could also be done by first installing `react-native` and then running init. ```sh mkdir SomeDir && cd SomeDir yarn add react-native react-native init ProjectName ``` Hopefully we will be able to support yarn flows in the future: https://github.com/yarnpkg/rfcs/pull/113 ### TODO: - [x] - Add better logging - [x] - Add more unit tests - [x] - Update template in `react-native` repository (https://github.com/facebook/react-native/pull/24138) - [ ] - Update documentation Test Plan: ---------- - [x] - Tested manually - [x] - Unit tests - [x] - E2E tests - probably most important one --- .gitignore | 1 + e2e/__tests__/__snapshots__/init.test.js.snap | 29 +++ .../__snapshots__/legacyInit.test.js.snap | 28 +++ e2e/__tests__/init.test.js | 86 ++++++++ e2e/__tests__/legacyInit.test.js | 51 +++++ packages/cli/src/cliEntry.js | 2 +- packages/cli/src/commands/index.js | 22 +- .../android/com/placeholdername/Main.java | 7 + .../com/placeholdername/PlaceholderName.java | 0 .../ios/PlaceholderName-tvOS/.gitkeep | 0 .../ios/PlaceholderName/AppDelegate.m | 17 ++ .../ios/PlaceholderNameTests/.gitkeep | 0 .../editTemplate/node_modules/PlaceholderName | 0 .../__snapshots__/editTemplate.test.js.snap | 58 +++++ .../init/__tests__/editTemplate.test.js | 78 +++++++ .../commands/init/__tests__/template.test.js | 88 ++++++++ .../init/__tests__/templateName.test.js | 60 ++++++ .../commands/init/__tests__/validate.test.js | 28 +++ .../cli/src/commands/init/editTemplate.js | 91 ++++++++ .../errors/DirectoryAlreadyExistsError.js | 10 + .../commands/init/errors/InvalidNameError.js | 8 + .../commands/init/errors/ReservedNameError.js | 8 + packages/cli/src/commands/init/index.js | 22 ++ packages/cli/src/commands/init/init.js | 204 ++++++++++-------- packages/cli/src/commands/init/initCompat.js | 100 +++++++++ .../init}/printRunInstructions.js | 2 +- packages/cli/src/commands/init/template.js | 48 +++++ .../cli/src/commands/init/templateName.js | 54 +++++ packages/cli/src/commands/init/validate.js | 15 ++ .../upgrade/__tests__/upgrade.test.js | 5 +- packages/cli/src/commands/upgrade/upgrade.js | 2 +- packages/cli/src/tools/PackageManager.js | 6 + packages/cli/src/tools/config/index.js | 2 +- .../upgrade/helpers.js => tools/fetch.js} | 0 34 files changed, 1018 insertions(+), 114 deletions(-) create mode 100644 e2e/__tests__/__snapshots__/init.test.js.snap create mode 100644 e2e/__tests__/__snapshots__/legacyInit.test.js.snap create mode 100644 e2e/__tests__/init.test.js create mode 100644 e2e/__tests__/legacyInit.test.js create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/Main.java create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/PlaceholderName.java create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName-tvOS/.gitkeep create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName/AppDelegate.m create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderNameTests/.gitkeep create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName create mode 100644 packages/cli/src/commands/init/__tests__/__snapshots__/editTemplate.test.js.snap create mode 100644 packages/cli/src/commands/init/__tests__/editTemplate.test.js create mode 100644 packages/cli/src/commands/init/__tests__/template.test.js create mode 100644 packages/cli/src/commands/init/__tests__/templateName.test.js create mode 100644 packages/cli/src/commands/init/__tests__/validate.test.js create mode 100644 packages/cli/src/commands/init/editTemplate.js create mode 100644 packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js create mode 100644 packages/cli/src/commands/init/errors/InvalidNameError.js create mode 100644 packages/cli/src/commands/init/errors/ReservedNameError.js create mode 100644 packages/cli/src/commands/init/index.js create mode 100644 packages/cli/src/commands/init/initCompat.js rename packages/cli/src/{tools/generator => commands/init}/printRunInstructions.js (96%) create mode 100644 packages/cli/src/commands/init/template.js create mode 100644 packages/cli/src/commands/init/templateName.js create mode 100644 packages/cli/src/commands/init/validate.js rename packages/cli/src/{commands/upgrade/helpers.js => tools/fetch.js} (100%) diff --git a/.gitignore b/.gitignore index 47b59865f..a0031dbb3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ package-lock.json *.log build/ .eslintcache +!packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules diff --git a/e2e/__tests__/__snapshots__/init.test.js.snap b/e2e/__tests__/__snapshots__/init.test.js.snap new file mode 100644 index 000000000..138ac6214 --- /dev/null +++ b/e2e/__tests__/__snapshots__/init.test.js.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`init --template: package.json contains necessary configuration 1`] = ` +Object { + "dependencies": Object { + "react": "16.8.1", + "react-native": "0.59.0-rc.1", + }, + "devDependencies": Object { + "@babel/core": "^7.3.3", + "@babel/runtime": "^7.3.1", + "@react-native-community/eslint-config": "^0.0.3", + "babel-jest": "^24.1.0", + "jest": "^24.1.0", + "metro-react-native-babel-preset": "^0.51.1", + "react-test-renderer": "16.8.1", + }, + "jest": Object { + "preset": "react-native", + }, + "name": "TestInit", + "private": true, + "scripts": Object { + "start": "node node_modules/react-native/local-cli/cli.js start", + "test": "jest", + }, + "version": "0.0.1", +} +`; diff --git a/e2e/__tests__/__snapshots__/legacyInit.test.js.snap b/e2e/__tests__/__snapshots__/legacyInit.test.js.snap new file mode 100644 index 000000000..f78d5e2b4 --- /dev/null +++ b/e2e/__tests__/__snapshots__/legacyInit.test.js.snap @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`legacy init through react-native-cli: package.json contains necessary configuration 1`] = ` +Object { + "dependencies": Object { + "react": "16.8.3", + "react-native": "0.59.3", + }, + "devDependencies": Object { + "@babel/core": "^7.4.0", + "@babel/runtime": "^7.4.2", + "babel-jest": "^24.6.0", + "jest": "^24.6.0", + "metro-react-native-babel-preset": "^0.53.1", + "react-test-renderer": "16.8.3", + }, + "jest": Object { + "preset": "react-native", + }, + "name": "TestApp", + "private": true, + "scripts": Object { + "start": "node node_modules/react-native/local-cli/cli.js start", + "test": "jest", + }, + "version": "0.0.1", +} +`; diff --git a/e2e/__tests__/init.test.js b/e2e/__tests__/init.test.js new file mode 100644 index 000000000..08cd0f780 --- /dev/null +++ b/e2e/__tests__/init.test.js @@ -0,0 +1,86 @@ +// @flow +import fs from 'fs'; +import path from 'path'; +import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; + +const DIR = getTempDirectory('command-init'); + +beforeEach(() => { + cleanup(DIR); + writeFiles(DIR, {}); +}); +afterEach(() => { + cleanup(DIR); +}); + +test('init --template fails without package name', () => { + const {stderr} = run(DIR, [ + 'init', + '--template', + 'react-native-new-template', + ]); + expect(stderr).toContain('missing required argument'); +}); + +test('init --template', () => { + const templateFiles = [ + '.buckconfig', + '.eslintrc.js', + '.flowconfig', + '.gitattributes', + // should be here, but it's not published yet + // '.gitignore', + '.watchmanconfig', + 'App.js', + '__tests__', + 'android', + 'babel.config.js', + 'index.js', + 'ios', + 'metro.config.js', + 'node_modules', + 'package.json', + 'yarn.lock', + ]; + + const {stdout} = run(DIR, [ + 'init', + '--template', + 'react-native-new-template', + 'TestInit', + ]); + + expect(stdout).toContain('Initializing new project from external template'); + expect(stdout).toContain('Run instructions'); + + // make sure we don't leave garbage + expect(fs.readdirSync(DIR)).toEqual(['TestInit']); + expect(fs.readdirSync(path.join(DIR, 'TestInit'))).toEqual(templateFiles); + + const pkgJson = require(path.join(DIR, 'TestInit', 'package.json')); + expect(pkgJson).toMatchSnapshot( + 'package.json contains necessary configuration', + ); +}); + +test('init --template file:/tmp/custom/template', () => { + writeFiles(DIR, { + 'custom/template/template.config.js': `module.exports = { + placeholderName: 'HelloWorld', + templateDir: './template-dir', + };`, + 'custom/template/package.json': + '{ "name": "template", "version": "0.0.1" }', + 'custom/template/template-dir/package.json': '{}', + 'custom/template/template-dir/empty': '', + }); + + const {stdout} = run(DIR, [ + 'init', + '--template', + `file://${path.resolve(DIR, 'custom', 'template')}`, + 'TestInit', + ]); + + expect(stdout).toContain('Run instructions'); +}); diff --git a/e2e/__tests__/legacyInit.test.js b/e2e/__tests__/legacyInit.test.js new file mode 100644 index 000000000..ce5c71c5e --- /dev/null +++ b/e2e/__tests__/legacyInit.test.js @@ -0,0 +1,51 @@ +// @flow +import fs from 'fs'; +import path from 'path'; +import execa from 'execa'; +import {getTempDirectory, cleanup, writeFiles} from '../helpers'; + +const DIR = getTempDirectory('command-legacy-init'); + +beforeEach(() => { + cleanup(DIR); + writeFiles(DIR, {}); +}); +afterEach(() => { + cleanup(DIR); +}); + +test('legacy init through react-native-cli', () => { + const templateFiles = [ + '.buckconfig', + '.flowconfig', + '.gitattributes', + '.gitignore', + '.watchmanconfig', + 'App.js', + '__tests__', + 'android', + 'app.json', + 'babel.config.js', + 'index.js', + 'ios', + 'metro.config.js', + 'node_modules', + 'package.json', + 'yarn.lock', + ]; + + const {stdout} = execa.sync('npx', ['react-native-cli', 'init', 'TestApp'], { + cwd: DIR, + }); + + expect(stdout).toContain('Run instructions'); + + // make sure we don't leave garbage + expect(fs.readdirSync(DIR)).toEqual(['TestApp']); + expect(fs.readdirSync(path.join(DIR, 'TestApp'))).toEqual(templateFiles); + + const pkgJson = require(path.join(DIR, 'TestApp', 'package.json')); + expect(pkgJson).toMatchSnapshot( + 'package.json contains necessary configuration', + ); +}); diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 1b69ccee7..2112659d8 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -15,7 +15,7 @@ import path from 'path'; import type {CommandT, ContextT} from './tools/types.flow'; import {getCommands} from './commands'; -import init from './commands/init/init'; +import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; import findPlugins from './tools/findPlugins'; diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index c3fc82f76..86920456c 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -3,9 +3,6 @@ */ import path from 'path'; - -import logger from '../tools/logger'; - import type { CommandT, ProjectCommandT, @@ -13,7 +10,6 @@ import type { } from '../tools/types.flow'; import {type ContextT} from '../tools/types.flow'; - import server from './server/server'; import runIOS from './runIOS/runIOS'; import runAndroid from './runAndroid/runAndroid'; @@ -29,6 +25,7 @@ import logAndroid from './logAndroid/logAndroid'; import logIOS from './logIOS/logIOS'; import info from './info/info'; import config from './config/config'; +import init from './init'; /** * List of built-in commands @@ -50,6 +47,7 @@ const loadLocalCommands: Array = [ logIOS, info, config, + init, ]; /** @@ -102,19 +100,5 @@ const loadProjectCommands = ({ * Loads all the commands inside a given `root` folder */ export function getCommands(ctx: ContextT): 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(ctx), - ]; + return [...loadLocalCommands, ...loadProjectCommands(ctx)]; } diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/Main.java b/packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/Main.java new file mode 100644 index 000000000..a4dca4603 --- /dev/null +++ b/packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/Main.java @@ -0,0 +1,7 @@ +com.placeholdername; + +public static class Main { + public static void run() { + String name = "PlaceholderName"; + } +} diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/PlaceholderName.java b/packages/cli/src/commands/init/__fixtures__/editTemplate/android/com/placeholdername/PlaceholderName.java new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName-tvOS/.gitkeep b/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName-tvOS/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName/AppDelegate.m b/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName/AppDelegate.m new file mode 100644 index 000000000..0bc93c7c4 --- /dev/null +++ b/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderName/AppDelegate.m @@ -0,0 +1,17 @@ +#import "AppDelegate.h" + +#import +#import +#import + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge + moduleName:@"PlaceholderName" + initialProperties:nil]; +} + +@end \ No newline at end of file diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderNameTests/.gitkeep b/packages/cli/src/commands/init/__fixtures__/editTemplate/ios/PlaceholderNameTests/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName b/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/commands/init/__tests__/__snapshots__/editTemplate.test.js.snap b/packages/cli/src/commands/init/__tests__/__snapshots__/editTemplate.test.js.snap new file mode 100644 index 000000000..5e9a1f488 --- /dev/null +++ b/packages/cli/src/commands/init/__tests__/__snapshots__/editTemplate.test.js.snap @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should edit template 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -12,3 +12,3 @@ + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge +- moduleName:@\\"PlaceholderName\\" ++ moduleName:@\\"ProjectName\\" + initialProperties:nil];" +`; + +exports[`should edit template 2`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -1,2 +1,2 @@ +- com.placeholdername; ++ com.projectname; + +@@ -4,3 +4,3 @@ + public static void run() { +- String name = \\"PlaceholderName\\"; ++ String name = \\"ProjectName\\"; + }" +`; + +exports[`should edit template 3`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -4,12 +4,12 @@ + \\"/android/com\\", +- \\"/android/com/placeholdername\\", +- \\"/android/com/placeholdername/Main.java\\", +- \\"/android/com/placeholdername/PlaceholderName.java\\", ++ \\"/android/com/projectname\\", ++ \\"/android/com/projectname/Main.java\\", ++ \\"/android/com/projectname/ProjectName.java\\", + \\"/ios\\", +- \\"/ios/PlaceholderName\\", +- \\"/ios/PlaceholderName/AppDelegate.m\\", +- \\"/ios/PlaceholderName-tvOS\\", +- \\"/ios/PlaceholderName-tvOS/.gitkeep\\", +- \\"/ios/PlaceholderNameTests\\", +- \\"/ios/PlaceholderNameTests/.gitkeep\\", ++ \\"/ios/ProjectName\\", ++ \\"/ios/ProjectName/AppDelegate.m\\", ++ \\"/ios/ProjectName-tvOS\\", ++ \\"/ios/ProjectName-tvOS/.gitkeep\\", ++ \\"/ios/ProjectNameTests\\", ++ \\"/ios/ProjectNameTests/.gitkeep\\", + \\"/node_modules\\"," +`; diff --git a/packages/cli/src/commands/init/__tests__/editTemplate.test.js b/packages/cli/src/commands/init/__tests__/editTemplate.test.js new file mode 100644 index 000000000..8917c54d4 --- /dev/null +++ b/packages/cli/src/commands/init/__tests__/editTemplate.test.js @@ -0,0 +1,78 @@ +// @flow +import os from 'os'; +import path from 'path'; +import fs from 'fs-extra'; +import snapshotDiff from 'snapshot-diff'; +import walk from '../../../tools/walk'; +import {changePlaceholderInTemplate} from '../editTemplate'; + +const FIXTURE_DIR = path.resolve( + __dirname, + '..', + '__fixtures__', + 'editTemplate', +); +const PLACEHOLDER_NAME = 'PlaceholderName'; +const PROJECT_NAME = 'ProjectName'; + +function createTestEnv() { + const TEST_DIR = `rncli-should-edit-template-${Date.now()}`; + const tmpDir = os.tmpdir(); + const testPath = path.resolve(tmpDir, TEST_DIR); + + fs.mkdirSync(testPath); + fs.copySync(FIXTURE_DIR, testPath); + + return testPath; +} + +test('should edit template', () => { + const testPath = createTestEnv(); + + jest.spyOn(process, 'cwd').mockImplementation(() => testPath); + + changePlaceholderInTemplate(PROJECT_NAME, PLACEHOLDER_NAME); + + const transformedTree = walk(testPath).map(e => e.replace(testPath, '')); + const fixtureTree = walk(FIXTURE_DIR).map(e => e.replace(FIXTURE_DIR, '')); + + const oldJavaFile = fs.readFileSync( + path.resolve( + FIXTURE_DIR, + 'android', + 'com', + PLACEHOLDER_NAME.toLowerCase(), + 'Main.java', + ), + 'utf8', + ); + const newJavaFile = fs.readFileSync( + path.resolve( + testPath, + 'android', + 'com', + PROJECT_NAME.toLowerCase(), + 'Main.java', + ), + 'utf8', + ); + + const oldCFile = fs.readFileSync( + path.resolve(FIXTURE_DIR, 'ios', PLACEHOLDER_NAME, 'AppDelegate.m'), + 'utf8', + ); + const newCFile = fs.readFileSync( + path.resolve(testPath, 'ios', PROJECT_NAME, 'AppDelegate.m'), + 'utf8', + ); + + expect(snapshotDiff(oldCFile, newCFile, {contextLines: 1})).toMatchSnapshot(); + expect( + snapshotDiff(oldJavaFile, newJavaFile, {contextLines: 1}), + ).toMatchSnapshot(); + expect( + snapshotDiff(fixtureTree, transformedTree, {contextLines: 1}), + ).toMatchSnapshot(); + + fs.removeSync(testPath); +}); diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js new file mode 100644 index 000000000..73590ce17 --- /dev/null +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -0,0 +1,88 @@ +// @flow +import fs from 'fs-extra'; +import path from 'path'; +import ChildProcess from 'child_process'; +import * as PackageManger from '../../../tools/PackageManager'; +import { + installTemplatePackage, + getTemplateConfig, + copyTemplate, + executePostInitScript, +} from '../template'; + +const TEMPLATE_NAME = 'templateName'; + +afterEach(() => { + jest.restoreAllMocks(); +}); + +test('installTemplatePackage', () => { + jest.spyOn(PackageManger, 'install').mockImplementationOnce(() => {}); + + installTemplatePackage(TEMPLATE_NAME, true); + + expect(PackageManger.install).toHaveBeenCalledWith([TEMPLATE_NAME], { + preferYarn: false, + }); +}); + +test('getTemplateConfig', () => { + jest.mock( + `node_modules/${TEMPLATE_NAME}/template.config`, + () => ({ + placeholderName: 'someName', + templateDir: 'someDir', + }), + { + virtual: true, + }, + ); + jest.spyOn(path, 'resolve').mockImplementationOnce((...e) => e.join('/')); + + expect(getTemplateConfig(TEMPLATE_NAME)).toEqual({ + placeholderName: 'someName', + templateDir: 'someDir', + }); + expect(path.resolve).toHaveBeenCalledWith( + 'node_modules', + TEMPLATE_NAME, + 'template.config', + ); +}); + +test('copyTemplate', () => { + const TEMPLATE_DIR = 'some/dir'; + const CWD = '.'; + + jest.spyOn(path, 'resolve').mockImplementationOnce((...e) => e.join('/')); + jest.spyOn(fs, 'copySync').mockImplementationOnce(() => {}); + jest.spyOn(process, 'cwd').mockImplementationOnce(() => CWD); + + copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR); + + expect(path.resolve).toHaveBeenCalledWith( + 'node_modules', + TEMPLATE_NAME, + TEMPLATE_DIR, + ); + expect(fs.copySync).toHaveBeenCalledWith(expect.any(String), CWD); +}); + +test('executePostInitScript', () => { + const RESOLVED_PATH = '/some/path/script.js'; + const SCRIPT_PATH = './script.js'; + + jest.spyOn(path, 'resolve').mockImplementationOnce(() => RESOLVED_PATH); + jest.spyOn(ChildProcess, 'execFileSync').mockImplementationOnce(() => {}); + + executePostInitScript(TEMPLATE_NAME, SCRIPT_PATH); + + expect(path.resolve).toHaveBeenCalledWith( + 'node_modules', + TEMPLATE_NAME, + SCRIPT_PATH, + ); + expect(ChildProcess.execFileSync).toHaveBeenCalledWith(RESOLVED_PATH, { + stdio: 'inherit', + }); +}); diff --git a/packages/cli/src/commands/init/__tests__/templateName.test.js b/packages/cli/src/commands/init/__tests__/templateName.test.js new file mode 100644 index 000000000..513d3c0cb --- /dev/null +++ b/packages/cli/src/commands/init/__tests__/templateName.test.js @@ -0,0 +1,60 @@ +// @flow +import {processTemplateName} from '../templateName'; +import {fetch} from '../../../tools/fetch'; + +jest.mock('../../../tools/fetch', () => ({fetch: jest.fn()})); + +const VERSION = '0.58.0'; +const RN_WITH_VERSION = 'react-native@0.58.0'; +const ABS_RN_PATH = '/path/to/react-native'; +const PACKAGE_NAME = 'react-native'; + +test('should support file protocol with absolute path', async () => { + jest.mock( + `${ABS_RN_PATH}/package.json`, + () => ({ + name: 'react-native', + }), + {virtual: true}, + ); + expect(await processTemplateName(`file://${ABS_RN_PATH}`)).toEqual({ + uri: ABS_RN_PATH, + name: PACKAGE_NAME, + }); +}); + +test('should get default package if none protocols were handled', async () => { + expect(await processTemplateName(VERSION)).toEqual({ + uri: VERSION, + name: VERSION, + }); +}); + +test('should support shorthand templates', async () => { + const templateName = 'typescript'; + (fetch: any).mockImplementationOnce(() => { + return Promise.resolve(`{"name": "react-native-template-${templateName}"}`); + }); + expect(await processTemplateName(templateName)).toEqual({ + uri: `react-native-template-${templateName}`, + name: `react-native-template-${templateName}`, + }); +}); + +test('should support not-found shorthand templates', async () => { + const templateName = 'typescriptz'; + (fetch: any).mockImplementationOnce(() => { + return Promise.resolve('Not found'); + }); + expect(await processTemplateName(templateName)).toEqual({ + uri: templateName, + name: templateName, + }); +}); + +test('should get package if none protocols were handled', async () => { + expect(await processTemplateName(RN_WITH_VERSION)).toEqual({ + uri: RN_WITH_VERSION, + name: RN_WITH_VERSION, + }); +}); diff --git a/packages/cli/src/commands/init/__tests__/validate.test.js b/packages/cli/src/commands/init/__tests__/validate.test.js new file mode 100644 index 000000000..fda90efcf --- /dev/null +++ b/packages/cli/src/commands/init/__tests__/validate.test.js @@ -0,0 +1,28 @@ +// @flow +import {validateProjectName} from '../validate'; +import InvalidNameError from '../errors/InvalidNameError'; +import ReservedNameError from '../errors/ReservedNameError'; + +test.each(['projectName', 'ProjectName', 'project_name'])( + "'%s' project name should be valid", + (name: string) => { + expect(() => validateProjectName(name)).not.toThrowError(); + }, +); + +test.each([ + { + name: 'project-name', + error: InvalidNameError, + }, + { + name: 'React', + error: ReservedNameError, + }, + { + name: 'react', + error: ReservedNameError, + }, +])("'%s' is invalid name", ({name, error}: {name: string, error: Error}) => { + expect(() => validateProjectName(name)).toThrowError(error); +}); diff --git a/packages/cli/src/commands/init/editTemplate.js b/packages/cli/src/commands/init/editTemplate.js new file mode 100644 index 000000000..e5f669ec7 --- /dev/null +++ b/packages/cli/src/commands/init/editTemplate.js @@ -0,0 +1,91 @@ +// @flow +import fs from 'fs-extra'; +import path from 'path'; +import walk from '../../tools/walk'; +import logger from '../../tools/logger'; + +function replaceNameInUTF8File( + filePath: string, + projectName: string, + templateName: string, +) { + logger.debug(`Replacing in ${filePath}`); + + const content = fs + .readFileSync(filePath, 'utf8') + .replace(new RegExp(templateName, 'g'), projectName) + .replace( + new RegExp(templateName.toLowerCase(), 'g'), + projectName.toLowerCase(), + ); + + fs.writeFileSync(filePath, content, 'utf8'); +} + +function renameFile(filePath: string, oldName: string, newName: string) { + const newFileName = path.join( + path.dirname(filePath), + path.basename(filePath).replace(new RegExp(oldName, 'g'), newName), + ); + + logger.debug(`Renaming ${filePath} -> file:${newFileName}`); + + fs.moveSync(filePath, newFileName); +} + +function shouldRenameFile(filePath: string, nameToReplace: string) { + return path.basename(filePath).includes(nameToReplace); +} + +function shouldIgnoreFile(filePath: string) { + return filePath.match(/node_modules|yarn.lock|package-lock.json/g); +} + +const UNDERSCORED_DOTFILES = [ + 'buckconfig', + 'eslintrc.js', + 'flowconfig', + 'gitattributes', + 'gitignore', + 'watchmanconfig', +]; + +function processDotfiles(filePath: string) { + const dotfile = UNDERSCORED_DOTFILES.find(e => filePath.includes(`_${e}`)); + + if (dotfile === undefined) { + return; + } + + renameFile(filePath, `_${dotfile}`, `.${dotfile}`); +} + +export function changePlaceholderInTemplate( + projectName: string, + placeholderName: string, +) { + logger.debug(`Changing ${placeholderName} for ${projectName} in template`); + + walk(process.cwd()) + .reverse() + .forEach((filePath: string) => { + if (shouldIgnoreFile(filePath)) { + return; + } + if (!fs.statSync(filePath).isDirectory()) { + replaceNameInUTF8File(filePath, projectName, placeholderName); + } + if (shouldRenameFile(filePath, placeholderName)) { + renameFile(filePath, placeholderName, projectName); + } + if (shouldRenameFile(filePath, placeholderName.toLowerCase())) { + renameFile( + filePath, + placeholderName.toLowerCase(), + projectName.toLowerCase(), + ); + } + + processDotfiles(filePath); + }); +} diff --git a/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js b/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js new file mode 100644 index 000000000..4c7c7aabe --- /dev/null +++ b/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js @@ -0,0 +1,10 @@ +// @flow +import path from 'path'; + +export default class DirectoryAlreadyExistsError extends Error { + constructor(directory: string) { + super( + `Cannot initialize new project because directory "${directory}" already exists.`, + ); + } +} diff --git a/packages/cli/src/commands/init/errors/InvalidNameError.js b/packages/cli/src/commands/init/errors/InvalidNameError.js new file mode 100644 index 000000000..b7391cd54 --- /dev/null +++ b/packages/cli/src/commands/init/errors/InvalidNameError.js @@ -0,0 +1,8 @@ +// @flow +export default class InvalidNameError extends Error { + constructor(name: string) { + super( + `"${name}" is not a valid name for a project. Please use a valid identifier name (alphanumeric).`, + ); + } +} diff --git a/packages/cli/src/commands/init/errors/ReservedNameError.js b/packages/cli/src/commands/init/errors/ReservedNameError.js new file mode 100644 index 000000000..6c747caac --- /dev/null +++ b/packages/cli/src/commands/init/errors/ReservedNameError.js @@ -0,0 +1,8 @@ +// @flow +export default class ReservedNameError extends Error { + constructor() { + super( + 'Not a valid name for a project. Please do not use the reserved word "React".', + ); + } +} diff --git a/packages/cli/src/commands/init/index.js b/packages/cli/src/commands/init/index.js new file mode 100644 index 000000000..23e409f78 --- /dev/null +++ b/packages/cli/src/commands/init/index.js @@ -0,0 +1,22 @@ +// @flow +import init from './init'; + +export default { + func: init, + name: 'init ', + description: 'initialize new React Native project', + options: [ + { + command: '--version [string]', + description: 'Version of RN', + }, + { + command: '--template [string]', + description: 'Custom template', + }, + { + command: '--npm', + description: 'Force use of npm during initialization', + }, + ], +}; diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 86df93c25..7b8486723 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -1,100 +1,128 @@ -/** - * 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 - */ - -import fs from 'fs'; +// @flow +import fs from 'fs-extra'; import minimist from 'minimist'; -import path from 'path'; -import process from 'process'; -import printRunInstructions from '../../tools/generator/printRunInstructions'; -import {createProjectFromTemplate} from '../../tools/generator/templates'; -import * as PackageManager from '../../tools/PackageManager'; +import semver from 'semver'; +import type {ContextT} from '../../tools/types.flow'; +import {validateProjectName} from './validate'; +import DirectoryAlreadyExistsError from './errors/DirectoryAlreadyExistsError'; +import printRunInstructions from './printRunInstructions'; import logger from '../../tools/logger'; +import { + installTemplatePackage, + getTemplateConfig, + copyTemplate, + executePostInitScript, +} from './template'; +import {changePlaceholderInTemplate} from './editTemplate'; +import * as PackageManager from '../../tools/PackageManager'; +import {processTemplateName} from './templateName'; -/** - * Creates the template for a React Native project given the provided - * parameters: - * @param projectDir Templates will be copied here. - * @param argsOrName Project name or full list of custom arguments - * for the generator. - * @param options Command line options passed from the react-native-cli directly. - * E.g. `{ version: '0.43.0', template: 'navigation' }` - */ -function init(projectDir, argsOrName) { - const args = Array.isArray(argsOrName) - ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose'] - : [argsOrName].concat(process.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp' - - // args array is e.g. ['AwesomeApp', '--verbose', '--template', 'navigation'] - if (!args || args.length === 0) { - logger.error('react-native init requires a project name.'); - return; +type Options = {| + template?: string, + npm?: boolean, +|}; + +function adjustNameIfUrl(name) { + // We use package manager to infer the name of the template module for us. + // That's why we get it from temporary package.json, where the name is the + // first and only dependency (hence 0). + if (name.match(/https?:/)) { + name = Object.keys( + JSON.parse(fs.readFileSync('./package.json', 'utf8')).dependencies, + )[0]; } + return name; +} - const newProjectName = args[0]; - const options = minimist(args); +async function createFromExternalTemplate( + projectName: string, + templateName: string, + npm?: boolean, +) { + logger.info('Initializing new project from external template'); - logger.info(`Setting up new React Native app in ${projectDir}`); - generateProject(projectDir, newProjectName, options); + let {uri, name} = await processTemplateName(templateName); + + installTemplatePackage(uri, npm); + name = adjustNameIfUrl(name); + const templateConfig = getTemplateConfig(name); + copyTemplate(name, templateConfig.templateDir); + changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + + if (templateConfig.postInitScript) { + executePostInitScript(name, templateConfig.postInitScript); + } + + PackageManager.installAll({preferYarn: !npm}); } -/** - * Generates a new React Native project based on the template. - * @param Absolute path at which the project folder should be created. - * @param options Command line arguments parsed by minimist. - */ -function generateProject(destinationRoot, newProjectName, options) { - const pkgJson = require('react-native/package.json'); - const reactVersion = pkgJson.peerDependencies.react; - - PackageManager.setProjectDir(destinationRoot); - createProjectFromTemplate( - destinationRoot, - newProjectName, - options.template, - destinationRoot, - ); - - logger.info('Adding required dependencies'); - PackageManager.install([`react@${reactVersion}`]); - - logger.info('Adding required dev dependencies'); - PackageManager.installDev([ - '@babel/core', - '@babel/runtime', - '@react-native-community/eslint-config', - 'eslint', - 'jest', - 'babel-jest', - 'metro-react-native-babel-preset', - `react-test-renderer@${reactVersion}`, - ]); - - addJestToPackageJson(destinationRoot); - printRunInstructions(destinationRoot, newProjectName); +async function createFromReactNativeTemplate( + projectName: string, + version: string, + npm?: boolean, +) { + logger.info('Initializing new project'); + + if (semver.valid(version) && !semver.satisfies(version, '0.60.0')) { + throw new Error( + 'Cannot use React Native CLI to initialize project with version less than 0.60.0', + ); + } + + const TEMPLATE_NAME = 'react-native'; + + const {uri} = await processTemplateName(`${TEMPLATE_NAME}@${version}`); + + installTemplatePackage(uri, npm); + const templateConfig = getTemplateConfig(TEMPLATE_NAME); + copyTemplate(TEMPLATE_NAME, templateConfig.templateDir); + changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + + if (templateConfig.postInitScript) { + executePostInitScript(TEMPLATE_NAME, templateConfig.postInitScript); + } + + PackageManager.installAll({preferYarn: !npm}); } -/** - * Add Jest-related stuff to package.json, which was created by the react-native-cli. - */ -function addJestToPackageJson(destinationRoot) { - const packageJSONPath = path.join(destinationRoot, 'package.json'); - const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath)); - - packageJSON.scripts.test = 'jest'; - packageJSON.scripts.lint = 'eslint .'; - packageJSON.jest = { - preset: 'react-native', - }; - fs.writeFileSync( - packageJSONPath, - `${JSON.stringify(packageJSON, null, 2)}\n`, - ); +function createProject(projectName: string, options: Options, version: string) { + fs.mkdirSync(projectName); + process.chdir(projectName); + + if (options.template) { + return createFromExternalTemplate( + projectName, + options.template, + options.npm, + ); + } + + return createFromReactNativeTemplate(projectName, version, options.npm); } -export default init; +export default async function initialize( + [projectName]: Array, + context: ContextT, + options: Options, +) { + validateProjectName(projectName); + + /** + * Commander is stripping `version` from options automatically. + * We have to use `minimist` to take that directly from `process.argv` + */ + const version: string = minimist(process.argv).version || 'latest'; + + if (fs.existsSync(projectName)) { + throw new DirectoryAlreadyExistsError(projectName); + } + + try { + await createProject(projectName, options, version); + + printRunInstructions(process.cwd(), projectName); + } catch (e) { + logger.error(e.message); + fs.removeSync(projectName); + } +} diff --git a/packages/cli/src/commands/init/initCompat.js b/packages/cli/src/commands/init/initCompat.js new file mode 100644 index 000000000..4d059f29d --- /dev/null +++ b/packages/cli/src/commands/init/initCompat.js @@ -0,0 +1,100 @@ +/** + * 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 + */ + +import fs from 'fs'; +import minimist from 'minimist'; +import path from 'path'; +import process from 'process'; +import printRunInstructions from './printRunInstructions'; +import {createProjectFromTemplate} from '../../tools/generator/templates'; +import * as PackageManager from '../../tools/PackageManager'; +import logger from '../../tools/logger'; + +/** + * Creates the template for a React Native project given the provided + * parameters: + * @param projectDir Templates will be copied here. + * @param argsOrName Project name or full list of custom arguments + * for the generator. + * @param options Command line options passed from the react-native-cli directly. + * E.g. `{ version: '0.43.0', template: 'navigation' }` + */ +function initCompat(projectDir, argsOrName) { + const args = Array.isArray(argsOrName) + ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose'] + : [argsOrName].concat(process.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp' + + // args array is e.g. ['AwesomeApp', '--verbose', '--template', 'navigation'] + if (!args || args.length === 0) { + logger.error('react-native init requires a project name.'); + return; + } + + const newProjectName = args[0]; + const options = minimist(args); + + logger.info(`Setting up new React Native app in ${projectDir}`); + generateProject(projectDir, newProjectName, options); +} + +/** + * Generates a new React Native project based on the template. + * @param Absolute path at which the project folder should be created. + * @param options Command line arguments parsed by minimist. + */ +function generateProject(destinationRoot, newProjectName, options) { + const pkgJson = require('react-native/package.json'); + const reactVersion = pkgJson.peerDependencies.react; + + PackageManager.setProjectDir(destinationRoot); + createProjectFromTemplate( + destinationRoot, + newProjectName, + options.template, + destinationRoot, + ); + + logger.info('Adding required dependencies'); + PackageManager.install([`react@${reactVersion}`]); + + logger.info('Adding required dev dependencies'); + PackageManager.installDev([ + '@babel/core', + '@babel/runtime', + '@react-native-community/eslint-config', + 'eslint', + 'jest', + 'babel-jest', + 'metro-react-native-babel-preset', + `react-test-renderer@${reactVersion}`, + ]); + + addJestToPackageJson(destinationRoot); + printRunInstructions(destinationRoot, newProjectName); +} + +/** + * Add Jest-related stuff to package.json, which was created by the react-native-cli. + */ +function addJestToPackageJson(destinationRoot) { + const packageJSONPath = path.join(destinationRoot, 'package.json'); + const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath)); + + packageJSON.scripts.test = 'jest'; + packageJSON.scripts.lint = 'eslint .'; + packageJSON.jest = { + preset: 'react-native', + }; + fs.writeFileSync( + packageJSONPath, + `${JSON.stringify(packageJSON, null, 2)}\n`, + ); +} + +export default initCompat; diff --git a/packages/cli/src/tools/generator/printRunInstructions.js b/packages/cli/src/commands/init/printRunInstructions.js similarity index 96% rename from packages/cli/src/tools/generator/printRunInstructions.js rename to packages/cli/src/commands/init/printRunInstructions.js index f09f7adcf..bca12c4cf 100644 --- a/packages/cli/src/tools/generator/printRunInstructions.js +++ b/packages/cli/src/commands/init/printRunInstructions.js @@ -10,7 +10,7 @@ import path from 'path'; import chalk from 'chalk'; -import logger from '../logger'; +import logger from '../../tools/logger'; function printRunInstructions(projectDir: string, projectName: string) { const absoluteProjectDir = path.resolve(projectDir); diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js new file mode 100644 index 000000000..40c670487 --- /dev/null +++ b/packages/cli/src/commands/init/template.js @@ -0,0 +1,48 @@ +// @flow +import {execFileSync} from 'child_process'; +import fs from 'fs-extra'; +import path from 'path'; +import * as PackageManager from '../../tools/PackageManager'; +import logger from '../../tools/logger'; + +export type TemplateConfig = { + placeholderName: string, + templateDir: string, + postInitScript?: string, +}; + +export function installTemplatePackage(templateName: string, npm?: boolean) { + logger.debug(`Installing template from ${templateName}`); + PackageManager.install([templateName], {preferYarn: !npm}); +} + +export function getTemplateConfig(templateName: string): TemplateConfig { + const configFilePath = path.resolve( + 'node_modules', + templateName, + 'template.config', + ); + + logger.debug(`Getting config from ${configFilePath}.js`); + + return require(configFilePath); +} + +export function copyTemplate(templateName: string, templateDir: string) { + const templatePath = path.resolve('node_modules', templateName, templateDir); + + logger.debug(`Copying template from ${templatePath}`); + + fs.copySync(templatePath, process.cwd()); +} + +export function executePostInitScript( + templateName: string, + postInitScript: string, +) { + const scriptPath = path.resolve('node_modules', templateName, postInitScript); + + logger.debug(`Executing post init script located ${scriptPath}`); + + execFileSync(scriptPath, {stdio: 'inherit'}); +} diff --git a/packages/cli/src/commands/init/templateName.js b/packages/cli/src/commands/init/templateName.js new file mode 100644 index 000000000..7692cf28c --- /dev/null +++ b/packages/cli/src/commands/init/templateName.js @@ -0,0 +1,54 @@ +// @flow +import path from 'path'; +import {URL} from 'url'; +import {fetch} from '../../tools/fetch'; + +const FILE_PROTOCOL = /file:/; +const HTTP_PROTOCOL = /https?:/; + +function handleFileProtocol(filePath: string) { + const uri = new URL(filePath).pathname; + + return { + uri, + name: require(path.join(uri, 'package.json')).name, + }; +} + +export async function processTemplateName(templateName: string) { + if (templateName.match(FILE_PROTOCOL)) { + return handleFileProtocol(templateName); + } + + const name = await tryTemplateShorthand(templateName); + + return { + uri: name, + name, + }; +} + +/** + * `init` may be invoked with a shorthand like `--template typescript` + * which should resolve to `react-native-template-typescript` package. + * To support that, we query npm registry if a package like this exists, if not + * we return the original name without a change. + */ +async function tryTemplateShorthand(templateName: string) { + if (templateName.match(FILE_PROTOCOL) || templateName.match(HTTP_PROTOCOL)) { + return templateName; + } + try { + const reactNativeTemplatePackage = `react-native-template-${templateName}`; + const response = await fetch( + `https://registry.yarnpkg.com/${reactNativeTemplatePackage}/latest`, + ); + + if (JSON.parse(response).name) { + return reactNativeTemplatePackage; + } + } catch (e) { + // we expect this to fail when `file://` protocol or regular module is passed + } + return templateName; +} diff --git a/packages/cli/src/commands/init/validate.js b/packages/cli/src/commands/init/validate.js new file mode 100644 index 000000000..9166c4026 --- /dev/null +++ b/packages/cli/src/commands/init/validate.js @@ -0,0 +1,15 @@ +// @flow +import InvalidNameError from './errors/InvalidNameError'; +import ReservedNameError from './errors/ReservedNameError'; + +const NAME_REGEX = /^[$A-Z_][0-9A-Z_$]*$/i; + +export function validateProjectName(name: string) { + if (!String(name).match(NAME_REGEX)) { + throw new InvalidNameError(name); + } + + if (name === 'React' || name === 'react') { + throw new ReservedNameError(); + } +} diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index e136fa6d7..5b550fdf2 100644 --- a/packages/cli/src/commands/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 stripAnsi from 'strip-ansi'; import upgrade from '../upgrade'; -import {fetch} from '../helpers'; +import {fetch} from '../../../tools/fetch'; import logger from '../../../tools/logger'; jest.mock('https'); @@ -38,8 +38,7 @@ jest.mock('../../../tools/PackageManager', () => ({ mockPushLog('$ yarn add', ...args); }, })); -jest.mock('../helpers', () => ({ - ...jest.requireActual('../helpers'), +jest.mock('../../../tools/fetch', () => ({ fetch: jest.fn(() => Promise.resolve('patch')), })); jest.mock('../../../tools/logger', () => ({ diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 8d2e69b8c..148cfd99b 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -7,7 +7,7 @@ import execa from 'execa'; import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import * as PackageManager from '../../tools/PackageManager'; -import {fetch} from './helpers'; +import {fetch} from '../../tools/fetch'; import legacyUpgrade from './legacyUpgrade'; type FlagsT = { diff --git a/packages/cli/src/tools/PackageManager.js b/packages/cli/src/tools/PackageManager.js index b1426e62d..fa4b999f1 100644 --- a/packages/cli/src/tools/PackageManager.js +++ b/packages/cli/src/tools/PackageManager.js @@ -50,3 +50,9 @@ export function uninstall(packageNames: Array, options?: Options) { ? executeCommand(`yarn remove ${packageNames.join(' ')}`, options) : executeCommand(`npm uninstall ${packageNames.join(' ')} --save`, options); } + +export function installAll(options?: Options) { + return shouldUseYarn(options) + ? executeCommand('yarn install') + : executeCommand('npm install'); +} diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index f6920a8c5..82636944f 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -96,7 +96,7 @@ function loadConfig(projectRoot: string = process.cwd()): ProjectConfigT { readProjectConfigFromDisk(projectRoot), ); - if (config.reactNativePath === null) { + if (config.reactNativePath === null && !process.argv.includes('init')) { throw new Error(dedent` Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies. diff --git a/packages/cli/src/commands/upgrade/helpers.js b/packages/cli/src/tools/fetch.js similarity index 100% rename from packages/cli/src/commands/upgrade/helpers.js rename to packages/cli/src/tools/fetch.js From 624426579f310c54a142b7b0197dee984ed7799f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Apr 2019 21:30:05 +0200 Subject: [PATCH 050/234] feat: point to --verbose when command fails (#283) --- packages/cli/src/cliEntry.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 2112659d8..0b44c5fe4 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -35,7 +35,18 @@ commander.on('command:*', () => { const defaultOptParser = val => val; const handleError = err => { - logger.error(err.message); + if (commander.verbose) { + logger.error(err.message); + } else { + logger.error( + `${err.message}. ${chalk.dim( + `Run CLI with ${chalk.reset('--verbose')} ${chalk.dim( + 'flag for more details.', + )}`, + )}`, + ); + } + logger.debug(err.stack); process.exit(1); }; From 65f5f9cdd7e6ebd6b69ccbb3f89dc5f2b49f9c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Apr 2019 20:37:04 +0200 Subject: [PATCH 051/234] v2.0.0-alpha.1 --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 7fa336b42..ecb955702 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0", + "version": "2.0.0-alpha.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 4bf4028639e3a8b9b4eb86d6cfa5050921451e47 Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Wed, 3 Apr 2019 01:22:45 -0700 Subject: [PATCH 052/234] fix: properly copy template binary files (#285) Summary: --------- `fs.copySync` does not properly copy binary files. I am using the copy method that we already have in the repo. Test Plan: ---------- Without this change `react-native run-android` breaks with the following error: Screen Shot 2019-04-02 at 16 58 14 --- .../__snapshots__/legacyInit.test.js.snap | 8 +++--- .../init/__tests__/editTemplate.test.js | 3 +- .../commands/init/__tests__/template.test.js | 6 ++-- packages/cli/src/commands/init/template.js | 4 +-- packages/cli/src/tools/copyFiles.js | 28 +++++++++++++++++++ 5 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 packages/cli/src/tools/copyFiles.js diff --git a/e2e/__tests__/__snapshots__/legacyInit.test.js.snap b/e2e/__tests__/__snapshots__/legacyInit.test.js.snap index f78d5e2b4..2f5b89897 100644 --- a/e2e/__tests__/__snapshots__/legacyInit.test.js.snap +++ b/e2e/__tests__/__snapshots__/legacyInit.test.js.snap @@ -7,10 +7,10 @@ Object { "react-native": "0.59.3", }, "devDependencies": Object { - "@babel/core": "^7.4.0", - "@babel/runtime": "^7.4.2", - "babel-jest": "^24.6.0", - "jest": "^24.6.0", + "@babel/core": "^7.4.3", + "@babel/runtime": "^7.4.3", + "babel-jest": "^24.7.0", + "jest": "^24.7.0", "metro-react-native-babel-preset": "^0.53.1", "react-test-renderer": "16.8.3", }, diff --git a/packages/cli/src/commands/init/__tests__/editTemplate.test.js b/packages/cli/src/commands/init/__tests__/editTemplate.test.js index 8917c54d4..f664d2557 100644 --- a/packages/cli/src/commands/init/__tests__/editTemplate.test.js +++ b/packages/cli/src/commands/init/__tests__/editTemplate.test.js @@ -4,6 +4,7 @@ import path from 'path'; import fs from 'fs-extra'; import snapshotDiff from 'snapshot-diff'; import walk from '../../../tools/walk'; +import copyFiles from '../../../tools/copyFiles'; import {changePlaceholderInTemplate} from '../editTemplate'; const FIXTURE_DIR = path.resolve( @@ -21,7 +22,7 @@ function createTestEnv() { const testPath = path.resolve(tmpDir, TEST_DIR); fs.mkdirSync(testPath); - fs.copySync(FIXTURE_DIR, testPath); + copyFiles(FIXTURE_DIR, testPath); return testPath; } diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js index 73590ce17..657a2ca1f 100644 --- a/packages/cli/src/commands/init/__tests__/template.test.js +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -1,5 +1,4 @@ // @flow -import fs from 'fs-extra'; import path from 'path'; import ChildProcess from 'child_process'; import * as PackageManger from '../../../tools/PackageManager'; @@ -9,6 +8,7 @@ import { copyTemplate, executePostInitScript, } from '../template'; +import * as copyFiles from '../../../tools/copyFiles'; const TEMPLATE_NAME = 'templateName'; @@ -55,7 +55,7 @@ test('copyTemplate', () => { const CWD = '.'; jest.spyOn(path, 'resolve').mockImplementationOnce((...e) => e.join('/')); - jest.spyOn(fs, 'copySync').mockImplementationOnce(() => {}); + jest.spyOn(copyFiles, 'default').mockImplementationOnce(() => {}); jest.spyOn(process, 'cwd').mockImplementationOnce(() => CWD); copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR); @@ -65,7 +65,7 @@ test('copyTemplate', () => { TEMPLATE_NAME, TEMPLATE_DIR, ); - expect(fs.copySync).toHaveBeenCalledWith(expect.any(String), CWD); + expect(copyFiles.default).toHaveBeenCalledWith(expect.any(String), CWD); }); test('executePostInitScript', () => { diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index 40c670487..dd7180ece 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -1,9 +1,9 @@ // @flow import {execFileSync} from 'child_process'; -import fs from 'fs-extra'; import path from 'path'; import * as PackageManager from '../../tools/PackageManager'; import logger from '../../tools/logger'; +import copyFiles from '../../tools/copyFiles'; export type TemplateConfig = { placeholderName: string, @@ -33,7 +33,7 @@ export function copyTemplate(templateName: string, templateDir: string) { logger.debug(`Copying template from ${templatePath}`); - fs.copySync(templatePath, process.cwd()); + copyFiles(templatePath, process.cwd()); } export function executePostInitScript( diff --git a/packages/cli/src/tools/copyFiles.js b/packages/cli/src/tools/copyFiles.js new file mode 100644 index 000000000..c94581f78 --- /dev/null +++ b/packages/cli/src/tools/copyFiles.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +import path from 'path'; +import copyAndReplace from './copyAndReplace'; +import walk from './walk'; + +/** + * Copy files (binary included) recursively. + */ +function copyFiles(srcPath: string, destPath: string) { + walk(srcPath).forEach(absoluteSrcFilePath => { + const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); + copyAndReplace( + absoluteSrcFilePath, + path.resolve(destPath, relativeFilePath), + {}, // no replacements + ); + }); +} + +export default copyFiles; From 90c0f492492b076eac04ca48759f3f46f87fb2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 3 Apr 2019 10:43:15 +0200 Subject: [PATCH 053/234] chore: make legacyInit test less flaky (#286) Summary: --------- Get rid of moving parts in legacy init test Test Plan: ---------- Test runs fine --- .../__snapshots__/legacyInit.test.js.snap | 28 ------------------- e2e/__tests__/legacyInit.test.js | 26 +++++++++++++++-- packages/cli/package.json | 2 +- 3 files changed, 24 insertions(+), 32 deletions(-) delete mode 100644 e2e/__tests__/__snapshots__/legacyInit.test.js.snap diff --git a/e2e/__tests__/__snapshots__/legacyInit.test.js.snap b/e2e/__tests__/__snapshots__/legacyInit.test.js.snap deleted file mode 100644 index 2f5b89897..000000000 --- a/e2e/__tests__/__snapshots__/legacyInit.test.js.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`legacy init through react-native-cli: package.json contains necessary configuration 1`] = ` -Object { - "dependencies": Object { - "react": "16.8.3", - "react-native": "0.59.3", - }, - "devDependencies": Object { - "@babel/core": "^7.4.3", - "@babel/runtime": "^7.4.3", - "babel-jest": "^24.7.0", - "jest": "^24.7.0", - "metro-react-native-babel-preset": "^0.53.1", - "react-test-renderer": "16.8.3", - }, - "jest": Object { - "preset": "react-native", - }, - "name": "TestApp", - "private": true, - "scripts": Object { - "start": "node node_modules/react-native/local-cli/cli.js start", - "test": "jest", - }, - "version": "0.0.1", -} -`; diff --git a/e2e/__tests__/legacyInit.test.js b/e2e/__tests__/legacyInit.test.js index ce5c71c5e..cd1a49af1 100644 --- a/e2e/__tests__/legacyInit.test.js +++ b/e2e/__tests__/legacyInit.test.js @@ -45,7 +45,27 @@ test('legacy init through react-native-cli', () => { expect(fs.readdirSync(path.join(DIR, 'TestApp'))).toEqual(templateFiles); const pkgJson = require(path.join(DIR, 'TestApp', 'package.json')); - expect(pkgJson).toMatchSnapshot( - 'package.json contains necessary configuration', - ); + expect(pkgJson).toMatchObject({ + dependencies: { + react: expect.any(String), + 'react-native': expect.any(String), + }, + devDependencies: { + '@babel/core': expect.any(String), + '@babel/runtime': expect.any(String), + 'babel-jest': expect.any(String), + jest: expect.any(String), + 'metro-react-native-babel-preset': expect.any(String), + 'react-test-renderer': expect.any(String), + }, + jest: { + preset: 'react-native', + }, + name: 'TestApp', + private: true, + scripts: { + start: 'node node_modules/react-native/local-cli/cli.js start', + test: 'jest', + }, + }); }); diff --git a/packages/cli/package.json b/packages/cli/package.json index ecb955702..e1a7fcfdf 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.1", + "version": "2.0.0-alpha.3", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 4320d3e447df25f458b1799f4e0412874f10e4a3 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 4 Apr 2019 17:47:13 +0200 Subject: [PATCH 054/234] feat: make legacy `link` use new configuration (#281) Summary: --------- This PR switches `link` to rely on the new configuration (from "ctx") that is also used by "react-native config" and soon, "auto linking". Test Plan: ---------- You should be able to run link w/o any issues --- .circleci/config.yml | 6 +- .flowconfig | 1 + e2e/__tests__/uninstall.test.js | 2 +- packages/cli/src/cliEntry.js | 11 +- .../src/commands/info/__tests__/info.test.js | 17 +- packages/cli/src/commands/init/init.js | 6 +- packages/cli/src/commands/install/install.js | 6 +- .../getDependencyConfig-test.js.snap | 19 - .../__tests__/getDependencyConfig-test.js | 45 -- .../__tests__/getProjectDependencies-test.js | 44 -- .../src/commands/link/__tests__/link-test.js | 402 ++++++++---------- .../src/commands/link/getDependencyConfig.js | 47 -- .../cli/src/commands/link/getPlatformName.js | 12 + .../cli/src/commands/link/getProjectConfig.js | 33 -- .../commands/link/getProjectDependencies.js | 31 -- .../link/ios/common/unregisterNativeModule.js | 4 +- packages/cli/src/commands/link/link.js | 81 ++-- packages/cli/src/commands/link/linkAll.js | 64 ++- packages/cli/src/commands/link/linkAssets.js | 2 +- .../cli/src/commands/link/linkDependency.js | 39 +- packages/cli/src/commands/link/unlink.js | 89 ++-- .../upgrade/__tests__/upgrade.test.js | 17 +- .../src/tools/__tests__/findPlugins-test.js | 99 ----- packages/cli/src/tools/assign.js | 25 ++ .../cli/src/tools/config/__mocks__/index.js | 25 ++ .../{index.js.snap => index-test.js.snap} | 65 ++- .../{ => config}/__tests__/findAssets-test.js | 5 +- .../config/__tests__/findDependencies-test.js | 32 ++ .../__tests__/{index.js => index-test.js} | 39 +- .../__tests__/makeHook-test.js} | 23 +- .../{getAssets.js => config/findAssets.js} | 11 +- .../cli/src/tools/config/findDependencies.js | 18 +- packages/cli/src/tools/config/index.js | 140 +++--- .../tools/{getHooks.js => config/makeHook.js} | 15 +- .../src/tools/config/readConfigFromDisk.js | 8 +- .../tools/config/resolveReactNativePath.js | 14 +- packages/cli/src/tools/config/schema.js | 46 +- packages/cli/src/tools/config/types.flow.js | 200 +++++++-- packages/cli/src/tools/errors.js | 58 ++- packages/cli/src/tools/findPlugins.js | 126 ------ .../cli/src/tools/getPackageConfiguration.js | 14 - packages/cli/src/tools/getParams.js | 10 - packages/cli/src/tools/getPlatforms.js | 56 --- packages/cli/src/tools/loadMetroConfig.js | 7 +- packages/cli/src/tools/types.flow.js | 116 +---- 45 files changed, 858 insertions(+), 1272 deletions(-) delete mode 100644 packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap delete mode 100644 packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js delete mode 100644 packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js delete mode 100644 packages/cli/src/commands/link/getDependencyConfig.js create mode 100644 packages/cli/src/commands/link/getPlatformName.js delete mode 100644 packages/cli/src/commands/link/getProjectConfig.js delete mode 100644 packages/cli/src/commands/link/getProjectDependencies.js delete mode 100644 packages/cli/src/tools/__tests__/findPlugins-test.js create mode 100644 packages/cli/src/tools/assign.js create mode 100644 packages/cli/src/tools/config/__mocks__/index.js rename packages/cli/src/tools/config/__tests__/__snapshots__/{index.js.snap => index-test.js.snap} (78%) rename packages/cli/src/tools/{ => config}/__tests__/findAssets-test.js (90%) create mode 100644 packages/cli/src/tools/config/__tests__/findDependencies-test.js rename packages/cli/src/tools/config/__tests__/{index.js => index-test.js} (81%) rename packages/cli/src/tools/{__tests__/makeCommand-test.js => config/__tests__/makeHook-test.js} (56%) rename packages/cli/src/tools/{getAssets.js => config/findAssets.js} (61%) rename packages/cli/src/tools/{getHooks.js => config/makeHook.js} (60%) delete mode 100644 packages/cli/src/tools/findPlugins.js delete mode 100644 packages/cli/src/tools/getPackageConfiguration.js delete mode 100644 packages/cli/src/tools/getParams.js delete mode 100644 packages/cli/src/tools/getPlatforms.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 53e390b7e..ec7d9ef57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,11 +14,11 @@ jobs: at: ~/react-native-cli - restore_cache: keys: - - dependencies-{{ checksum "package.json" }} - - dependencies- + - v2-dependencies-{{ checksum "package.json" }} + - v2-dependencies- - run: yarn install - save_cache: - key: dependencies-{{ checksum "package.json" }} + key: v2-dependencies-{{ checksum "package.json" }} paths: - node_modules - persist_to_workspace: diff --git a/.flowconfig b/.flowconfig index be12bc31a..87fb9288f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -43,6 +43,7 @@ module.ignore_non_literal_requires=true all=warn unnecessary-optional-chain=off dynamic-export=off +unsafe-getters-setters=off # There is an ESLint rule for this unclear-type=off diff --git a/e2e/__tests__/uninstall.test.js b/e2e/__tests__/uninstall.test.js index 1c9f6df05..1b9053e49 100644 --- a/e2e/__tests__/uninstall.test.js +++ b/e2e/__tests__/uninstall.test.js @@ -38,7 +38,7 @@ test('uninstall fails when package is not installed', () => { }); const {stderr, code} = run(DIR, ['uninstall', pkg]); - expect(stderr).toContain(`Project "${pkg}" is not a react-native library`); + expect(stderr).toContain(`Failed to unlink "${pkg}".`); expect(code).toBe(1); }); diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 0b44c5fe4..fded0f87f 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -18,7 +18,6 @@ import {getCommands} from './commands'; import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; -import findPlugins from './tools/findPlugins'; import {setProjectDir} from './tools/PackageManager'; import pkgJson from '../package.json'; import loadConfig from './tools/config'; @@ -38,15 +37,17 @@ const handleError = err => { if (commander.verbose) { logger.error(err.message); } else { + // Some error messages (esp. custom ones) might have `.` at the end already. + const message = err.message.replace(/\.$/, ''); logger.error( - `${err.message}. ${chalk.dim( + `${message}. ${chalk.dim( `Run CLI with ${chalk.reset('--verbose')} ${chalk.dim( 'flag for more details.', )}`, )}`, ); } - logger.debug(err.stack); + logger.debug(chalk.dim(err.stack)); process.exit(1); }; @@ -184,7 +185,7 @@ async function setupAndRun() { export default { run, init, - findPlugins, + loadConfig, }; -export {run, init, findPlugins}; +export {run, init, loadConfig}; diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js index 12dc9383f..cbda1f26f 100644 --- a/packages/cli/src/commands/info/__tests__/info.test.js +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -1,6 +1,7 @@ // @flow import info from '../info'; import logger from '../../../tools/logger'; +import loadConfig from '../../../tools/config'; jest.mock('../../../tools/logger', () => ({ info: jest.fn(), @@ -8,24 +9,16 @@ jest.mock('../../../tools/logger', () => ({ log: jest.fn(), })); -const ctx = { - root: '', - reactNativePath: '', - dependencies: {}, - platforms: {}, - commands: [], - haste: { - platforms: [], - providesModuleNodeModules: [], - }, -}; +jest.mock('../../../tools/config'); beforeEach(() => { jest.resetAllMocks(); }); +const config = loadConfig(); + test('prints output without arguments', async () => { - await info.func([], ctx, {}); + await info.func([], config, {}); expect(logger.info).toHaveBeenCalledWith( 'Fetching system and libraries information...', ); diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 7b8486723..24c8b965a 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -100,9 +100,9 @@ function createProject(projectName: string, options: Options, version: string) { return createFromReactNativeTemplate(projectName, version, options.npm); } -export default async function initialize( +export default (async function initialize( [projectName]: Array, - context: ContextT, + _context: ContextT, options: Options, ) { validateProjectName(projectName); @@ -125,4 +125,4 @@ export default async function initialize( logger.error(e.message); fs.removeSync(projectName); } -} +}); diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index bd9097a0c..ffcb7f0df 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -11,6 +11,7 @@ import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; import * as PackageManager from '../../tools/PackageManager'; import link from '../link/link'; +import loadConfig from '../../tools/config'; async function install(args: Array, ctx: ContextT) { const name = args[0]; @@ -18,8 +19,11 @@ async function install(args: Array, ctx: ContextT) { logger.info(`Installing "${name}"...`); PackageManager.install([name]); + // Reload configuration to see newly installed dependency + const newConfig = loadConfig(); + logger.info(`Linking "${name}"...`); - await link.func([name], ctx, {platforms: undefined}); + await link.func([name], newConfig, {platforms: undefined}); logger.success(`Successfully installed and linked "${name}"`); } diff --git a/packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap b/packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap deleted file mode 100644 index 9fc3eecc9..000000000 --- a/packages/cli/src/commands/link/__tests__/__snapshots__/getDependencyConfig-test.js.snap +++ /dev/null @@ -1,19 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`getDependencyConfig should return an array of dependencies' config 1`] = ` -Object { - "assets": Array [], - "commands": Object {}, - "config": Object { - "android": Object { - "sampleAndroidKey": "", - }, - "ios": Object { - "sampleiOSKey": "", - }, - }, - "name": "react-native-windows", - "params": Array [], - "path": "/root/node_modules/react-native-windows", -} -`; diff --git a/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js b/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js deleted file mode 100644 index 73cd1f7a2..000000000 --- a/packages/cli/src/commands/link/__tests__/getDependencyConfig-test.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -const platforms = { - ios: { - dependencyConfig: () => ({sampleiOSKey: ''}), - }, - android: { - dependencyConfig: () => ({sampleAndroidKey: ''}), - }, -}; - -jest.setMock('../../../tools/getPackageConfiguration', folder => { - if (folder === '/root/node_modules/abcd') { - throw new Error('Cannot require'); - } - return {}; -}); - -const getDependencyConfig = require('../getDependencyConfig').default; - -describe('getDependencyConfig', () => { - it("should return an array of dependencies' config", () => { - const dependencies = getDependencyConfig( - {root: '/root'}, - platforms, - 'react-native-windows', - ); - - expect(dependencies).toMatchSnapshot(); - }); - - it('should throw on invalid react-native dependency', () => { - expect(() => - getDependencyConfig({root: '/root'}, platforms, 'abcd'), - ).toThrowError(); - }); -}); diff --git a/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js b/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js deleted file mode 100644 index 5eac43b0b..000000000 --- a/packages/cli/src/commands/link/__tests__/getProjectDependencies-test.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - * @format - */ - -import getProjectDependencies from '../getProjectDependencies'; - -const path = require('path'); - -const CWD = path.resolve(__dirname, '../../'); - -describe('getProjectDependencies', () => { - beforeEach(() => { - jest.resetModules(); - }); - it('should return an array of project dependencies', () => { - jest.doMock( - path.join(CWD, './package.json'), - () => ({ - dependencies: { - lodash: '^6.0.0', - 'react-native': '^16.0.0', - '@react-native-community/cli': '*', - }, - }), - {virtual: true}, - ); - - expect(getProjectDependencies(CWD)).toEqual(['lodash']); - }); - - it('should return an empty array when no dependencies set', () => { - jest.doMock(path.join(CWD, './package.json'), () => ({}), { - virtual: true, - }); - expect(getProjectDependencies(CWD)).toEqual([]); - }); -}); diff --git a/packages/cli/src/commands/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js index 59e905d9f..c409283f3 100644 --- a/packages/cli/src/commands/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -1,18 +1,18 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ +import {func as link} from '../link'; +import loadConfig from '../../../tools/config'; jest.mock('chalk', () => ({grey: str => str})); +jest.mock('../../../tools/config'); jest.mock('../../../tools/logger'); -const context = { - root: process.cwd(), +const baseConfig = loadConfig(); + +const baseDependencyConfig = { + name: 'react-native-gradient', + assets: [], + hooks: {}, + params: [], + platforms: {ios: {}, android: {}}, }; describe('link', () => { @@ -20,89 +20,74 @@ describe('link', () => { jest.resetModules(); }); - it('should reject when run in a folder without package.json', done => { - const link = require('../link').func; - link([], {root: '/'}, {}).catch(() => done()); - }); - - it('should accept a name of a dependency to link', done => { - const getDependencyConfig = jest.fn(() => ({ - config: { - ios: null, - android: null, + it('should accept a name of a dependency to link', async () => { + const config = { + ...baseConfig, + dependencies: { + get ['react-native-gradient']() { + return baseDependencyConfig; + }, }, - assets: [], - commands: {}, - })); + }; - jest.doMock('../getDependencyConfig', () => getDependencyConfig); + const spy = jest.spyOn(config.dependencies, 'react-native-gradient', 'get'); - const link = require('../link').func; - link(['react-native-gradient'], context, {}).then(() => { - expect(getDependencyConfig.mock.calls[0][2]).toEqual( - 'react-native-gradient', - ); - done(); - }); + await link(['react-native-gradient'], config, {}); + + expect(spy).toHaveBeenCalled(); }); it('should accept the name of a dependency with a scope / tag', async () => { - const getDependencyConfig = jest.fn(() => ({ - config: { - ios: null, - android: null, + const config = { + ...baseConfig, + dependencies: { + get ['@scope/something']() { + return baseDependencyConfig; + }, }, - assets: [], - commands: {}, - })); + }; - jest.doMock('../getDependencyConfig', () => getDependencyConfig); + const spy = jest.spyOn(config.dependencies, '@scope/something', 'get'); - const link = require('../link').func; - await link(['@scope/something@latest'], context, {}); + await link(['@scope/something@latest'], config, {}); - expect(getDependencyConfig.mock.calls[0][2]).toEqual('@scope/something'); + expect(spy).toHaveBeenCalled(); }); it('should register native module when android/ios projects are present', done => { const prelink = jest.fn().mockImplementation(cb => cb()); const postlink = jest.fn().mockImplementation(cb => cb()); + const registerNativeModule = jest.fn(); - jest.doMock('../getProjectConfig', () => () => ({ - ios: {}, - android: {}, - })); - - const getDependencyConfig = jest.fn(() => ({ - config: { + const config = { + ...baseConfig, + project: { ios: {}, android: {}, }, - assets: [], - commands: {prelink, postlink}, - })); - - jest.doMock('../getDependencyConfig', () => getDependencyConfig); - - const registerNativeModule = jest.fn(); - - jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(false), - ); - jest.doMock( - '../android/registerNativeModule.js', - () => registerNativeModule, - ); - - jest.doMock('../ios/isInstalled.js', () => - jest.fn().mockReturnValue(false), - ); - jest.doMock('../ios/registerNativeModule.js', () => registerNativeModule); - - const link = require('../link').func; - registerNativeModule.mockClear(); + platforms: { + ios: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + android: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + }, + dependencies: { + 'react-native-blur': { + ...baseDependencyConfig, + hooks: {prelink, postlink}, + }, + }, + }; - link(['react-native-blur'], context, {}).then(() => { + link(['react-native-blur'], config, {}).then(() => { expect(registerNativeModule.mock.calls).toHaveLength(2); expect(prelink.mock.invocationCallOrder[0]).toBeLessThan( @@ -121,199 +106,158 @@ describe('link', () => { const dependencyAssets = ['Fonts/Font.ttf']; const projectAssets = ['Fonts/FontC.ttf']; - jest.doMock('../getProjectConfig', () => () => ({ - ios: {}, - android: {}, - })); + const copyAssets = jest.fn(); + const dependency = { + ...baseDependencyConfig, + assets: dependencyAssets, + }; - jest.doMock('../getDependencyConfig', () => () => ({ - config: { + const config = { + ...baseConfig, + project: { ios: {}, android: {}, }, - assets: dependencyAssets, - commands: {}, - })); - - jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(false), - ); - jest.doMock('../android/registerNativeModule.js', () => jest.fn()); - - jest.doMock('../ios/isInstalled.js', () => - jest.fn().mockReturnValue(false), - ); - jest.doMock('../ios/registerNativeModule.js', () => jest.fn()); - - jest.doMock('../../../tools/getAssets', () => projectAssets); - - const copyAssets = jest.fn(); - - jest.doMock('../ios/copyAssets.js', () => copyAssets); - jest.doMock('../android/copyAssets.js', () => copyAssets); - - const link = require('../link').func; + platforms: { + ios: { + linkConfig: () => ({ + register: jest.fn(), + copyAssets, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + android: { + linkConfig: () => ({ + register: jest.fn(), + copyAssets, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + }, + dependencies: { + 'react-native-blur': dependency, + }, + assets: projectAssets, + }; - link(['react-native-blur'], context, {}).then(() => { + link(['react-native-blur'], config, {}).then(() => { expect(copyAssets.mock.calls).toHaveLength(2); expect(copyAssets.mock.calls[0][0]).toEqual(dependencyAssets); - jest.unmock('../../../tools/getAssets'); done(); }); }); it('should not register modules when they are already installed', done => { - jest.doMock('../getProjectConfig', () => () => ({ - ios: {}, - android: {}, - })); + const registerNativeModule = jest.fn(); - const getDependencyConfig = jest.fn(() => ({ - config: { + const config = { + ...baseConfig, + project: { ios: {}, android: {}, }, - assets: [], - commands: {}, - })); - - jest.doMock('../getDependencyConfig', () => getDependencyConfig); - - const registerNativeModule = jest.fn(); - - jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(true), - ); - jest.doMock( - '../android/registerNativeModule.js', - () => registerNativeModule, - ); - - jest.doMock('../ios/isInstalled.js', () => jest.fn().mockReturnValue(true)); - jest.doMock('../ios/registerNativeModule.js', () => registerNativeModule); - - const link = require('../link').func; + platforms: { + ios: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(true), + }), + }, + android: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(true), + }), + }, + }, + dependencies: { + 'react-native-blur': baseDependencyConfig, + }, + }; - link(['react-native-blur', {}], context, {}).then(() => { + link(['react-native-blur'], config, {}).then(() => { expect(registerNativeModule.mock.calls).toHaveLength(0); done(); }); }); it('should register native modules for additional platforms', done => { - jest.doMock('../getProjectConfig', () => () => ({ - ios: {}, - android: {}, - windows: {}, - })); - const registerNativeModule = jest.fn(); - const genericLinkConfig = () => ({ - isInstalled: () => false, - register: registerNativeModule, - }); - - const getDependencyConfig = jest.fn(() => ({ - config: { + const config = { + ...baseConfig, + project: { ios: {}, android: {}, windows: {}, }, - assets: [], - commands: {}, - })); - - jest.doMock('../../../tools/getPlatforms', () => { - const fn = () => ({ - ios: {linkConfig: require('../ios').default}, - android: {linkConfig: require('../android').default}, - windows: {linkConfig: genericLinkConfig}, - }); - fn.getPlatformName = jest.fn(); - return fn; - }); - - jest.doMock('../getDependencyConfig', () => getDependencyConfig); - - jest.doMock('../android/isInstalled.js', () => - jest.fn().mockReturnValue(true), - ); - jest.doMock( - '../android/registerNativeModule.js', - () => registerNativeModule, - ); - - jest.doMock('../ios/isInstalled.js', () => jest.fn().mockReturnValue(true)); - jest.doMock('../ios/registerNativeModule.js', () => registerNativeModule); + platforms: { + ios: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(true), + }), + }, + android: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(true), + }), + }, + windows: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + }, + dependencies: { + 'react-native-blur': { + ...baseDependencyConfig, + platforms: { + ...baseDependencyConfig.platforms, + windows: {}, + }, + }, + }, + }; - const link = require('../link').func; - link(['react-native-blur'], context, {}).then(() => { + link(['react-native-blur'], config, {}).then(() => { expect(registerNativeModule.mock.calls).toHaveLength(1); done(); }); }); it('should link only for specific platforms if --platforms is used', async () => { - jest.doMock('../getProjectDependencies', () => () => ['react-native-maps']); - jest.doMock('../../../tools/getPackageConfiguration', () => () => ({ - assets: [], - })); - - const registerAndroidNativeModule = jest.fn(); - const registerIOSNativeModule = jest.fn(); - - const genericAndroidLinkConfig = () => ({ - isInstalled: () => false, - register: registerAndroidNativeModule, - }); - - const genericIOSLinkConfig = () => ({ - isInstalled: () => false, - register: registerIOSNativeModule, - }); - - jest.doMock('../../../tools/getPlatforms', () => { - const fn = () => ({ - android: {linkConfig: genericAndroidLinkConfig}, - ios: {linkConfig: genericIOSLinkConfig}, - }); - fn.getPlatformName = jest.fn(); - return fn; - }); + const registerNativeModule = jest.fn(); - jest.doMock( - '../android/registerNativeModule.js', - () => registerAndroidNativeModule, - ); - jest.doMock( - '../ios/registerNativeModule.js', - () => registerIOSNativeModule, - ); - - const link = require('../link').func; - const assertPlaftormsCalledTimes = (android, ios) => { - expect(registerAndroidNativeModule).toHaveBeenCalledTimes(android); - expect(registerIOSNativeModule).toHaveBeenCalledTimes(ios); - registerAndroidNativeModule.mockClear(); - registerIOSNativeModule.mockClear(); + const config = { + ...baseConfig, + project: { + ios: {}, + android: {}, + }, + platforms: { + ios: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + android: { + linkConfig: () => ({ + register: registerNativeModule, + isInstalled: jest.fn().mockReturnValue(false), + }), + }, + }, + dependencies: { + 'react-native-blur': baseDependencyConfig, + }, }; - await link( - ['react-native-gradient'], - {root: '/'}, - {platforms: ['android']}, - ); - assertPlaftormsCalledTimes(1, 0); - - await link(['react-native-gradient'], {root: '/'}, {platforms: ['ios']}); - assertPlaftormsCalledTimes(0, 1); - - await link( - ['react-native-gradient'], - {root: '/'}, - {platforms: ['android', 'ios']}, - ); - assertPlaftormsCalledTimes(1, 1); + await link(['react-native-blur'], config, {platforms: ['android']}); + + expect(registerNativeModule.mock.calls).toHaveLength(1); }); }); diff --git a/packages/cli/src/commands/link/getDependencyConfig.js b/packages/cli/src/commands/link/getDependencyConfig.js deleted file mode 100644 index 7983691c2..000000000 --- a/packages/cli/src/commands/link/getDependencyConfig.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @flow - */ - -import path from 'path'; -import type { - PlatformsT, - ContextT, - DependenciesConfig, -} from '../../tools/types.flow'; - -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, - availablePlatforms: PlatformsT, - dependency: string, -): DependenciesConfig { - try { - const folder = path.join(ctx.root, 'node_modules', dependency); - const config = getPackageConfiguration(folder); - - const platformConfigs = {ios: undefined, android: undefined}; - - Object.keys(availablePlatforms).forEach(platform => { - platformConfigs[platform] = availablePlatforms[platform].dependencyConfig( - folder, - // $FlowIssue: Flow can't match platform config with its appropriate config function - config[platform] || {}, - ); - }); - - return { - config: platformConfigs, - name: dependency, - path: folder, - commands: getHooks(folder), - assets: getAssets(folder), - params: getParams(folder), - }; - } catch (e) { - throw new Error('Failed to get dependency config'); - } -} diff --git a/packages/cli/src/commands/link/getPlatformName.js b/packages/cli/src/commands/link/getPlatformName.js new file mode 100644 index 000000000..455d9c06c --- /dev/null +++ b/packages/cli/src/commands/link/getPlatformName.js @@ -0,0 +1,12 @@ +/** + * @flow + */ + +const names = { + ios: 'iOS', + android: 'Android', +}; + +export default function getPlatformName(name: string) { + return names[name] || name; +} diff --git a/packages/cli/src/commands/link/getProjectConfig.js b/packages/cli/src/commands/link/getProjectConfig.js deleted file mode 100644 index d3b40c169..000000000 --- a/packages/cli/src/commands/link/getProjectConfig.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @flow - */ - -import type { - PlatformsT, - ContextT, - ProjectConfigT, -} from '../../tools/types.flow'; - -import getPackageConfiguration from '../../tools/getPackageConfiguration'; -import {getPlatformName} from '../../tools/getPlatforms'; -import logger from '../../tools/logger'; - -export default function getProjectConfig( - ctx: ContextT, - availablePlatforms: PlatformsT, -): ProjectConfigT { - const config = getPackageConfiguration(ctx.root); - - const platformConfigs = {ios: undefined, android: undefined}; - - Object.keys(availablePlatforms).forEach(platform => { - logger.debug(`Getting project config for ${getPlatformName(platform)}...`); - platformConfigs[platform] = availablePlatforms[platform].projectConfig( - ctx.root, - // $FlowIssue: Flow can't match platform config with its appropriate config function - config[platform] || {}, - ); - }); - - return platformConfigs; -} diff --git a/packages/cli/src/commands/link/getProjectDependencies.js b/packages/cli/src/commands/link/getProjectDependencies.js deleted file mode 100644 index 9d6c3d4f3..000000000 --- a/packages/cli/src/commands/link/getProjectDependencies.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ - -import path from 'path'; - -/** - * List of projects that should not be treated as projects to be linked. - * - * That includes `react-native` itself and the CLI project (under its real and staging npm package). - */ -const EXCLUDED_PROJECTS = [ - 'react-native', - '@react-native-community/cli', - 'react-native-local-cli-preview', -]; - -/** - * Returns an array of dependencies that should be linked/checked. - */ -export default function getProjectDependencies(cwd: string) { - const pkgJson = require(path.join(cwd, './package.json')); - return (Object.keys(pkgJson.dependencies || {}).filter( - name => EXCLUDED_PROJECTS.includes(name) === false, - ): Array); -} diff --git a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js b/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js index 482f3ef67..61752d42c 100644 --- a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js +++ b/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js @@ -22,7 +22,9 @@ export default function unregisterNativeModule( const isIosInstalled = isInstalledIOS(projectConfig, dependencyConfig); const isPodInstalled = isInstalledPods(projectConfig, dependencyConfig); if (isIosInstalled) { - const iOSDependencies = compact(otherDependencies.map(d => d.config.ios)); + const iOSDependencies = compact( + otherDependencies.map(d => d.platforms.ios), + ); unregisterDependencyIOS(dependencyConfig, projectConfig, iOSDependencies); } else if (isPodInstalled) { unregisterDependencyPods(dependencyConfig, projectConfig); diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index c57f950ac..0afddc112 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -8,18 +8,21 @@ */ import {pick} from 'lodash'; -import type {ContextT} from '../../tools/types.flow'; +import dedent from 'dedent'; + +import {type ContextT} from '../../tools/types.flow'; + +import {CLIError} from '../../tools/errors'; import promiseWaterfall from './promiseWaterfall'; import logger from '../../tools/logger'; -import getDependencyConfig from './getDependencyConfig'; import commandStub from './commandStub'; import promisify from './promisify'; -import getProjectConfig from './getProjectConfig'; +import getPlatformName from './getPlatformName'; + import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; -import getPlatforms, {getPlatformName} from '../../tools/getPlatforms'; type FlagsType = { platforms?: Array, @@ -32,60 +35,54 @@ type FlagsType = { * only that package is processed. */ function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { - let platforms; - let project; - try { - platforms = getPlatforms(ctx.root); - logger.debug( - 'Available platforms: ' + - `${Object.getOwnPropertyNames(platforms) - .map(platform => getPlatformName(platform)) - .join(', ')}`, - ); - if (opts.platforms) { - platforms = pick(platforms, opts.platforms); - } - logger.debug( - 'Targeted platforms: ' + - `${Object.getOwnPropertyNames(platforms) - .map(platform => getPlatformName(platform)) - .join(', ')}`, - ); - project = getProjectConfig(ctx, platforms); - } catch (err) { - logger.error( - 'No package found. Are you sure this is a React Native project?', - ); - return Promise.reject(err); + let platforms = ctx.platforms; + let project = ctx.project; + + if (opts.platforms) { + platforms = pick(platforms, opts.platforms); + logger.debug('Skipping selected platforms'); } + logger.debug( + 'Available platforms: ' + + `${Object.keys(platforms) + .map(getPlatformName) + .join(', ')}`, + ); + if (rawPackageName === undefined) { logger.debug( 'No package name provided, will attemp to link all possible packages.', ); - return linkAll(ctx, platforms, project); + return linkAll(ctx); } - logger.debug(`Package to link: ${rawPackageName}`); - // Trim the version / tag out of the package name (eg. package@latest) const packageName = rawPackageName.replace(/^(.+?)(@.+?)$/gi, '$1'); - const dependencyConfig = getDependencyConfig(ctx, platforms, packageName); + if (!Object.keys(ctx.dependencies).includes(packageName)) { + throw new CLIError(dedent` + Unknown dependency. Make sure that the package you are trying to link is + already installed in your "node_modules" and present in your "package.json" dependencies. + `); + } + + const {[packageName]: dependency} = ctx.dependencies; + + logger.debug(`Package to link: ${rawPackageName}`); const tasks = [ - () => promisify(dependencyConfig.commands.prelink || commandStub), - () => linkDependency(platforms, project, dependencyConfig), - () => promisify(dependencyConfig.commands.postlink || commandStub), - () => linkAssets(platforms, project, dependencyConfig.assets), + () => promisify(dependency.hooks.prelink || commandStub), + () => linkDependency(platforms, project, dependency), + () => promisify(dependency.hooks.postlink || commandStub), + () => linkAssets(platforms, project, dependency.assets), ]; return promiseWaterfall(tasks).catch(err => { - logger.error( - `Something went wrong while linking. Error: ${err.message} \n` + - 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues', + throw new CLIError( + `Something went wrong while linking. Reason: ${err.message}`, + err, ); - throw err; }); } @@ -104,5 +101,3 @@ export default { }, ], }; - -// link; diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 9ba413763..bd9f80a80 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -1,64 +1,48 @@ -// @flow +/** + * @flow + */ -import {uniqBy, flatten} from 'lodash'; +import {uniqBy, flatMap} from 'lodash'; import path from 'path'; -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 type {ConfigT, PlatformsT} from '../../tools/config/types.flow'; +import {CLIError} from '../../tools/errors'; + import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; import promisify from './promisify'; + import linkAssets from './linkAssets'; import linkDependency from './linkDependency'; const dedupeAssets = (assets: Array): Array => uniqBy(assets, asset => path.basename(asset)); -function linkAll( - context: ContextT, - platforms: PlatformsT, - project: ProjectConfigT, -) { - logger.warn( - 'Running `react-native link` without package name is deprecated and will be removed ' + - 'in next release. If you use this command to link your project assets, ' + - 'please let us know about your use case here: https://goo.gl/RKTeoc', - ); - - const projectAssets = getAssets(context.root); - const dependencies = getProjectDependencies(context.root); - const dependenciesConfig = dependencies.map(dependency => - getDependencyConfig(context, platforms, dependency), - ); +function linkAll(config: ConfigT) { + const projectAssets = config.assets; const assets = dedupeAssets( - dependenciesConfig.reduce( - (acc, dependency) => acc.concat(dependency.assets), + Object.keys(config.dependencies).reduce( + (acc, dependency) => acc.concat(config.dependencies[dependency].assets), projectAssets, ), ); - const tasks = flatten( - dependenciesConfig.map(config => [ - () => promisify(config.commands.prelink || commandStub), - () => linkDependency(platforms, project, config), - () => promisify(config.commands.postlink || commandStub), - () => linkAssets(platforms, project, assets), - ]), + const tasks = flatMap( + config.dependencies, + dependency => [ + () => promisify(dependency.hooks.prelink || commandStub), + () => linkDependency(config.platforms, config.project, dependency), + () => promisify(dependency.hooks.postlink || commandStub), + ], + () => linkAssets(config.platforms, config.project, assets), ); return promiseWaterfall(tasks).catch(err => { - logger.error( - `Something went wrong while linking. Error: ${err.message} \n` + - 'Please file an issue here: https://github.com/react-native-community/react-native-cli/issues', + throw new CLIError( + `Something went wrong while linking. Reason: ${err.message}`, + err, ); - throw err; }); } diff --git a/packages/cli/src/commands/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js index 7060ef4ca..462fbc676 100644 --- a/packages/cli/src/commands/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -1,7 +1,7 @@ // @flow import {isEmpty} from 'lodash'; -import type {PlatformsT, ProjectConfigT} from '../../tools/types.flow'; +import type {PlatformsT, ProjectConfigT} from '../../tools/config/types.flow'; import logger from '../../tools/logger'; diff --git a/packages/cli/src/commands/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js index e669aae29..23b2fbb04 100644 --- a/packages/cli/src/commands/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -1,26 +1,29 @@ // @flow import type { - PlatformsT, + DependencyConfigT, ProjectConfigT, - DependenciesConfig, -} from '../../tools/types.flow'; + PlatformsT, +} from '../../tools/config/types.flow'; import logger from '../../tools/logger'; import pollParams from './pollParams'; -import {getPlatformName} from '../../tools/getPlatforms'; +import getPlatformName from './getPlatformName'; const linkDependency = async ( platforms: PlatformsT, project: ProjectConfigT, - dependency: DependenciesConfig, + dependency: DependencyConfigT, ) => { const params = await pollParams(dependency.params); Object.keys(platforms || {}).forEach(platform => { - if (!project[platform] || !dependency.config[platform]) { + const projectConfig = project[platform]; + const dependencyConfig = dependency.platforms[platform]; + + if (!projectConfig || !dependencyConfig) { return; } - + const {name} = dependency; const linkConfig = platforms[platform] && platforms[platform].linkConfig && @@ -31,31 +34,21 @@ const linkDependency = async ( } const isInstalled = linkConfig.isInstalled( - project[platform], - dependency.name, - dependency.config[platform], + projectConfig, + name, + dependencyConfig, ); if (isInstalled) { logger.info( - `${getPlatformName(platform)} module "${ - dependency.name - }" is already linked`, + `${getPlatformName(platform)} module "${name}" is already linked`, ); return; } - logger.info( - `Linking "${dependency.name}" ${getPlatformName(platform)} dependency`, - ); + logger.info(`Linking "${name}" ${getPlatformName(platform)} dependency`); - linkConfig.register( - dependency.name, - dependency.config[platform] || {}, - params, - // $FlowFixMe: We check if project[platform] exists on line 42 - project[platform], - ); + linkConfig.register(name, dependencyConfig, params, projectConfig); logger.info( `${getPlatformName(platform)} module "${ diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 72f44e8c5..67ace63a1 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -7,16 +7,14 @@ * @flow */ -import {flatten, isEmpty, difference} from 'lodash'; +import {flatMap, values, difference} from 'lodash'; import type {ContextT} from '../../tools/types.flow'; +import dedent from 'dedent'; 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 '../../tools/getPlatforms'; +import getPlatformName from './getPlatformName'; const unlinkDependency = ( platforms, @@ -26,7 +24,9 @@ const unlinkDependency = ( otherDependencies, ) => { Object.keys(platforms || {}).forEach(platform => { - if (!project[platform] || !dependency.config[platform]) { + const projectConfig = project[platform]; + const dependencyConfig = dependency.platforms[platform]; + if (!projectConfig || !dependencyConfig) { return; } @@ -40,9 +40,9 @@ const unlinkDependency = ( } const isInstalled = linkConfig.isInstalled( - project[platform], + projectConfig, packageName, - dependency.config[platform], + dependencyConfig, ); if (!isInstalled) { @@ -58,10 +58,8 @@ const unlinkDependency = ( linkConfig.unregister( packageName, - // $FlowFixMe: We check for existence on line 38 - dependency.config[platform], - // $FlowFixMe: We check for existence on line 38 - project[platform], + dependencyConfig, + projectConfig, otherDependencies, ); @@ -82,76 +80,55 @@ const unlinkDependency = ( function unlink(args: Array, ctx: ContextT) { const packageName = args[0]; - let platforms; + const {[packageName]: dependency, ...otherDependencies} = ctx.dependencies; - try { - platforms = getPlatforms(ctx.root); - } catch (err) { - logger.error( - "No package.json found. Are you sure it's a React Native project?", - ); - return Promise.reject(err); - } - - const allDependencies = getProjectDependencies(ctx.root).map(dependency => - getDependencyConfig(ctx, platforms, dependency), - ); - let otherDependencies; - let dependency; - - try { - const idx = allDependencies.findIndex(p => p.name === packageName); - - if (idx === -1) { - throw new Error(`Project "${packageName}" is not a react-native library`); - } - - otherDependencies = [...allDependencies]; - dependency = otherDependencies.splice(idx, 1)[0]; - } catch (err) { - return Promise.reject(err); + if (!dependency) { + throw new Error(dedent` + Failed to unlink "${packageName}". It appears that the project is not linked yet. + `); } - const project = getProjectConfig(ctx, platforms); + const dependencies = values(otherDependencies); const tasks = [ - () => promisify(dependency.commands.preunlink || commandStub), + () => promisify(dependency.hooks.preulink || commandStub), () => unlinkDependency( - platforms, - project, + ctx.platforms, + ctx.project, dependency, packageName, - otherDependencies, + dependencies, ), - () => promisify(dependency.commands.postunlink || commandStub), + () => promisify(dependency.hooks.postunlink || commandStub), ]; return promiseWaterfall(tasks) .then(() => { - // @todo move all these to `tasks` array, just like in - // link + // @todo move all these to `tasks` array + // @todo it is possible we could be unlinking some project assets in case of duplicate const assets = difference( dependency.assets, - flatten(allDependencies, d => d.assets), + flatMap(dependencies, d => d.assets), ); - if (isEmpty(assets)) { + if (assets.length === 0) { return; } - Object.keys(platforms || {}).forEach(platform => { + Object.keys(ctx.platforms || {}).forEach(platform => { + const projectConfig = ctx.project[platform]; const linkConfig = - platforms[platform] && - platforms[platform].linkConfig && - platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.unlinkAssets || !project[platform]) { + ctx.platforms[platform] && + ctx.platforms[platform].linkConfig && + ctx.platforms[platform].linkConfig(); + if (!linkConfig || !linkConfig.unlinkAssets || !projectConfig) { return; } logger.info(`Unlinking assets from ${platform} project`); - // $FlowFixMe: We check for platorm existence on line 150 - linkConfig.unlinkAssets(assets, project[platform]); + + linkConfig.unlinkAssets(assets, projectConfig); }); logger.info( diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 5b550fdf2..4e91f187d 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -7,6 +7,7 @@ import stripAnsi from 'strip-ansi'; import upgrade from '../upgrade'; import {fetch} from '../../../tools/fetch'; import logger from '../../../tools/logger'; +import loadConfig from '../../../tools/config'; jest.mock('https'); jest.mock('fs'); @@ -52,17 +53,11 @@ jest.mock('../../../tools/logger', () => ({ const currentVersion = '0.57.8'; const newVersion = '0.58.4'; const olderVersion = '0.56.0'; -const ctx = { - root: '/project/root', - reactNativePath: '', - commands: [], - platforms: {}, - dependencies: {}, - haste: { - providesModuleNodeModules: [], - platforms: [], - }, -}; + +jest.mock('../../../tools/config'); + +const ctx = loadConfig(); + const opts = { legacy: false, }; diff --git a/packages/cli/src/tools/__tests__/findPlugins-test.js b/packages/cli/src/tools/__tests__/findPlugins-test.js deleted file mode 100644 index c1cee2079..000000000 --- a/packages/cli/src/tools/__tests__/findPlugins-test.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -import findPlugins from '../findPlugins'; - -const path = require('path'); - -const ROOT = path.join(__dirname, '..', '..'); -const pjsonPath = path.join(ROOT, './package.json'); - -describe('findPlugins', () => { - beforeEach(() => { - jest.resetModules(); - }); - - it('returns an array of dependencies', () => { - jest.doMock( - pjsonPath, - () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - }), - {virtual: true}, - ); - - expect(findPlugins(ROOT)).toHaveProperty('commands'); - expect(findPlugins(ROOT)).toHaveProperty('platforms'); - expect(findPlugins(ROOT).commands).toHaveLength(1); - expect(findPlugins(ROOT).commands[0]).toBe('rnpm-plugin-test'); - expect(findPlugins(ROOT).platforms).toHaveLength(0); - }); - - it('returns an empty array if there are no plugins in this folder', () => { - jest.doMock(pjsonPath, () => ({}), {virtual: true}); - expect(findPlugins(ROOT)).toHaveProperty('commands'); - expect(findPlugins(ROOT)).toHaveProperty('platforms'); - expect(findPlugins(ROOT).commands).toHaveLength(0); - expect(findPlugins(ROOT).platforms).toHaveLength(0); - }); - - it('returns an object with empty arrays if there is no package.json in the supplied folder', () => { - expect(findPlugins('fake-path')).toHaveProperty('commands'); - expect(findPlugins('fake-path')).toHaveProperty('platforms'); - expect(findPlugins('fake-path').commands).toHaveLength(0); - expect(findPlugins('fake-path').platforms).toHaveLength(0); - }); - - it('returns plugins from both dependencies and dev dependencies', () => { - jest.doMock( - pjsonPath, - () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - devDependencies: {'rnpm-plugin-test-2': '*'}, - }), - {virtual: true}, - ); - expect(findPlugins(ROOT)).toHaveProperty('commands'); - expect(findPlugins(ROOT)).toHaveProperty('platforms'); - expect(findPlugins(ROOT).commands).toHaveLength(2); - expect(findPlugins(ROOT).platforms).toHaveLength(0); - }); - - it('returns unique list of plugins', () => { - jest.doMock( - pjsonPath, - () => ({ - dependencies: {'rnpm-plugin-test': '*'}, - devDependencies: {'rnpm-plugin-test': '*'}, - }), - {virtual: true}, - ); - expect(findPlugins(ROOT).commands).toHaveLength(1); - }); - - it('returns plugins in scoped modules', () => { - jest.doMock( - pjsonPath, - () => ({ - dependencies: { - '@org/rnpm-plugin-test': '*', - '@org/react-native-test': '*', - '@react-native/test': '*', - '@react-native-org/test': '*', - }, - }), - {virtual: true}, - ); - - expect(findPlugins(ROOT)).toHaveProperty('commands'); - expect(findPlugins(ROOT)).toHaveProperty('platforms'); - expect(findPlugins(ROOT).commands[0]).toBe('@org/rnpm-plugin-test'); - }); -}); diff --git a/packages/cli/src/tools/assign.js b/packages/cli/src/tools/assign.js new file mode 100644 index 000000000..18f061712 --- /dev/null +++ b/packages/cli/src/tools/assign.js @@ -0,0 +1,25 @@ +/** + * Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + * + * Similar to Object.assign(), but it doesn't execute getters. This allows us to have + * lazy properties on an object and still be able to merge them together + * + * @flow + */ +export default function assign(target: Object, ...sources: Object[]) { + sources.forEach(source => { + let descriptors = Object.keys(source).reduce((acc, key) => { + acc[key] = Object.getOwnPropertyDescriptor(source, key); + return acc; + }, {}); + // by default, Object.assign copies enumerable Symbols too + Object.getOwnPropertySymbols(source).forEach(sym => { + let descriptor = Object.getOwnPropertyDescriptor(source, sym); + if (descriptor && descriptor.enumerable) { + descriptors[sym.toString()] = descriptor; + } + }); + Object.defineProperties(target, descriptors); + }); + return target; +} diff --git a/packages/cli/src/tools/config/__mocks__/index.js b/packages/cli/src/tools/config/__mocks__/index.js new file mode 100644 index 000000000..78f27628a --- /dev/null +++ b/packages/cli/src/tools/config/__mocks__/index.js @@ -0,0 +1,25 @@ +/** + * @flow + */ + +export default function mockedLoadConfig() { + return { + root: '/project/root', + reactNativePath: '', + commands: [], + platforms: { + ios: {projectConfig: () => null, dependencyConfig: () => null}, + android: {projectConfig: () => null, dependencyConfig: () => null}, + }, + project: { + ios: null, + android: null, + }, + dependencies: {}, + assets: [], + haste: { + providesModuleNodeModules: [], + platforms: [], + }, + }; +} diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap similarity index 78% rename from packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap rename to packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index aaa2e0cb7..3fc391a4b 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -1,12 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should deep merge project configuration with default values 1`] = ` +exports[`should merge project configuration with default values 1`] = ` Object { + "assets": Array [], "commands": Array [], "dependencies": Object { - "react-native-test": Object { + "react-native": Object { "assets": Array [], "hooks": Object {}, + "name": "react-native", + "params": Array [], + "platforms": Object { + "android": null, + "ios": null, + }, + }, + "react-native-test": Object { + "assets": Array [ + "foo", + ], + "hooks": Object {}, + "name": "react-native-test", "params": Array [], "platforms": Object { "android": null, @@ -26,13 +40,22 @@ Object { }, }, "haste": Object { - "platforms": Array [], - "providesModuleNodeModules": Array [], + "platforms": Array [ + "ios", + "android", + ], + "providesModuleNodeModules": Array [ + "react-native", + ], }, "platforms": Object { "android": Object {}, "ios": Object {}, }, + "project": Object { + "android": null, + "ios": null, + }, "reactNativePath": ".", "root": "<>", } @@ -40,16 +63,15 @@ Object { exports[`should have a valid structure by default 1`] = ` Object { + "assets": Array [], "commands": Array [], "dependencies": Object {}, "haste": Object { "platforms": Array [], "providesModuleNodeModules": Array [], }, - "platforms": Object { - "android": Object {}, - "ios": Object {}, - }, + "platforms": Object {}, + "project": Object {}, "reactNativePath": ".", "root": "<>", } @@ -66,8 +88,6 @@ Object { ], }, "platforms": Object { - "android": Object {}, - "ios": Object {}, "windows": Object {}, }, } @@ -84,6 +104,7 @@ exports[`should read \`rnpm\` config from a dependency and transform it to a new Object { "assets": Array [], "hooks": Object {}, + "name": "react-native-foo", "params": Array [], "platforms": Object { "android": null, @@ -107,6 +128,7 @@ exports[`should read a config of a dependency and use it to load other settings Object { "assets": Array [], "hooks": Object {}, + "name": "react-native-test", "params": Array [], "platforms": Object { "android": null, @@ -128,9 +150,20 @@ Object { exports[`should return dependencies from package.json 1`] = ` Object { + "react-native": Object { + "assets": Array [], + "hooks": Object {}, + "name": "react-native", + "params": Array [], + "platforms": Object { + "android": null, + "ios": null, + }, + }, "react-native-test": Object { "assets": Array [], "hooks": Object {}, + "name": "react-native-test", "params": Array [], "platforms": Object { "android": null, @@ -150,3 +183,15 @@ Object { }, } `; + +exports[`should automatically put "react-native" into haste config 1`] = ` +Object { + "platforms": Array [ + "ios", + "android", + ], + "providesModuleNodeModules": Array [ + "react-native", + ], +} +`; diff --git a/packages/cli/src/tools/__tests__/findAssets-test.js b/packages/cli/src/tools/config/__tests__/findAssets-test.js similarity index 90% rename from packages/cli/src/tools/__tests__/findAssets-test.js rename to packages/cli/src/tools/config/__tests__/findAssets-test.js index a912a846f..ed0358854 100644 --- a/packages/cli/src/tools/__tests__/findAssets-test.js +++ b/packages/cli/src/tools/config/__tests__/findAssets-test.js @@ -8,15 +8,14 @@ * @emails oncall+javascript_foundation */ -import dependencies from '../__fixtures__/dependencies'; +import dependencies from '../../__fixtures__/dependencies'; +import findAssets from '../findAssets'; jest.mock('path'); jest.mock('fs'); const fs = require('fs'); -const {findAssets} = require('../getAssets'); - describe('findAssets', () => { beforeEach(() => { fs.__setMockFilesystem({testDir: dependencies.withAssets}); diff --git a/packages/cli/src/tools/config/__tests__/findDependencies-test.js b/packages/cli/src/tools/config/__tests__/findDependencies-test.js new file mode 100644 index 000000000..92750a82e --- /dev/null +++ b/packages/cli/src/tools/config/__tests__/findDependencies-test.js @@ -0,0 +1,32 @@ +/** + * @flow + */ + +import findDependencies from '../findDependencies'; + +import { + cleanup, + writeFiles, + getTempDirectory, +} from '../../../../../../e2e/helpers'; + +beforeEach(() => { + cleanup(DIR); + jest.resetModules(); +}); + +afterEach(() => cleanup(DIR)); + +const DIR = getTempDirectory('find_dependencies_test'); + +test('returns plugins from both dependencies and dev dependencies', () => { + writeFiles(DIR, { + 'package.json': ` + { + "dependencies": {"rnpm-plugin-test": "*"}, + "devDependencies": {"rnpm-plugin-test-2": "*"} + } + `, + }); + expect(findDependencies(DIR)).toHaveLength(2); +}); diff --git a/packages/cli/src/tools/config/__tests__/index.js b/packages/cli/src/tools/config/__tests__/index-test.js similarity index 81% rename from packages/cli/src/tools/config/__tests__/index.js rename to packages/cli/src/tools/config/__tests__/index-test.js index be2173b51..c5ddc765a 100644 --- a/packages/cli/src/tools/config/__tests__/index.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -2,7 +2,7 @@ * @flow */ -import loadConfig from '../'; +import loadConfig from '..'; import { cleanup, @@ -39,11 +39,13 @@ test('should have a valid structure by default', () => { test('should return dependencies from package.json', () => { writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', 'node_modules/react-native-test/package.json': '{}', 'node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj': '', 'package.json': `{ "dependencies": { + "react-native": "0.0.1", "react-native-test": "0.0.1" }, "react-native": { @@ -57,6 +59,7 @@ test('should return dependencies from package.json', () => { test('should read a config of a dependency and use it to load other settings', () => { writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', 'node_modules/react-native-test/package.json': `{ "react-native": { "dependency": { @@ -70,6 +73,7 @@ test('should read a config of a dependency and use it to load other settings', ( }`, 'package.json': `{ "dependencies": { + "react-native": "0.0.1", "react-native-test": "0.0.1" }, "react-native": { @@ -83,13 +87,21 @@ test('should read a config of a dependency and use it to load other settings', ( ).toMatchSnapshot(); }); -test('should deep merge project configuration with default values', () => { +test('should merge project configuration with default values', () => { writeFiles(DIR, { - 'node_modules/react-native-test/package.json': '{}', + 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native-test/package.json': `{ + "react-native": { + "dependency": { + "assets": ["foo", "baz"] + } + } + }`, 'node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj': '', 'package.json': `{ "dependencies": { + "react-native": "0.0.1", "react-native-test": "0.0.1" }, "react-native": { @@ -100,7 +112,8 @@ test('should deep merge project configuration with default values', () => { "ios": { "sourceDir": "./abc" } - } + }, + "assets": ["foo"] } } } @@ -112,6 +125,7 @@ test('should deep merge project configuration with default values', () => { test('should read `rnpm` config from a dependency and transform it to a new format', () => { writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', 'node_modules/react-native-foo/package.json': `{ "name": "react-native-foo", "rnpm": { @@ -122,6 +136,7 @@ test('should read `rnpm` config from a dependency and transform it to a new form }`, 'package.json': `{ "dependencies": { + "react-native": "0.0.1", "react-native-foo": "0.0.1" }, "react-native": { @@ -195,3 +210,19 @@ test('should load an out-of-tree "windows" platform that ships with a dependency const {haste, platforms} = loadConfig(DIR); expect(removeString({haste, platforms}, DIR)).toMatchSnapshot(); }); + +test('should automatically put "react-native" into haste config', () => { + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'package.json': `{ + "dependencies": { + "react-native": "0.0.1" + }, + "react-native": { + "reactNativePath": "." + } + }`, + }); + const {haste} = loadConfig(DIR); + expect(haste).toMatchSnapshot(); +}); diff --git a/packages/cli/src/tools/__tests__/makeCommand-test.js b/packages/cli/src/tools/config/__tests__/makeHook-test.js similarity index 56% rename from packages/cli/src/tools/__tests__/makeCommand-test.js rename to packages/cli/src/tools/config/__tests__/makeHook-test.js index 6a058a1bb..d16953c4a 100644 --- a/packages/cli/src/tools/__tests__/makeCommand-test.js +++ b/packages/cli/src/tools/config/__tests__/makeHook-test.js @@ -1,12 +1,7 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation + * @flow */ +import makeHook from '../makeHook'; let spawnError = false; @@ -16,26 +11,24 @@ jest.setMock('child_process', { }), }); -const {makeCommand} = require('../getHooks'); - afterAll(() => { jest.restoreAllMocks(); }); -describe('makeCommand', () => { - const command = makeCommand('echo'); +describe('makeHook', () => { + const hook = makeHook('echo'); it('generates a function around shell command', () => { - expect(typeof command).toBe('function'); + expect(typeof hook).toBe('function'); }); it('throws an error if there is no callback provided', () => { - expect(command).toThrow(); + expect(hook).toThrow(); }); it('invokes a callback after command execution', () => { const spy = jest.fn(); - command(spy); + hook(spy); expect(spy.mock.calls).toHaveLength(1); }); @@ -43,7 +36,7 @@ describe('makeCommand', () => { spawnError = true; const cb = jest.fn(); expect(() => { - command(cb); + hook(cb); }).toThrow(); }); }); diff --git a/packages/cli/src/tools/getAssets.js b/packages/cli/src/tools/config/findAssets.js similarity index 61% rename from packages/cli/src/tools/getAssets.js rename to packages/cli/src/tools/config/findAssets.js index d0927ea61..9f35e5c0c 100644 --- a/packages/cli/src/tools/getAssets.js +++ b/packages/cli/src/tools/config/findAssets.js @@ -4,7 +4,6 @@ import glob from 'glob'; import path from 'path'; -import getPackageConfiguration from './getPackageConfiguration'; const findAssetsInFolder = folder => glob.sync(path.join(folder, '**'), {nodir: true}); @@ -15,7 +14,7 @@ const findAssetsInFolder = folder => * * It returns an array of absolute paths to files found. */ -export function findAssets(folder: string, assets?: string[]) { +export default function findAssets(folder: string, assets: string[]) { return (assets || []) .map(asset => path.join(folder, asset)) .reduce( @@ -24,11 +23,3 @@ export function findAssets(folder: string, assets?: string[]) { [], ); } - -/** - * Returns a project configuration in a given folder - */ -export default function getAssets(root: string) { - const config = getPackageConfiguration(root); - return findAssets(root, config.assets); -} diff --git a/packages/cli/src/tools/config/findDependencies.js b/packages/cli/src/tools/config/findDependencies.js index 7fda35955..c5f392964 100644 --- a/packages/cli/src/tools/config/findDependencies.js +++ b/packages/cli/src/tools/config/findDependencies.js @@ -3,24 +3,18 @@ */ import path from 'path'; - -const pluginRe = new RegExp( - [ - '^react-native-', - '^@(.*)/react-native-', - '^@react-native(.*)/(?!rnpm-plugin-)', - ].join('|'), -); +import fs from 'fs'; /** - * Returns an array of dependencies from project's package.json that - * are likely to be React Native packages (see regular expression above) + * Returns an array of dependencies from project's package.json */ export default function findDependencies(root: string): Array { let pjson; try { - pjson = require(path.join(root, 'package.json')); + pjson = JSON.parse( + fs.readFileSync(path.join(root, 'package.json'), 'UTF-8'), + ); } catch (e) { return []; } @@ -30,5 +24,5 @@ export default function findDependencies(root: string): Array { ...Object.keys(pjson.devDependencies || {}), ]; - return deps.filter(dependency => pluginRe.test(dependency)); + return deps; } diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 82636944f..101a1ca15 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -1,63 +1,88 @@ /** * @flow */ -import dedent from 'dedent'; import path from 'path'; -import merge from 'deepmerge'; +import deepmerge from 'deepmerge'; +import {mapValues} from 'lodash'; import findDependencies from './findDependencies'; +import resolveReactNativePath from './resolveReactNativePath'; +import findAssets from './findAssets'; +import makeHook from './makeHook'; import { - readProjectConfigFromDisk, + readConfigFromDisk, readDependencyConfigFromDisk, readLegacyDependencyConfigFromDisk, } from './readConfigFromDisk'; -import {type ProjectConfigT, type RawProjectConfigT} from './types.flow'; +import {type ConfigT} from './types.flow'; + +import assign from '../assign'; /** * Built-in platforms */ import * as ios from '../ios'; import * as android from '../android'; -import resolveReactNativePath from './resolveReactNativePath'; + +/** + * `deepmerge` concatenates arrays by default instead of overwriting them. + * We define custom merging function for arrays to change that behaviour + */ +const merge = (...objs: Object[]) => + deepmerge(...objs, { + arrayMerge: (destinationArray, sourceArray, options) => sourceArray, + }); /** * Loads CLI configuration */ -function loadConfig(projectRoot: string = process.cwd()): ProjectConfigT { - const inferredProjectConfig = findDependencies(projectRoot).reduce( - (acc: RawProjectConfigT, dependencyName) => { +function loadConfig(projectRoot: string = process.cwd()): ConfigT { + const userConfig = readConfigFromDisk(projectRoot); + + const finalConfig = findDependencies(projectRoot).reduce( + (acc: ConfigT, dependencyName) => { const root = path.join(projectRoot, 'node_modules', dependencyName); const config = readLegacyDependencyConfigFromDisk(root) || readDependencyConfigFromDisk(root); - return { - ...acc, - dependencies: { - ...acc.dependencies, - // $FlowIssue: Computed getters are not yet supported. + // @todo: Move this to React Native in the future + if (dependencyName === 'react-native') { + config.platforms = {ios, android}; + } + + const isPlatform = Object.keys(config.platforms).length > 0; + + return assign({}, acc, { + dependencies: assign({}, acc.dependencies, { + // $FlowExpectedError: Dynamic getters are not supported get [dependencyName]() { - return { - platforms: Object.keys(acc.platforms).reduce( - (dependency, platform) => { - dependency[platform] = acc.platforms[ - platform - ].dependencyConfig( - root, - config.dependency.platforms[platform], - ); - return dependency; - }, - {}, - ), - assets: config.dependency.assets, - hooks: config.dependency.hooks, - params: config.dependency.params, - }; + return merge( + { + name: dependencyName, + platforms: Object.keys(finalConfig.platforms).reduce( + (dependency, platform) => { + // Linking platforms is not supported + dependency[platform] = isPlatform + ? null + : finalConfig.platforms[platform].dependencyConfig( + root, + config.dependency.platforms[platform] || {}, + ); + return dependency; + }, + {}, + ), + assets: findAssets(root, config.dependency.assets), + hooks: mapValues(config.dependency.hooks, makeHook), + params: config.dependency.params, + }, + userConfig.dependencies[dependencyName] || {}, + ); }, - }, + }), commands: acc.commands.concat( config.commands.map(pathToCommand => path.join(dependencyName, pathToCommand), @@ -69,50 +94,43 @@ function loadConfig(projectRoot: string = process.cwd()): ProjectConfigT { }, haste: { providesModuleNodeModules: acc.haste.providesModuleNodeModules.concat( - Object.keys(config.platforms).length > 0 ? dependencyName : [], + isPlatform ? dependencyName : [], ), platforms: [...acc.haste.platforms, ...Object.keys(config.platforms)], }, - }; + }); }, ({ root: projectRoot, - reactNativePath: resolveReactNativePath(projectRoot), + get reactNativePath() { + return ( + userConfig.reactNativePath || resolveReactNativePath(projectRoot) + ); + }, dependencies: {}, - commands: [], - platforms: { - ios, - android, + commands: userConfig.commands, + get assets() { + return findAssets(projectRoot, userConfig.assets); }, + platforms: {}, haste: { providesModuleNodeModules: [], platforms: [], }, - }: RawProjectConfigT), - ); - - const config: RawProjectConfigT = merge( - inferredProjectConfig, - readProjectConfigFromDisk(projectRoot), - ); - - if (config.reactNativePath === null && !process.argv.includes('init')) { - throw new Error(dedent` - Unable to find React Native files. Make sure "react-native" module is installed - in your project dependencies. - - If you are using React Native from a non-standard location, consider setting: - { - "react-native": { - "reactNativePath": "./path/to/react-native" + get project() { + const project = {}; + for (const platform in finalConfig.platforms) { + project[platform] = finalConfig.platforms[platform].projectConfig( + projectRoot, + userConfig.project[platform] || {}, + ); } - } - in your \`package.json\`. - `); - } + return project; + }, + }: ConfigT), + ); - // $FlowIssue: `reactNativePath: null` is never null at this point - return config; + return finalConfig; } export default loadConfig; diff --git a/packages/cli/src/tools/getHooks.js b/packages/cli/src/tools/config/makeHook.js similarity index 60% rename from packages/cli/src/tools/getHooks.js rename to packages/cli/src/tools/config/makeHook.js index aac342808..2eaad64db 100644 --- a/packages/cli/src/tools/getHooks.js +++ b/packages/cli/src/tools/config/makeHook.js @@ -3,9 +3,8 @@ */ import {spawn} from 'child_process'; -import getPackageConfiguration from './getPackageConfiguration'; -export function makeCommand(command: string) { +export default function makeCommand(command: string) { return (cb: Function) => { if (!cb) { throw new Error( @@ -30,15 +29,3 @@ export function makeCommand(command: string) { }); }; } - -export default function getHooks(root: string) { - const commands = getPackageConfiguration(root).commands || {}; - - const acc = {}; - - Object.keys(commands).forEach(command => { - acc[command] = makeCommand(commands[command]); - }); - - return acc; -} diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 11ebc7915..90aad6cf5 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -7,7 +7,7 @@ import Joi from 'joi'; import cosmiconfig from 'cosmiconfig'; import path from 'path'; -import {type DependencyConfigT, type ProjectConfigT} from './types.flow'; +import {type UserDependencyConfigT, type UserConfigT} from './types.flow'; import {JoiError} from '../errors'; @@ -23,7 +23,7 @@ const searchPlaces = ['react-native.config.js', 'package.json']; * Reads a project configuration as defined by the user in the current * workspace. */ -export function readProjectConfigFromDisk(rootFolder: string): ProjectConfigT { +export function readConfigFromDisk(rootFolder: string): UserConfigT { const explorer = cosmiconfig('react-native', {searchPlaces}); const {config} = explorer.searchSync(rootFolder) || {config: undefined}; @@ -43,7 +43,7 @@ export function readProjectConfigFromDisk(rootFolder: string): ProjectConfigT { */ export function readDependencyConfigFromDisk( rootFolder: string, -): DependencyConfigT { +): UserDependencyConfigT { const explorer = cosmiconfig('react-native', { stopDir: rootFolder, searchPlaces, @@ -65,7 +65,7 @@ export function readDependencyConfigFromDisk( */ export function readLegacyDependencyConfigFromDisk( rootFolder: string, -): ?DependencyConfigT { +): ?UserDependencyConfigT { const {rnpm: config, name} = require(path.join(rootFolder, 'package.json')); if (!config) { diff --git a/packages/cli/src/tools/config/resolveReactNativePath.js b/packages/cli/src/tools/config/resolveReactNativePath.js index 422a10249..bf1facd66 100644 --- a/packages/cli/src/tools/config/resolveReactNativePath.js +++ b/packages/cli/src/tools/config/resolveReactNativePath.js @@ -2,6 +2,7 @@ * @flow */ import path from 'path'; +import dedent from 'dedent'; /** * Finds path to React Native inside `node_modules` or throws @@ -16,6 +17,17 @@ export default function resolveReactNativePath(root: string) { }), ); } catch (_ignored) { - return null; + throw new Error(dedent` + Unable to find React Native files. Make sure "react-native" module is installed + in your project dependencies. + + If you are using React Native from a non-standard location, consider setting: + { + "react-native": { + "reactNativePath": "./path/to/react-native" + } + } + in your \`package.json\`. + `); } } diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 93f058cb9..067395c52 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -10,7 +10,7 @@ const map = (key, value) => .pattern(key, value); /** - * Schema for DependencyConfigT + * Schema for UserDependencyConfigT */ export const dependencyConfig = t .object({ @@ -39,7 +39,7 @@ export const dependencyConfig = t .array() .items(t.string()) .default([]), - hooks: map(t.string(), t.string()).default(), + hooks: map(t.string(), t.string()).default({}), params: t .array() .items( @@ -110,13 +110,39 @@ export const projectConfig = t ), }) .allow(null), - ), - commands: t.array().items(t.string()), - haste: t.object({ - providesModuleNodeModules: t.array().items(t.string()), - platforms: t.array().items(t.string()), - }), + ).default({}), reactNativePath: t.string(), - root: t.string(), + project: map(t.string(), t.any()) + .keys({ + ios: t + .object({ + project: t.string(), + sharedLibraries: t.array().items(t.string()), + libraryFolder: t.string(), + }) + .default({}), + android: t + .object({ + sourceDir: t.string(), + manifestPath: t.string(), + packageName: t.string(), + packageFolder: t.string(), + mainFilePath: t.string(), + stringsPath: t.string(), + settingsGradlePath: t.string(), + assetsPath: t.string(), + buildGradlePath: t.string(), + }) + .default({}), + }) + .default(), + assets: t + .array() + .items(t.string()) + .default([]), + commands: t + .array() + .items(t.string()) + .default([]), }) - .default({}); + .default(); diff --git a/packages/cli/src/tools/config/types.flow.js b/packages/cli/src/tools/config/types.flow.js index 01901b934..9e038d86b 100644 --- a/packages/cli/src/tools/config/types.flow.js +++ b/packages/cli/src/tools/config/types.flow.js @@ -2,75 +2,193 @@ * @flow */ -import type { - AndroidConfigParamsT, - IOSConfigParamsT, - InquirerPromptT, - DependencyConfigAndroidT, - DependencyConfigIOST, -} from '../types.flow'; +/** + * Opaque type that describes the Inquirer question format. Not typed, since we just + * pass it directly to Inquirer. Validation is done with Joi in `schema.js` + */ +type InquirerPromptT = any; /** - * A map of hooks to run pre/post some of the CLI actions + * Settings that a library author can define in the configuration bundled with + * dependency for Android + * + * See UserDependencyConfigT for details */ -type HooksT = { - [key: string]: string, - prelink?: string, - postlink?: string, +type DependencyParamsAndroidT = { + sourceDir?: string, + manifestPath?: string, + packageImportPath?: string, + packageInstance?: string, }; /** - * A map with additional platforms that ship with a dependency. + * Settings that user can define in the project configuration for Android + * + * See UserConfigT for details */ -export type PlatformsT = { - [key: string]: { - dependencyConfig?: Function, - projectConfig?: Function, - linkConfig?: Function, - }, +type ProjectParamsAndroidT = { + sourceDir?: string, + manifestPath?: string, + packageName?: string, + packageFolder?: string, + mainFilePath?: string, + stringsPath?: string, + settingsGradlePath?: string, + assetsPath?: string, + buildGradlePath?: string, }; -export type DependencyConfigT = { - dependency: { - platforms: { - android?: AndroidConfigParamsT, - ios?: IOSConfigParamsT, - [key: string]: any, - }, - assets: string[], - hooks: HooksT, - params: InquirerPromptT[], +/** + * Settings that user can define in the project configuration for iOS. + * Same for dependency - we share the type. + * + * See UserDependencyConfigT and UserConfigT for details + */ +type ProjectParamsIOST = { + project?: string, + sharedLibraries?: string[], + libraryFolder?: string, +}; + +type PlatformConfig = { + projectConfig: (string, ProjectParams) => ?ProjectConfig, + dependencyConfig: (string, ProjectParams) => ?DependencyConfig, + linkConfig: () => { + isInstalled: (ProjectConfig, string, DependencyConfig) => boolean, + register: (string, DependencyConfig, Object, ProjectConfig) => void, + unregister: ( + string, + DependencyConfig, + ProjectConfig, + Array, + ) => void, + copyAssets: (string[], ProjectConfig) => void, + unlinkAssets: (string[], ProjectConfig) => void, }, - commands: string[], - platforms: PlatformsT, }; -type _ProjectConfigT = { +/** + * Final configuration object + */ +export type ConfigT = {| + // Root where the configuration has been resolved from root: string, + + // Path to React Native source + reactNativePath: string, + + // Object that contains configuration for a project (null, when platform not available) + project: { + android?: ?ProjectConfigAndroidT, + ios?: ?ProjectConfigIOST, + [key: string]: ?Object, + }, + + // An array of assets as defined by the user + assets: string[], + + // Map of the dependencies that are present in the project dependencies: { [key: string]: { + name: string, platforms: { - android: DependencyConfigAndroidT | null, - ios: DependencyConfigIOST | null, + android?: DependencyConfigAndroidT | null, + ios?: DependencyConfigIOST | null, [key: string]: any, }, assets: string[], - hooks: HooksT, + hooks: { + [key: string]: string, + prelink?: string, + postlink?: string, + }, params: InquirerPromptT[], }, }, - platforms: PlatformsT, + + // Map of available platforms (built-ins and dynamically loaded) + platforms: { + [name: string]: PlatformConfig, + ios?: PlatformConfig< + ProjectParamsIOST, + ProjectConfigIOST, + DependencyConfigIOST, + >, + android?: PlatformConfig< + ProjectParamsAndroidT, + ProjectConfigAndroidT, + DependencyConfigAndroidT, + >, + }, + + // An array of commands that are present in 3rd party packages commands: string[], + + // Haste configuration resolved based on available plugins haste: { platforms: Array, providesModuleNodeModules: Array, }, -}; +|}; + +/** + * Aliases + */ +export type DependencyConfigT = $PropertyType< + $PropertyType, + '[key: string]', +>; +export type HooksT = $PropertyType; +export type ProjectConfigT = $PropertyType; +export type PlatformsT = $PropertyType; + +/** + * Config defined by a developer for a library + */ +export type UserDependencyConfigT = { + // Additional dependency settings + dependency: { + platforms: { + android: DependencyParamsAndroidT, + ios: ProjectParamsIOST, + [key: string]: any, + }, + assets: string[], + hooks: HooksT, + params: InquirerPromptT[], + }, -export type RawProjectConfigT = _ProjectConfigT & { - reactNativePath: string | null, + // An array of commands that ship with the dependency + commands: string[], + + // An array of extra platforms to load + platforms: { + [name: string]: any, + }, }; -export type ProjectConfigT = _ProjectConfigT & { - reactNativePath: string, +/** + * Config defined by a developer for the project + */ +export type UserConfigT = { + /** + * Shares some structure with ConfigT, except that haste, root, platforms + * are calculated and can't be defined + */ + ...$Diff, + reactNativePath: ?string, + + // Additional project settings + project: { + android?: ProjectParamsAndroidT, + ios?: ProjectParamsIOST, + [key: string]: any, + }, }; + +// The following types are used in untyped-parts of the codebase, so I am leaving them +// until we actually need them. +type ProjectConfigIOST = {}; +type DependencyConfigIOST = ProjectConfigIOST; +type ProjectConfigAndroidT = {}; +type DependencyConfigAndroidT = {}; diff --git a/packages/cli/src/tools/errors.js b/packages/cli/src/tools/errors.js index 82bd9090c..6c2dfb159 100644 --- a/packages/cli/src/tools/errors.js +++ b/packages/cli/src/tools/errors.js @@ -4,6 +4,27 @@ import chalk from 'chalk'; import dedent from 'dedent'; +/** + * CLIError + * + * Features: + * - uses original stack trace when error object is passed + * - makes an inline string to match current styling inside CLI + */ +export class CLIError extends Error { + constructor(msg: string, error?: Error) { + super(msg.replace(/(\r\n|\n|\r)/gm, ' ')); + if (error) { + this.stack = error.stack + .split('\n') + .slice(0, 2) + .join('\n'); + } else { + Error.captureStackTrace(this, CLIError); + } + } +} + export class ProcessError extends Error { constructor(msg: string, processError: string) { super(`${chalk.red(msg)}\n\n${chalk.gray(processError)}`); @@ -11,39 +32,48 @@ export class ProcessError extends Error { } } +type JoiErrorDetails = { + message: string, + path: string[], + type: K, + context: T, +}; + type JoiErrorT = { - details: Array<{ - message: string, - path: string[], - type: string, - context: { - key: string, - label: string, - value: Object, - }, - }>, + details: Array< + JoiErrorDetails< + 'object.allowUnknown' | 'object.base' | 'string.base', + { + key: string, + label: string, + value: Object, + }, + >, + >, }; -export class JoiError extends Error { +export class JoiError extends CLIError { constructor(joiError: JoiErrorT) { super( joiError.details .map(error => { const name = error.path.join('.'); - const value = JSON.stringify(error.context.value); switch (error.type) { - case 'object.allowUnknown': + case 'object.allowUnknown': { + const value = JSON.stringify(error.context.value); return dedent` Unknown option ${name} with value "${value}" was found. This is either a typing error or a user mistake. Fixing it will remove this message. `; + } case 'object.base': - case 'string.base': + case 'string.base': { const expectedType = error.type.replace('.base', ''); const actualType = typeof error.context.value; return dedent` Option ${name} must be a ${expectedType}, instead got ${actualType} `; + } default: return error.message; } diff --git a/packages/cli/src/tools/findPlugins.js b/packages/cli/src/tools/findPlugins.js deleted file mode 100644 index 3ae92775c..000000000 --- a/packages/cli/src/tools/findPlugins.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ - -import path from 'path'; -import {union, uniq, flatten} from 'lodash'; - -const RNPM_PLUGIN_PATTERNS = [/^rnpm-plugin-/, /^@(.*)\/rnpm-plugin-/]; - -const REACT_NATIVE_PLUGIN_PATTERNS = [ - /^react-native-/, - /^@(.*)\/react-native-/, - /^@react-native(.*)\/(?!rnpm-plugin-)/, -]; - -/** - * Filter dependencies by name pattern - * @param {String} dependency Name of the dependency - * @return {Boolean} If dependency is a rnpm plugin - */ -const isRNPMPlugin = dependency => - RNPM_PLUGIN_PATTERNS.some(pattern => pattern.test(dependency)); -const isReactNativePlugin = dependency => - REACT_NATIVE_PLUGIN_PATTERNS.some(pattern => pattern.test(dependency)); - -const readPackage = folder => { - try { - return require(path.join(folder, 'package.json')); - } catch (e) { - return null; - } -}; - -const findPluginsInReactNativePackage = pjson => { - if (!pjson.rnpm || !pjson.rnpm.plugin) { - return []; - } - - return path.join(pjson.name, pjson.rnpm.plugin); -}; - -const findPlatformsInPackage = pjson => { - if (!pjson.rnpm || !pjson.rnpm.platform) { - return []; - } - - return path.join(pjson.name, pjson.rnpm.platform); -}; - -const getEmptyPluginConfig = () => ({ - commands: [], - platforms: [], - haste: { - platforms: [], - providesModuleNodeModules: [], - }, -}); - -const findHasteConfigInPackageAndConcat = (pjson, haste) => { - if (!pjson.rnpm || !pjson.rnpm.haste) { - return; - } - const pkgHaste = pjson.rnpm.haste; - - if (pkgHaste.platforms) { - haste.platforms = haste.platforms.concat(pkgHaste.platforms); - } - - if (pkgHaste.providesModuleNodeModules) { - haste.providesModuleNodeModules = haste.providesModuleNodeModules.concat( - pkgHaste.providesModuleNodeModules, - ); - } -}; - -const findPluginsInFolder = folder => { - const pjson = readPackage(folder); - - if (!pjson) { - return getEmptyPluginConfig(); - } - - const deps = union( - Object.keys(pjson.dependencies || {}), - Object.keys(pjson.devDependencies || {}), - ); - - return deps.reduce((acc, pkg) => { - let {commands, platforms} = acc; - if (isRNPMPlugin(pkg)) { - commands = commands.concat(pkg); - } - if (isReactNativePlugin(pkg)) { - const pkgJson = readPackage(path.join(folder, 'node_modules', pkg)); - if (pkgJson) { - commands = commands.concat(findPluginsInReactNativePackage(pkgJson)); - platforms = platforms.concat(findPlatformsInPackage(pkgJson)); - findHasteConfigInPackageAndConcat(pkgJson, acc.haste); - } - } - return {commands, platforms, haste: acc.haste}; - }, getEmptyPluginConfig()); -}; - -/** - * Find plugins in package.json of the given folder - * @param {String} folder Path to the folder to get the package.json from - */ -export default function findPlugins(folder: string) { - const plugin = findPluginsInFolder(folder); - return { - commands: uniq(flatten(plugin.commands)), - platforms: uniq(flatten(plugin.platforms)), - haste: { - platforms: uniq(flatten(plugin.haste.platforms)), - providesModuleNodeModules: uniq( - flatten(plugin.haste.providesModuleNodeModules), - ), - }, - }; -} diff --git a/packages/cli/src/tools/getPackageConfiguration.js b/packages/cli/src/tools/getPackageConfiguration.js deleted file mode 100644 index b1ce140e5..000000000 --- a/packages/cli/src/tools/getPackageConfiguration.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @flow - */ -import path from 'path'; -import type {PackageConfigurationT} from './types.flow'; - -/** - * Returns configuration of the CLI from `package.json`. - */ -export default function getPackageConfiguration( - folder: string, -): PackageConfigurationT { - return require(path.join(folder, './package.json')).rnpm || {}; -} diff --git a/packages/cli/src/tools/getParams.js b/packages/cli/src/tools/getParams.js deleted file mode 100644 index d8a528b60..000000000 --- a/packages/cli/src/tools/getParams.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @flow - */ - -import getPackageConfiguration from './getPackageConfiguration'; - -export default function getParams(root: string) { - const config = getPackageConfiguration(root); - return config.params || []; -} diff --git a/packages/cli/src/tools/getPlatforms.js b/packages/cli/src/tools/getPlatforms.js deleted file mode 100644 index 2aefde45d..000000000 --- a/packages/cli/src/tools/getPlatforms.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @flow - */ - -import path from 'path'; -import type {PlatformsT} from './types.flow'; - -import findPlugins from './findPlugins'; - -/** - * Support for `ios` and `android` platforms is built-in - * - * @todo(grabbou): Move this out of the core to increase "interoperability" - * with other platforms - */ -const builtInPlatforms = { - ios: require('./ios'), - android: require('./android'), -}; - -/** - * Returns an object with available platforms - */ -export default function getPlatforms(root: string): PlatformsT { - const plugins = findPlugins(root); - - /** - * Each `platfom` is a file that should define an object with platforms available - * and the config required. - * - * @todo(grabbou): We should validate if the config loaded is correct, warn and skip - * using it if it's invalid. - */ - const projectPlatforms = plugins.platforms.reduce( - (acc, pathToPlatform) => - Object.assign( - acc, - require(path.join(root, 'node_modules', pathToPlatform)), - ), - {}, - ); - - return { - ...builtInPlatforms, - ...projectPlatforms, - }; -} - -const names = { - ios: 'iOS', - android: 'Android', -}; - -export function getPlatformName(name: string) { - return names[name] || name; -} diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 608b73c48..8a380f0d9 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -35,11 +35,8 @@ export const getDefaultConfig = (ctx: ContextT) => { resolver: { resolverMainFields: ['react-native', 'browser', 'main'], blacklistRE: getBlacklistRE(), - platforms: ['ios', 'android', 'native', ...ctx.haste.platforms], - providesModuleNodeModules: [ - 'react-native', - ...ctx.haste.providesModuleNodeModules, - ], + platforms: [...ctx.haste.platforms, 'native'], + providesModuleNodeModules: ctx.haste.providesModuleNodeModules, hasteImplModulePath: path.join(ctx.reactNativePath, 'jest/hasteImpl'), }, serializer: { diff --git a/packages/cli/src/tools/types.flow.js b/packages/cli/src/tools/types.flow.js index 32682a3e2..5926e655c 100644 --- a/packages/cli/src/tools/types.flow.js +++ b/packages/cli/src/tools/types.flow.js @@ -2,7 +2,7 @@ * @flow */ -import {type ProjectConfigT as ConfigT} from './config/types.flow'; +import {type ConfigT} from './config/types.flow'; export type ContextT = ConfigT; @@ -40,117 +40,3 @@ export type ProjectCommandT = LocalCommandT & { * Main type. Can be either local or a project command. */ export type CommandT = LocalCommandT | ProjectCommandT; - -/** - * Config of a single platform - */ -export type PlatformConfigT = { - projectConfig: (string, ParamsT) => ?ProjectConfigT, - dependencyConfig: (string, ParamsT) => ?DependencyConfigT, - /** - * @todo(grabbou): This should not be part of the "core". It should be - * specific to `link` and `unlink`. Remove it from here soon. - */ - linkConfig: () => { - /** - * @todo(grabbou): Revert the arguments order to align with the rest - */ - isInstalled: (ProjectConfigT, string, DependencyConfigT) => boolean, - register: (string, DependencyConfigT, Object, ProjectConfigT) => void, - unregister: ( - string, - DependencyConfigT, - ProjectConfigT, - Array, - ) => void, - copyAssets: (string[], ProjectConfigT) => void, - unlinkAssets: (string[], ProjectConfigT) => void, - }, -}; - -export type AndroidConfigParamsT = { - sourceDir?: string, - manifestPath?: string, - packageImportPath?: string, - packageInstance?: string, -}; - -export type IOSConfigParamsT = { - project?: string, - sharedLibraries?: string[], - libraryFolder?: string, -}; - -export type ProjectConfigIOST = {}; - -export type DependencyConfigIOST = ProjectConfigIOST; - -export type ProjectConfigAndroidT = {}; - -export type DependencyConfigAndroidT = {}; - -/** - * Config of a project. - * - * When one of the projects is `null`, that means given platform - * is not available in the current project. - */ -export type ProjectConfigT = { - android: ?ProjectConfigAndroidT, - ios: ?ProjectConfigIOST, -}; - -/** - * Config of a dependency. Just like above, when one of the values is `null`, - * given platform is not available. - */ -export type DependencyConfigT = { - android: ?DependencyConfigAndroidT, - ios: ?DependencyConfigIOST, -}; - -export type DependenciesConfig = { - config: DependencyConfigT, - name: string, - path: string, - assets: string[], - commands: {[name: string]: string}, - params: InquirerPromptT[], -}; - -/** - * Available platforms. Additional plugins should assert the type on their own. - */ -export type PlatformsT = { - ios: PlatformConfigT< - ProjectConfigIOST, - DependencyConfigIOST, - IOSConfigParamsT, - >, - android: PlatformConfigT< - ProjectConfigAndroidT, - DependencyConfigAndroidT, - AndroidConfigParamsT, - >, - [name: string]: PlatformConfigT, -}; - -export type InquirerPromptT = any; - -/** - * Configuration of the CLI as set by a package in the package.json - */ -export type PackageConfigurationT = { - assets?: string[], - commands?: {[name: string]: string}, - params?: InquirerPromptT[], - android: AndroidConfigParamsT, - ios: IOSConfigParamsT, - - plugin?: string | Array, - platform?: string, - haste?: { - platforms?: Array, - providesModuleNodeModules?: Array, - }, -}; From 323b9a2f40692c0e3cc0a9a0cda9685fd249fab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 4 Apr 2019 17:47:21 +0200 Subject: [PATCH 055/234] chore: add better error handling for failing e2e tests (#289) --- e2e/__tests__/uninstall.test.js | 4 ++-- e2e/helpers.js | 35 +++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/e2e/__tests__/uninstall.test.js b/e2e/__tests__/uninstall.test.js index 1b9053e49..d8615d9e2 100644 --- a/e2e/__tests__/uninstall.test.js +++ b/e2e/__tests__/uninstall.test.js @@ -24,7 +24,7 @@ test('uninstall fails when package is not defined', () => { "dependencies": {} }`, }); - const {stderr, code} = run(DIR, ['uninstall']); + const {stderr, code} = run(DIR, ['uninstall'], {expectedFailure: true}); expect(stderr).toContain('missing required argument'); expect(code).toBe(1); @@ -36,7 +36,7 @@ test('uninstall fails when package is not installed', () => { "dependencies": {} }`, }); - const {stderr, code} = run(DIR, ['uninstall', pkg]); + const {stderr, code} = run(DIR, ['uninstall', pkg], {expectedFailure: true}); expect(stderr).toContain(`Failed to unlink "${pkg}".`); expect(code).toBe(1); diff --git a/e2e/helpers.js b/e2e/helpers.js index da4dca334..e9b8ce6ec 100644 --- a/e2e/helpers.js +++ b/e2e/helpers.js @@ -5,6 +5,7 @@ import path from 'path'; import {createDirectory} from 'jest-util'; import rimraf from 'rimraf'; import execa from 'execa'; +import chalk from 'chalk'; import {Writable} from 'readable-stream'; const CLI_PATH = path.resolve(__dirname, '../packages/cli/build/bin.js'); @@ -13,12 +14,15 @@ type RunOptions = { nodeOptions?: string, nodePath?: string, timeout?: number, // kill the process after X milliseconds + expectedFailure?: boolean, }; export function run( dir: string, args?: Array, - options: RunOptions = {}, + options: RunOptions = { + expectedFailure: false, + }, ) { return spawnCli(dir, args, options); } @@ -28,7 +32,9 @@ export async function runUntil( dir: string, args: Array | void, text: string, - options: RunOptions = {}, + options: RunOptions = { + expectedFailure: false, + }, ) { const spawnPromise = spawnCliAsync(dir, args, {timeout: 30000, ...options}); @@ -109,7 +115,11 @@ export const getTempDirectory = (name: string) => function spawnCli(dir: string, args?: Array, options: RunOptions = {}) { const {spawnArgs, spawnOptions} = getCliArguments({dir, args, options}); - return execa.sync(process.execPath, spawnArgs, spawnOptions); + const result = execa.sync(process.execPath, spawnArgs, spawnOptions); + + handleTestCliFailure(options, result, dir, args); + + return result; } function spawnCliAsync( @@ -119,7 +129,12 @@ function spawnCliAsync( ) { const {spawnArgs, spawnOptions} = getCliArguments({dir, args, options}); - return execa(process.execPath, spawnArgs, spawnOptions); + try { + return execa(process.execPath, spawnArgs, spawnOptions); + } catch (result) { + handleTestCliFailure(options, result, dir, args); + return result; + } } function getCliArguments({dir, args, options}) { @@ -147,3 +162,15 @@ function getCliArguments({dir, args, options}) { }; return {spawnArgs, spawnOptions}; } + +function handleTestCliFailure(options, result, dir, args) { + if (!options.expectedFailure && result.code !== 0) { + console.log(`Running CLI failed for unexpected reason. Here's more info: + +${chalk.bold('dir:')} ${dir} +${chalk.bold('args:')} ${(args || []).join(' ')} +${chalk.bold('stderr:')} ${result.stderr} +${chalk.bold('stdout:')} ${result.stdout} +${chalk.bold('code:')} ${result.code}`); + } +} From 0d8f2e4182ff3f4f57a0e5f8c61ad604306f30ec Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Fri, 5 Apr 2019 20:37:23 +0200 Subject: [PATCH 056/234] feat: add React logo and spinners to make `init` UI nicer (#292) * Implement spinners for initializing flow * Use execa module * Change banner * Ignore silent flag when in verbose mode * Refactor packageManager test * Change loader exports * Fix e2e test * Rename packageManager * Add e2e test * smaller paddings for React logo * Cleanup tests * fix flowfixme * add space for post install script * rename packageManager.test as well --- e2e/__tests__/init.test.js | 2 +- packages/cli/package.json | 1 + packages/cli/src/cliEntry.js | 2 +- .../commands/init/__tests__/template.test.js | 18 +-- packages/cli/src/commands/init/banner.js | 43 +++++++ packages/cli/src/commands/init/init.js | 107 +++++++++++++----- packages/cli/src/commands/init/initCompat.js | 16 +-- packages/cli/src/commands/init/template.js | 12 +- packages/cli/src/commands/install/install.js | 4 +- .../cli/src/commands/install/uninstall.js | 4 +- .../upgrade/__tests__/upgrade.test.js | 2 +- packages/cli/src/commands/upgrade/upgrade.js | 4 +- ...Manager-test.js => packageManager-test.js} | 75 +++++++----- packages/cli/src/tools/generator/templates.js | 29 +++-- packages/cli/src/tools/loader.js | 15 +++ packages/cli/src/tools/logger.js | 3 + .../{PackageManager.js => packageManager.js} | 32 ++++-- yarn.lock | 38 ++++++- 18 files changed, 297 insertions(+), 110 deletions(-) create mode 100644 packages/cli/src/commands/init/banner.js rename packages/cli/src/tools/__tests__/{PackageManager-test.js => packageManager-test.js} (54%) create mode 100644 packages/cli/src/tools/loader.js rename packages/cli/src/tools/{PackageManager.js => packageManager.js} (54%) diff --git a/e2e/__tests__/init.test.js b/e2e/__tests__/init.test.js index 08cd0f780..d8760d17b 100644 --- a/e2e/__tests__/init.test.js +++ b/e2e/__tests__/init.test.js @@ -50,7 +50,7 @@ test('init --template', () => { 'TestInit', ]); - expect(stdout).toContain('Initializing new project from external template'); + expect(stdout).toContain('Welcome to React Native!'); expect(stdout).toContain('Run instructions'); // make sure we don't leave garbage diff --git a/packages/cli/package.json b/packages/cli/package.json index e1a7fcfdf..4a7684e49 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -48,6 +48,7 @@ "node-fetch": "^2.2.0", "node-notifier": "^5.2.1", "opn": "^3.0.2", + "ora": "^3.4.0", "plist": "^3.0.0", "semver": "^5.0.3", "serve-static": "^1.13.1", diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index fded0f87f..af2827b28 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -18,7 +18,7 @@ import {getCommands} from './commands'; import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import logger from './tools/logger'; -import {setProjectDir} from './tools/PackageManager'; +import {setProjectDir} from './tools/packageManager'; import pkgJson from '../package.json'; import loadConfig from './tools/config'; diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js index 657a2ca1f..829dcd2f6 100644 --- a/packages/cli/src/commands/init/__tests__/template.test.js +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -1,7 +1,8 @@ // @flow +jest.mock('execa', () => jest.fn()); +import execa from 'execa'; import path from 'path'; -import ChildProcess from 'child_process'; -import * as PackageManger from '../../../tools/PackageManager'; +import * as PackageManger from '../../../tools/packageManager'; import { installTemplatePackage, getTemplateConfig, @@ -14,15 +15,17 @@ const TEMPLATE_NAME = 'templateName'; afterEach(() => { jest.restoreAllMocks(); + jest.clearAllMocks(); }); -test('installTemplatePackage', () => { +test('installTemplatePackage', async () => { jest.spyOn(PackageManger, 'install').mockImplementationOnce(() => {}); - installTemplatePackage(TEMPLATE_NAME, true); + await installTemplatePackage(TEMPLATE_NAME, true); expect(PackageManger.install).toHaveBeenCalledWith([TEMPLATE_NAME], { preferYarn: false, + silent: true, }); }); @@ -68,21 +71,20 @@ test('copyTemplate', () => { expect(copyFiles.default).toHaveBeenCalledWith(expect.any(String), CWD); }); -test('executePostInitScript', () => { +test('executePostInitScript', async () => { const RESOLVED_PATH = '/some/path/script.js'; const SCRIPT_PATH = './script.js'; jest.spyOn(path, 'resolve').mockImplementationOnce(() => RESOLVED_PATH); - jest.spyOn(ChildProcess, 'execFileSync').mockImplementationOnce(() => {}); - executePostInitScript(TEMPLATE_NAME, SCRIPT_PATH); + await executePostInitScript(TEMPLATE_NAME, SCRIPT_PATH); expect(path.resolve).toHaveBeenCalledWith( 'node_modules', TEMPLATE_NAME, SCRIPT_PATH, ); - expect(ChildProcess.execFileSync).toHaveBeenCalledWith(RESOLVED_PATH, { + expect(execa).toHaveBeenCalledWith(RESOLVED_PATH, { stdio: 'inherit', }); }); diff --git a/packages/cli/src/commands/init/banner.js b/packages/cli/src/commands/init/banner.js new file mode 100644 index 000000000..bf865302d --- /dev/null +++ b/packages/cli/src/commands/init/banner.js @@ -0,0 +1,43 @@ +// @flow +import chalk from 'chalk'; + +const reactLogoArray = [ + ' ', + ' ###### ###### ', + ' ### #### #### ### ', + ' ## ### ### ## ', + ' ## #### ## ', + ' ## #### ## ', + ' ## ## ## ## ', + ' ## ### ### ## ', + ' ## ######################## ## ', + ' ###### ### ### ###### ', + ' ### ## ## ## ## ### ', + ' ### ## ### #### ### ## ### ', + ' ## #### ######## #### ## ', + ' ## ### ########## ### ## ', + ' ## #### ######## #### ## ', + ' ### ## ### #### ### ## ### ', + ' ### ## ## ## ## ### ', + ' ###### ### ### ###### ', + ' ## ######################## ## ', + ' ## ### ### ## ', + ' ## ## ## ## ', + ' ## #### ## ', + ' ## #### ## ', + ' ## ### ### ## ', + ' ### #### #### ### ', + ' ###### ###### ', + ' ', +]; + +const welcomeMessage = + ' Welcome to React Native! '; +const learnOnceMessage = + ' Learn Once Write Anywhere '; + +export default `${chalk.blue(reactLogoArray.join('\n'))} + +${chalk.yellow.bold(welcomeMessage)} +${chalk.gray(learnOnceMessage)} +`; diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 24c8b965a..e39421d70 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -14,8 +14,10 @@ import { executePostInitScript, } from './template'; import {changePlaceholderInTemplate} from './editTemplate'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import {processTemplateName} from './templateName'; +import banner from './banner'; +import {getLoader} from '../../tools/loader'; type Options = {| template?: string, @@ -39,21 +41,46 @@ async function createFromExternalTemplate( templateName: string, npm?: boolean, ) { - logger.info('Initializing new project from external template'); + logger.debug('Initializing new project from external template'); + logger.log(banner); - let {uri, name} = await processTemplateName(templateName); + const Loader = getLoader(); - installTemplatePackage(uri, npm); - name = adjustNameIfUrl(name); - const templateConfig = getTemplateConfig(name); - copyTemplate(name, templateConfig.templateDir); - changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + const loader = new Loader({text: 'Downloading template'}); + loader.start(); - if (templateConfig.postInitScript) { - executePostInitScript(name, templateConfig.postInitScript); - } + try { + let {uri, name} = await processTemplateName(templateName); + + await installTemplatePackage(uri, npm); + loader.succeed(); + loader.start('Copying template'); + + name = adjustNameIfUrl(name); + const templateConfig = getTemplateConfig(name); + copyTemplate(name, templateConfig.templateDir); + + loader.succeed(); + loader.start('Preparing template'); - PackageManager.installAll({preferYarn: !npm}); + changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + + loader.succeed(); + const {postInitScript} = templateConfig; + if (postInitScript) { + // Leaving trailing space because there may be stdout from the script + loader.start('Executing post init script '); + await executePostInitScript(name, postInitScript); + loader.succeed(); + } + + loader.start('Installing all required dependencies'); + await PackageManager.installAll({preferYarn: !npm, silent: true}); + loader.succeed(); + } catch (e) { + loader.fail(); + throw new Error(e); + } } async function createFromReactNativeTemplate( @@ -61,28 +88,52 @@ async function createFromReactNativeTemplate( version: string, npm?: boolean, ) { - logger.info('Initializing new project'); + logger.debug('Initializing new project'); + logger.log(banner); - if (semver.valid(version) && !semver.satisfies(version, '0.60.0')) { - throw new Error( - 'Cannot use React Native CLI to initialize project with version less than 0.60.0', - ); - } + const Loader = getLoader(); + const loader = new Loader({text: 'Downloading template'}); + loader.start(); - const TEMPLATE_NAME = 'react-native'; + try { + if (semver.valid(version) && !semver.gte(version, '0.60.0')) { + throw new Error( + 'Cannot use React Native CLI to initialize project with version less than 0.60.0', + ); + } - const {uri} = await processTemplateName(`${TEMPLATE_NAME}@${version}`); + const TEMPLATE_NAME = 'react-native'; - installTemplatePackage(uri, npm); - const templateConfig = getTemplateConfig(TEMPLATE_NAME); - copyTemplate(TEMPLATE_NAME, templateConfig.templateDir); - changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + const {uri} = await processTemplateName(`${TEMPLATE_NAME}@${version}`); - if (templateConfig.postInitScript) { - executePostInitScript(TEMPLATE_NAME, templateConfig.postInitScript); - } + await installTemplatePackage(uri, npm); + + loader.succeed(); + loader.start('Copying template'); + + const templateConfig = getTemplateConfig(TEMPLATE_NAME); + copyTemplate(TEMPLATE_NAME, templateConfig.templateDir); - PackageManager.installAll({preferYarn: !npm}); + loader.succeed(); + loader.start('Processing template'); + + changePlaceholderInTemplate(projectName, templateConfig.placeholderName); + + loader.succeed(); + const {postInitScript} = templateConfig; + if (postInitScript) { + loader.start('Executing post init script'); + await executePostInitScript(TEMPLATE_NAME, postInitScript); + loader.succeed(); + } + + loader.start('Installing all required dependencies'); + await PackageManager.installAll({preferYarn: !npm, silent: true}); + loader.succeed(); + } catch (e) { + loader.fail(); + throw new Error(e); + } } function createProject(projectName: string, options: Options, version: string) { diff --git a/packages/cli/src/commands/init/initCompat.js b/packages/cli/src/commands/init/initCompat.js index 4d059f29d..9c18fca00 100644 --- a/packages/cli/src/commands/init/initCompat.js +++ b/packages/cli/src/commands/init/initCompat.js @@ -13,7 +13,7 @@ import path from 'path'; import process from 'process'; import printRunInstructions from './printRunInstructions'; import {createProjectFromTemplate} from '../../tools/generator/templates'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import logger from '../../tools/logger'; /** @@ -25,7 +25,7 @@ import logger from '../../tools/logger'; * @param options Command line options passed from the react-native-cli directly. * E.g. `{ version: '0.43.0', template: 'navigation' }` */ -function initCompat(projectDir, argsOrName) { +async function initCompat(projectDir, argsOrName) { const args = Array.isArray(argsOrName) ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose'] : [argsOrName].concat(process.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp' @@ -40,7 +40,7 @@ function initCompat(projectDir, argsOrName) { const options = minimist(args); logger.info(`Setting up new React Native app in ${projectDir}`); - generateProject(projectDir, newProjectName, options); + await generateProject(projectDir, newProjectName, options); } /** @@ -48,12 +48,12 @@ function initCompat(projectDir, argsOrName) { * @param Absolute path at which the project folder should be created. * @param options Command line arguments parsed by minimist. */ -function generateProject(destinationRoot, newProjectName, options) { +async function generateProject(destinationRoot, newProjectName, options) { const pkgJson = require('react-native/package.json'); const reactVersion = pkgJson.peerDependencies.react; - PackageManager.setProjectDir(destinationRoot); - createProjectFromTemplate( + await PackageManager.setProjectDir(destinationRoot); + await createProjectFromTemplate( destinationRoot, newProjectName, options.template, @@ -61,10 +61,10 @@ function generateProject(destinationRoot, newProjectName, options) { ); logger.info('Adding required dependencies'); - PackageManager.install([`react@${reactVersion}`]); + await PackageManager.install([`react@${reactVersion}`]); logger.info('Adding required dev dependencies'); - PackageManager.installDev([ + await PackageManager.installDev([ '@babel/core', '@babel/runtime', '@react-native-community/eslint-config', diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index dd7180ece..ef5066c55 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -1,7 +1,8 @@ // @flow -import {execFileSync} from 'child_process'; + +import execa from 'execa'; import path from 'path'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import logger from '../../tools/logger'; import copyFiles from '../../tools/copyFiles'; @@ -13,7 +14,10 @@ export type TemplateConfig = { export function installTemplatePackage(templateName: string, npm?: boolean) { logger.debug(`Installing template from ${templateName}`); - PackageManager.install([templateName], {preferYarn: !npm}); + return PackageManager.install([templateName], { + preferYarn: !npm, + silent: true, + }); } export function getTemplateConfig(templateName: string): TemplateConfig { @@ -44,5 +48,5 @@ export function executePostInitScript( logger.debug(`Executing post init script located ${scriptPath}`); - execFileSync(scriptPath, {stdio: 'inherit'}); + return execa(scriptPath, {stdio: 'inherit'}); } diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index ffcb7f0df..f5c00ff15 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -9,7 +9,7 @@ import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import link from '../link/link'; import loadConfig from '../../tools/config'; @@ -17,7 +17,7 @@ async function install(args: Array, ctx: ContextT) { const name = args[0]; logger.info(`Installing "${name}"...`); - PackageManager.install([name]); + await PackageManager.install([name]); // Reload configuration to see newly installed dependency const newConfig = loadConfig(); diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index 654c594a8..d0b70ed8a 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -9,7 +9,7 @@ import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import link from '../link/unlink'; async function uninstall(args: Array, ctx: ContextT) { @@ -19,7 +19,7 @@ async function uninstall(args: Array, ctx: ContextT) { await link.func([name], ctx); logger.info(`Uninstalling "${name}"...`); - PackageManager.uninstall([name]); + await PackageManager.uninstall([name]); logger.success(`Successfully uninstalled and unlinked "${name}"`); } diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 4e91f187d..812156fa6 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -34,7 +34,7 @@ jest.mock( () => ({name: 'TestApp', dependencies: {'react-native': '^0.57.8'}}), {virtual: true}, ); -jest.mock('../../../tools/PackageManager', () => ({ +jest.mock('../../../tools/packageManager', () => ({ install: args => { mockPushLog('$ yarn add', ...args); }, diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 148cfd99b..514041a12 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -6,7 +6,7 @@ import semver from 'semver'; import execa from 'execa'; import type {ContextT} from '../../tools/types.flow'; import logger from '../../tools/logger'; -import * as PackageManager from '../../tools/PackageManager'; +import * as PackageManager from '../../tools/packageManager'; import {fetch} from '../../tools/fetch'; import legacyUpgrade from './legacyUpgrade'; @@ -115,7 +115,7 @@ const installDeps = async (newVersion, projectDir) => { `react-native@${newVersion}`, ...Object.keys(peerDeps).map(module => `${module}@${peerDeps[module]}`), ]; - PackageManager.install(deps, { + await PackageManager.install(deps, { silent: true, }); await execa('git', ['add', 'package.json']); diff --git a/packages/cli/src/tools/__tests__/PackageManager-test.js b/packages/cli/src/tools/__tests__/packageManager-test.js similarity index 54% rename from packages/cli/src/tools/__tests__/PackageManager-test.js rename to packages/cli/src/tools/__tests__/packageManager-test.js index 33c4ce210..647daea21 100644 --- a/packages/cli/src/tools/__tests__/PackageManager-test.js +++ b/packages/cli/src/tools/__tests__/packageManager-test.js @@ -1,17 +1,16 @@ // @flow -import ChildProcess from 'child_process'; -import * as PackageManager from '../PackageManager'; +jest.mock('execa', () => jest.fn()); +import execa from 'execa'; import * as yarn from '../yarn'; +import logger from '../logger'; +import * as PackageManager from '../packageManager'; const PACKAGES = ['react', 'react-native']; const EXEC_OPTS = {stdio: 'inherit'}; const PROJECT_ROOT = '/some/dir'; -beforeEach(() => { - jest.spyOn(ChildProcess, 'execSync').mockImplementation(() => {}); -}); afterEach(() => { - (ChildProcess.execSync: any).mockRestore(); + jest.resetAllMocks(); }); describe('yarn', () => { @@ -19,22 +18,22 @@ describe('yarn', () => { jest .spyOn(yarn, 'getYarnVersionIfAvailable') .mockImplementation(() => true); + + jest.spyOn(logger, 'isVerbose').mockImplementation(() => false); }); it('should install', () => { PackageManager.install(PACKAGES, {preferYarn: true}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'yarn add react react-native', - EXEC_OPTS, - ); + expect(execa).toHaveBeenCalledWith('yarn', ['add', ...PACKAGES], EXEC_OPTS); }); it('should installDev', () => { PackageManager.installDev(PACKAGES, {preferYarn: true}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'yarn add -D react react-native', + expect(execa).toHaveBeenCalledWith( + 'yarn', + ['add', '-D', ...PACKAGES], EXEC_OPTS, ); }); @@ -42,8 +41,9 @@ describe('yarn', () => { it('should uninstall', () => { PackageManager.uninstall(PACKAGES, {preferYarn: true}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'yarn remove react react-native', + expect(execa).toHaveBeenCalledWith( + 'yarn', + ['remove', ...PACKAGES], EXEC_OPTS, ); }); @@ -53,8 +53,9 @@ describe('npm', () => { it('should install', () => { PackageManager.install(PACKAGES, {preferYarn: false}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'npm install react react-native --save --save-exact', + expect(execa).toHaveBeenCalledWith( + 'npm', + ['install', ...PACKAGES, '--save', '--save-exact'], EXEC_OPTS, ); }); @@ -62,8 +63,9 @@ describe('npm', () => { it('should installDev', () => { PackageManager.installDev(PACKAGES, {preferYarn: false}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'npm install react react-native --save-dev --save-exact', + expect(execa).toHaveBeenCalledWith( + 'npm', + ['install', ...PACKAGES, '--save-dev', '--save-exact'], EXEC_OPTS, ); }); @@ -71,8 +73,9 @@ describe('npm', () => { it('should uninstall', () => { PackageManager.uninstall(PACKAGES, {preferYarn: false}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'npm uninstall react react-native --save', + expect(execa).toHaveBeenCalledWith( + 'npm', + ['uninstall', ...PACKAGES, '--save'], EXEC_OPTS, ); }); @@ -82,8 +85,9 @@ it('should use npm if yarn is not available', () => { jest.spyOn(yarn, 'getYarnVersionIfAvailable').mockImplementation(() => false); PackageManager.install(PACKAGES, {preferYarn: true}); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'npm install react react-native --save --save-exact', + expect(execa).toHaveBeenCalledWith( + 'npm', + ['install', ...PACKAGES, '--save', '--save-exact'], EXEC_OPTS, ); }); @@ -94,8 +98,9 @@ it('should use npm if project is not using yarn', () => { PackageManager.setProjectDir(PROJECT_ROOT); PackageManager.install(PACKAGES); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'npm install react react-native --save --save-exact', + expect(execa).toHaveBeenCalledWith( + 'npm', + ['install', ...PACKAGES, '--save', '--save-exact'], EXEC_OPTS, ); expect(yarn.isProjectUsingYarn).toHaveBeenCalledWith(PROJECT_ROOT); @@ -108,9 +113,23 @@ it('should use yarn if project is using yarn', () => { PackageManager.setProjectDir(PROJECT_ROOT); PackageManager.install(PACKAGES); - expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'yarn add react react-native', - EXEC_OPTS, - ); + expect(execa).toHaveBeenCalledWith('yarn', ['add', ...PACKAGES], EXEC_OPTS); expect(yarn.isProjectUsingYarn).toHaveBeenCalledWith(PROJECT_ROOT); }); + +test.each([[false, 'pipe'], [true, 'inherit']])( + 'when verbose is set to %s should use "%s" stdio', + (isVerbose: boolean, stdioType: string) => { + jest + .spyOn(yarn, 'getYarnVersionIfAvailable') + .mockImplementation(() => true); + jest.spyOn(yarn, 'isProjectUsingYarn').mockImplementation(() => true); + jest.spyOn(logger, 'isVerbose').mockImplementation(() => isVerbose); + + PackageManager.install(PACKAGES, {silent: true}); + + expect(execa).toHaveBeenCalledWith('yarn', ['add', ...PACKAGES], { + stdio: stdioType, + }); + }, +); diff --git a/packages/cli/src/tools/generator/templates.js b/packages/cli/src/tools/generator/templates.js index b771efa72..460cdead2 100644 --- a/packages/cli/src/tools/generator/templates.js +++ b/packages/cli/src/tools/generator/templates.js @@ -13,7 +13,7 @@ import fs from 'fs'; import path from 'path'; import copyProjectTemplateAndReplace from './copyProjectTemplateAndReplace'; import logger from '../logger'; -import * as PackageManager from '../PackageManager'; +import * as PackageManager from '../packageManager'; /** * @param destPath Create the new project at this path. @@ -22,7 +22,7 @@ import * as PackageManager from '../PackageManager'; * @param yarnVersion Version of yarn available on the system, or null if * yarn is not available. For example '0.18.1'. */ -function createProjectFromTemplate( +async function createProjectFromTemplate( destPath: string, newProjectName: string, template: string, @@ -44,7 +44,12 @@ function createProjectFromTemplate( // This way we don't have to duplicate the native files in every template. // If we duplicated them we'd make RN larger and risk that people would // forget to maintain all the copies so they would go out of sync. - createFromRemoteTemplate(template, destPath, newProjectName, destinationRoot); + await createFromRemoteTemplate( + template, + destPath, + newProjectName, + destinationRoot, + ); } /** @@ -52,7 +57,7 @@ function createProjectFromTemplate( * - 'demo' -> Fetch the package react-native-template-demo from npm * - git://..., http://..., file://... or any other URL supported by npm */ -function createFromRemoteTemplate( +async function createFromRemoteTemplate( template: string, destPath: string, newProjectName: string, @@ -73,7 +78,7 @@ function createFromRemoteTemplate( // Check if the template exists logger.info(`Fetching template ${installPackage}...`); try { - PackageManager.install([installPackage]); + await PackageManager.install([installPackage]); const templatePath = path.resolve('node_modules', templateName); copyProjectTemplateAndReplace(templatePath, destPath, newProjectName, { // Every template contains a dummy package.json file included @@ -86,12 +91,12 @@ function createFromRemoteTemplate( 'devDependencies.json', ], }); - installTemplateDependencies(templatePath, destinationRoot); - installTemplateDevDependencies(templatePath, destinationRoot); + await installTemplateDependencies(templatePath, destinationRoot); + await installTemplateDevDependencies(templatePath, destinationRoot); } finally { // Clean up the temp files try { - PackageManager.uninstall([templateName]); + await PackageManager.uninstall([templateName]); } catch (err) { // Not critical but we still want people to know and report // if this the clean up fails. @@ -103,7 +108,7 @@ function createFromRemoteTemplate( } } -function installTemplateDependencies(templatePath, destinationRoot) { +async function installTemplateDependencies(templatePath, destinationRoot) { // dependencies.json is a special file that lists additional dependencies // that are required by this template const dependenciesJsonPath = path.resolve(templatePath, 'dependencies.json'); @@ -124,12 +129,12 @@ function installTemplateDependencies(templatePath, destinationRoot) { const dependenciesToInstall = Object.keys(dependencies).map( depName => `${depName}@${dependencies[depName]}`, ); - PackageManager.install(dependenciesToInstall); + await PackageManager.install(dependenciesToInstall); logger.info("Linking native dependencies into the project's build files..."); execSync('react-native link', {stdio: 'inherit'}); } -function installTemplateDevDependencies(templatePath, destinationRoot) { +async function installTemplateDevDependencies(templatePath, destinationRoot) { // devDependencies.json is a special file that lists additional develop dependencies // that are required by this template const devDependenciesJsonPath = path.resolve( @@ -154,7 +159,7 @@ function installTemplateDevDependencies(templatePath, destinationRoot) { const dependenciesToInstall = Object.keys(dependencies).map( depName => `${depName}@${dependencies[depName]}`, ); - PackageManager.installDev(dependenciesToInstall); + await PackageManager.installDev(dependenciesToInstall); } export {createProjectFromTemplate}; diff --git a/packages/cli/src/tools/loader.js b/packages/cli/src/tools/loader.js new file mode 100644 index 000000000..525cc5c9d --- /dev/null +++ b/packages/cli/src/tools/loader.js @@ -0,0 +1,15 @@ +// @flow +import Ora from 'ora'; +import logger from './logger'; + +class OraMock { + succeed() {} + fail() {} + start() {} +} + +function getLoader(): typeof Ora { + return logger.isVerbose() ? OraMock : Ora; +} + +export {getLoader}; diff --git a/packages/cli/src/tools/logger.js b/packages/cli/src/tools/logger.js index 42e6e262f..8bb9cbddd 100644 --- a/packages/cli/src/tools/logger.js +++ b/packages/cli/src/tools/logger.js @@ -40,6 +40,8 @@ const setVerbose = (level: boolean) => { verbose = level; }; +const isVerbose = () => verbose; + export default { success, info, @@ -48,4 +50,5 @@ export default { debug, log, setVerbose, + isVerbose, }; diff --git a/packages/cli/src/tools/PackageManager.js b/packages/cli/src/tools/packageManager.js similarity index 54% rename from packages/cli/src/tools/PackageManager.js rename to packages/cli/src/tools/packageManager.js index fa4b999f1..941a218c7 100644 --- a/packages/cli/src/tools/PackageManager.js +++ b/packages/cli/src/tools/packageManager.js @@ -1,5 +1,6 @@ // @flow -import {execSync} from 'child_process'; +import execa from 'execa'; +import logger from './logger'; import {getYarnVersionIfAvailable, isProjectUsingYarn} from './yarn'; type Options = {| @@ -9,9 +10,14 @@ type Options = {| let projectDir; -function executeCommand(command: string, options?: Options) { - return execSync(command, { - stdio: options && options.silent ? 'pipe' : 'inherit', +function executeCommand( + command: string, + args: Array, + options?: Options, +) { + return execa(command, args, { + stdio: + options && options.silent && !logger.isVerbose() ? 'pipe' : 'inherit', }); } @@ -29,30 +35,32 @@ export function setProjectDir(dir: string) { export function install(packageNames: Array, options?: Options) { return shouldUseYarn(options) - ? executeCommand(`yarn add ${packageNames.join(' ')}`, options) + ? executeCommand('yarn', ['add', ...packageNames], options) : executeCommand( - `npm install ${packageNames.join(' ')} --save --save-exact`, + 'npm', + ['install', ...packageNames, '--save', '--save-exact'], options, ); } export function installDev(packageNames: Array, options?: Options) { return shouldUseYarn(options) - ? executeCommand(`yarn add -D ${packageNames.join(' ')}`, options) + ? executeCommand('yarn', ['add', '-D', ...packageNames], options) : executeCommand( - `npm install ${packageNames.join(' ')} --save-dev --save-exact`, + 'npm', + ['install', ...packageNames, '--save-dev', '--save-exact'], options, ); } export function uninstall(packageNames: Array, options?: Options) { return shouldUseYarn(options) - ? executeCommand(`yarn remove ${packageNames.join(' ')}`, options) - : executeCommand(`npm uninstall ${packageNames.join(' ')} --save`, options); + ? executeCommand('yarn', ['remove', ...packageNames], options) + : executeCommand('npm', ['uninstall', ...packageNames, '--save'], options); } export function installAll(options?: Options) { return shouldUseYarn(options) - ? executeCommand('yarn install') - : executeCommand('npm install'); + ? executeCommand('yarn', ['install'], options) + : executeCommand('npm', ['install'], options); } diff --git a/yarn.lock b/yarn.lock index 745260fc3..61eb22770 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,6 +2042,11 @@ ansi-regex@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -2703,6 +2708,11 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-spinners@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.0.0.tgz#4b078756fc17a8f72043fdc9f1f14bf4fa87e2df" + integrity sha512-yiEBmhaKPPeBj7wWm4GEdtPZK940p9pl3EANIrnJ3JnvWyrPjcFcsEq6qRUuQ7fzB0+Y82ld3p6B34xo95foWw== + cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" @@ -5779,6 +5789,13 @@ lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5 version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== + dependencies: + chalk "^2.0.1" + loose-envify@^1.0.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -6719,6 +6736,18 @@ options@>=0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f" +ora@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" + integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== + dependencies: + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-spinners "^2.0.0" + log-symbols "^2.2.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -8163,6 +8192,13 @@ strip-ansi@^5.0.0: dependencies: ansi-regex "^4.0.0" +strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -8669,7 +8705,7 @@ watch@~0.18.0: exec-sh "^0.2.0" minimist "^1.2.0" -wcwidth@^1.0.0: +wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= From 5f7dba3d6e5720e91c967bdd8bc6867d67485737 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Fri, 5 Apr 2019 22:02:26 +0200 Subject: [PATCH 057/234] feat: extract iOS and Android specific linking files out of the core (#290) Summary: --------- Historically, Android and iOS platform were hardcoded inside CLI and provided by default. Then, other packages could export additional platforms on top of it. React Native as a platform was hardcoded in Metro configuration (default platforms, default extensions) and inside link. That means all new features were always developed with these platforms in mind, leaving others behind. We often used private APIs, which made things more complicated for 3rd party platform developers. From this PR on, there's no longer concept of an out-of-tree platform inside of the CLI. In a follow up PR to React Native, I am going to configure iOS and Android platforms inside React Native, just like React Native Windows exposes Windows platform. This will open room for improvements and should make it even easier for the CLI to welcome other platforms. --- .circleci/config.yml | 34 +- .eslintrc.js | 2 +- .../__snapshots__/init.test.js.snap | 0 {e2e/__tests__ => __e2e__}/init.test.js | 12 +- {e2e/__tests__ => __e2e__}/install.test.js | 2 +- {e2e/__tests__ => __e2e__}/legacyInit.test.js | 2 +- {e2e/__tests__ => __e2e__}/uninstall.test.js | 2 +- .../cli/src/__mocks__ => __mocks__}/fs.js | 0 .../cli/src/__mocks__ => __mocks__}/path.js | 0 e2e/jest.config.js | 5 - jest.config.js | 18 +- {e2e => jest}/helpers.js | 0 e2e/testSetup.js => jest/setupE2eTests.js | 0 jest/setupUnitTests.js | 19 + lerna.json | 2 +- package.json | 3 +- packages/cli/jest.config.js | 4 - packages/cli/package.json | 3 + packages/cli/src/cliEntry.js | 2 +- .../cli/src/commands/bundle/buildBundle.js | 2 +- .../cli/src/commands/bundle/saveAssets.js | 2 +- .../src/commands/info/__tests__/info.test.js | 12 +- packages/cli/src/commands/info/info.js | 2 +- .../cli/src/commands/init/editTemplate.js | 2 +- packages/cli/src/commands/init/init.js | 2 +- packages/cli/src/commands/init/initCompat.js | 2 +- .../src/commands/init/printRunInstructions.js | 2 +- packages/cli/src/commands/init/template.js | 2 +- packages/cli/src/commands/install/install.js | 2 +- .../cli/src/commands/install/uninstall.js | 2 +- packages/cli/src/commands/library/library.js | 2 +- .../android/0.17/MainActivity.java | 85 -- .../android/0.17/patchedMainActivity.java | 87 -- .../android/0.18/MainActivity.java | 46 - .../android/0.18/patchedMainActivity.java | 48 -- .../android/0.20/MainActivity.java | 47 - .../link/__fixtures__/android/build.gradle | 12 - .../android/patchedSettings.gradle | 12 - .../link/__fixtures__/android/settings.gradle | 10 - packages/cli/src/commands/link/link.js | 2 +- packages/cli/src/commands/link/linkAssets.js | 2 +- .../cli/src/commands/link/linkDependency.js | 2 +- packages/cli/src/commands/link/unlink.js | 2 +- .../cli/src/commands/logAndroid/logAndroid.js | 2 +- packages/cli/src/commands/logIOS/logIOS.js | 2 +- .../cli/src/commands/runAndroid/runAndroid.js | 2 +- .../commands/runAndroid/runOnAllDevices.js | 2 +- .../runAndroid/tryLaunchAppOnDevice.js | 2 +- .../commands/runAndroid/tryRunAdbReverse.js | 2 +- packages/cli/src/commands/runIOS/runIOS.js | 2 +- .../cli/src/commands/server/launchChrome.js | 2 +- .../cli/src/commands/server/launchEditor.js | 2 +- .../cli/src/commands/server/messageSocket.js | 2 +- .../middleware/copyToClipBoardMiddleware.js | 2 +- .../middleware/getDevToolsMiddleware.js | 2 +- .../middleware/systraceProfileMiddleware.js | 2 +- .../cli/src/commands/server/webSocketProxy.js | 2 +- .../upgrade/__tests__/upgrade.test.js | 28 +- .../cli/src/commands/upgrade/legacyUpgrade.js | 2 +- packages/cli/src/commands/upgrade/upgrade.js | 2 +- .../cli/src/tools/__fixtures__/commands.js | 27 - .../src/tools/__fixtures__/dependencies.js | 37 - packages/cli/src/tools/__fixtures__/ios.js | 33 - .../cli/src/tools/__fixtures__/projects.js | 39 - .../__tests__/ios/findPodfilePath-test.js | 30 - .../tools/__tests__/packageManager-test.js | 2 +- .../tools/config/__tests__/findAssets-test.js | 13 +- .../config/__tests__/findDependencies-test.js | 2 +- .../src/tools/config/__tests__/index-test.js | 2 +- packages/cli/src/tools/config/index.js | 4 +- .../src/tools/config/readConfigFromDisk.js | 2 +- .../copyProjectTemplateAndReplace.js | 2 +- packages/cli/src/tools/generator/templates.js | 2 +- packages/cli/src/tools/logger.js | 55 +- packages/cli/src/tools/yarn.js | 2 +- packages/cli/testSetup.js | 4 - packages/platform-android/package.json | 8 + .../src/config}/__fixtures__/android.js | 0 .../files/AndroidManifest-debug.xml | 0 .../__fixtures__/files/AndroidManifest.xml | 0 .../src/config}/__fixtures__/files/Main.java | 0 .../__fixtures__/files/ReactPackage.java | 0 .../__fixtures__/files/ReactPackage.kt | 0 .../config}/__fixtures__/files/package.json | 0 .../__fixtures__/files/project.pbxproj | 0 .../src/config/__fixtures__/projects.js | 16 + .../__tests__}/findAndroidAppFolder-test.js | 4 +- .../config/__tests__}/findManifest-test.js | 4 +- .../__tests__}/findPackageClassName-test.js | 4 +- .../__tests__}/getDependencyConfig-test.js | 4 +- .../__tests__}/getProjectConfig-test.js | 4 +- .../config/__tests__}/readManifest-test.js | 6 +- .../src/config}/findAndroidAppFolder.js | 0 .../src/config}/findManifest.js | 0 .../src/config}/findPackageClassName.js | 0 .../src/config}/index.js | 3 - .../src/config}/readManifest.js | 0 packages/platform-android/src/index.js | 8 + .../link/__fixtures__}/patchedBuild.gradle | 0 .../src/link/__tests__}/isInstalled-test.js | 7 +- .../src/link}/copyAssets.js | 3 +- .../src/link}/index.js | 0 .../src/link}/isInstalled.js | 0 .../patches/__tests__}/applyPatch-test.js | 2 +- .../patches/__tests__}/makeBuildPatch-test.js | 17 +- .../__tests__}/makeImportPatch-test.js | 2 +- .../__tests__}/makePackagePatch-test.js | 4 +- .../__tests__}/makeSettingsPatch-test.js | 5 +- .../__tests__}/makeStringsPatch-test.js | 2 +- .../__tests__}/normalizeProjectName-test.js | 2 +- .../src/link}/patches/applyParams.js | 0 .../src/link}/patches/applyPatch.js | 2 +- .../src/link}/patches/makeBuildPatch.js | 0 .../src/link}/patches/makeImportPatch.js | 0 .../src/link}/patches/makePackagePatch.js | 0 .../src/link}/patches/makeSettingsPatch.js | 0 .../src/link}/patches/makeStringsPatch.js | 0 .../src/link}/patches/normalizeProjectName.js | 0 .../src/link}/patches/revokePatch.js | 2 +- .../src/link}/registerNativeModule.js | 0 .../src/link}/unlinkAssets.js | 3 +- .../src/link}/unregisterNativeModule.js | 0 packages/platform-ios/package.json | 8 + .../config/__fixtures__/files/project.pbxproj | 804 ++++++++++++++++++ .../src/config/__fixtures__/projects.js | 45 + .../config/__tests__/findPodfilePath-test.js | 19 + .../config/__tests__}/findPodspecName-test.js | 7 +- .../src/config/__tests__}/findProject-test.js | 10 +- .../__tests__}/getProjectConfig-test.js | 4 +- .../src/config}/findPodfilePath.js | 0 .../src/config}/findPodspecName.js | 0 .../src/config}/findProject.js | 0 .../ios => platform-ios/src/config}/index.js | 3 - packages/platform-ios/src/index.js | 8 + .../src/link-pods/__fixtures__/Info.plist | 0 .../src/link-pods/__fixtures__}/PodfileSimple | 0 .../__fixtures__}/PodfileWithFunction | 0 .../__fixtures__}/PodfileWithMarkers | 0 .../link-pods/__fixtures__}/PodfileWithTarget | 0 .../__tests__}/findLineToAddPod-test.js | 10 +- .../findMarkedLinesInPodfile-test.js | 8 +- .../__tests__}/findPodTargetLine-test.js | 8 +- .../link-pods/__tests__}/isInstalled-test.js | 4 +- .../__tests__}/removePodEntry-test.js | 6 +- .../src/link-pods}/addPodEntry.js | 2 +- .../src/link-pods}/findLineToAddPod.js | 0 .../link-pods}/findMarkedLinesInPodfile.js | 0 .../src/link-pods}/findPodTargetLine.js | 0 .../src/link-pods}/isInstalled.js | 0 .../src/link-pods}/readPodfile.js | 2 +- .../src/link-pods}/registerNativeModule.js | 0 .../src/link-pods}/removePodEntry.js | 2 +- .../src/link-pods}/savePodFile.js | 2 +- .../src/link-pods}/unregisterNativeModule.js | 2 +- .../src}/link/__fixtures__/Info.plist | 0 .../link/__fixtures__/linearGradient.pbxproj | 0 .../src}/link/__fixtures__/project.pbxproj | 0 .../link/__tests__}/addFileToProject-test.js | 6 +- .../__tests__}/addProjectToLibraries-test.js | 4 +- .../__tests__}/addSharedLibraries-test.js | 6 +- .../src/link/__tests__}/createGroup-test.js | 6 +- .../link/__tests__}/getBuildProperty-test.js | 4 +- .../src/link/__tests__}/getGroup-test.js | 4 +- .../__tests__}/getHeaderSearchPath-test.js | 2 +- .../__tests__}/getHeadersInFolder-test.js | 3 +- .../src/link/__tests__}/getPlist-test.js | 4 +- .../src/link/__tests__}/getPlistPath-test.js | 4 +- .../src/link/__tests__}/getTargets-test.js | 4 +- .../__tests__}/hasLibraryImported-test.js | 4 +- .../src/link/__tests__}/isInstalled-test.js | 4 +- .../__tests__}/mapHeaderSearchPaths-test.js | 4 +- .../removeProjectFromLibraries-test.js | 6 +- .../removeProjectFromProject-test.js | 8 +- .../__tests__}/removeSharedLibrary-test.js | 8 +- .../src/link/__tests__}/writePlist-test.js | 13 +- .../src/link}/addFileToProject.js | 0 .../src/link}/addProjectToLibraries.js | 0 .../src/link}/addSharedLibraries.js | 0 .../src/link}/addToHeaderSearchPaths.js | 2 +- .../src/link}/common/isInstalled.js | 2 +- .../src/link}/common/registerNativeModule.js | 2 +- .../link}/common/unregisterNativeModule.js | 4 +- .../src/link}/copyAssets.js | 3 +- .../src/link}/createGroup.js | 0 .../src/link}/createGroupWithMessage.js | 4 +- .../src/link}/getBuildProperty.js | 0 .../ios => platform-ios/src/link}/getGroup.js | 0 .../src/link}/getHeaderSearchPath.js | 0 .../src/link}/getHeadersInFolder.js | 0 .../ios => platform-ios/src/link}/getPlist.js | 0 .../src/link}/getPlistPath.js | 0 .../src/link}/getTargets.js | 0 .../src/link}/hasLibraryImported.js | 0 .../ios => platform-ios/src/link}/index.js | 0 .../src/link}/isInstalled.js | 0 .../src/link}/mapHeaderSearchPaths.js | 0 .../src/link}/registerNativeModule.js | 2 +- .../src/link}/removeFromHeaderSearchPaths.js | 2 +- .../removeFromPbxItemContainerProxySection.js | 0 .../removeFromPbxReferenceProxySection.js | 0 .../src/link}/removeFromProjectReferences.js | 0 .../src/link}/removeFromStaticLibraries.js | 0 .../src/link}/removeProductGroup.js | 0 .../src/link}/removeProjectFromLibraries.js | 0 .../src/link}/removeProjectFromProject.js | 0 .../src/link}/removeSharedLibraries.js | 0 .../src/link}/unlinkAssets.js | 8 +- .../src/link}/unregisterNativeModule.js | 2 +- .../src/link}/writePlist.js | 0 packages/tools/package.json | 10 + .../log.js => tools/src/__mocks__/logger.js} | 0 .../src}/__tests__/groupFilesByType-test.js | 0 .../link => tools/src}/groupFilesByType.js | 0 packages/tools/src/index.js | 5 + packages/tools/src/logger.js | 54 ++ 215 files changed, 1260 insertions(+), 815 deletions(-) rename {e2e/__tests__ => __e2e__}/__snapshots__/init.test.js.snap (100%) rename {e2e/__tests__ => __e2e__}/init.test.js (90%) rename {e2e/__tests__ => __e2e__}/install.test.js (92%) rename {e2e/__tests__ => __e2e__}/legacyInit.test.js (95%) rename {e2e/__tests__ => __e2e__}/uninstall.test.js (94%) rename {packages/cli/src/__mocks__ => __mocks__}/fs.js (100%) rename {packages/cli/src/__mocks__ => __mocks__}/path.js (100%) delete mode 100644 e2e/jest.config.js rename {e2e => jest}/helpers.js (100%) rename e2e/testSetup.js => jest/setupE2eTests.js (100%) create mode 100644 jest/setupUnitTests.js delete mode 100644 packages/cli/jest.config.js delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/build.gradle delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle delete mode 100644 packages/cli/src/commands/link/__fixtures__/android/settings.gradle delete mode 100644 packages/cli/src/tools/__fixtures__/commands.js delete mode 100644 packages/cli/src/tools/__fixtures__/dependencies.js delete mode 100644 packages/cli/src/tools/__fixtures__/ios.js delete mode 100644 packages/cli/src/tools/__fixtures__/projects.js delete mode 100644 packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js delete mode 100644 packages/cli/testSetup.js create mode 100644 packages/platform-android/package.json rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/android.js (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/AndroidManifest-debug.xml (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/AndroidManifest.xml (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/Main.java (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/ReactPackage.java (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/ReactPackage.kt (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/package.json (100%) rename packages/{cli/src/tools => platform-android/src/config}/__fixtures__/files/project.pbxproj (100%) create mode 100644 packages/platform-android/src/config/__fixtures__/projects.js rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/findAndroidAppFolder-test.js (88%) rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/findManifest-test.js (87%) rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/findPackageClassName-test.js (92%) rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/getDependencyConfig-test.js (92%) rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/getProjectConfig-test.js (95%) rename packages/{cli/src/tools/__tests__/android => platform-android/src/config/__tests__}/readManifest-test.js (85%) rename packages/{cli/src/tools/android => platform-android/src/config}/findAndroidAppFolder.js (100%) rename packages/{cli/src/tools/android => platform-android/src/config}/findManifest.js (100%) rename packages/{cli/src/tools/android => platform-android/src/config}/findPackageClassName.js (100%) rename packages/{cli/src/tools/android => platform-android/src/config}/index.js (96%) rename packages/{cli/src/tools/android => platform-android/src/config}/readManifest.js (100%) create mode 100644 packages/platform-android/src/index.js rename packages/{cli/src/commands/link/__fixtures__/android => platform-android/src/link/__fixtures__}/patchedBuild.gradle (100%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/__tests__}/isInstalled-test.js (85%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/copyAssets.js (91%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/index.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/isInstalled.js (100%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/applyPatch-test.js (89%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/makeBuildPatch-test.js (84%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/makeImportPatch-test.js (90%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/makePackagePatch-test.js (86%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/makeSettingsPatch-test.js (94%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/makeStringsPatch-test.js (90%) rename packages/{cli/src/commands/link/__tests__/android => platform-android/src/link/patches/__tests__}/normalizeProjectName-test.js (87%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/applyParams.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/applyPatch.js (89%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/makeBuildPatch.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/makeImportPatch.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/makePackagePatch.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/makeSettingsPatch.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/makeStringsPatch.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/normalizeProjectName.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/patches/revokePatch.js (88%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/registerNativeModule.js (100%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/unlinkAssets.js (90%) rename packages/{cli/src/commands/link/android => platform-android/src/link}/unregisterNativeModule.js (100%) create mode 100644 packages/platform-ios/package.json create mode 100644 packages/platform-ios/src/config/__fixtures__/files/project.pbxproj create mode 100644 packages/platform-ios/src/config/__fixtures__/projects.js create mode 100644 packages/platform-ios/src/config/__tests__/findPodfilePath-test.js rename packages/{cli/src/tools/__tests__/ios => platform-ios/src/config/__tests__}/findPodspecName-test.js (86%) rename packages/{cli/src/tools/__tests__/ios => platform-ios/src/config/__tests__}/findProject-test.js (87%) rename packages/{cli/src/tools/__tests__/ios => platform-ios/src/config/__tests__}/getProjectConfig-test.js (91%) rename packages/{cli/src/tools/ios => platform-ios/src/config}/findPodfilePath.js (100%) rename packages/{cli/src/tools/ios => platform-ios/src/config}/findPodspecName.js (100%) rename packages/{cli/src/tools/ios => platform-ios/src/config}/findProject.js (100%) rename packages/{cli/src/tools/ios => platform-ios/src/config}/index.js (94%) create mode 100644 packages/platform-ios/src/index.js create mode 100644 packages/platform-ios/src/link-pods/__fixtures__/Info.plist rename packages/{cli/src/commands/link/__fixtures__/pods => platform-ios/src/link-pods/__fixtures__}/PodfileSimple (100%) rename packages/{cli/src/commands/link/__fixtures__/pods => platform-ios/src/link-pods/__fixtures__}/PodfileWithFunction (100%) rename packages/{cli/src/commands/link/__fixtures__/pods => platform-ios/src/link-pods/__fixtures__}/PodfileWithMarkers (100%) rename packages/{cli/src/commands/link/__fixtures__/pods => platform-ios/src/link-pods/__fixtures__}/PodfileWithTarget (100%) rename packages/{cli/src/commands/link/__tests__/pods => platform-ios/src/link-pods/__tests__}/findLineToAddPod-test.js (84%) rename packages/{cli/src/commands/link/__tests__/pods => platform-ios/src/link-pods/__tests__}/findMarkedLinesInPodfile-test.js (80%) rename packages/{cli/src/commands/link/__tests__/pods => platform-ios/src/link-pods/__tests__}/findPodTargetLine-test.js (77%) rename packages/{cli/src/commands/link/__tests__/pods => platform-ios/src/link-pods/__tests__}/isInstalled-test.js (91%) rename packages/{cli/src/commands/link/__tests__/pods => platform-ios/src/link-pods/__tests__}/removePodEntry-test.js (89%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/addPodEntry.js (94%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/findLineToAddPod.js (100%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/findMarkedLinesInPodfile.js (100%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/findPodTargetLine.js (100%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/isInstalled.js (100%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/readPodfile.js (87%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/registerNativeModule.js (100%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/removePodEntry.js (92%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/savePodFile.js (88%) rename packages/{cli/src/commands/link/pods => platform-ios/src/link-pods}/unregisterNativeModule.js (91%) rename packages/{cli/src/commands => platform-ios/src}/link/__fixtures__/Info.plist (100%) rename packages/{cli/src/commands => platform-ios/src}/link/__fixtures__/linearGradient.pbxproj (100%) rename packages/{cli/src/commands => platform-ios/src}/link/__fixtures__/project.pbxproj (100%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/addFileToProject-test.js (80%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/addProjectToLibraries-test.js (86%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/addSharedLibraries-test.js (89%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/createGroup-test.js (91%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getBuildProperty-test.js (83%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getGroup-test.js (92%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getHeaderSearchPath-test.js (97%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getHeadersInFolder-test.js (94%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getPlist-test.js (85%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getPlistPath-test.js (84%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/getTargets-test.js (86%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/hasLibraryImported-test.js (87%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/isInstalled-test.js (89%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/mapHeaderSearchPaths-test.js (89%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/removeProjectFromLibraries-test.js (81%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/removeProjectFromProject-test.js (80%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/removeSharedLibrary-test.js (81%) rename packages/{cli/src/commands/link/__tests__/ios => platform-ios/src/link/__tests__}/writePlist-test.js (81%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/addFileToProject.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/addProjectToLibraries.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/addSharedLibraries.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/addToHeaderSearchPaths.js (88%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/common/isInstalled.js (88%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/common/registerNativeModule.js (88%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/common/unregisterNativeModule.js (86%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/copyAssets.js (94%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/createGroup.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/createGroupWithMessage.js (91%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getBuildProperty.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getGroup.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getHeaderSearchPath.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getHeadersInFolder.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getPlist.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getPlistPath.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/getTargets.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/hasLibraryImported.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/index.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/isInstalled.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/mapHeaderSearchPaths.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/registerNativeModule.js (97%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeFromHeaderSearchPaths.js (91%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeFromPbxItemContainerProxySection.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeFromPbxReferenceProxySection.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeFromProjectReferences.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeFromStaticLibraries.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeProductGroup.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeProjectFromLibraries.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeProjectFromProject.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/removeSharedLibraries.js (100%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/unlinkAssets.js (90%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/unregisterNativeModule.js (97%) rename packages/{cli/src/commands/link/ios => platform-ios/src/link}/writePlist.js (100%) create mode 100644 packages/tools/package.json rename packages/{cli/src/tools/__mocks__/log.js => tools/src/__mocks__/logger.js} (100%) rename packages/{cli/src/commands/link => tools/src}/__tests__/groupFilesByType-test.js (100%) rename packages/{cli/src/commands/link => tools/src}/groupFilesByType.js (100%) create mode 100644 packages/tools/src/index.js create mode 100644 packages/tools/src/logger.js diff --git a/.circleci/config.yml b/.circleci/config.yml index ec7d9ef57..8bd31c04e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,7 +16,7 @@ jobs: keys: - v2-dependencies-{{ checksum "package.json" }} - v2-dependencies- - - run: yarn install + - run: yarn --frozen-lockfile - save_cache: key: v2-dependencies-{{ checksum "package.json" }} paths: @@ -25,32 +25,48 @@ jobs: root: . paths: - . - lint-and-flow: + lint: <<: *defaults steps: - attach_workspace: at: ~/react-native-cli - - run: | - yarn lint - yarn flow-check - tests: + - run: yarn lint + typecheck: <<: *defaults steps: - attach_workspace: at: ~/react-native-cli - - run: yarn test:ci + - run: yarn flow-check + unit-tests: + <<: *defaults + steps: + - attach_workspace: + at: ~/react-native-cli + - run: yarn test:ci:unit - store_artifacts: path: coverage destination: coverage + e2e-tests: + <<: *defaults + steps: + - attach_workspace: + at: ~/react-native-cli + - run: yarn test:ci:e2e workflows: version: 2 build-and-test: jobs: - install-dependencies - - lint-and-flow: + - lint: + requires: + - install-dependencies + - typecheck: + requires: + - install-dependencies + - unit-tests: requires: - install-dependencies - - tests: + - e2e-tests: requires: - install-dependencies diff --git a/.eslintrc.js b/.eslintrc.js index aabf2157e..291813410 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,7 +13,7 @@ module.exports = { }, overrides: [ { - files: ['**/__mocks__/**', '**/__fixtures__/**', 'testSetup.js'], + files: ['**/__mocks__/**', '**/__fixtures__/**', '**/__e2e__/**', 'jest/**'], env: { jest: true, }, diff --git a/e2e/__tests__/__snapshots__/init.test.js.snap b/__e2e__/__snapshots__/init.test.js.snap similarity index 100% rename from e2e/__tests__/__snapshots__/init.test.js.snap rename to __e2e__/__snapshots__/init.test.js.snap diff --git a/e2e/__tests__/init.test.js b/__e2e__/init.test.js similarity index 90% rename from e2e/__tests__/init.test.js rename to __e2e__/init.test.js index d8760d17b..a7d1586ba 100644 --- a/e2e/__tests__/init.test.js +++ b/__e2e__/init.test.js @@ -1,7 +1,7 @@ // @flow import fs from 'fs'; import path from 'path'; -import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; +import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers'; const DIR = getTempDirectory('command-init'); @@ -14,11 +14,11 @@ afterEach(() => { }); test('init --template fails without package name', () => { - const {stderr} = run(DIR, [ - 'init', - '--template', - 'react-native-new-template', - ]); + const {stderr} = run( + DIR, + ['init', '--template', 'react-native-new-template'], + {expectedFailure: true}, + ); expect(stderr).toContain('missing required argument'); }); diff --git a/e2e/__tests__/install.test.js b/__e2e__/install.test.js similarity index 92% rename from e2e/__tests__/install.test.js rename to __e2e__/install.test.js index 49de1eac4..5f8c1f63c 100644 --- a/e2e/__tests__/install.test.js +++ b/__e2e__/install.test.js @@ -1,6 +1,6 @@ // @flow import path from 'path'; -import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; +import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers'; const DIR = getTempDirectory('command-install-test'); const pkg = 'react-native-config'; diff --git a/e2e/__tests__/legacyInit.test.js b/__e2e__/legacyInit.test.js similarity index 95% rename from e2e/__tests__/legacyInit.test.js rename to __e2e__/legacyInit.test.js index cd1a49af1..dee3170a7 100644 --- a/e2e/__tests__/legacyInit.test.js +++ b/__e2e__/legacyInit.test.js @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; import execa from 'execa'; -import {getTempDirectory, cleanup, writeFiles} from '../helpers'; +import {getTempDirectory, cleanup, writeFiles} from '../jest/helpers'; const DIR = getTempDirectory('command-legacy-init'); diff --git a/e2e/__tests__/uninstall.test.js b/__e2e__/uninstall.test.js similarity index 94% rename from e2e/__tests__/uninstall.test.js rename to __e2e__/uninstall.test.js index d8615d9e2..5103aeede 100644 --- a/e2e/__tests__/uninstall.test.js +++ b/__e2e__/uninstall.test.js @@ -1,5 +1,5 @@ // @flow -import {run, getTempDirectory, cleanup, writeFiles} from '../helpers'; +import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers'; const DIR = getTempDirectory('command-uninstall-test'); const pkg = 'react-native-config'; diff --git a/packages/cli/src/__mocks__/fs.js b/__mocks__/fs.js similarity index 100% rename from packages/cli/src/__mocks__/fs.js rename to __mocks__/fs.js diff --git a/packages/cli/src/__mocks__/path.js b/__mocks__/path.js similarity index 100% rename from packages/cli/src/__mocks__/path.js rename to __mocks__/path.js diff --git a/e2e/jest.config.js b/e2e/jest.config.js deleted file mode 100644 index a4a44922a..000000000 --- a/e2e/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - testEnvironment: 'node', - testPathIgnorePatterns: ['/(?:.+?)/__tests__/'], - setupFiles: ['./testSetup.js'], -}; diff --git a/jest.config.js b/jest.config.js index fca02fb79..eb479491c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,18 @@ +const common = {testEnvironment: 'node'}; + module.exports = { - testEnvironment: 'node', - projects: ['/packages/*', '/e2e'], + projects: [ + { + ...common, + displayName: 'e2e', + setupFiles: ['/jest/setupE2eTests.js'], + testMatch: ['/**/__e2e__/*{.,-}test.js'], + }, + { + ...common, + displayName: 'unit', + setupFiles: ['/jest/setupUnitTests.js'], + testMatch: ['/**/__tests__/*{.,-}test.js'], + }, + ], }; diff --git a/e2e/helpers.js b/jest/helpers.js similarity index 100% rename from e2e/helpers.js rename to jest/helpers.js diff --git a/e2e/testSetup.js b/jest/setupE2eTests.js similarity index 100% rename from e2e/testSetup.js rename to jest/setupE2eTests.js diff --git a/jest/setupUnitTests.js b/jest/setupUnitTests.js new file mode 100644 index 000000000..4c31f817a --- /dev/null +++ b/jest/setupUnitTests.js @@ -0,0 +1,19 @@ +/** + * @flow + */ + +jest.mock('@react-native-community/cli-tools', () => ({ + ...jest.requireActual('@react-native-community/cli-tools'), + logger: { + success: jest.fn(), + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + debug: jest.fn(), + log: jest.fn(), + setVerbose: jest.fn(), + isVerbose: jest.fn(), + }, +})); + +jest.setTimeout(20000); diff --git a/lerna.json b/lerna.json index 94399037e..3a38c5a0b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "independent", + "version": "2.0.0-alpha.3", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 3aca1c3ff..f24511f05 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build-clean": "rm -rf ./packages/*/build", "watch": "node ./scripts/watch.js", "test": "jest", - "test:ci": "jest -i", + "test:ci:unit": "jest packages --ci --coverage", + "test:ci:e2e": "jest e2e --ci -i", "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", "postinstall": "yarn build-clean && yarn build", diff --git a/packages/cli/jest.config.js b/packages/cli/jest.config.js deleted file mode 100644 index d7999eb60..000000000 --- a/packages/cli/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - setupFiles: ['./testSetup.js'], - testEnvironment: 'node', -}; diff --git a/packages/cli/package.json b/packages/cli/package.json index 4a7684e49..5ae6e7ee1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,6 +19,9 @@ "testEnvironment": "node" }, "dependencies": { + "@react-native-community/cli-platform-ios": "2.0.0-alpha.3", + "@react-native-community/cli-platform-android": "2.0.0-alpha.3", + "@react-native-community/cli-tools": "2.0.0-alpha.3", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index af2827b28..9758eb849 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -17,7 +17,7 @@ import type {CommandT, ContextT} from './tools/types.flow'; import {getCommands} from './commands'; import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; -import logger from './tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import {setProjectDir} from './tools/packageManager'; import pkgJson from '../package.json'; import loadConfig from './tools/config'; diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index f4d9fb406..e11f7512a 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -16,7 +16,7 @@ import type {CommandLineArgs} from './bundleCommandLineArgs'; import type {ContextT} from '../../tools/types.flow'; import saveAssets from './saveAssets'; import loadMetroConfig from '../../tools/loadMetroConfig'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; async function buildBundle( args: CommandLineArgs, diff --git a/packages/cli/src/commands/bundle/saveAssets.js b/packages/cli/src/commands/bundle/saveAssets.js index 257cf111e..34e7dcc08 100644 --- a/packages/cli/src/commands/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 '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function saveAssets(assets, platform, assetsDest) { if (!assetsDest) { diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js index cbda1f26f..5887a6a63 100644 --- a/packages/cli/src/commands/info/__tests__/info.test.js +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -1,12 +1,14 @@ // @flow import info from '../info'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import loadConfig from '../../../tools/config'; -jest.mock('../../../tools/logger', () => ({ - info: jest.fn(), - error: jest.fn(), - log: jest.fn(), +jest.mock('@react-native-community/cli-tools', () => ({ + logger: { + info: jest.fn(), + error: jest.fn(), + log: jest.fn(), + }, })); jest.mock('../../../tools/config'); diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index 8d35f83c0..4faae7860 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -8,7 +8,7 @@ */ import envinfo from 'envinfo'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import type {ContextT} from '../../tools/types.flow'; const info = async function getInfo( diff --git a/packages/cli/src/commands/init/editTemplate.js b/packages/cli/src/commands/init/editTemplate.js index e5f669ec7..10c0e9df3 100644 --- a/packages/cli/src/commands/init/editTemplate.js +++ b/packages/cli/src/commands/init/editTemplate.js @@ -2,7 +2,7 @@ import fs from 'fs-extra'; import path from 'path'; import walk from '../../tools/walk'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function replaceNameInUTF8File( filePath: string, diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index e39421d70..77279d7ba 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -6,7 +6,7 @@ import type {ContextT} from '../../tools/types.flow'; import {validateProjectName} from './validate'; import DirectoryAlreadyExistsError from './errors/DirectoryAlreadyExistsError'; import printRunInstructions from './printRunInstructions'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import { installTemplatePackage, getTemplateConfig, diff --git a/packages/cli/src/commands/init/initCompat.js b/packages/cli/src/commands/init/initCompat.js index 9c18fca00..caf66b8c2 100644 --- a/packages/cli/src/commands/init/initCompat.js +++ b/packages/cli/src/commands/init/initCompat.js @@ -14,7 +14,7 @@ import process from 'process'; import printRunInstructions from './printRunInstructions'; import {createProjectFromTemplate} from '../../tools/generator/templates'; import * as PackageManager from '../../tools/packageManager'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Creates the template for a React Native project given the provided diff --git a/packages/cli/src/commands/init/printRunInstructions.js b/packages/cli/src/commands/init/printRunInstructions.js index bca12c4cf..220c146fe 100644 --- a/packages/cli/src/commands/init/printRunInstructions.js +++ b/packages/cli/src/commands/init/printRunInstructions.js @@ -10,7 +10,7 @@ import path from 'path'; import chalk from 'chalk'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function printRunInstructions(projectDir: string, projectName: string) { const absoluteProjectDir = path.resolve(projectDir); diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index ef5066c55..d9c40a3b7 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -3,7 +3,7 @@ import execa from 'execa'; import path from 'path'; import * as PackageManager from '../../tools/packageManager'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import copyFiles from '../../tools/copyFiles'; export type TemplateConfig = { diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index f5c00ff15..4750087b5 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -8,7 +8,7 @@ */ import type {ContextT} from '../../tools/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/link'; import loadConfig from '../../tools/config'; diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index d0b70ed8a..a8173d26e 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -8,7 +8,7 @@ */ import type {ContextT} from '../../tools/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/unlink'; diff --git a/packages/cli/src/commands/library/library.js b/packages/cli/src/commands/library/library.js index 5a1b13c85..026d151aa 100644 --- a/packages/cli/src/commands/library/library.js +++ b/packages/cli/src/commands/library/library.js @@ -12,7 +12,7 @@ import path from 'path'; import copyAndReplace from '../../tools/copyAndReplace'; import isValidPackageName from '../../tools/isValidPackageName'; import walk from '../../tools/walk'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Creates a new native library with the given name diff --git a/packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java deleted file mode 100644 index d0794b72b..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/0.17/MainActivity.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.basic; - -import android.app.Activity; -import android.os.Bundle; -import android.view.KeyEvent; - -import com.facebook.react.LifecycleState; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactRootView; -import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { - - private ReactInstanceManager mReactInstanceManager; - private ReactRootView mReactRootView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mReactRootView = new ReactRootView(this); - - mReactInstanceManager = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setBundleAssetName("index.android.bundle") - .setJSMainModuleName("index.android") - .addPackage(new MainReactPackage()) - .setUseDeveloperSupport(BuildConfig.DEBUG) - .setInitialLifecycleState(LifecycleState.RESUMED) - .build(); - - mReactRootView.startReactApplication(mReactInstanceManager, "Basic", null); - - setContentView(mReactRootView); - } - - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { - mReactInstanceManager.showDevOptionsDialog(); - return true; - } - return super.onKeyUp(keyCode, event); - } - - @Override - public void onBackPressed() { - if (mReactInstanceManager != null) { - mReactInstanceManager.onBackPressed(); - } else { - super.onBackPressed(); - } - } - - @Override - public void invokeDefaultOnBackPressed() { - super.onBackPressed(); - } - - @Override - protected void onPause() { - super.onPause(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onPause(); - } - } - - @Override - protected void onResume() { - super.onResume(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onResume(this, this); - } - } -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java deleted file mode 100644 index 17c2b278d..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/0.17/patchedMainActivity.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.basic; - -import android.app.Activity; -import com.oblador.vectoricons.VectorIconsPackage; -import android.os.Bundle; -import android.view.KeyEvent; - -import com.facebook.react.LifecycleState; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactRootView; -import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { - - private ReactInstanceManager mReactInstanceManager; - private ReactRootView mReactRootView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mReactRootView = new ReactRootView(this); - - mReactInstanceManager = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setBundleAssetName("index.android.bundle") - .setJSMainModuleName("index.android") - .addPackage(new MainReactPackage()) - .addPackage(new VectorIconsPackage()) - .setUseDeveloperSupport(BuildConfig.DEBUG) - .setInitialLifecycleState(LifecycleState.RESUMED) - .build(); - - mReactRootView.startReactApplication(mReactInstanceManager, "Basic", null); - - setContentView(mReactRootView); - } - - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { - mReactInstanceManager.showDevOptionsDialog(); - return true; - } - return super.onKeyUp(keyCode, event); - } - - @Override - public void onBackPressed() { - if (mReactInstanceManager != null) { - mReactInstanceManager.onBackPressed(); - } else { - super.onBackPressed(); - } - } - - @Override - public void invokeDefaultOnBackPressed() { - super.onBackPressed(); - } - - @Override - protected void onPause() { - super.onPause(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onPause(); - } - } - - @Override - protected void onResume() { - super.onResume(); - - if (mReactInstanceManager != null) { - mReactInstanceManager.onResume(this, this); - } - } -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java deleted file mode 100644 index c63062744..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/0.18/MainActivity.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.testrn; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage()); - } -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java deleted file mode 100644 index b099735c4..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/0.18/patchedMainActivity.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.testrn; - -import com.facebook.react.ReactActivity; -import com.oblador.vectoricons.VectorIconsPackage; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new VectorIconsPackage()); - } -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java b/packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java deleted file mode 100644 index 642f4259c..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/0.20/MainActivity.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.myawesomeproject; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "TestRN"; - } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); - } -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/build.gradle b/packages/cli/src/commands/link/__fixtures__/android/build.gradle deleted file mode 100644 index f206d053e..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:27.1.1" - implementation "com.facebook.react:react-native:+" -} diff --git a/packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle b/packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle deleted file mode 100644 index 2b311263a..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/patchedSettings.gradle +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -rootProject.name = 'TestRN' - -include ':app' -include ':test' -project(':test').projectDir = new File(rootProject.projectDir, '../node_modules/test/android') diff --git a/packages/cli/src/commands/link/__fixtures__/android/settings.gradle b/packages/cli/src/commands/link/__fixtures__/android/settings.gradle deleted file mode 100644 index 5bb3d945c..000000000 --- a/packages/cli/src/commands/link/__fixtures__/android/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -rootProject.name = 'TestRN' - -include ':app' diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 0afddc112..94f10bb2c 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -15,7 +15,7 @@ import {type ContextT} from '../../tools/types.flow'; import {CLIError} from '../../tools/errors'; import promiseWaterfall from './promiseWaterfall'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import commandStub from './commandStub'; import promisify from './promisify'; import getPlatformName from './getPlatformName'; diff --git a/packages/cli/src/commands/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js index 462fbc676..f5a5d6404 100644 --- a/packages/cli/src/commands/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -3,7 +3,7 @@ import {isEmpty} from 'lodash'; import type {PlatformsT, ProjectConfigT} from '../../tools/config/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; const linkAssets = ( platforms: PlatformsT, diff --git a/packages/cli/src/commands/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js index 23b2fbb04..c4081cf5e 100644 --- a/packages/cli/src/commands/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -5,7 +5,7 @@ import type { ProjectConfigT, PlatformsT, } from '../../tools/config/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import pollParams from './pollParams'; import getPlatformName from './getPlatformName'; diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 67ace63a1..b593f21a2 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -10,7 +10,7 @@ import {flatMap, values, difference} from 'lodash'; import type {ContextT} from '../../tools/types.flow'; import dedent from 'dedent'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; import promisify from './promisify'; diff --git a/packages/cli/src/commands/logAndroid/logAndroid.js b/packages/cli/src/commands/logAndroid/logAndroid.js index 6eb2cf651..8c09aa1fe 100644 --- a/packages/cli/src/commands/logAndroid/logAndroid.js +++ b/packages/cli/src/commands/logAndroid/logAndroid.js @@ -6,7 +6,7 @@ */ import {spawnSync} from 'child_process'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Starts adb logcat diff --git a/packages/cli/src/commands/logIOS/logIOS.js b/packages/cli/src/commands/logIOS/logIOS.js index e4c46b5a5..0a0cf0d2b 100644 --- a/packages/cli/src/commands/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 '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function findAvailableDevice(devices) { for (const key of Object.keys(devices)) { diff --git a/packages/cli/src/commands/runAndroid/runAndroid.js b/packages/cli/src/commands/runAndroid/runAndroid.js index d3d2b3033..ac5577ffa 100644 --- a/packages/cli/src/commands/runAndroid/runAndroid.js +++ b/packages/cli/src/commands/runAndroid/runAndroid.js @@ -20,7 +20,7 @@ import runOnAllDevices from './runOnAllDevices'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; import getAdbPath from './getAdbPath'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; // Verifies this is an Android project function checkAndroid(root) { diff --git a/packages/cli/src/commands/runAndroid/runOnAllDevices.js b/packages/cli/src/commands/runAndroid/runOnAllDevices.js index 993cf72a4..3eb59ae44 100644 --- a/packages/cli/src/commands/runAndroid/runOnAllDevices.js +++ b/packages/cli/src/commands/runAndroid/runOnAllDevices.js @@ -8,7 +8,7 @@ */ import {spawnSync, execFileSync} from 'child_process'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import adb from './adb'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; diff --git a/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js index ee793b751..a2b88d021 100644 --- a/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js +++ b/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js @@ -8,7 +8,7 @@ */ import {spawnSync} from 'child_process'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function tryLaunchAppOnDevice( device: string, diff --git a/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js index 8c6198848..58c443b67 100644 --- a/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js +++ b/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js @@ -8,7 +8,7 @@ */ import {execFileSync} from 'child_process'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; 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/commands/runIOS/runIOS.js b/packages/cli/src/commands/runIOS/runIOS.js index 8e23d7da4..20e968e1a 100644 --- a/packages/cli/src/commands/runIOS/runIOS.js +++ b/packages/cli/src/commands/runIOS/runIOS.js @@ -16,7 +16,7 @@ import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; import {ProcessError} from '../../tools/errors'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; type FlagsT = { simulator: string, diff --git a/packages/cli/src/commands/server/launchChrome.js b/packages/cli/src/commands/server/launchChrome.js index 758dbbd73..dfe045469 100644 --- a/packages/cli/src/commands/server/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 '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function commandExistsUnixSync(commandName) { try { diff --git a/packages/cli/src/commands/server/launchEditor.js b/packages/cli/src/commands/server/launchEditor.js index aa0867b94..e3e61afe9 100644 --- a/packages/cli/src/commands/server/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 '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function isTerminalEditor(editor) { switch (editor) { diff --git a/packages/cli/src/commands/server/messageSocket.js b/packages/cli/src/commands/server/messageSocket.js index 2108cd6e5..a60ea2105 100644 --- a/packages/cli/src/commands/server/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 '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; const PROTOCOL_VERSION = 2; diff --git a/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js b/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js index 882f747dc..ab369efdb 100644 --- a/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js +++ b/packages/cli/src/commands/server/middleware/copyToClipBoardMiddleware.js @@ -8,7 +8,7 @@ */ import copyToClipBoard from '../copyToClipBoard'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Handle the request from JS to copy contents onto host system clipboard. diff --git a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js index d6f09639b..93bb78076 100644 --- a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js @@ -7,7 +7,7 @@ * @format */ import launchChrome from '../launchChrome'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import {exec} from 'child_process'; function launchChromeDevTools(port, args = '') { diff --git a/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js index 7993995d1..0a54d0687 100644 --- a/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js +++ b/packages/cli/src/commands/server/middleware/systraceProfileMiddleware.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function systraceProfileMiddleware(req, res, next) { if (req.url !== '/systrace') { diff --git a/packages/cli/src/commands/server/webSocketProxy.js b/packages/cli/src/commands/server/webSocketProxy.js index 0f109de08..d333bbac2 100644 --- a/packages/cli/src/commands/server/webSocketProxy.js +++ b/packages/cli/src/commands/server/webSocketProxy.js @@ -8,7 +8,7 @@ */ import ws from 'ws'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; function attachToServer(server, path) { const WebSocketServer = ws.Server; diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 812156fa6..edef33b7d 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -42,12 +42,14 @@ jest.mock('../../../tools/packageManager', () => ({ jest.mock('../../../tools/fetch', () => ({ fetch: jest.fn(() => Promise.resolve('patch')), })); -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)), - success: jest.fn((...args) => mockPushLog('success', args)), - log: jest.fn((...args) => mockPushLog(args)), +jest.mock('@react-native-community/cli-tools', () => ({ + logger: { + info: jest.fn((...args) => mockPushLog('info', args)), + error: jest.fn((...args) => mockPushLog('error', args)), + warn: jest.fn((...args) => mockPushLog('warn', args)), + success: jest.fn((...args) => mockPushLog('success', args)), + log: jest.fn((...args) => mockPushLog(args)), + }, })); const currentVersion = '0.57.8'; @@ -90,28 +92,28 @@ afterEach(() => { test('uses latest version of react-native when none passed', async () => { await upgrade.func([], ctx, opts); expect(execa).toBeCalledWith('npm', ['info', 'react-native', 'version']); -}); +}, 60000); test('errors when invalid version passed', async () => { await upgrade.func(['next'], ctx, opts); expect(logger.error).toBeCalledWith( 'Provided version "next" is not allowed. Please pass a valid semver version', ); -}); +}, 60000); test('errors when older version passed', async () => { await upgrade.func([olderVersion], ctx, opts); expect(logger.error).toBeCalledWith( `Trying to upgrade from newer version "${currentVersion}" to older "${olderVersion}"`, ); -}); +}, 60000); test('warns when dependency upgrade version is in semver range', async () => { await upgrade.func([currentVersion], ctx, opts); expect(logger.warn).toBeCalledWith( `Specified version "${currentVersion}" is already installed in node_modules and it satisfies "^0.57.8" semver range. No need to upgrade`, ); -}); +}, 60000); test('fetches empty patch and installs deps', async () => { (fetch: any).mockImplementation(() => Promise.resolve('')); @@ -127,7 +129,7 @@ $ execa git add yarn.lock $ execa git add package-lock.json success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" `); -}); +}, 60000); test('fetches regular patch, adds remote, applies patch, installs deps, removes remote,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); @@ -155,7 +157,7 @@ success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the contextLines: 1, }), ).toMatchSnapshot('RnDiffApp is replaced with app name (TestApp)'); -}); +}, 60000); test('cleans up if patching fails,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); (execa: any).mockImplementation((command, args) => { @@ -196,4 +198,4 @@ info You may find these resources helpful: • Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 • Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" `); -}); +}, 60000); diff --git a/packages/cli/src/commands/upgrade/legacyUpgrade.js b/packages/cli/src/commands/upgrade/legacyUpgrade.js index 57d82da3e..ccb93eef7 100644 --- a/packages/cli/src/commands/upgrade/legacyUpgrade.js +++ b/packages/cli/src/commands/upgrade/legacyUpgrade.js @@ -12,7 +12,7 @@ import fs from 'fs'; import path from 'path'; import semver from 'semver'; import type {ContextT} from '../../tools/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; /** diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 514041a12..816e6cdd0 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -5,7 +5,7 @@ import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; import type {ContextT} from '../../tools/types.flow'; -import logger from '../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import {fetch} from '../../tools/fetch'; import legacyUpgrade from './legacyUpgrade'; diff --git a/packages/cli/src/tools/__fixtures__/commands.js b/packages/cli/src/tools/__fixtures__/commands.js deleted file mode 100644 index 5331649a7..000000000 --- a/packages/cli/src/tools/__fixtures__/commands.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -exports.single = { - func: () => {}, - description: 'Test action', - name: 'test', -}; - -exports.multiple = [ - { - func: () => {}, - description: 'Test action #1', - name: 'test1', - }, - { - func: () => {}, - description: 'Test action #2', - name: 'test2', - }, -]; diff --git a/packages/cli/src/tools/__fixtures__/dependencies.js b/packages/cli/src/tools/__fixtures__/dependencies.js deleted file mode 100644 index 73de8974c..000000000 --- a/packages/cli/src/tools/__fixtures__/dependencies.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import path from 'path'; -import android from './android'; - -const fs = jest.requireActual('fs'); - -const pjson = fs.readFileSync(path.join(__dirname, 'files', 'package.json')); - -export default { - valid: { - 'package.json': pjson, - android: android.valid, - }, - withAssets: { - 'package.json': pjson, - android: android.valid, - fonts: { - 'A.ttf': '', - 'B.ttf': '', - }, - images: { - 'C.jpg': '', - }, - }, - noPackage: { - 'package.json': pjson, - android: android.noPackage, - }, -}; diff --git a/packages/cli/src/tools/__fixtures__/ios.js b/packages/cli/src/tools/__fixtures__/ios.js deleted file mode 100644 index 876a6cfd1..000000000 --- a/packages/cli/src/tools/__fixtures__/ios.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import path from 'path'; - -const fs = jest.requireActual('fs'); - -exports.valid = { - 'demoProject.xcodeproj': { - 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj'), - ), - }, - 'TestPod.podspec': 'empty', -}; - -exports.validTestName = { - 'MyTestProject.xcodeproj': { - 'project.pbxproj': fs.readFileSync( - path.join(__dirname, './files/project.pbxproj'), - ), - }, -}; - -exports.pod = { - 'TestPod.podspec': 'empty', -}; diff --git a/packages/cli/src/tools/__fixtures__/projects.js b/packages/cli/src/tools/__fixtures__/projects.js deleted file mode 100644 index 67034aeae..000000000 --- a/packages/cli/src/tools/__fixtures__/projects.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import android from './android'; -import ios from './ios'; - -const flat = { - android: android.valid, - ios: ios.valid, - Podfile: 'empty', -}; - -const nested = { - android: { - app: android.valid, - }, - ios: ios.valid, -}; - -const withExamples = { - Examples: flat, - ios: ios.valid, - android: android.valid, -}; - -const withPods = { - Podfile: 'content', - ios: ios.pod, -}; - -export default {flat, nested, withExamples, withPods}; - -// export { flat, nested, withExamples, withPods }; diff --git a/packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js b/packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js deleted file mode 100644 index c7cd37ded..000000000 --- a/packages/cli/src/tools/__tests__/ios/findPodfilePath-test.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -import findPodfilePath from '../../ios/findPodfilePath'; -import projects from '../../__fixtures__/projects'; -import ios from '../../__fixtures__/ios'; - -jest.mock('path'); -jest.mock('fs'); - -const fs = require('fs'); - -describe('ios::findPodfilePath', () => { - it('returns null if there is no Podfile', () => { - fs.__setMockFilesystem(ios.valid); - expect(findPodfilePath('')).toBeNull(); - }); - - it('returns Podfile path if it exists', () => { - fs.__setMockFilesystem(projects.withPods); - expect(findPodfilePath('/ios')).toContain('Podfile'); - }); -}); diff --git a/packages/cli/src/tools/__tests__/packageManager-test.js b/packages/cli/src/tools/__tests__/packageManager-test.js index 647daea21..1e53b185f 100644 --- a/packages/cli/src/tools/__tests__/packageManager-test.js +++ b/packages/cli/src/tools/__tests__/packageManager-test.js @@ -2,7 +2,7 @@ jest.mock('execa', () => jest.fn()); import execa from 'execa'; import * as yarn from '../yarn'; -import logger from '../logger'; +import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../packageManager'; const PACKAGES = ['react', 'react-native']; diff --git a/packages/cli/src/tools/config/__tests__/findAssets-test.js b/packages/cli/src/tools/config/__tests__/findAssets-test.js index ed0358854..a6387ce8f 100644 --- a/packages/cli/src/tools/config/__tests__/findAssets-test.js +++ b/packages/cli/src/tools/config/__tests__/findAssets-test.js @@ -8,7 +8,6 @@ * @emails oncall+javascript_foundation */ -import dependencies from '../../__fixtures__/dependencies'; import findAssets from '../findAssets'; jest.mock('path'); @@ -18,7 +17,17 @@ const fs = require('fs'); describe('findAssets', () => { beforeEach(() => { - fs.__setMockFilesystem({testDir: dependencies.withAssets}); + fs.__setMockFilesystem({ + testDir: { + fonts: { + 'A.ttf': '', + 'B.ttf': '', + }, + images: { + 'C.jpg': '', + }, + }, + }); }); it('returns an array of all files in given folders', () => { diff --git a/packages/cli/src/tools/config/__tests__/findDependencies-test.js b/packages/cli/src/tools/config/__tests__/findDependencies-test.js index 92750a82e..d807cad03 100644 --- a/packages/cli/src/tools/config/__tests__/findDependencies-test.js +++ b/packages/cli/src/tools/config/__tests__/findDependencies-test.js @@ -8,7 +8,7 @@ import { cleanup, writeFiles, getTempDirectory, -} from '../../../../../../e2e/helpers'; +} from '../../../../../../jest/helpers'; beforeEach(() => { cleanup(DIR); diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index c5ddc765a..a12f6464e 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -8,7 +8,7 @@ import { cleanup, writeFiles, getTempDirectory, -} from '../../../../../../e2e/helpers'; +} from '../../../../../../jest/helpers'; const DIR = getTempDirectory('resolve_config_path_test'); diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 101a1ca15..03df4add4 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -22,8 +22,8 @@ import assign from '../assign'; /** * Built-in platforms */ -import * as ios from '../ios'; -import * as android from '../android'; +import * as ios from '@react-native-community/cli-platform-ios'; +import * as android from '@react-native-community/cli-platform-android'; /** * `deepmerge` concatenates arrays by default instead of overwriting them. diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 90aad6cf5..edc86091d 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -12,7 +12,7 @@ import {type UserDependencyConfigT, type UserConfigT} from './types.flow'; import {JoiError} from '../errors'; import * as schema from './schema'; -import logger from '../logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Places to look for the new configuration diff --git a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js index d582904ba..1f6578127 100644 --- a/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js +++ b/packages/cli/src/tools/generator/copyProjectTemplateAndReplace.js @@ -12,7 +12,7 @@ import path from 'path'; import copyAndReplace from '../copyAndReplace'; import promptInitializer from './promptSync'; import walk from '../walk'; -import logger from '../logger'; +import {logger} from '@react-native-community/cli-tools'; const prompt = promptInitializer(); diff --git a/packages/cli/src/tools/generator/templates.js b/packages/cli/src/tools/generator/templates.js index 460cdead2..1520c0645 100644 --- a/packages/cli/src/tools/generator/templates.js +++ b/packages/cli/src/tools/generator/templates.js @@ -12,7 +12,7 @@ import {execSync} from 'child_process'; import fs from 'fs'; import path from 'path'; import copyProjectTemplateAndReplace from './copyProjectTemplateAndReplace'; -import logger from '../logger'; +import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../packageManager'; /** diff --git a/packages/cli/src/tools/logger.js b/packages/cli/src/tools/logger.js index 8bb9cbddd..839cbbe63 100644 --- a/packages/cli/src/tools/logger.js +++ b/packages/cli/src/tools/logger.js @@ -1,54 +1 @@ -/** - * @flow - */ -import chalk from 'chalk'; - -const SEPARATOR = ', '; - -let verbose = false; - -const formatMessages = (messages: Array) => - chalk.reset(messages.join(SEPARATOR)); - -const success = (...messages: Array) => { - console.log(`${chalk.green.bold('success')} ${formatMessages(messages)}`); -}; - -const info = (...messages: Array) => { - console.log(`${chalk.cyan.bold('info')} ${formatMessages(messages)}`); -}; - -const warn = (...messages: Array) => { - console.warn(`${chalk.yellow.bold('warn')} ${formatMessages(messages)}`); -}; - -const error = (...messages: Array) => { - console.error(`${chalk.red.bold('error')} ${formatMessages(messages)}`); -}; - -const debug = (...messages: Array) => { - if (verbose) { - console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`); - } -}; - -const log = (...messages: Array) => { - console.log(`${formatMessages(messages)}`); -}; - -const setVerbose = (level: boolean) => { - verbose = level; -}; - -const isVerbose = () => verbose; - -export default { - success, - info, - warn, - error, - debug, - log, - setVerbose, - isVerbose, -}; +export {logger as default} from '@react-native-community/cli-tools'; diff --git a/packages/cli/src/tools/yarn.js b/packages/cli/src/tools/yarn.js index bdefbee58..13817d42f 100644 --- a/packages/cli/src/tools/yarn.js +++ b/packages/cli/src/tools/yarn.js @@ -11,7 +11,7 @@ import {execSync} from 'child_process'; import fs from 'fs'; import path from 'path'; import semver from 'semver'; -import logger from './logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Use Yarn if available, it's much faster than the npm client. diff --git a/packages/cli/testSetup.js b/packages/cli/testSetup.js deleted file mode 100644 index 36c5620d0..000000000 --- a/packages/cli/testSetup.js +++ /dev/null @@ -1,4 +0,0 @@ -// @flow -jest.mock('./src/tools/logger'); - -jest.setTimeout(20000); diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json new file mode 100644 index 000000000..301e3f595 --- /dev/null +++ b/packages/platform-android/package.json @@ -0,0 +1,8 @@ +{ + "name": "@react-native-community/cli-platform-android", + "version": "2.0.0-alpha.3", + "main": "build/index.js", + "dependencies": { + "@react-native-community/cli-tools": "2.0.0-alpha.3" + } +} diff --git a/packages/cli/src/tools/__fixtures__/android.js b/packages/platform-android/src/config/__fixtures__/android.js similarity index 100% rename from packages/cli/src/tools/__fixtures__/android.js rename to packages/platform-android/src/config/__fixtures__/android.js diff --git a/packages/cli/src/tools/__fixtures__/files/AndroidManifest-debug.xml b/packages/platform-android/src/config/__fixtures__/files/AndroidManifest-debug.xml similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/AndroidManifest-debug.xml rename to packages/platform-android/src/config/__fixtures__/files/AndroidManifest-debug.xml diff --git a/packages/cli/src/tools/__fixtures__/files/AndroidManifest.xml b/packages/platform-android/src/config/__fixtures__/files/AndroidManifest.xml similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/AndroidManifest.xml rename to packages/platform-android/src/config/__fixtures__/files/AndroidManifest.xml diff --git a/packages/cli/src/tools/__fixtures__/files/Main.java b/packages/platform-android/src/config/__fixtures__/files/Main.java similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/Main.java rename to packages/platform-android/src/config/__fixtures__/files/Main.java diff --git a/packages/cli/src/tools/__fixtures__/files/ReactPackage.java b/packages/platform-android/src/config/__fixtures__/files/ReactPackage.java similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/ReactPackage.java rename to packages/platform-android/src/config/__fixtures__/files/ReactPackage.java diff --git a/packages/cli/src/tools/__fixtures__/files/ReactPackage.kt b/packages/platform-android/src/config/__fixtures__/files/ReactPackage.kt similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/ReactPackage.kt rename to packages/platform-android/src/config/__fixtures__/files/ReactPackage.kt diff --git a/packages/cli/src/tools/__fixtures__/files/package.json b/packages/platform-android/src/config/__fixtures__/files/package.json similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/package.json rename to packages/platform-android/src/config/__fixtures__/files/package.json diff --git a/packages/cli/src/tools/__fixtures__/files/project.pbxproj b/packages/platform-android/src/config/__fixtures__/files/project.pbxproj similarity index 100% rename from packages/cli/src/tools/__fixtures__/files/project.pbxproj rename to packages/platform-android/src/config/__fixtures__/files/project.pbxproj diff --git a/packages/platform-android/src/config/__fixtures__/projects.js b/packages/platform-android/src/config/__fixtures__/projects.js new file mode 100644 index 000000000..646a77c9b --- /dev/null +++ b/packages/platform-android/src/config/__fixtures__/projects.js @@ -0,0 +1,16 @@ +import android from './android'; + +export const flat = { + android: android.valid, +}; + +export const nested = { + android: { + app: android.valid, + }, +}; + +export const withExamples = { + Examples: flat, + android: android.valid, +}; diff --git a/packages/cli/src/tools/__tests__/android/findAndroidAppFolder-test.js b/packages/platform-android/src/config/__tests__/findAndroidAppFolder-test.js similarity index 88% rename from packages/cli/src/tools/__tests__/android/findAndroidAppFolder-test.js rename to packages/platform-android/src/config/__tests__/findAndroidAppFolder-test.js index 866350e13..1c6ebb3e4 100644 --- a/packages/cli/src/tools/__tests__/android/findAndroidAppFolder-test.js +++ b/packages/platform-android/src/config/__tests__/findAndroidAppFolder-test.js @@ -8,8 +8,8 @@ * @emails oncall+javascript_foundation */ -import findAndroidAppFolder from '../../android/findAndroidAppFolder'; -import mocks from '../../__fixtures__/android'; +import findAndroidAppFolder from '../findAndroidAppFolder'; +import mocks from '../__fixtures__/android'; jest.mock('path'); jest.mock('fs'); diff --git a/packages/cli/src/tools/__tests__/android/findManifest-test.js b/packages/platform-android/src/config/__tests__/findManifest-test.js similarity index 87% rename from packages/cli/src/tools/__tests__/android/findManifest-test.js rename to packages/platform-android/src/config/__tests__/findManifest-test.js index 74259e833..88c3803d8 100644 --- a/packages/cli/src/tools/__tests__/android/findManifest-test.js +++ b/packages/platform-android/src/config/__tests__/findManifest-test.js @@ -8,8 +8,8 @@ * @emails oncall+javascript_foundation */ -import findManifest from '../../android/findManifest'; -import mocks from '../../__fixtures__/android'; +import findManifest from '../findManifest'; +import mocks from '../__fixtures__/android'; jest.mock('path'); jest.mock('fs'); diff --git a/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js b/packages/platform-android/src/config/__tests__/findPackageClassName-test.js similarity index 92% rename from packages/cli/src/tools/__tests__/android/findPackageClassName-test.js rename to packages/platform-android/src/config/__tests__/findPackageClassName-test.js index 9c9cd8b80..f12b6c555 100644 --- a/packages/cli/src/tools/__tests__/android/findPackageClassName-test.js +++ b/packages/platform-android/src/config/__tests__/findPackageClassName-test.js @@ -8,8 +8,8 @@ * @emails oncall+javascript_foundation */ -import mocks from '../../__fixtures__/android'; -import findPackageClassName from '../../android/findPackageClassName'; +import mocks from '../__fixtures__/android'; +import findPackageClassName from '../findPackageClassName'; jest.mock('path'); jest.mock('fs'); diff --git a/packages/cli/src/tools/__tests__/android/getDependencyConfig-test.js b/packages/platform-android/src/config/__tests__/getDependencyConfig-test.js similarity index 92% rename from packages/cli/src/tools/__tests__/android/getDependencyConfig-test.js rename to packages/platform-android/src/config/__tests__/getDependencyConfig-test.js index a11c73169..e0eb79d3d 100644 --- a/packages/cli/src/tools/__tests__/android/getDependencyConfig-test.js +++ b/packages/platform-android/src/config/__tests__/getDependencyConfig-test.js @@ -8,14 +8,14 @@ * @emails oncall+javascript_foundation */ -import mocks from '../../__fixtures__/android'; +import mocks from '../__fixtures__/android'; jest.mock('path'); jest.mock('fs'); const fs = require('fs'); -const getDependencyConfig = require('../../android').dependencyConfig; +const getDependencyConfig = require('../').dependencyConfig; const userConfig = {}; diff --git a/packages/cli/src/tools/__tests__/android/getProjectConfig-test.js b/packages/platform-android/src/config/__tests__/getProjectConfig-test.js similarity index 95% rename from packages/cli/src/tools/__tests__/android/getProjectConfig-test.js rename to packages/platform-android/src/config/__tests__/getProjectConfig-test.js index 6061498eb..5dae615c6 100644 --- a/packages/cli/src/tools/__tests__/android/getProjectConfig-test.js +++ b/packages/platform-android/src/config/__tests__/getProjectConfig-test.js @@ -8,14 +8,14 @@ * @emails oncall+javascript_foundation */ -import mocks from '../../__fixtures__/android'; +import mocks from '../__fixtures__/android'; jest.mock('path'); jest.mock('fs'); const fs = require('fs'); -const getProjectConfig = require('../../android').projectConfig; +const getProjectConfig = require('../').projectConfig; describe('android::getProjectConfig', () => { beforeAll(() => { diff --git a/packages/cli/src/tools/__tests__/android/readManifest-test.js b/packages/platform-android/src/config/__tests__/readManifest-test.js similarity index 85% rename from packages/cli/src/tools/__tests__/android/readManifest-test.js rename to packages/platform-android/src/config/__tests__/readManifest-test.js index 58c00d9e0..5aaa7dea3 100644 --- a/packages/cli/src/tools/__tests__/android/readManifest-test.js +++ b/packages/platform-android/src/config/__tests__/readManifest-test.js @@ -8,9 +8,9 @@ * @emails oncall+javascript_foundation */ -import findManifest from '../../android/findManifest'; -import readManifest from '../../android/readManifest'; -import mocks from '../../__fixtures__/android'; +import findManifest from '../findManifest'; +import readManifest from '../readManifest'; +import mocks from '../__fixtures__/android'; jest.mock('path'); jest.mock('fs'); diff --git a/packages/cli/src/tools/android/findAndroidAppFolder.js b/packages/platform-android/src/config/findAndroidAppFolder.js similarity index 100% rename from packages/cli/src/tools/android/findAndroidAppFolder.js rename to packages/platform-android/src/config/findAndroidAppFolder.js diff --git a/packages/cli/src/tools/android/findManifest.js b/packages/platform-android/src/config/findManifest.js similarity index 100% rename from packages/cli/src/tools/android/findManifest.js rename to packages/platform-android/src/config/findManifest.js diff --git a/packages/cli/src/tools/android/findPackageClassName.js b/packages/platform-android/src/config/findPackageClassName.js similarity index 100% rename from packages/cli/src/tools/android/findPackageClassName.js rename to packages/platform-android/src/config/findPackageClassName.js diff --git a/packages/cli/src/tools/android/index.js b/packages/platform-android/src/config/index.js similarity index 96% rename from packages/cli/src/tools/android/index.js rename to packages/platform-android/src/config/index.js index 4fa788a18..c2534ddce 100644 --- a/packages/cli/src/tools/android/index.js +++ b/packages/platform-android/src/config/index.js @@ -12,9 +12,6 @@ import findAndroidAppFolder from './findAndroidAppFolder'; import findManifest from './findManifest'; import findPackageClassName from './findPackageClassName'; import readManifest from './readManifest'; -import linkConfigAndroid from '../../commands/link/android'; - -export const linkConfig = linkConfigAndroid; const getPackageName = manifest => manifest.attr.package; diff --git a/packages/cli/src/tools/android/readManifest.js b/packages/platform-android/src/config/readManifest.js similarity index 100% rename from packages/cli/src/tools/android/readManifest.js rename to packages/platform-android/src/config/readManifest.js diff --git a/packages/platform-android/src/index.js b/packages/platform-android/src/index.js new file mode 100644 index 000000000..88ea2ac7e --- /dev/null +++ b/packages/platform-android/src/index.js @@ -0,0 +1,8 @@ +/** + * @flow + * + * Android platform files + */ + +export {default as linkConfig} from './link'; +export {projectConfig, dependencyConfig} from './config'; diff --git a/packages/cli/src/commands/link/__fixtures__/android/patchedBuild.gradle b/packages/platform-android/src/link/__fixtures__/patchedBuild.gradle similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/android/patchedBuild.gradle rename to packages/platform-android/src/link/__fixtures__/patchedBuild.gradle diff --git a/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js b/packages/platform-android/src/link/__tests__/isInstalled-test.js similarity index 85% rename from packages/cli/src/commands/link/__tests__/android/isInstalled-test.js rename to packages/platform-android/src/link/__tests__/isInstalled-test.js index 151ed63d9..f5ada2908 100644 --- a/packages/cli/src/commands/link/__tests__/android/isInstalled-test.js +++ b/packages/platform-android/src/link/__tests__/isInstalled-test.js @@ -8,15 +8,12 @@ * @emails oncall+javascript_foundation */ -import isInstalled from '../../android/isInstalled'; +import isInstalled from '../isInstalled'; const path = require('path'); const projectConfig = { - buildGradlePath: path.join( - __dirname, - '../../__fixtures__/android/patchedBuild.gradle', - ), + buildGradlePath: path.join(__dirname, '../__fixtures__/patchedBuild.gradle'), }; describe('android::isInstalled', () => { diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/platform-android/src/link/copyAssets.js similarity index 91% rename from packages/cli/src/commands/link/android/copyAssets.js rename to packages/platform-android/src/link/copyAssets.js index 1f475fcdb..dcc61e2d2 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/platform-android/src/link/copyAssets.js @@ -9,8 +9,7 @@ import fs from 'fs-extra'; import path from 'path'; -import groupFilesByType from '../groupFilesByType'; -import logger from '../../../tools/logger'; +import {logger, groupFilesByType} from '@react-native-community/cli-tools'; /** * Copies each file from an array of assets provided to targetPath directory diff --git a/packages/cli/src/commands/link/android/index.js b/packages/platform-android/src/link/index.js similarity index 100% rename from packages/cli/src/commands/link/android/index.js rename to packages/platform-android/src/link/index.js diff --git a/packages/cli/src/commands/link/android/isInstalled.js b/packages/platform-android/src/link/isInstalled.js similarity index 100% rename from packages/cli/src/commands/link/android/isInstalled.js rename to packages/platform-android/src/link/isInstalled.js diff --git a/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js b/packages/platform-android/src/link/patches/__tests__/applyPatch-test.js similarity index 89% rename from packages/cli/src/commands/link/__tests__/android/applyPatch-test.js rename to packages/platform-android/src/link/patches/__tests__/applyPatch-test.js index a088303ff..55a5ec5a6 100644 --- a/packages/cli/src/commands/link/__tests__/android/applyPatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/applyPatch-test.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import applyParams from '../../android/patches/applyParams'; +import applyParams from '../applyParams'; describe('applyParams', () => { it('apply params to the string', () => { diff --git a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js b/packages/platform-android/src/link/patches/__tests__/makeBuildPatch-test.js similarity index 84% rename from packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js rename to packages/platform-android/src/link/patches/__tests__/makeBuildPatch-test.js index 2e4fb76a1..4663e8e3b 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeBuildPatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/makeBuildPatch-test.js @@ -8,20 +8,17 @@ * @emails oncall+javascript_foundation */ -import makeBuildPatch from '../../android/patches/makeBuildPatch'; -import normalizeProjectName from '../../android/patches/normalizeProjectName'; +import makeBuildPatch from '../makeBuildPatch'; +import normalizeProjectName from '../normalizeProjectName'; import path from 'path'; -const projectConfig = { - buildGradlePath: path.join( - __dirname, - '../../__fixtures__/android/patchedBuild.gradle', - ), -}; - const name = 'test'; const scopedName = '@scoped/test'; const normalizedScopedName = normalizeProjectName('@scoped/test'); +const buildGradlePath = path.join( + __dirname, + '../../__fixtures__/patchedBuild.gradle', +); describe('makeBuildPatch', () => { it('should build a patch function', () => { @@ -51,7 +48,7 @@ describe('makeBuildPatch', () => { ])( 'properly detects the patch string of project %p in build.gradle', (project, projectPatchString) => { - expect(makeBuildPatch(project, projectConfig.buildGradlePath).patch).toBe( + expect(makeBuildPatch(project, buildGradlePath).patch).toBe( projectPatchString, ); }, diff --git a/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js b/packages/platform-android/src/link/patches/__tests__/makeImportPatch-test.js similarity index 90% rename from packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js rename to packages/platform-android/src/link/patches/__tests__/makeImportPatch-test.js index 13de71114..fdbac3413 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeImportPatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/makeImportPatch-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -import makeImportPatch from '../../android/patches/makeImportPatch'; +import makeImportPatch from '../makeImportPatch'; const packageImportPath = 'import some.example.project'; diff --git a/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js b/packages/platform-android/src/link/patches/__tests__/makePackagePatch-test.js similarity index 86% rename from packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js rename to packages/platform-android/src/link/patches/__tests__/makePackagePatch-test.js index 457426497..681b19a2b 100644 --- a/packages/cli/src/commands/link/__tests__/android/makePackagePatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/makePackagePatch-test.js @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import makePackagePatch from '../../android/patches/makePackagePatch'; -import applyParams from '../../android/patches/applyParams'; +import makePackagePatch from '../makePackagePatch'; +import applyParams from '../applyParams'; const packageInstance = "new SomeLibrary(${foo}, ${bar}, 'something')"; const name = 'some-library'; diff --git a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js b/packages/platform-android/src/link/patches/__tests__/makeSettingsPatch-test.js similarity index 94% rename from packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js rename to packages/platform-android/src/link/patches/__tests__/makeSettingsPatch-test.js index d21bd0b6f..aa7cdd014 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeSettingsPatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/makeSettingsPatch-test.js @@ -7,7 +7,7 @@ * @flow */ -import makeSettingsPatch from '../../android/patches/makeSettingsPatch'; +import makeSettingsPatch from '../makeSettingsPatch'; const projectConfig = { sourceDir: '/home/project/android/app', @@ -51,8 +51,7 @@ project(':test').projectDir = new File(rootProject.projectDir, '../node_modules/ return path; }); // eslint-disable-next-line no-shadow - const makeSettingsPatch = require('../../android/patches/makeSettingsPatch') - .default; + const makeSettingsPatch = require('../makeSettingsPatch').default; const projectConfigWindows = { sourceDir: 'C:\\home\\project\\android\\app', settingsGradlePath: 'C:\\home\\project\\android\\settings.gradle', diff --git a/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js b/packages/platform-android/src/link/patches/__tests__/makeStringsPatch-test.js similarity index 90% rename from packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js rename to packages/platform-android/src/link/patches/__tests__/makeStringsPatch-test.js index f62b9c191..0186de375 100644 --- a/packages/cli/src/commands/link/__tests__/android/makeStringsPatch-test.js +++ b/packages/platform-android/src/link/patches/__tests__/makeStringsPatch-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -import makeStringsPatch from '../../android/patches/makeStringsPatch'; +import makeStringsPatch from '../makeStringsPatch'; describe('makeStringsPatch', () => { it('should export a patch with element', () => { diff --git a/packages/cli/src/commands/link/__tests__/android/normalizeProjectName-test.js b/packages/platform-android/src/link/patches/__tests__/normalizeProjectName-test.js similarity index 87% rename from packages/cli/src/commands/link/__tests__/android/normalizeProjectName-test.js rename to packages/platform-android/src/link/patches/__tests__/normalizeProjectName-test.js index 27792874a..69443035e 100644 --- a/packages/cli/src/commands/link/__tests__/android/normalizeProjectName-test.js +++ b/packages/platform-android/src/link/patches/__tests__/normalizeProjectName-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -import normalizeProjectName from '../../android/patches/normalizeProjectName'; +import normalizeProjectName from '../normalizeProjectName'; const name = 'test'; const scopedName = '@scoped/test'; diff --git a/packages/cli/src/commands/link/android/patches/applyParams.js b/packages/platform-android/src/link/patches/applyParams.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/applyParams.js rename to packages/platform-android/src/link/patches/applyParams.js diff --git a/packages/cli/src/commands/link/android/patches/applyPatch.js b/packages/platform-android/src/link/patches/applyPatch.js similarity index 89% rename from packages/cli/src/commands/link/android/patches/applyPatch.js rename to packages/platform-android/src/link/patches/applyPatch.js index 704646ebd..94f3e6630 100644 --- a/packages/cli/src/commands/link/android/patches/applyPatch.js +++ b/packages/platform-android/src/link/patches/applyPatch.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function applyPatch(file, patch) { if (file) { diff --git a/packages/cli/src/commands/link/android/patches/makeBuildPatch.js b/packages/platform-android/src/link/patches/makeBuildPatch.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/makeBuildPatch.js rename to packages/platform-android/src/link/patches/makeBuildPatch.js diff --git a/packages/cli/src/commands/link/android/patches/makeImportPatch.js b/packages/platform-android/src/link/patches/makeImportPatch.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/makeImportPatch.js rename to packages/platform-android/src/link/patches/makeImportPatch.js diff --git a/packages/cli/src/commands/link/android/patches/makePackagePatch.js b/packages/platform-android/src/link/patches/makePackagePatch.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/makePackagePatch.js rename to packages/platform-android/src/link/patches/makePackagePatch.js diff --git a/packages/cli/src/commands/link/android/patches/makeSettingsPatch.js b/packages/platform-android/src/link/patches/makeSettingsPatch.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/makeSettingsPatch.js rename to packages/platform-android/src/link/patches/makeSettingsPatch.js diff --git a/packages/cli/src/commands/link/android/patches/makeStringsPatch.js b/packages/platform-android/src/link/patches/makeStringsPatch.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/makeStringsPatch.js rename to packages/platform-android/src/link/patches/makeStringsPatch.js diff --git a/packages/cli/src/commands/link/android/patches/normalizeProjectName.js b/packages/platform-android/src/link/patches/normalizeProjectName.js similarity index 100% rename from packages/cli/src/commands/link/android/patches/normalizeProjectName.js rename to packages/platform-android/src/link/patches/normalizeProjectName.js diff --git a/packages/cli/src/commands/link/android/patches/revokePatch.js b/packages/platform-android/src/link/patches/revokePatch.js similarity index 88% rename from packages/cli/src/commands/link/android/patches/revokePatch.js rename to packages/platform-android/src/link/patches/revokePatch.js index ca0fb753d..ccf9eaaaf 100644 --- a/packages/cli/src/commands/link/android/patches/revokePatch.js +++ b/packages/platform-android/src/link/patches/revokePatch.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function revokePatch(file, patch) { if (file) { diff --git a/packages/cli/src/commands/link/android/registerNativeModule.js b/packages/platform-android/src/link/registerNativeModule.js similarity index 100% rename from packages/cli/src/commands/link/android/registerNativeModule.js rename to packages/platform-android/src/link/registerNativeModule.js diff --git a/packages/cli/src/commands/link/android/unlinkAssets.js b/packages/platform-android/src/link/unlinkAssets.js similarity index 90% rename from packages/cli/src/commands/link/android/unlinkAssets.js rename to packages/platform-android/src/link/unlinkAssets.js index c15aa4c2c..33e256c94 100644 --- a/packages/cli/src/commands/link/android/unlinkAssets.js +++ b/packages/platform-android/src/link/unlinkAssets.js @@ -10,8 +10,7 @@ import fs from 'fs'; import path from 'path'; -import groupFilesByType from '../groupFilesByType'; -import logger from '../../../tools/logger'; +import {logger, groupFilesByType} from '@react-native-community/cli-tools'; /** * Copies each file from an array of assets provided to targetPath directory diff --git a/packages/cli/src/commands/link/android/unregisterNativeModule.js b/packages/platform-android/src/link/unregisterNativeModule.js similarity index 100% rename from packages/cli/src/commands/link/android/unregisterNativeModule.js rename to packages/platform-android/src/link/unregisterNativeModule.js diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json new file mode 100644 index 000000000..2451b7048 --- /dev/null +++ b/packages/platform-ios/package.json @@ -0,0 +1,8 @@ +{ + "name": "@react-native-community/cli-platform-ios", + "version": "2.0.0-alpha.3", + "main": "build/index.js", + "dependencies": { + "@react-native-community/cli-tools": "2.0.0-alpha.3" + } +} diff --git a/packages/platform-ios/src/config/__fixtures__/files/project.pbxproj b/packages/platform-ios/src/config/__fixtures__/files/project.pbxproj new file mode 100644 index 000000000..b27d06606 --- /dev/null +++ b/packages/platform-ios/src/config/__fixtures__/files/project.pbxproj @@ -0,0 +1,804 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { +/* Begin PBXBuildFile section */ + 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; + 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; + 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; + 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; + 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; + 00E356F31AD99517003FC87E /* androidTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* androidTestTests.m */; }; + 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; + 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; + 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; + 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; + 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; + 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 672DE8B31B124B8088D0D29F /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5255B7628A54AC2A9B4B2A0 /* libBVLinearGradient.a */; }; + 68FEB18F24414EF981BD7940 /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 53C67FE8F7294B7A83790610 /* libCodePush.a */; }; + 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; + C6C437D070BA42D6BE39198B /* libRCTVideo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A7396DFBAFA4CA092E367F5 /* libRCTVideo.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RCTActionSheet; + }; + 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RCTGeolocation; + }; + 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 58B5115D1A9E6B3D00147676; + remoteInfo = RCTImage; + }; + 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 58B511DB1A9E6C8500147676; + remoteInfo = RCTNetwork; + }; + 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; + remoteInfo = RCTVibration; + }; + 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = androidTest; + }; + 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RCTSettings; + }; + 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3C86DF461ADF2C930047B81A; + remoteInfo = RCTWebSocket; + }; + 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; + remoteInfo = React; + }; + 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 134814201AA4EA6300B7C361; + remoteInfo = RCTLinking; + }; + 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 58B5119B1A9E6C1200147676; + remoteInfo = RCTText; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; + 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; + 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; + 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; + 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; + 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; + 00E356EE1AD99517003FC87E /* androidTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = androidTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 00E356F21AD99517003FC87E /* androidTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = androidTestTests.m; sourceTree = ""; }; + 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; + 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; + 13B07F961A680F5B00A75B9A /* androidTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = androidTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = androidTest/AppDelegate.h; sourceTree = ""; }; + 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = androidTest/AppDelegate.m; sourceTree = ""; }; + 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = androidTest/Images.xcassets; sourceTree = ""; }; + 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = androidTest/Info.plist; sourceTree = ""; }; + 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = androidTest/main.m; sourceTree = ""; }; + 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; + 53C67FE8F7294B7A83790610 /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libCodePush.a; sourceTree = ""; }; + 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; + 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + B5255B7628A54AC2A9B4B2A0 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = ""; }; + 467A6CBCB2164E7D9B673D4C /* CodePush.xcodeproj */ = {isa = PBXFileReference; name = "CodePush.xcodeproj"; path = "../node_modules/react-native-code-push/CodePush.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + FD7121847BA447D8B737F22A /* BVLinearGradient.xcodeproj */ = {isa = PBXFileReference; name = "BVLinearGradient.xcodeproj"; path = "../node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 409DA945815C46DEB4F254DB /* RCTVideo.xcodeproj */ = {isa = PBXFileReference; name = "RCTVideo.xcodeproj"; path = "../node_modules/react-native-video/RCTVideo.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 3A7396DFBAFA4CA092E367F5 /* libRCTVideo.a */ = {isa = PBXFileReference; name = "libRCTVideo.a"; path = "libRCTVideo.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 00E356EB1AD99517003FC87E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 146834051AC3E58100842450 /* libReact.a in Frameworks */, + 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, + 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, + 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, + 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, + 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, + 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, + 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, + 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, + 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, + 672DE8B31B124B8088D0D29F /* libBVLinearGradient.a in Frameworks */, + 68FEB18F24414EF981BD7940 /* libCodePush.a in Frameworks */, + C6C437D070BA42D6BE39198B /* libRCTVideo.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00C302A81ABCB8CE00DB3ED1 /* Products */ = { + isa = PBXGroup; + children = ( + 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, + ); + name = Products; + sourceTree = ""; + }; + 00C302B61ABCB90400DB3ED1 /* Products */ = { + isa = PBXGroup; + children = ( + 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, + ); + name = Products; + sourceTree = ""; + }; + 00C302BC1ABCB91800DB3ED1 /* Products */ = { + isa = PBXGroup; + children = ( + 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, + ); + name = Products; + sourceTree = ""; + }; + 00C302D41ABCB9D200DB3ED1 /* Products */ = { + isa = PBXGroup; + children = ( + 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, + ); + name = Products; + sourceTree = ""; + }; + 00C302E01ABCB9EE00DB3ED1 /* Products */ = { + isa = PBXGroup; + children = ( + 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, + ); + name = Products; + sourceTree = ""; + }; + 00E356EF1AD99517003FC87E /* androidTestTests */ = { + isa = PBXGroup; + children = ( + 00E356F21AD99517003FC87E /* androidTestTests.m */, + 00E356F01AD99517003FC87E /* Supporting Files */, + ); + path = androidTestTests; + sourceTree = ""; + }; + 00E356F01AD99517003FC87E /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 00E356F11AD99517003FC87E /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 139105B71AF99BAD00B5F7CC /* Products */ = { + isa = PBXGroup; + children = ( + 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, + ); + name = Products; + sourceTree = ""; + }; + 139FDEE71B06529A00C62182 /* Products */ = { + isa = PBXGroup; + children = ( + 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, + ); + name = Products; + sourceTree = ""; + }; + 13B07FAE1A68108700A75B9A /* androidTest */ = { + isa = PBXGroup; + children = ( + 008F07F21AC5B25A0029DE68 /* main.jsbundle */, + 13B07FAF1A68108700A75B9A /* AppDelegate.h */, + 13B07FB01A68108700A75B9A /* AppDelegate.m */, + 13B07FB51A68108700A75B9A /* Images.xcassets */, + 13B07FB61A68108700A75B9A /* Info.plist */, + 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, + 13B07FB71A68108700A75B9A /* main.m */, + ); + name = androidTest; + sourceTree = ""; + }; + 146834001AC3E56700842450 /* Products */ = { + isa = PBXGroup; + children = ( + 146834041AC3E56700842450 /* libReact.a */, + ); + name = Products; + sourceTree = ""; + }; + 78C398B11ACF4ADC00677621 /* Products */ = { + isa = PBXGroup; + children = ( + 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, + ); + name = Products; + sourceTree = ""; + }; + 832341AE1AAA6A7D00B99B32 /* Libraries */ = { + isa = PBXGroup; + children = ( + 146833FF1AC3E56700842450 /* React.xcodeproj */, + 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, + 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, + 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, + 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, + 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, + 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, + 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, + 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, + 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, + 467A6CBCB2164E7D9B673D4C /* CodePush.xcodeproj */, + FD7121847BA447D8B737F22A /* BVLinearGradient.xcodeproj */, + 409DA945815C46DEB4F254DB /* RCTVideo.xcodeproj */, + ); + name = Libraries; + sourceTree = ""; + }; + 832341B11AAA6A8300B99B32 /* Products */ = { + isa = PBXGroup; + children = ( + 832341B51AAA6A8300B99B32 /* libRCTText.a */, + ); + name = Products; + sourceTree = ""; + }; + 83CBB9F61A601CBA00E9B192 = { + isa = PBXGroup; + children = ( + 13B07FAE1A68108700A75B9A /* androidTest */, + 832341AE1AAA6A7D00B99B32 /* Libraries */, + 00E356EF1AD99517003FC87E /* androidTestTests */, + 83CBBA001A601CBA00E9B192 /* Products */, + ); + indentWidth = 2; + sourceTree = ""; + tabWidth = 2; + }; + 83CBBA001A601CBA00E9B192 /* Products */ = { + isa = PBXGroup; + children = ( + 13B07F961A680F5B00A75B9A /* androidTest.app */, + 00E356EE1AD99517003FC87E /* androidTestTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 00E356ED1AD99517003FC87E /* androidTestTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "androidTestTests" */; + buildPhases = ( + 00E356EA1AD99517003FC87E /* Sources */, + 00E356EB1AD99517003FC87E /* Frameworks */, + 00E356EC1AD99517003FC87E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 00E356F51AD99517003FC87E /* PBXTargetDependency */, + ); + name = androidTestTests; + productName = androidTestTests; + productReference = 00E356EE1AD99517003FC87E /* androidTestTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 13B07F861A680F5B00A75B9A /* androidTest */ = { + isa = PBXNativeTarget; + buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "androidTest" */; + buildPhases = ( + 13B07F871A680F5B00A75B9A /* Sources */, + 13B07F8C1A680F5B00A75B9A /* Frameworks */, + 13B07F8E1A680F5B00A75B9A /* Resources */, + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = androidTest; + productName = "Hello World"; + productReference = 13B07F961A680F5B00A75B9A /* androidTest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83CBB9F71A601CBA00E9B192 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 610; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 00E356ED1AD99517003FC87E = { + CreatedOnToolsVersion = 6.2; + TestTargetID = 13B07F861A680F5B00A75B9A; + }; + }; + }; + buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "androidTest" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 83CBB9F61A601CBA00E9B192; + productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; + ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; + }, + { + ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; + ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; + }, + { + ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; + ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; + }, + { + ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; + ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; + }, + { + ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; + ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; + }, + { + ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; + ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; + }, + { + ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; + ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; + }, + { + ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; + ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; + }, + { + ProductGroup = 139FDEE71B06529A00C62182 /* Products */; + ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + }, + { + ProductGroup = 146834001AC3E56700842450 /* Products */; + ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 13B07F861A680F5B00A75B9A /* androidTest */, + 00E356ED1AD99517003FC87E /* androidTestTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTActionSheet.a; + remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTGeolocation.a; + remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTImage.a; + remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTNetwork.a; + remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTVibration.a; + remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTSettings.a; + remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTWebSocket.a; + remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 146834041AC3E56700842450 /* libReact.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libReact.a; + remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTLinking.a; + remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTText.a; + remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 00E356EC1AD99517003FC87E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F8E1A680F5B00A75B9A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, + 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Bundle React Native code and images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "../node_modules/react-native/scripts/react-native-xcode.sh"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 00E356EA1AD99517003FC87E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00E356F31AD99517003FC87E /* androidTestTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F871A680F5B00A75B9A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, + 13B07FC11A68108700A75B9A /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* androidTest */; + targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 13B07FB21A68108700A75B9A /* Base */, + ); + name = LaunchScreen.xib; + path = androidTest; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 00E356F61AD99517003FC87E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = androidTestTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/androidTest.app/androidTest"; + }; + name = Debug; + }; + 00E356F71AD99517003FC87E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = androidTestTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/androidTest.app/androidTest"; + }; + name = Release; + }; + 13B07F941A680F5B00A75B9A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEAD_CODE_STRIPPING = NO; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)", + "$(SRCROOT)/../node_modules/react-native-code-push", + "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", + "$(SRCROOT)/../node_modules/react-native-video", + ); + INFOPLIST_FILE = androidTest/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = androidTest; + }; + name = Debug; + }; + 13B07F951A680F5B00A75B9A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)", + "$(SRCROOT)/../node_modules/react-native-code-push", + "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", + "$(SRCROOT)/../node_modules/react-native-video", + ); + INFOPLIST_FILE = androidTest/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = androidTest; + }; + name = Release; + }; + 83CBBA201A601CBA00E9B192 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)", + "$(SRCROOT)/../node_modules/react-native-code-push", + "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", + "$(SRCROOT)/../node_modules/react-native-video", + ); + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 83CBBA211A601CBA00E9B192 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)", + "$(SRCROOT)/../node_modules/react-native-code-push", + "$(SRCROOT)/../node_modules/react-native-linear-gradient/**", + "$(SRCROOT)/../node_modules/react-native-video", + ); + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "androidTestTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00E356F61AD99517003FC87E /* Debug */, + 00E356F71AD99517003FC87E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "androidTest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 13B07F941A680F5B00A75B9A /* Debug */, + 13B07F951A680F5B00A75B9A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "androidTest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83CBBA201A601CBA00E9B192 /* Debug */, + 83CBBA211A601CBA00E9B192 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; +} diff --git a/packages/platform-ios/src/config/__fixtures__/projects.js b/packages/platform-ios/src/config/__fixtures__/projects.js new file mode 100644 index 000000000..b347fcae0 --- /dev/null +++ b/packages/platform-ios/src/config/__fixtures__/projects.js @@ -0,0 +1,45 @@ +/** + * @flow + */ + +const path = jest.requireActual('path'); +const fs = jest.requireActual('fs'); + +const ios = { + 'demoProject.xcodeproj': { + 'project.pbxproj': fs.readFileSync( + path.join(__dirname, './files/project.pbxproj'), + ), + }, +}; + +const iosPod = { + 'demoProject.xcodeproj': { + 'project.pbxproj': fs.readFileSync( + path.join(__dirname, './files/project.pbxproj'), + ), + }, + 'TestPod.podspec': 'empty', +}; + +export const flat = { + ios, +}; + +export const nested = { + ios, +}; + +export const withExamples = { + Examples: flat, + ios, +}; + +export const withPods = { + Podfile: 'content', + ios: iosPod, +}; + +export const withoutPods = { + ios, +}; diff --git a/packages/platform-ios/src/config/__tests__/findPodfilePath-test.js b/packages/platform-ios/src/config/__tests__/findPodfilePath-test.js new file mode 100644 index 000000000..f3da6da8e --- /dev/null +++ b/packages/platform-ios/src/config/__tests__/findPodfilePath-test.js @@ -0,0 +1,19 @@ +import findPodfilePath from '../findPodfilePath'; +import * as projects from '../__fixtures__/projects'; + +jest.mock('path'); +jest.mock('fs'); + +const fs = require('fs'); + +describe('ios::findPodfilePath', () => { + it('returns null if there is no Podfile', () => { + fs.__setMockFilesystem(projects.withoutPods); + expect(findPodfilePath('')).toBeNull(); + }); + + it('returns Podfile path if it exists', () => { + fs.__setMockFilesystem(projects.withPods); + expect(findPodfilePath('/ios')).toContain('Podfile'); + }); +}); diff --git a/packages/cli/src/tools/__tests__/ios/findPodspecName-test.js b/packages/platform-ios/src/config/__tests__/findPodspecName-test.js similarity index 86% rename from packages/cli/src/tools/__tests__/ios/findPodspecName-test.js rename to packages/platform-ios/src/config/__tests__/findPodspecName-test.js index a6a5d157e..7a1c1600d 100644 --- a/packages/cli/src/tools/__tests__/ios/findPodspecName-test.js +++ b/packages/platform-ios/src/config/__tests__/findPodspecName-test.js @@ -8,9 +8,8 @@ * @emails oncall+javascript_foundation */ -import findPodspecName from '../../ios/findPodspecName'; -import projects from '../../__fixtures__/projects'; -import ios from '../../__fixtures__/ios'; +import findPodspecName from '../findPodspecName'; +import * as projects from '../__fixtures__/projects'; jest.mock('path'); jest.mock('fs'); @@ -24,7 +23,7 @@ describe('ios::findPodspecName', () => { }); it('returns podspec name if only one exists', () => { - fs.__setMockFilesystem(ios.pod); + fs.__setMockFilesystem(projects.withPods.ios); expect(findPodspecName('/')).toBe('TestPod'); }); diff --git a/packages/cli/src/tools/__tests__/ios/findProject-test.js b/packages/platform-ios/src/config/__tests__/findProject-test.js similarity index 87% rename from packages/cli/src/tools/__tests__/ios/findProject-test.js rename to packages/platform-ios/src/config/__tests__/findProject-test.js index 0b490a053..8c5e029e7 100644 --- a/packages/cli/src/tools/__tests__/ios/findProject-test.js +++ b/packages/platform-ios/src/config/__tests__/findProject-test.js @@ -8,9 +8,8 @@ * @emails oncall+javascript_foundation */ -import findProject from '../../ios/findProject'; -import projects from '../../__fixtures__/projects'; -import ios from '../../__fixtures__/ios'; +import findProject from '../findProject'; +import * as projects from '../__fixtures__/projects'; jest.mock('path'); jest.mock('fs'); @@ -28,11 +27,6 @@ describe('ios::findProject', () => { expect(findProject('/')).toBeNull(); }); - it('returns ios project regardless of its name', () => { - fs.__setMockFilesystem({ios: ios.validTestName}); - expect(findProject('/')).not.toBeNull(); - }); - it('ignores node_modules', () => { fs.__setMockFilesystem({node_modules: projects.flat}); expect(findProject('/')).toBeNull(); diff --git a/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js b/packages/platform-ios/src/config/__tests__/getProjectConfig-test.js similarity index 91% rename from packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js rename to packages/platform-ios/src/config/__tests__/getProjectConfig-test.js index cd51f654c..e804796c3 100644 --- a/packages/cli/src/tools/__tests__/ios/getProjectConfig-test.js +++ b/packages/platform-ios/src/config/__tests__/getProjectConfig-test.js @@ -8,14 +8,14 @@ * @emails oncall+javascript_foundation */ -import projects from '../../__fixtures__/projects'; +import * as projects from '../__fixtures__/projects'; jest.mock('path'); jest.mock('fs'); const fs = require('fs'); -const getProjectConfig = require('../../ios').projectConfig; +const getProjectConfig = require('../').projectConfig; describe('ios::getProjectConfig', () => { const userConfig = {}; diff --git a/packages/cli/src/tools/ios/findPodfilePath.js b/packages/platform-ios/src/config/findPodfilePath.js similarity index 100% rename from packages/cli/src/tools/ios/findPodfilePath.js rename to packages/platform-ios/src/config/findPodfilePath.js diff --git a/packages/cli/src/tools/ios/findPodspecName.js b/packages/platform-ios/src/config/findPodspecName.js similarity index 100% rename from packages/cli/src/tools/ios/findPodspecName.js rename to packages/platform-ios/src/config/findPodspecName.js diff --git a/packages/cli/src/tools/ios/findProject.js b/packages/platform-ios/src/config/findProject.js similarity index 100% rename from packages/cli/src/tools/ios/findProject.js rename to packages/platform-ios/src/config/findProject.js diff --git a/packages/cli/src/tools/ios/index.js b/packages/platform-ios/src/config/index.js similarity index 94% rename from packages/cli/src/tools/ios/index.js rename to packages/platform-ios/src/config/index.js index 6e0c537c9..bd33aa754 100644 --- a/packages/cli/src/tools/ios/index.js +++ b/packages/platform-ios/src/config/index.js @@ -11,9 +11,6 @@ import path from 'path'; import findProject from './findProject'; import findPodfilePath from './findPodfilePath'; import findPodspecName from './findPodspecName'; -import linkConfigIos from '../../commands/link/ios'; - -export const linkConfig = linkConfigIos; /** * For libraries specified without an extension, add '.tbd' for those that diff --git a/packages/platform-ios/src/index.js b/packages/platform-ios/src/index.js new file mode 100644 index 000000000..b0da4421c --- /dev/null +++ b/packages/platform-ios/src/index.js @@ -0,0 +1,8 @@ +/** + * @flow + * + * iOS platform files + */ + +export {default as linkConfig} from './link'; +export {projectConfig, dependencyConfig} from './config'; diff --git a/packages/platform-ios/src/link-pods/__fixtures__/Info.plist b/packages/platform-ios/src/link-pods/__fixtures__/Info.plist new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/commands/link/__fixtures__/pods/PodfileSimple b/packages/platform-ios/src/link-pods/__fixtures__/PodfileSimple similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/pods/PodfileSimple rename to packages/platform-ios/src/link-pods/__fixtures__/PodfileSimple diff --git a/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithFunction b/packages/platform-ios/src/link-pods/__fixtures__/PodfileWithFunction similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/pods/PodfileWithFunction rename to packages/platform-ios/src/link-pods/__fixtures__/PodfileWithFunction diff --git a/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithMarkers b/packages/platform-ios/src/link-pods/__fixtures__/PodfileWithMarkers similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/pods/PodfileWithMarkers rename to packages/platform-ios/src/link-pods/__fixtures__/PodfileWithMarkers diff --git a/packages/cli/src/commands/link/__fixtures__/pods/PodfileWithTarget b/packages/platform-ios/src/link-pods/__fixtures__/PodfileWithTarget similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/pods/PodfileWithTarget rename to packages/platform-ios/src/link-pods/__fixtures__/PodfileWithTarget diff --git a/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js b/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js similarity index 84% rename from packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js rename to packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js index 7c76885fc..245190d01 100644 --- a/packages/cli/src/commands/link/__tests__/pods/findLineToAddPod-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js @@ -8,17 +8,17 @@ * @emails oncall+javascript_foundation */ -import findLineToAddPod from '../../pods/findLineToAddPod'; -import readPodfile from '../../pods/readPodfile'; +import findLineToAddPod from '../findLineToAddPod'; +import readPodfile from '../readPodfile'; const path = require('path'); -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); +const PODFILES_PATH = path.join(__dirname, '../__fixtures__/'); const LINE_AFTER_TARGET_IN_TEST_PODFILE = 4; - +console.log(PODFILES_PATH); describe('pods::findLineToAddPod', () => { it('returns null if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); + const podfile = readPodfile(path.join(PODFILES_PATH, 'Info.plist')); expect( findLineToAddPod(podfile, LINE_AFTER_TARGET_IN_TEST_PODFILE), ).toBeNull(); diff --git a/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js b/packages/platform-ios/src/link-pods/__tests__/findMarkedLinesInPodfile-test.js similarity index 80% rename from packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js rename to packages/platform-ios/src/link-pods/__tests__/findMarkedLinesInPodfile-test.js index ae98a21c3..43b52ecfc 100644 --- a/packages/cli/src/commands/link/__tests__/pods/findMarkedLinesInPodfile-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/findMarkedLinesInPodfile-test.js @@ -8,17 +8,17 @@ * @emails oncall+javascript_foundation */ -import readPodfile from '../../pods/readPodfile'; -import findMarkedLinesInPodfile from '../../pods/findMarkedLinesInPodfile'; +import readPodfile from '../readPodfile'; +import findMarkedLinesInPodfile from '../findMarkedLinesInPodfile'; const path = require('path'); -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); +const PODFILES_PATH = path.join(__dirname, '../__fixtures__'); const LINE_AFTER_TARGET_IN_TEST_PODFILE = 4; describe('pods::findMarkedLinesInPodfile', () => { it('returns empty array if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); + const podfile = readPodfile(path.join(PODFILES_PATH, 'Info.plist')); expect(findMarkedLinesInPodfile(podfile)).toEqual([]); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/findPodTargetLine-test.js b/packages/platform-ios/src/link-pods/__tests__/findPodTargetLine-test.js similarity index 77% rename from packages/cli/src/commands/link/__tests__/pods/findPodTargetLine-test.js rename to packages/platform-ios/src/link-pods/__tests__/findPodTargetLine-test.js index 86988fb38..8c45c7871 100644 --- a/packages/cli/src/commands/link/__tests__/pods/findPodTargetLine-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/findPodTargetLine-test.js @@ -8,16 +8,16 @@ * @emails oncall+javascript_foundation */ -import findPodTargetLine from '../../pods/findPodTargetLine'; -import readPodfile from '../../pods/readPodfile'; +import findPodTargetLine from '../findPodTargetLine'; +import readPodfile from '../readPodfile'; const path = require('path'); -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); +const PODFILES_PATH = path.join(__dirname, '../__fixtures__'); describe('pods::findPodTargetLine', () => { it('returns null if file is not Podfile', () => { - const podfile = readPodfile(path.join(PODFILES_PATH, '../Info.plist')); + const podfile = readPodfile(path.join(PODFILES_PATH, 'Info.plist')); expect(findPodTargetLine(podfile, 'name')).toBeNull(); }); diff --git a/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js b/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js similarity index 91% rename from packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js rename to packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js index f0538bfb0..0f66648f6 100644 --- a/packages/cli/src/commands/link/__tests__/pods/isInstalled-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js @@ -8,11 +8,11 @@ * @emails oncall+javascript_foundation */ -import isInstalled from '../../pods/isInstalled'; +import isInstalled from '../isInstalled'; const path = require('path'); -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); +const PODFILES_PATH = path.join(__dirname, '../__fixtures__/'); describe('pods::isInstalled', () => { it('returns false if pod is missing', () => { diff --git a/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js b/packages/platform-ios/src/link-pods/__tests__/removePodEntry-test.js similarity index 89% rename from packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js rename to packages/platform-ios/src/link-pods/__tests__/removePodEntry-test.js index b980cc2a9..525fc0422 100644 --- a/packages/cli/src/commands/link/__tests__/pods/removePodEntry-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/removePodEntry-test.js @@ -8,12 +8,12 @@ * @emails oncall+javascript_foundation */ -import removePodEntry from '../../pods/removePodEntry'; -import readPodfile from '../../pods/readPodfile'; +import removePodEntry from '../removePodEntry'; +import readPodfile from '../readPodfile'; const path = require('path'); -const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods'); +const PODFILES_PATH = path.join(__dirname, '../__fixtures__/'); describe('pods::removePodEntry', () => { it('should remove one line from Podfile with TestPod', () => { diff --git a/packages/cli/src/commands/link/pods/addPodEntry.js b/packages/platform-ios/src/link-pods/addPodEntry.js similarity index 94% rename from packages/cli/src/commands/link/pods/addPodEntry.js rename to packages/platform-ios/src/link-pods/addPodEntry.js index e1040759d..d22d088ba 100644 --- a/packages/cli/src/commands/link/pods/addPodEntry.js +++ b/packages/platform-ios/src/link-pods/addPodEntry.js @@ -7,7 +7,7 @@ * @format */ -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function addPodEntry( podLines, diff --git a/packages/cli/src/commands/link/pods/findLineToAddPod.js b/packages/platform-ios/src/link-pods/findLineToAddPod.js similarity index 100% rename from packages/cli/src/commands/link/pods/findLineToAddPod.js rename to packages/platform-ios/src/link-pods/findLineToAddPod.js diff --git a/packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js b/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js similarity index 100% rename from packages/cli/src/commands/link/pods/findMarkedLinesInPodfile.js rename to packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js diff --git a/packages/cli/src/commands/link/pods/findPodTargetLine.js b/packages/platform-ios/src/link-pods/findPodTargetLine.js similarity index 100% rename from packages/cli/src/commands/link/pods/findPodTargetLine.js rename to packages/platform-ios/src/link-pods/findPodTargetLine.js diff --git a/packages/cli/src/commands/link/pods/isInstalled.js b/packages/platform-ios/src/link-pods/isInstalled.js similarity index 100% rename from packages/cli/src/commands/link/pods/isInstalled.js rename to packages/platform-ios/src/link-pods/isInstalled.js diff --git a/packages/cli/src/commands/link/pods/readPodfile.js b/packages/platform-ios/src/link-pods/readPodfile.js similarity index 87% rename from packages/cli/src/commands/link/pods/readPodfile.js rename to packages/platform-ios/src/link-pods/readPodfile.js index 8dd419325..ab613e2e0 100644 --- a/packages/cli/src/commands/link/pods/readPodfile.js +++ b/packages/platform-ios/src/link-pods/readPodfile.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function readPodfile(podfilePath) { logger.debug(`Reading ${podfilePath}`); diff --git a/packages/cli/src/commands/link/pods/registerNativeModule.js b/packages/platform-ios/src/link-pods/registerNativeModule.js similarity index 100% rename from packages/cli/src/commands/link/pods/registerNativeModule.js rename to packages/platform-ios/src/link-pods/registerNativeModule.js diff --git a/packages/cli/src/commands/link/pods/removePodEntry.js b/packages/platform-ios/src/link-pods/removePodEntry.js similarity index 92% rename from packages/cli/src/commands/link/pods/removePodEntry.js rename to packages/platform-ios/src/link-pods/removePodEntry.js index eafa7b34f..75849636d 100644 --- a/packages/cli/src/commands/link/pods/removePodEntry.js +++ b/packages/platform-ios/src/link-pods/removePodEntry.js @@ -7,7 +7,7 @@ * @format */ -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function removePodEntry(podfileContent, podName) { // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1'] diff --git a/packages/cli/src/commands/link/pods/savePodFile.js b/packages/platform-ios/src/link-pods/savePodFile.js similarity index 88% rename from packages/cli/src/commands/link/pods/savePodFile.js rename to packages/platform-ios/src/link-pods/savePodFile.js index 4cfaba26e..aca383867 100644 --- a/packages/cli/src/commands/link/pods/savePodFile.js +++ b/packages/platform-ios/src/link-pods/savePodFile.js @@ -8,7 +8,7 @@ */ import fs from 'fs'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function savePodFile(podfilePath, podLines) { const newPodfile = podLines.join('\n'); diff --git a/packages/cli/src/commands/link/pods/unregisterNativeModule.js b/packages/platform-ios/src/link-pods/unregisterNativeModule.js similarity index 91% rename from packages/cli/src/commands/link/pods/unregisterNativeModule.js rename to packages/platform-ios/src/link-pods/unregisterNativeModule.js index 96abbd0e5..fc485fc93 100644 --- a/packages/cli/src/commands/link/pods/unregisterNativeModule.js +++ b/packages/platform-ios/src/link-pods/unregisterNativeModule.js @@ -9,7 +9,7 @@ import fs from 'fs'; import removePodEntry from './removePodEntry'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Unregister native module IOS with CocoaPods diff --git a/packages/cli/src/commands/link/__fixtures__/Info.plist b/packages/platform-ios/src/link/__fixtures__/Info.plist similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/Info.plist rename to packages/platform-ios/src/link/__fixtures__/Info.plist diff --git a/packages/cli/src/commands/link/__fixtures__/linearGradient.pbxproj b/packages/platform-ios/src/link/__fixtures__/linearGradient.pbxproj similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/linearGradient.pbxproj rename to packages/platform-ios/src/link/__fixtures__/linearGradient.pbxproj diff --git a/packages/cli/src/commands/link/__fixtures__/project.pbxproj b/packages/platform-ios/src/link/__fixtures__/project.pbxproj similarity index 100% rename from packages/cli/src/commands/link/__fixtures__/project.pbxproj rename to packages/platform-ios/src/link/__fixtures__/project.pbxproj diff --git a/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js b/packages/platform-ios/src/link/__tests__/addFileToProject-test.js similarity index 80% rename from packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js rename to packages/platform-ios/src/link/__tests__/addFileToProject-test.js index e318c9419..100f384fb 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addFileToProject-test.js +++ b/packages/platform-ios/src/link/__tests__/addFileToProject-test.js @@ -8,14 +8,14 @@ * @emails oncall+javascript_foundation */ -import addFileToProject from '../../ios/addFileToProject'; +import addFileToProject from '../addFileToProject'; const xcode = require('xcode'); const path = require('path'); const _ = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::addFileToProject', () => { @@ -26,7 +26,7 @@ describe('ios::addFileToProject', () => { it('should add file to a project', () => { const {fileRef} = addFileToProject( project, - '../../__fixtures__/linearGradient.pbxproj', + '../__fixtures__/linearGradient.pbxproj', ); expect( _.includes(Object.keys(project.pbxFileReferenceSection()), fileRef), diff --git a/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js b/packages/platform-ios/src/link/__tests__/addProjectToLibraries-test.js similarity index 86% rename from packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js rename to packages/platform-ios/src/link/__tests__/addProjectToLibraries-test.js index ee043e301..c6c173ec6 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addProjectToLibraries-test.js +++ b/packages/platform-ios/src/link/__tests__/addProjectToLibraries-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -import addProjectToLibraries from '../../ios/addProjectToLibraries'; +import addProjectToLibraries from '../addProjectToLibraries'; const xcode = require('xcode'); const path = require('path'); @@ -16,7 +16,7 @@ const PbxFile = require('xcode/lib/pbxFile'); const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::addProjectToLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js b/packages/platform-ios/src/link/__tests__/addSharedLibraries-test.js similarity index 89% rename from packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js rename to packages/platform-ios/src/link/__tests__/addSharedLibraries-test.js index d6bc90c89..9ce7e1a97 100644 --- a/packages/cli/src/commands/link/__tests__/ios/addSharedLibraries-test.js +++ b/packages/platform-ios/src/link/__tests__/addSharedLibraries-test.js @@ -8,14 +8,14 @@ * @emails oncall+javascript_foundation */ -import addSharedLibraries from '../../ios/addSharedLibraries'; -import getGroup from '../../ios/getGroup'; +import addSharedLibraries from '../addSharedLibraries'; +import getGroup from '../getGroup'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::addSharedLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js b/packages/platform-ios/src/link/__tests__/createGroup-test.js similarity index 91% rename from packages/cli/src/commands/link/__tests__/ios/createGroup-test.js rename to packages/platform-ios/src/link/__tests__/createGroup-test.js index da718cd0f..e23f2232f 100644 --- a/packages/cli/src/commands/link/__tests__/ios/createGroup-test.js +++ b/packages/platform-ios/src/link/__tests__/createGroup-test.js @@ -8,15 +8,15 @@ * @emails oncall+javascript_foundation */ -import createGroup from '../../ios/createGroup'; -import getGroup from '../../ios/getGroup'; +import createGroup from '../createGroup'; +import getGroup from '../getGroup'; const xcode = require('xcode'); const path = require('path'); const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::createGroup', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js b/packages/platform-ios/src/link/__tests__/getBuildProperty-test.js similarity index 83% rename from packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js rename to packages/platform-ios/src/link/__tests__/getBuildProperty-test.js index b66b2b98c..8b009acd1 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getBuildProperty-test.js +++ b/packages/platform-ios/src/link/__tests__/getBuildProperty-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import getBuildProperty from '../../ios/getBuildProperty'; +import getBuildProperty from '../getBuildProperty'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::getBuildProperty', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js b/packages/platform-ios/src/link/__tests__/getGroup-test.js similarity index 92% rename from packages/cli/src/commands/link/__tests__/ios/getGroup-test.js rename to packages/platform-ios/src/link/__tests__/getGroup-test.js index d100318d1..00aa02049 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getGroup-test.js +++ b/packages/platform-ios/src/link/__tests__/getGroup-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import getGroup from '../../ios/getGroup'; +import getGroup from '../getGroup'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::getGroup', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js b/packages/platform-ios/src/link/__tests__/getHeaderSearchPath-test.js similarity index 97% rename from packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js rename to packages/platform-ios/src/link/__tests__/getHeaderSearchPath-test.js index 0c0755f55..60e328528 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getHeaderSearchPath-test.js +++ b/packages/platform-ios/src/link/__tests__/getHeaderSearchPath-test.js @@ -8,7 +8,7 @@ * @emails oncall+javascript_foundation */ -import getHeaderSearchPath from '../../ios/getHeaderSearchPath'; +import getHeaderSearchPath from '../getHeaderSearchPath'; const path = require('path'); diff --git a/packages/cli/src/commands/link/__tests__/ios/getHeadersInFolder-test.js b/packages/platform-ios/src/link/__tests__/getHeadersInFolder-test.js similarity index 94% rename from packages/cli/src/commands/link/__tests__/ios/getHeadersInFolder-test.js rename to packages/platform-ios/src/link/__tests__/getHeadersInFolder-test.js index e356341b1..e55a46f1b 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getHeadersInFolder-test.js +++ b/packages/platform-ios/src/link/__tests__/getHeadersInFolder-test.js @@ -8,10 +8,11 @@ * @emails oncall+javascript_foundation */ -import getHeadersInFolder from '../../ios/getHeadersInFolder'; +import getHeadersInFolder from '../getHeadersInFolder'; jest.mock('fs'); jest.mock('path'); + const fs = require('fs'); const ROOT_DIR = '/'; diff --git a/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js b/packages/platform-ios/src/link/__tests__/getPlist-test.js similarity index 85% rename from packages/cli/src/commands/link/__tests__/ios/getPlist-test.js rename to packages/platform-ios/src/link/__tests__/getPlist-test.js index d28d06b2c..1bfa611b5 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getPlist-test.js +++ b/packages/platform-ios/src/link/__tests__/getPlist-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import getPlist from '../../ios/getPlist'; +import getPlist from '../getPlist'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::getPlist', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js b/packages/platform-ios/src/link/__tests__/getPlistPath-test.js similarity index 84% rename from packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js rename to packages/platform-ios/src/link/__tests__/getPlistPath-test.js index ff5b5f4ad..8a88f869f 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getPlistPath-test.js +++ b/packages/platform-ios/src/link/__tests__/getPlistPath-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import getPlistPath from '../../ios/getPlistPath'; +import getPlistPath from '../getPlistPath'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::getPlistPath', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js b/packages/platform-ios/src/link/__tests__/getTargets-test.js similarity index 86% rename from packages/cli/src/commands/link/__tests__/ios/getTargets-test.js rename to packages/platform-ios/src/link/__tests__/getTargets-test.js index a18758576..de704e6c5 100644 --- a/packages/cli/src/commands/link/__tests__/ios/getTargets-test.js +++ b/packages/platform-ios/src/link/__tests__/getTargets-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import getTargets from '../../ios/getTargets'; +import getTargets from '../getTargets'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::getTargets', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js b/packages/platform-ios/src/link/__tests__/hasLibraryImported-test.js similarity index 87% rename from packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js rename to packages/platform-ios/src/link/__tests__/hasLibraryImported-test.js index 0b2e9d32a..1256040cc 100644 --- a/packages/cli/src/commands/link/__tests__/ios/hasLibraryImported-test.js +++ b/packages/platform-ios/src/link/__tests__/hasLibraryImported-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import hasLibraryImported from '../../ios/hasLibraryImported'; +import hasLibraryImported from '../hasLibraryImported'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::hasLibraryImported', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js b/packages/platform-ios/src/link/__tests__/isInstalled-test.js similarity index 89% rename from packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js rename to packages/platform-ios/src/link/__tests__/isInstalled-test.js index eb51a9aef..65757214e 100644 --- a/packages/cli/src/commands/link/__tests__/ios/isInstalled-test.js +++ b/packages/platform-ios/src/link/__tests__/isInstalled-test.js @@ -8,12 +8,12 @@ * @emails oncall+javascript_foundation */ -import isInstalled from '../../ios/isInstalled'; +import isInstalled from '../isInstalled'; const path = require('path'); const baseProjectConfig = { - pbxprojPath: path.join(__dirname, '../../__fixtures__/project.pbxproj'), + pbxprojPath: path.join(__dirname, '../__fixtures__/project.pbxproj'), libraryFolder: 'Libraries', }; diff --git a/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js b/packages/platform-ios/src/link/__tests__/mapHeaderSearchPaths-test.js similarity index 89% rename from packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js rename to packages/platform-ios/src/link/__tests__/mapHeaderSearchPaths-test.js index b53e35f63..1d55ff318 100644 --- a/packages/cli/src/commands/link/__tests__/ios/mapHeaderSearchPaths-test.js +++ b/packages/platform-ios/src/link/__tests__/mapHeaderSearchPaths-test.js @@ -8,13 +8,13 @@ * @emails oncall+javascript_foundation */ -import mapHeaderSearchPaths from '../../ios/mapHeaderSearchPaths'; +import mapHeaderSearchPaths from '../mapHeaderSearchPaths'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::mapHeaderSearchPaths', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js b/packages/platform-ios/src/link/__tests__/removeProjectFromLibraries-test.js similarity index 81% rename from packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js rename to packages/platform-ios/src/link/__tests__/removeProjectFromLibraries-test.js index a56c57b66..62c5ae58b 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromLibraries-test.js +++ b/packages/platform-ios/src/link/__tests__/removeProjectFromLibraries-test.js @@ -8,8 +8,8 @@ * @emails oncall+javascript_foundation */ -import addProjectToLibraries from '../../ios/addProjectToLibraries'; -import removeProjectFromLibraries from '../../ios/removeProjectFromLibraries'; +import addProjectToLibraries from '../addProjectToLibraries'; +import removeProjectFromLibraries from '../removeProjectFromLibraries'; const xcode = require('xcode'); const PbxFile = require('xcode/lib/pbxFile'); @@ -17,7 +17,7 @@ const path = require('path'); const {last} = require('lodash'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::removeProjectFromLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js b/packages/platform-ios/src/link/__tests__/removeProjectFromProject-test.js similarity index 80% rename from packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js rename to packages/platform-ios/src/link/__tests__/removeProjectFromProject-test.js index c8164bc78..1a537395d 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeProjectFromProject-test.js +++ b/packages/platform-ios/src/link/__tests__/removeProjectFromProject-test.js @@ -8,17 +8,17 @@ * @emails oncall+javascript_foundation */ -import addFileToProject from '../../ios/addFileToProject'; -import removeProjectFromProject from '../../ios/removeProjectFromProject'; +import addFileToProject from '../addFileToProject'; +import removeProjectFromProject from '../removeProjectFromProject'; const xcode = require('xcode'); const pbxFile = require('xcode/lib/pbxFile'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); -const filePath = '../../__fixtures__/linearGradient.pbxproj'; +const filePath = '../__fixtures__/linearGradient.pbxproj'; describe('ios::addFileToProject', () => { beforeEach(() => { diff --git a/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js b/packages/platform-ios/src/link/__tests__/removeSharedLibrary-test.js similarity index 81% rename from packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js rename to packages/platform-ios/src/link/__tests__/removeSharedLibrary-test.js index e81639de7..edfd00cfe 100644 --- a/packages/cli/src/commands/link/__tests__/ios/removeSharedLibrary-test.js +++ b/packages/platform-ios/src/link/__tests__/removeSharedLibrary-test.js @@ -8,15 +8,15 @@ * @emails oncall+javascript_foundation */ -import addSharedLibraries from '../../ios/addSharedLibraries'; -import removeSharedLibraries from '../../ios/removeSharedLibraries'; -import getGroup from '../../ios/getGroup'; +import addSharedLibraries from '../addSharedLibraries'; +import removeSharedLibraries from '../removeSharedLibraries'; +import getGroup from '../getGroup'; const xcode = require('xcode'); const path = require('path'); const project = xcode.project( - path.join(__dirname, '../../__fixtures__/project.pbxproj'), + path.join(__dirname, '../__fixtures__/project.pbxproj'), ); describe('ios::removeSharedLibraries', () => { diff --git a/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js b/packages/platform-ios/src/link/__tests__/writePlist-test.js similarity index 81% rename from packages/cli/src/commands/link/__tests__/ios/writePlist-test.js rename to packages/platform-ios/src/link/__tests__/writePlist-test.js index c74582609..8fcf37c5f 100644 --- a/packages/cli/src/commands/link/__tests__/ios/writePlist-test.js +++ b/packages/platform-ios/src/link/__tests__/writePlist-test.js @@ -8,12 +8,12 @@ * @emails oncall+javascript_foundation */ -import getPlistPath from '../../ios/getPlistPath'; -import writePlist from '../../ios/writePlist'; +import getPlistPath from '../getPlistPath'; +import writePlist from '../writePlist'; jest.mock('path'); jest.mock('fs'); -jest.mock('../../ios/getPlistPath', () => jest.fn(() => null)); +jest.mock('../getPlistPath', () => jest.fn(() => null)); const {readFileSync} = jest.requireActual('fs'); const fs = require('fs'); @@ -21,11 +21,8 @@ const fs = require('fs'); const xcode = require('xcode'); const realPath = jest.requireActual('path'); -const projectPath = realPath.join( - __dirname, - '../../__fixtures__/project.pbxproj', -); -const infoPlistPath = realPath.join(__dirname, '../../__fixtures__/Info.plist'); +const projectPath = realPath.join(__dirname, '../__fixtures__/project.pbxproj'); +const infoPlistPath = realPath.join(__dirname, '../__fixtures__/Info.plist'); fs.readFileSync = jest.fn(() => readFileSync(projectPath).toString()); diff --git a/packages/cli/src/commands/link/ios/addFileToProject.js b/packages/platform-ios/src/link/addFileToProject.js similarity index 100% rename from packages/cli/src/commands/link/ios/addFileToProject.js rename to packages/platform-ios/src/link/addFileToProject.js diff --git a/packages/cli/src/commands/link/ios/addProjectToLibraries.js b/packages/platform-ios/src/link/addProjectToLibraries.js similarity index 100% rename from packages/cli/src/commands/link/ios/addProjectToLibraries.js rename to packages/platform-ios/src/link/addProjectToLibraries.js diff --git a/packages/cli/src/commands/link/ios/addSharedLibraries.js b/packages/platform-ios/src/link/addSharedLibraries.js similarity index 100% rename from packages/cli/src/commands/link/ios/addSharedLibraries.js rename to packages/platform-ios/src/link/addSharedLibraries.js diff --git a/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js b/packages/platform-ios/src/link/addToHeaderSearchPaths.js similarity index 88% rename from packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js rename to packages/platform-ios/src/link/addToHeaderSearchPaths.js index 83177ba74..2efd5df5f 100644 --- a/packages/cli/src/commands/link/ios/addToHeaderSearchPaths.js +++ b/packages/platform-ios/src/link/addToHeaderSearchPaths.js @@ -8,7 +8,7 @@ */ import mapHeaderSearchPaths from './mapHeaderSearchPaths'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; export default function addToHeaderSearchPaths(project, path) { logger.debug(`Adding ${path} to header search paths`); diff --git a/packages/cli/src/commands/link/ios/common/isInstalled.js b/packages/platform-ios/src/link/common/isInstalled.js similarity index 88% rename from packages/cli/src/commands/link/ios/common/isInstalled.js rename to packages/platform-ios/src/link/common/isInstalled.js index 93c018a0a..acbe38838 100644 --- a/packages/cli/src/commands/link/ios/common/isInstalled.js +++ b/packages/platform-ios/src/link/common/isInstalled.js @@ -8,7 +8,7 @@ */ import isInstalledIOS from '../isInstalled'; -import isInstalledPods from '../../pods/isInstalled'; +import isInstalledPods from '../../link-pods/isInstalled'; export default function isInstalled(projectConfig, name, dependencyConfig) { return ( diff --git a/packages/cli/src/commands/link/ios/common/registerNativeModule.js b/packages/platform-ios/src/link/common/registerNativeModule.js similarity index 88% rename from packages/cli/src/commands/link/ios/common/registerNativeModule.js rename to packages/platform-ios/src/link/common/registerNativeModule.js index e68aa11d7..cefca1dfa 100644 --- a/packages/cli/src/commands/link/ios/common/registerNativeModule.js +++ b/packages/platform-ios/src/link/common/registerNativeModule.js @@ -8,7 +8,7 @@ */ import registerDependencyIOS from '../registerNativeModule'; -import registerDependencyPods from '../../pods/registerNativeModule'; +import registerDependencyPods from '../../link-pods/registerNativeModule'; export default function registerNativeModule( name, diff --git a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js b/packages/platform-ios/src/link/common/unregisterNativeModule.js similarity index 86% rename from packages/cli/src/commands/link/ios/common/unregisterNativeModule.js rename to packages/platform-ios/src/link/common/unregisterNativeModule.js index 61752d42c..1fd689344 100644 --- a/packages/cli/src/commands/link/ios/common/unregisterNativeModule.js +++ b/packages/platform-ios/src/link/common/unregisterNativeModule.js @@ -9,9 +9,9 @@ import {compact} from 'lodash'; import isInstalledIOS from '../isInstalled'; -import isInstalledPods from '../../pods/isInstalled'; +import isInstalledPods from '../../link-pods/isInstalled'; import unregisterDependencyIOS from '../unregisterNativeModule'; -import unregisterDependencyPods from '../../pods/unregisterNativeModule'; +import unregisterDependencyPods from '../../link-pods/unregisterNativeModule'; export default function unregisterNativeModule( name, diff --git a/packages/cli/src/commands/link/ios/copyAssets.js b/packages/platform-ios/src/link/copyAssets.js similarity index 94% rename from packages/cli/src/commands/link/ios/copyAssets.js rename to packages/platform-ios/src/link/copyAssets.js index f3e89c161..f4d65170a 100644 --- a/packages/cli/src/commands/link/ios/copyAssets.js +++ b/packages/platform-ios/src/link/copyAssets.js @@ -10,11 +10,10 @@ import fs from 'fs'; import path from 'path'; import xcode from 'xcode'; -import groupFilesByType from '../groupFilesByType'; import createGroupWithMessage from './createGroupWithMessage'; import getPlist from './getPlist'; import writePlist from './writePlist'; -import logger from '../../../tools/logger'; +import {logger, groupFilesByType} from '@react-native-community/cli-tools'; /** * This function works in a similar manner to its Android version, diff --git a/packages/cli/src/commands/link/ios/createGroup.js b/packages/platform-ios/src/link/createGroup.js similarity index 100% rename from packages/cli/src/commands/link/ios/createGroup.js rename to packages/platform-ios/src/link/createGroup.js diff --git a/packages/cli/src/commands/link/ios/createGroupWithMessage.js b/packages/platform-ios/src/link/createGroupWithMessage.js similarity index 91% rename from packages/cli/src/commands/link/ios/createGroupWithMessage.js rename to packages/platform-ios/src/link/createGroupWithMessage.js index 2524aef0d..aad426e4f 100644 --- a/packages/cli/src/commands/link/ios/createGroupWithMessage.js +++ b/packages/platform-ios/src/link/createGroupWithMessage.js @@ -7,7 +7,7 @@ * @format */ -import log from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; import createGroup from './createGroup'; import getGroup from './getGroup'; @@ -23,7 +23,7 @@ export default function createGroupWithMessage(project, path) { if (!group) { group = createGroup(project, path); - log.warn( + logger.warn( `Group '${path}' does not exist in your Xcode project. We have created it automatically for you.`, ); } diff --git a/packages/cli/src/commands/link/ios/getBuildProperty.js b/packages/platform-ios/src/link/getBuildProperty.js similarity index 100% rename from packages/cli/src/commands/link/ios/getBuildProperty.js rename to packages/platform-ios/src/link/getBuildProperty.js diff --git a/packages/cli/src/commands/link/ios/getGroup.js b/packages/platform-ios/src/link/getGroup.js similarity index 100% rename from packages/cli/src/commands/link/ios/getGroup.js rename to packages/platform-ios/src/link/getGroup.js diff --git a/packages/cli/src/commands/link/ios/getHeaderSearchPath.js b/packages/platform-ios/src/link/getHeaderSearchPath.js similarity index 100% rename from packages/cli/src/commands/link/ios/getHeaderSearchPath.js rename to packages/platform-ios/src/link/getHeaderSearchPath.js diff --git a/packages/cli/src/commands/link/ios/getHeadersInFolder.js b/packages/platform-ios/src/link/getHeadersInFolder.js similarity index 100% rename from packages/cli/src/commands/link/ios/getHeadersInFolder.js rename to packages/platform-ios/src/link/getHeadersInFolder.js diff --git a/packages/cli/src/commands/link/ios/getPlist.js b/packages/platform-ios/src/link/getPlist.js similarity index 100% rename from packages/cli/src/commands/link/ios/getPlist.js rename to packages/platform-ios/src/link/getPlist.js diff --git a/packages/cli/src/commands/link/ios/getPlistPath.js b/packages/platform-ios/src/link/getPlistPath.js similarity index 100% rename from packages/cli/src/commands/link/ios/getPlistPath.js rename to packages/platform-ios/src/link/getPlistPath.js diff --git a/packages/cli/src/commands/link/ios/getTargets.js b/packages/platform-ios/src/link/getTargets.js similarity index 100% rename from packages/cli/src/commands/link/ios/getTargets.js rename to packages/platform-ios/src/link/getTargets.js diff --git a/packages/cli/src/commands/link/ios/hasLibraryImported.js b/packages/platform-ios/src/link/hasLibraryImported.js similarity index 100% rename from packages/cli/src/commands/link/ios/hasLibraryImported.js rename to packages/platform-ios/src/link/hasLibraryImported.js diff --git a/packages/cli/src/commands/link/ios/index.js b/packages/platform-ios/src/link/index.js similarity index 100% rename from packages/cli/src/commands/link/ios/index.js rename to packages/platform-ios/src/link/index.js diff --git a/packages/cli/src/commands/link/ios/isInstalled.js b/packages/platform-ios/src/link/isInstalled.js similarity index 100% rename from packages/cli/src/commands/link/ios/isInstalled.js rename to packages/platform-ios/src/link/isInstalled.js diff --git a/packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js b/packages/platform-ios/src/link/mapHeaderSearchPaths.js similarity index 100% rename from packages/cli/src/commands/link/ios/mapHeaderSearchPaths.js rename to packages/platform-ios/src/link/mapHeaderSearchPaths.js diff --git a/packages/cli/src/commands/link/ios/registerNativeModule.js b/packages/platform-ios/src/link/registerNativeModule.js similarity index 97% rename from packages/cli/src/commands/link/ios/registerNativeModule.js rename to packages/platform-ios/src/link/registerNativeModule.js index 943296aaf..2583d60fb 100644 --- a/packages/cli/src/commands/link/ios/registerNativeModule.js +++ b/packages/platform-ios/src/link/registerNativeModule.js @@ -20,7 +20,7 @@ import createGroupWithMessage from './createGroupWithMessage'; import addFileToProject from './addFileToProject'; import addProjectToLibraries from './addProjectToLibraries'; import addSharedLibraries from './addSharedLibraries'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Register native module IOS adds given dependency to project by adding diff --git a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js b/packages/platform-ios/src/link/removeFromHeaderSearchPaths.js similarity index 91% rename from packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js rename to packages/platform-ios/src/link/removeFromHeaderSearchPaths.js index 9db40a0be..0eacd74e1 100644 --- a/packages/cli/src/commands/link/ios/removeFromHeaderSearchPaths.js +++ b/packages/platform-ios/src/link/removeFromHeaderSearchPaths.js @@ -8,7 +8,7 @@ */ import mapHeaderSearchPaths from './mapHeaderSearchPaths'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Given Xcode project and absolute path, it makes sure there are no headers referring to it diff --git a/packages/cli/src/commands/link/ios/removeFromPbxItemContainerProxySection.js b/packages/platform-ios/src/link/removeFromPbxItemContainerProxySection.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeFromPbxItemContainerProxySection.js rename to packages/platform-ios/src/link/removeFromPbxItemContainerProxySection.js diff --git a/packages/cli/src/commands/link/ios/removeFromPbxReferenceProxySection.js b/packages/platform-ios/src/link/removeFromPbxReferenceProxySection.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeFromPbxReferenceProxySection.js rename to packages/platform-ios/src/link/removeFromPbxReferenceProxySection.js diff --git a/packages/cli/src/commands/link/ios/removeFromProjectReferences.js b/packages/platform-ios/src/link/removeFromProjectReferences.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeFromProjectReferences.js rename to packages/platform-ios/src/link/removeFromProjectReferences.js diff --git a/packages/cli/src/commands/link/ios/removeFromStaticLibraries.js b/packages/platform-ios/src/link/removeFromStaticLibraries.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeFromStaticLibraries.js rename to packages/platform-ios/src/link/removeFromStaticLibraries.js diff --git a/packages/cli/src/commands/link/ios/removeProductGroup.js b/packages/platform-ios/src/link/removeProductGroup.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeProductGroup.js rename to packages/platform-ios/src/link/removeProductGroup.js diff --git a/packages/cli/src/commands/link/ios/removeProjectFromLibraries.js b/packages/platform-ios/src/link/removeProjectFromLibraries.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeProjectFromLibraries.js rename to packages/platform-ios/src/link/removeProjectFromLibraries.js diff --git a/packages/cli/src/commands/link/ios/removeProjectFromProject.js b/packages/platform-ios/src/link/removeProjectFromProject.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeProjectFromProject.js rename to packages/platform-ios/src/link/removeProjectFromProject.js diff --git a/packages/cli/src/commands/link/ios/removeSharedLibraries.js b/packages/platform-ios/src/link/removeSharedLibraries.js similarity index 100% rename from packages/cli/src/commands/link/ios/removeSharedLibraries.js rename to packages/platform-ios/src/link/removeSharedLibraries.js diff --git a/packages/cli/src/commands/link/ios/unlinkAssets.js b/packages/platform-ios/src/link/unlinkAssets.js similarity index 90% rename from packages/cli/src/commands/link/ios/unlinkAssets.js rename to packages/platform-ios/src/link/unlinkAssets.js index f0da53423..c8ae6ab2e 100644 --- a/packages/cli/src/commands/link/ios/unlinkAssets.js +++ b/packages/platform-ios/src/link/unlinkAssets.js @@ -10,12 +10,10 @@ import fs from 'fs'; import path from 'path'; import xcode from 'xcode'; import {difference} from 'lodash'; -import log from '../../../tools/logger'; -import groupFilesByType from '../groupFilesByType'; import getPlist from './getPlist'; import writePlist from './writePlist'; -import logger from '../../../tools/logger'; +import {logger, groupFilesByType} from '@react-native-community/cli-tools'; /** * Unlinks assets from iOS project. Removes references for fonts from `Info.plist` @@ -27,14 +25,14 @@ export default function unlinkAssetsIOS(files, projectConfig) { const plist = getPlist(project, projectConfig.sourceDir); if (!plist) { - log.error( + logger.error( 'Could not locate "Info.plist" file. Check if your project has "INFOPLIST_FILE" set properly', ); return; } if (!project.pbxGroupByName('Resources')) { - log.error( + logger.error( 'Group "Resources" does not exist in your Xcode project. There is nothing to unlink.', ); return; diff --git a/packages/cli/src/commands/link/ios/unregisterNativeModule.js b/packages/platform-ios/src/link/unregisterNativeModule.js similarity index 97% rename from packages/cli/src/commands/link/ios/unregisterNativeModule.js rename to packages/platform-ios/src/link/unregisterNativeModule.js index b0a1239af..442c59c22 100644 --- a/packages/cli/src/commands/link/ios/unregisterNativeModule.js +++ b/packages/platform-ios/src/link/unregisterNativeModule.js @@ -21,7 +21,7 @@ import removeProjectFromLibraries from './removeProjectFromLibraries'; import removeFromStaticLibraries from './removeFromStaticLibraries'; import removeFromHeaderSearchPaths from './removeFromHeaderSearchPaths'; import removeSharedLibraries from './removeSharedLibraries'; -import logger from '../../../tools/logger'; +import {logger} from '@react-native-community/cli-tools'; /** * Unregister native module IOS diff --git a/packages/cli/src/commands/link/ios/writePlist.js b/packages/platform-ios/src/link/writePlist.js similarity index 100% rename from packages/cli/src/commands/link/ios/writePlist.js rename to packages/platform-ios/src/link/writePlist.js diff --git a/packages/tools/package.json b/packages/tools/package.json new file mode 100644 index 000000000..a23ac3e71 --- /dev/null +++ b/packages/tools/package.json @@ -0,0 +1,10 @@ +{ + "name": "@react-native-community/cli-tools", + "version": "2.0.0-alpha.3", + "main": "build/index.js", + "dependencies": { + "chalk": "^1.1.1", + "mime": "^1.3.4", + "lodash": "^4.17.5" + } +} diff --git a/packages/cli/src/tools/__mocks__/log.js b/packages/tools/src/__mocks__/logger.js similarity index 100% rename from packages/cli/src/tools/__mocks__/log.js rename to packages/tools/src/__mocks__/logger.js diff --git a/packages/cli/src/commands/link/__tests__/groupFilesByType-test.js b/packages/tools/src/__tests__/groupFilesByType-test.js similarity index 100% rename from packages/cli/src/commands/link/__tests__/groupFilesByType-test.js rename to packages/tools/src/__tests__/groupFilesByType-test.js diff --git a/packages/cli/src/commands/link/groupFilesByType.js b/packages/tools/src/groupFilesByType.js similarity index 100% rename from packages/cli/src/commands/link/groupFilesByType.js rename to packages/tools/src/groupFilesByType.js diff --git a/packages/tools/src/index.js b/packages/tools/src/index.js new file mode 100644 index 000000000..8568bba7e --- /dev/null +++ b/packages/tools/src/index.js @@ -0,0 +1,5 @@ +/** + * @flow + */ +export {default as logger} from './logger'; +export {default as groupFilesByType} from './groupFilesByType'; diff --git a/packages/tools/src/logger.js b/packages/tools/src/logger.js new file mode 100644 index 000000000..8bb9cbddd --- /dev/null +++ b/packages/tools/src/logger.js @@ -0,0 +1,54 @@ +/** + * @flow + */ +import chalk from 'chalk'; + +const SEPARATOR = ', '; + +let verbose = false; + +const formatMessages = (messages: Array) => + chalk.reset(messages.join(SEPARATOR)); + +const success = (...messages: Array) => { + console.log(`${chalk.green.bold('success')} ${formatMessages(messages)}`); +}; + +const info = (...messages: Array) => { + console.log(`${chalk.cyan.bold('info')} ${formatMessages(messages)}`); +}; + +const warn = (...messages: Array) => { + console.warn(`${chalk.yellow.bold('warn')} ${formatMessages(messages)}`); +}; + +const error = (...messages: Array) => { + console.error(`${chalk.red.bold('error')} ${formatMessages(messages)}`); +}; + +const debug = (...messages: Array) => { + if (verbose) { + console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`); + } +}; + +const log = (...messages: Array) => { + console.log(`${formatMessages(messages)}`); +}; + +const setVerbose = (level: boolean) => { + verbose = level; +}; + +const isVerbose = () => verbose; + +export default { + success, + info, + warn, + error, + debug, + log, + setVerbose, + isVerbose, +}; From 62b8b7c2b5cf7d0ef928387bdae17b20c48fbf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 5 Apr 2019 22:10:22 +0200 Subject: [PATCH 058/234] remove clean on postinstall --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f24511f05..308f6ed51 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test:ci:e2e": "jest e2e --ci -i", "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", - "postinstall": "yarn build-clean && yarn build", + "postinstall": "yarn build", "publish": "yarn build-clean && yarn build && lerna publish" }, "dependencies": { From 49352be129a447216357bf939f1933e53edcf59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 6 Apr 2019 18:40:21 +0200 Subject: [PATCH 059/234] v2.0.0-alpha.4 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lerna.json b/lerna.json index 3a38c5a0b..4b31aa928 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 5ae6e7ee1..79cb9c95a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -19,9 +19,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-ios": "2.0.0-alpha.3", - "@react-native-community/cli-platform-android": "2.0.0-alpha.3", - "@react-native-community/cli-tools": "2.0.0-alpha.3", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.4", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.4", + "@react-native-community/cli-tools": "^2.0.0-alpha.4", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 301e3f595..3db9e50a0 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,8 +1,8 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "2.0.0-alpha.3" + "@react-native-community/cli-tools": "^2.0.0-alpha.4" } } diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 2451b7048..ce174f838 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,8 +1,8 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "2.0.0-alpha.3" + "@react-native-community/cli-tools": "^2.0.0-alpha.4" } } diff --git a/packages/tools/package.json b/packages/tools/package.json index a23ac3e71..42984d992 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,10 +1,10 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", - "mime": "^1.3.4", - "lodash": "^4.17.5" + "lodash": "^4.17.5", + "mime": "^1.3.4" } } From 4d8cfe46d392ebc543a349c5ed88d929712736b3 Mon Sep 17 00:00:00 2001 From: maxaggedon Date: Sat, 6 Apr 2019 20:40:57 +0200 Subject: [PATCH 060/234] feat: apply upgrade patch in subdirectory if necessary (#272) * bug: apply update patch in subdirectory if necessary * add tests instead of changing existing ones --- .prettierrc.js | 5 + .../upgrade/__tests__/upgrade.test.js | 109 ++++++++++++++---- packages/cli/src/commands/upgrade/upgrade.js | 23 +++- 3 files changed, 114 insertions(+), 23 deletions(-) create mode 100644 .prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..50e441707 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +// added for Jest inline snapshots to not use default Prettier config +module.exports = { + bracketSpacing: false, + trailingComma: "all" +} diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index edef33b7d..d66a4bb37 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -12,18 +12,7 @@ import loadConfig from '../../../tools/config'; jest.mock('https'); jest.mock('fs'); jest.mock('path'); -jest.mock('execa', () => { - const module = jest.fn((command, args) => { - mockPushLog('$', 'execa', command, args); - if (command === 'npm' && args[3] === '--json') { - return Promise.resolve({ - stdout: '{"react": "16.6.3"}', - }); - } - return Promise.resolve({stdout: ''}); - }); - return module; -}); +jest.mock('execa'); jest.mock( '/project/root/node_modules/react-native/package.json', () => ({name: 'react-native', version: '0.57.8'}), @@ -34,6 +23,20 @@ jest.mock( () => ({name: 'TestApp', dependencies: {'react-native': '^0.57.8'}}), {virtual: true}, ); +jest.mock( + '/project/root/NestedApp/node_modules/react-native/package.json', + () => ({name: 'react-native', version: '0.57.8'}), + {virtual: true}, +); +jest.mock( + '/project/root/NestedApp/package.json', + () => ({ + name: 'TestAppNested', + dependencies: {'react-native': '^0.57.8'}, + }), + {virtual: true}, +); +jest.mock('../../../tools/config'); jest.mock('../../../tools/packageManager', () => ({ install: args => { mockPushLog('$ yarn add', ...args); @@ -52,14 +55,32 @@ jest.mock('@react-native-community/cli-tools', () => ({ }, })); +const mockExecaDefault = (command, args) => { + mockPushLog('$', 'execa', command, args); + if (command === 'npm' && args[3] === '--json') { + return Promise.resolve({stdout: '{"react": "16.6.3"}'}); + } + if (command === 'git' && args[0] === 'rev-parse') { + return Promise.resolve({stdout: ''}); + } + return Promise.resolve({stdout: ''}); +}; + +const mockExecaNested = (command, args) => { + mockPushLog('$', 'execa', command, args); + if (command === 'npm' && args[3] === '--json') { + return Promise.resolve({stdout: '{"react": "16.6.3"}'}); + } + if (command === 'git' && args[0] === 'rev-parse') { + return Promise.resolve({stdout: 'NestedApp/'}); + } + return Promise.resolve({stdout: ''}); +}; + const currentVersion = '0.57.8'; const newVersion = '0.58.4'; const olderVersion = '0.56.0'; - -jest.mock('../../../tools/config'); - const ctx = loadConfig(); - const opts = { legacy: false, }; @@ -75,11 +96,13 @@ const flushOutput = () => stripAnsi(logs.join('\n')); beforeEach(() => { jest.clearAllMocks(); + jest.restoreAllMocks(); // $FlowFixMe fs.writeFileSync = jest.fn(filename => mockPushLog('[fs] write', filename)); // $FlowFixMe fs.unlinkSync = jest.fn((...args) => mockPushLog('[fs] unlink', args)); logs = []; + (execa: any).mockImplementation(mockExecaDefault); }); afterEach(() => { @@ -94,6 +117,22 @@ test('uses latest version of react-native when none passed', async () => { expect(execa).toBeCalledWith('npm', ['info', 'react-native', 'version']); }, 60000); +test('applies patch in current working directory when nested', async () => { + (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); + (execa: any).mockImplementation(mockExecaNested); + const config = {...ctx, root: '/project/root/NestedApp'}; + await upgrade.func([newVersion], config, opts); + + expect(execa).toBeCalledWith('git', [ + 'apply', + 'tmp-upgrade-rn.patch', + '--exclude=NestedApp/package.json', + '-p2', + '--3way', + '--directory=NestedApp/', + ]); +}); + test('errors when invalid version passed', async () => { await upgrade.func(['next'], ctx, opts); expect(logger.error).toBeCalledWith( @@ -137,9 +176,10 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way +$ execa git rev-parse --show-prefix +$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= info Applying diff... -$ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way +$ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= [fs] unlink tmp-upgrade-rn.patch $ execa git status -s info Installing \\"react-native@0.58.4\\" and its peer dependencies... @@ -158,6 +198,31 @@ success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the }), ).toMatchSnapshot('RnDiffApp is replaced with app name (TestApp)'); }, 60000); +test('fetches regular patch, adds remote, applies patch, installs deps, removes remote when updated from nested directory', async () => { + (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); + (execa: any).mockImplementation(mockExecaNested); + const config = {...ctx, root: '/project/root/NestedApp'}; + await upgrade.func([newVersion], config, opts); + expect(flushOutput()).toMatchInlineSnapshot(` +"info Fetching diff between v0.57.8 and v0.58.4... +[fs] write tmp-upgrade-rn.patch +$ execa git rev-parse --show-prefix +$ execa git apply --check tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ +info Applying diff... +$ execa git apply tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ +[fs] unlink tmp-upgrade-rn.patch +$ execa git status -s +info Installing \\"react-native@0.58.4\\" and its peer dependencies... +$ execa npm info react-native@0.58.4 peerDependencies --json +$ yarn add react-native@0.58.4 react@16.6.3 +$ execa git add package.json +$ execa git add yarn.lock +$ execa git add package-lock.json +info Running \\"git status\\" to check what changed... +$ execa git status +success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" +`); +}, 60000); test('cleans up if patching fails,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); (execa: any).mockImplementation((command, args) => { @@ -173,6 +238,9 @@ test('cleans up if patching fails,', async () => { stderr: 'error: .flowconfig: does not exist in index\n', }); } + if (command === 'git' && args[0] === 'rev-parse') { + return Promise.resolve({stdout: ''}); + } return Promise.resolve({stdout: ''}); }); try { @@ -185,9 +253,10 @@ test('cleans up if patching fails,', async () => { expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way +$ execa git rev-parse --show-prefix +$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= info Applying diff (excluding: package.json, .flowconfig)... -$ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way +$ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way --directory= error: .flowconfig: does not exist in index error Automatically applying diff failed [fs] unlink tmp-upgrade-rn.patch diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 816e6cdd0..e5f153753 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -137,9 +137,16 @@ const applyPatch = async ( tmpPatchFile: string, ) => { let filesToExclude = ['package.json']; + // $FlowFixMe ThenableChildProcess is incompatible with Promise + const {stdout: relativePathFromRoot} = await execa('git', [ + 'rev-parse', + '--show-prefix', + ]); try { try { - const excludes = filesToExclude.map(e => `--exclude=${e}`); + const excludes = filesToExclude.map( + e => `--exclude=${path.join(relativePathFromRoot, e)}`, + ); await execa('git', [ 'apply', '--check', @@ -147,6 +154,7 @@ const applyPatch = async ( ...excludes, '-p2', '--3way', + `--directory=${relativePathFromRoot}`, ]); logger.info('Applying diff...'); } catch (error) { @@ -160,8 +168,17 @@ const applyPatch = async ( logger.info(`Applying diff (excluding: ${filesToExclude.join(', ')})...`); } finally { - const excludes = filesToExclude.map(e => `--exclude=${e}`); - await execa('git', ['apply', tmpPatchFile, ...excludes, '-p2', '--3way']); + const excludes = filesToExclude.map( + e => `--exclude=${path.join(relativePathFromRoot, e)}`, + ); + await execa('git', [ + 'apply', + tmpPatchFile, + ...excludes, + '-p2', + '--3way', + `--directory=${relativePathFromRoot}`, + ]); } } catch (error) { if (error.stderr) { From 586f79b4b7376ed5ede4e561222532d16656528b Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Tue, 9 Apr 2019 06:57:50 +0100 Subject: [PATCH 061/234] fix: copy `.keystore` files as binary extensions. (#300) --- packages/cli/src/tools/copyAndReplace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/copyAndReplace.js b/packages/cli/src/tools/copyAndReplace.js index 986088e43..1feb0e6f2 100644 --- a/packages/cli/src/tools/copyAndReplace.js +++ b/packages/cli/src/tools/copyAndReplace.js @@ -11,7 +11,7 @@ import fs from 'fs'; import path from 'path'; // Binary files, don't process these (avoid decoding as utf8) -const binaryExtensions = ['.png', '.jar']; +const binaryExtensions = ['.png', '.jar', '.keystore']; /** * Copy a file to given destination, replacing parts of its contents. From f1c72e92569f547cfae2dd107616153d21639c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Apr 2019 08:56:14 +0200 Subject: [PATCH 062/234] v2.0.0-alpha.5 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 4b31aa928..a1a5d44c3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.4", + "version": "2.0.0-alpha.5", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 79cb9c95a..287ce1f58 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.4", + "version": "2.0.0-alpha.5", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -19,9 +19,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.4", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.4", - "@react-native-community/cli-tools": "^2.0.0-alpha.4", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.5", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.5", + "@react-native-community/cli-tools": "^2.0.0-alpha.5", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 3db9e50a0..e5c82060c 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,8 +1,8 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.4", + "version": "2.0.0-alpha.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.4" + "@react-native-community/cli-tools": "^2.0.0-alpha.5" } } diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index ce174f838..7c31f0d2b 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,8 +1,8 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.4", + "version": "2.0.0-alpha.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.4" + "@react-native-community/cli-tools": "^2.0.0-alpha.5" } } diff --git a/packages/tools/package.json b/packages/tools/package.json index 42984d992..5ef084e73 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.4", + "version": "2.0.0-alpha.5", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 978935ff267183f1770187fc90a0f260616cea02 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Tue, 9 Apr 2019 12:45:14 +0200 Subject: [PATCH 063/234] feat: use `logkitty` to format android logs (#294) feat: use `logkitty` to format android logs --- packages/cli/package.json | 1 + .../cli/src/commands/logAndroid/logAndroid.js | 33 ++++++---- yarn.lock | 66 +++++++++---------- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 287ce1f58..a40dab5de 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -39,6 +39,7 @@ "inquirer": "^3.0.6", "joi": "^14.3.1", "lodash": "^4.17.5", + "logkitty": "^0.4.0", "metro": "^0.53.1", "metro-config": "^0.53.1", "metro-core": "^0.53.1", diff --git a/packages/cli/src/commands/logAndroid/logAndroid.js b/packages/cli/src/commands/logAndroid/logAndroid.js index 8c09aa1fe..b17f56b3d 100644 --- a/packages/cli/src/commands/logAndroid/logAndroid.js +++ b/packages/cli/src/commands/logAndroid/logAndroid.js @@ -5,26 +5,31 @@ * LICENSE file in the root directory of this source tree. */ -import {spawnSync} from 'child_process'; +import { + logkitty, + makeTagsFilter, + formatEntry, + formatError, + Priority, +} from 'logkitty'; import {logger} from '@react-native-community/cli-tools'; -/** - * Starts adb logcat - */ async function logAndroid() { - const adbPath = process.env.ANDROID_HOME - ? `${process.env.ANDROID_HOME}/platform-tools/adb` - : 'adb'; - - const adbArgs = ['logcat', '*:S', 'ReactNative:V', 'ReactNativeJS:V']; + logger.info('Starting logkitty'); - logger.info(`Starting the logger (${adbPath} ${adbArgs.join(' ')})...`); + const emitter = logkitty({ + platform: 'android', + minPriority: Priority.VERBOSE, + filter: makeTagsFilter('ReactNative', 'ReactNativeJS'), + }); - const log = spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); + emitter.on('entry', entry => { + logger.log(formatEntry(entry)); + }); - if (log.error !== null) { - throw log.error; - } + emitter.on('error', error => { + logger.log(formatError(error)); + }); } export default { diff --git a/yarn.lock b/yarn.lock index 61eb22770..3bae4772a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2030,6 +2030,15 @@ ansi-escapes@^3.0.0: version "3.1.0" resolved "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" +ansi-fragments@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ansi-fragments/-/ansi-fragments-0.2.1.tgz#24409c56c4cc37817c3d7caa99d8969e2de5a05e" + integrity sha512-DykbNHxuXQwUDRv5ibc2b0x7uw7wmwOGLBUd5RmaQ5z8Lhx19vwvKV+FAsM5rEA6dEcHxX+/Ad5s9eF2k2bB+w== + dependencies: + colorette "^1.0.7" + slice-ansi "^2.0.0" + strip-ansi "^5.0.0" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -2771,6 +2780,11 @@ color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" +colorette@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.0.7.tgz#7adf43c445ee63a541b4a4aef7d13f03df1e0cc0" + integrity sha512-KeK4klsvAgdODAjFPm6QLzvStizJqlxMBtVo4KQMCgk5tt/tf9rAzxmxLHNRynJg3tJjkKGKbHx3j4HLox27Lw== + colors@0.6.x: version "0.6.2" resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" @@ -3143,12 +3157,6 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" -decamelize@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" - dependencies: - xregexp "4.0.0" - decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -5796,6 +5804,14 @@ log-symbols@^2.2.0: dependencies: chalk "^2.0.1" +logkitty@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/logkitty/-/logkitty-0.4.0.tgz#4a534bb4fb2b27f0120ed7b9fc62b8aa3ba6bb43" + integrity sha512-IKuHwaXYDpbEzC9EfsrmvwdS80b4Lv+W4n7g6GG0gBHt5kXzQEvew46E0omrSD3ycEpTOtAX7BXGWnOUFEksYA== + dependencies: + ansi-fragments "^0.2.1" + yargs "^12.0.5" + loose-envify@^1.0.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -7919,6 +7935,15 @@ slice-ansi@1.0.0: dependencies: is-fullwidth-code-point "^2.0.0" +slice-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + slide@^1.1.5, slide@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" @@ -8904,10 +8929,6 @@ xpipe@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/xpipe/-/xpipe-1.0.5.tgz#8dd8bf45fc3f7f55f0e054b878f43a62614dafdf" -xregexp@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" - xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -8928,12 +8949,6 @@ yallist@^3.0.0, yallist@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" -yargs-parser@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" - dependencies: - camelcase "^4.1.0" - yargs-parser@^11.1.1: version "11.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" @@ -8956,7 +8971,7 @@ yargs-parser@^7.0.0: dependencies: camelcase "^4.1.0" -yargs@^12.0.1: +yargs@^12.0.1, yargs@^12.0.2, yargs@^12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== @@ -8974,23 +8989,6 @@ yargs@^12.0.1: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^12.0.2: - version "12.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.2.tgz#fe58234369392af33ecbef53819171eff0f5aadc" - dependencies: - cliui "^4.0.0" - decamelize "^2.0.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^10.1.0" - yargs@^4.2.0: version "4.8.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-4.8.1.tgz#c0c42924ca4aaa6b0e6da1739dfb216439f9ddc0" From 38129ea728b873fa6eb6459377c5f4e850e3595f Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 9 Apr 2019 15:03:38 +0200 Subject: [PATCH 064/234] feat: commands should be defined as object, unless defined via legacy config (#295) Summary: --------- This PR moves the logic for loading commands from CLI to the dependency authors. They should define a JavaScript configuration and return an array of commands (an object with required properties) they want to load. Previously, we would require them to define paths (relative to root) to a JavaScript file to require. This is necessary to send a follow-up PR, which removes built-in platform commands to be bundled with React Native. WIP: Need to check tests and update one or two snapshots to make sure we output Objects, instead of strings in a configuration. --- packages/cli/src/cliEntry.js | 10 +- .../cli/src/commands/bundle/buildBundle.js | 4 +- packages/cli/src/commands/config/config.js | 4 +- packages/cli/src/commands/index.js | 70 +----------- packages/cli/src/commands/info/info.js | 4 +- packages/cli/src/commands/init/init.js | 4 +- packages/cli/src/commands/install/install.js | 4 +- .../cli/src/commands/install/uninstall.js | 4 +- packages/cli/src/commands/link/link.js | 4 +- packages/cli/src/commands/link/unlink.js | 4 +- .../cli/src/commands/runAndroid/runAndroid.js | 4 +- packages/cli/src/commands/runIOS/runIOS.js | 4 +- packages/cli/src/commands/server/runServer.js | 4 +- .../cli/src/commands/upgrade/legacyUpgrade.js | 4 +- packages/cli/src/commands/upgrade/upgrade.js | 4 +- .../__snapshots__/index-test.js.snap | 108 +++++++++--------- .../src/tools/config/__tests__/index-test.js | 51 ++++----- packages/cli/src/tools/config/index.js | 6 +- .../src/tools/config/readConfigFromDisk.js | 30 ++++- packages/cli/src/tools/config/schema.js | 28 ++++- packages/cli/src/tools/config/types.flow.js | 20 +++- packages/cli/src/tools/loadMetroConfig.js | 6 +- packages/cli/src/tools/types.flow.js | 42 ------- 23 files changed, 186 insertions(+), 237 deletions(-) delete mode 100644 packages/cli/src/tools/types.flow.js diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 9758eb849..81036907d 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -12,9 +12,9 @@ import childProcess from 'child_process'; import commander from 'commander'; import path from 'path'; -import type {CommandT, ContextT} from './tools/types.flow'; +import type {CommandT, ConfigT} from './tools/config/types.flow'; -import {getCommands} from './commands'; +import commands from './commands'; import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import {logger} from '@react-native-community/cli-tools'; @@ -95,7 +95,7 @@ function printUnknownCommand(cmdName) { } } -const addCommand = (command: CommandT, ctx: ContextT) => { +const addCommand = (command: CommandT, ctx: ConfigT) => { const options = command.options || []; const cmd = commander @@ -162,9 +162,7 @@ async function setupAndRun() { setProjectDir(ctx.root); - const commands = getCommands(ctx); - - commands.forEach(command => addCommand(command, ctx)); + [...commands, ...ctx.commands].forEach(command => addCommand(command, ctx)); commander.parse(process.argv); diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index e11f7512a..89211c746 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -13,14 +13,14 @@ import outputBundle from 'metro/src/shared/output/bundle'; import path from 'path'; import chalk from 'chalk'; import type {CommandLineArgs} from './bundleCommandLineArgs'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import saveAssets from './saveAssets'; import loadMetroConfig from '../../tools/loadMetroConfig'; import {logger} from '@react-native-community/cli-tools'; async function buildBundle( args: CommandLineArgs, - ctx: ContextT, + ctx: ConfigT, output: typeof outputBundle = outputBundle, ) { const config = await loadMetroConfig(ctx, { diff --git a/packages/cli/src/commands/config/config.js b/packages/cli/src/commands/config/config.js index 51fd05243..83fa8bffb 100644 --- a/packages/cli/src/commands/config/config.js +++ b/packages/cli/src/commands/config/config.js @@ -1,11 +1,11 @@ /** * @flow */ -import {type ContextT} from '../../tools/types.flow'; +import {type ConfigT} from '../../tools/config/types.flow'; export default { name: 'config', description: 'Print CLI configuration', - func: async (argv: string[], ctx: ContextT) => { + func: async (argv: string[], ctx: ConfigT) => { console.log(JSON.stringify(ctx, null, 2)); }, }; diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index 86920456c..97e20dc6b 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -1,15 +1,8 @@ /** * @flow */ +import {type CommandT} from '../tools/config/types.flow'; -import path from 'path'; -import type { - CommandT, - ProjectCommandT, - LocalCommandT, -} from '../tools/types.flow'; - -import {type ContextT} from '../tools/types.flow'; import server from './server/server'; import runIOS from './runIOS/runIOS'; import runAndroid from './runAndroid/runAndroid'; @@ -27,11 +20,7 @@ import info from './info/info'; import config from './config/config'; import init from './init'; -/** - * List of built-in commands - */ - -const loadLocalCommands: Array = [ +export default ([ server, runIOS, runAndroid, @@ -48,57 +37,4 @@ const loadLocalCommands: Array = [ info, config, init, -]; - -/** - * Returns an array of commands that are defined in the project. - * - * This checks all CLI plugins for presence of 3rd party packages that define commands - * and loads them - */ -const loadProjectCommands = ({ - root, - commands, -}: ContextT): Array => { - return commands.reduce((acc: Array, cmdPath: string) => { - /** - * `pathToCommand` is a path to a file where commands are defined, relative to `node_modules` - * folder. - * - * Following code gets the name of the package name out of the path, taking scope - * into consideration. - */ - const name = - cmdPath[0] === '@' - ? cmdPath - .split(path.sep) - .slice(0, 2) - .join(path.sep) - : cmdPath.split(path.sep)[0]; - - const pkg = require(path.join(root, 'node_modules', name, 'package.json')); - - const requiredCommands: - | ProjectCommandT - | Array = require(path.join( - root, - 'node_modules', - cmdPath, - )); - - if (Array.isArray(requiredCommands)) { - return acc.concat( - requiredCommands.map(requiredCommand => ({...requiredCommand, pkg})), - ); - } - - return acc.concat({...requiredCommands, pkg}); - }, []); -}; - -/** - * Loads all the commands inside a given `root` folder - */ -export function getCommands(ctx: ContextT): Array { - return [...loadLocalCommands, ...loadProjectCommands(ctx)]; -} +]: CommandT[]); diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index 4faae7860..f404c5d92 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -9,11 +9,11 @@ import envinfo from 'envinfo'; import {logger} from '@react-native-community/cli-tools'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; const info = async function getInfo( argv: Array, - ctx: ContextT, + ctx: ConfigT, options: {}, ) { try { diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 77279d7ba..35e2811a5 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -2,7 +2,7 @@ import fs from 'fs-extra'; import minimist from 'minimist'; import semver from 'semver'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import {validateProjectName} from './validate'; import DirectoryAlreadyExistsError from './errors/DirectoryAlreadyExistsError'; import printRunInstructions from './printRunInstructions'; @@ -153,7 +153,7 @@ function createProject(projectName: string, options: Options, version: string) { export default (async function initialize( [projectName]: Array, - _context: ContextT, + _context: ConfigT, options: Options, ) { validateProjectName(projectName); diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index 4750087b5..7b6e5d6f5 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -7,13 +7,13 @@ * @flow */ -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/link'; import loadConfig from '../../tools/config'; -async function install(args: Array, ctx: ContextT) { +async function install(args: Array, ctx: ConfigT) { const name = args[0]; logger.info(`Installing "${name}"...`); diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index a8173d26e..85f4f4563 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -7,12 +7,12 @@ * @flow */ -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/unlink'; -async function uninstall(args: Array, ctx: ContextT) { +async function uninstall(args: Array, ctx: ConfigT) { const name = args[0]; logger.info(`Unlinking "${name}"...`); diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 94f10bb2c..2be0d3f72 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -10,7 +10,7 @@ import {pick} from 'lodash'; import dedent from 'dedent'; -import {type ContextT} from '../../tools/types.flow'; +import {type ConfigT} from '../../tools/config/types.flow'; import {CLIError} from '../../tools/errors'; @@ -34,7 +34,7 @@ type FlagsType = { * @param args If optional argument [packageName] is provided, * only that package is processed. */ -function link([rawPackageName]: Array, ctx: ContextT, opts: FlagsType) { +function link([rawPackageName]: Array, ctx: ConfigT, opts: FlagsType) { let platforms = ctx.platforms; let project = ctx.project; diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index b593f21a2..3bcf48758 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -8,7 +8,7 @@ */ import {flatMap, values, difference} from 'lodash'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import dedent from 'dedent'; import {logger} from '@react-native-community/cli-tools'; import promiseWaterfall from './promiseWaterfall'; @@ -77,7 +77,7 @@ const unlinkDependency = ( * If optional argument [packageName] is provided, it's the only one * that's checked */ -function unlink(args: Array, ctx: ContextT) { +function unlink(args: Array, ctx: ConfigT) { const packageName = args[0]; const {[packageName]: dependency, ...otherDependencies} = ctx.dependencies; diff --git a/packages/cli/src/commands/runAndroid/runAndroid.js b/packages/cli/src/commands/runAndroid/runAndroid.js index ac5577ffa..9fc40a551 100644 --- a/packages/cli/src/commands/runAndroid/runAndroid.js +++ b/packages/cli/src/commands/runAndroid/runAndroid.js @@ -13,7 +13,7 @@ import fs from 'fs'; import isString from 'lodash/isString'; import isPackagerRunning from '../../tools/isPackagerRunning'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; @@ -30,7 +30,7 @@ function checkAndroid(root) { /** * Starts the app on a connected Android emulator or device. */ -function runAndroid(argv: Array, ctx: ContextT, args: Object) { +function runAndroid(argv: Array, ctx: ConfigT, args: Object) { if (!checkAndroid(args.root)) { logger.error( 'Android project not found. Are you sure this is a React Native project?', diff --git a/packages/cli/src/commands/runIOS/runIOS.js b/packages/cli/src/commands/runIOS/runIOS.js index 20e968e1a..898b6697e 100644 --- a/packages/cli/src/commands/runIOS/runIOS.js +++ b/packages/cli/src/commands/runIOS/runIOS.js @@ -11,7 +11,7 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; @@ -30,7 +30,7 @@ type FlagsT = { port: number, }; -function runIOS(_: Array, ctx: ContextT, args: FlagsT) { +function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { if (!fs.existsSync(args.projectPath)) { throw new Error( 'iOS project folder not found. Are you sure this is a React Native project?', diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 8b20376c1..586fb4274 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -13,7 +13,7 @@ import {Terminal} from 'metro-core'; import morgan from 'morgan'; import path from 'path'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import messageSocket from './messageSocket'; import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; @@ -40,7 +40,7 @@ export type Args = {| config?: string, |}; -async function runServer(argv: Array, ctx: ContextT, args: Args) { +async function runServer(argv: Array, ctx: ConfigT, args: Args) { const terminal = new Terminal(process.stdout); const ReporterImpl = getReporterImpl(args.customLogReporterPath || null); const reporter = new ReporterImpl(terminal); diff --git a/packages/cli/src/commands/upgrade/legacyUpgrade.js b/packages/cli/src/commands/upgrade/legacyUpgrade.js index ccb93eef7..a416d5098 100644 --- a/packages/cli/src/commands/upgrade/legacyUpgrade.js +++ b/packages/cli/src/commands/upgrade/legacyUpgrade.js @@ -11,7 +11,7 @@ import fs from 'fs'; import path from 'path'; import semver from 'semver'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import {logger} from '@react-native-community/cli-tools'; import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; @@ -19,7 +19,7 @@ import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemp * Migrate application to a new version of React Native. * See http://facebook.github.io/react-native/docs/upgrading.html */ -function validateAndUpgrade(argv: Array, ctx: ContextT) { +function validateAndUpgrade(argv: Array, ctx: ConfigT) { const projectDir = ctx.root; const packageJSON = JSON.parse( diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index e5f153753..e321b801c 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -4,7 +4,7 @@ import fs from 'fs'; import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; -import type {ContextT} from '../../tools/types.flow'; +import type {ConfigT} from '../../tools/config/types.flow'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import {fetch} from '../../tools/fetch'; @@ -193,7 +193,7 @@ const applyPatch = async ( /** * Upgrade application to a new version of React Native. */ -async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { +async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 3fc391a4b..e2389afcb 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -1,5 +1,62 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`should automatically put "react-native" into haste config 1`] = ` +Object { + "platforms": Array [ + "ios", + "android", + ], + "providesModuleNodeModules": Array [ + "react-native", + ], +} +`; + +exports[`should have a valid structure by default 1`] = ` +Object { + "assets": Array [], + "commands": Array [], + "dependencies": Object {}, + "haste": Object { + "platforms": Array [], + "providesModuleNodeModules": Array [], + }, + "platforms": Object {}, + "project": Object {}, + "reactNativePath": ".", + "root": "<>", +} +`; + +exports[`should load an out-of-tree "windows" platform that ships with a dependency 1`] = ` +Object { + "haste": Object { + "platforms": Array [ + "windows", + ], + "providesModuleNodeModules": Array [ + "react-native-windows", + ], + }, + "platforms": Object { + "windows": Object {}, + }, +} +`; + +exports[`should load commands from "react-native-foo" and "react-native-bar" packages 1`] = ` +Array [ + Object { + "func": [Function], + "name": "foo-command", + }, + Object { + "func": [Function], + "name": "bar-command", + }, +] +`; + exports[`should merge project configuration with default values 1`] = ` Object { "assets": Array [], @@ -61,45 +118,6 @@ Object { } `; -exports[`should have a valid structure by default 1`] = ` -Object { - "assets": Array [], - "commands": Array [], - "dependencies": Object {}, - "haste": Object { - "platforms": Array [], - "providesModuleNodeModules": Array [], - }, - "platforms": Object {}, - "project": Object {}, - "reactNativePath": ".", - "root": "<>", -} -`; - -exports[`should load an out-of-tree "windows" platform that ships with a dependency 1`] = ` -Object { - "haste": Object { - "platforms": Array [ - "windows", - ], - "providesModuleNodeModules": Array [ - "react-native-windows", - ], - }, - "platforms": Object { - "windows": Object {}, - }, -} -`; - -exports[`should load commands from "react-native-foo" and "react-native-bar" packages 1`] = ` -Array [ - "react-native-foo/command-foo.js", - "react-native-bar/command-bar.js", -] -`; - exports[`should read \`rnpm\` config from a dependency and transform it to a new format 1`] = ` Object { "assets": Array [], @@ -183,15 +201,3 @@ Object { }, } `; - -exports[`should automatically put "react-native" into haste config 1`] = ` -Object { - "platforms": Array [ - "ios", - "android", - ], - "providesModuleNodeModules": Array [ - "react-native", - ], -} -`; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index a12f6464e..bb917ce9c 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -47,9 +47,6 @@ test('should return dependencies from package.json', () => { "dependencies": { "react-native": "0.0.1", "react-native-test": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); @@ -75,9 +72,6 @@ test('should read a config of a dependency and use it to load other settings', ( "dependencies": { "react-native": "0.0.1", "react-native-test": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); @@ -138,9 +132,6 @@ test('should read `rnpm` config from a dependency and transform it to a new form "dependencies": { "react-native": "0.0.1", "react-native-foo": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); @@ -150,32 +141,33 @@ test('should read `rnpm` config from a dependency and transform it to a new form test('should load commands from "react-native-foo" and "react-native-bar" packages', () => { writeFiles(DIR, { - 'node_modules/react-native-foo/package.json': `{ - "react-native": { - "commands": [ - "./command-foo.js" - ] - } + 'node_modules/react-native-foo/package.json': '{}', + 'node_modules/react-native-foo/react-native.config.js': `module.exports = { + commands: [ + { + name: 'foo-command', + func: () => console.log('foo') + } + ] }`, - 'node_modules/react-native-bar/package.json': `{ - "react-native": { - "commands": [ - "./command-bar.js" - ] - } + 'node_modules/react-native-bar/package.json': '{}', + 'node_modules/react-native-bar/react-native.config.js': `module.exports = { + commands: [ + { + name: 'bar-command', + func: () => console.log('bar') + } + ] }`, 'package.json': `{ "dependencies": { "react-native-foo": "0.0.1", "react-native-bar": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); const {commands} = loadConfig(DIR); - expect(removeString(commands, DIR)).toMatchSnapshot(); + expect(commands).toMatchSnapshot(); }); test('should load an out-of-tree "windows" platform that ships with a dependency', () => { @@ -183,6 +175,9 @@ test('should load an out-of-tree "windows" platform that ships with a dependency 'node_modules/react-native-windows/platform.js': ` module.exports = {"windows": {}}; `, + 'node_modules/react-native-windows/plugin.js': ` + module.exports = []; + `, 'node_modules/react-native-windows/package.json': `{ "name": "react-native-windows", "rnpm": { @@ -201,9 +196,6 @@ test('should load an out-of-tree "windows" platform that ships with a dependency 'package.json': `{ "dependencies": { "react-native-windows": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); @@ -217,9 +209,6 @@ test('should automatically put "react-native" into haste config', () => { 'package.json': `{ "dependencies": { "react-native": "0.0.1" - }, - "react-native": { - "reactNativePath": "." } }`, }); diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 03df4add4..aa903cea7 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -83,11 +83,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { ); }, }), - commands: acc.commands.concat( - config.commands.map(pathToCommand => - path.join(dependencyName, pathToCommand), - ), - ), + commands: [...acc.commands, ...config.commands], platforms: { ...acc.platforms, ...config.platforms, diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index edc86091d..fda58d138 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -7,11 +7,16 @@ import Joi from 'joi'; import cosmiconfig from 'cosmiconfig'; import path from 'path'; -import {type UserDependencyConfigT, type UserConfigT} from './types.flow'; +import { + type UserDependencyConfigT, + type UserConfigT, + type CommandT, +} from './types.flow'; import {JoiError} from '../errors'; import * as schema from './schema'; + import {logger} from '@react-native-community/cli-tools'; /** @@ -60,6 +65,27 @@ export function readDependencyConfigFromDisk( return result.value; } +/** + * Returns an array of commands that are defined in the project. + * + * `config.project` can be either an array of paths or a single string. + * Each of the files can export a commands (object) or an array of commands + */ +const loadProjectCommands = ( + root, + commands: ?(Array | string), +): Array => { + return [] + .concat(commands || []) + .reduce((acc: Array, cmdPath: string) => { + const cmds: Array | CommandT = require(path.join( + root, + cmdPath, + )); + return acc.concat(cmds); + }, []); +}; + /** * Reads a legacy configuaration from a `package.json` "rnpm" key. */ @@ -82,7 +108,7 @@ export function readLegacyDependencyConfigFromDisk( hooks: config.commands, params: config.params, }, - commands: [].concat(config.plugin || []), + commands: loadProjectCommands(rootFolder, config.plugin), platforms: config.platform ? require(path.join(rootFolder, config.platform)) : undefined, diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 067395c52..094c4e335 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -9,6 +9,30 @@ const map = (key, value) => .unknown(true) .pattern(key, value); +/** + * Schema for CommandT + */ +const command = t.object({ + name: t.string().required(), + description: t.string(), + usage: t.string(), + func: t.func().required(), + options: t.array().items( + t.object({ + command: t.string().required(), + description: t.string(), + parse: t.func(), + default: t.alternatives().try([t.bool(), t.number(), t.string()]), + }), + ), + examples: t.array().items( + t.object({ + desc: t.string().required(), + cmd: t.string().required(), + }), + ), +}); + /** * Schema for UserDependencyConfigT */ @@ -62,7 +86,7 @@ export const dependencyConfig = t ).default(), commands: t .array() - .items(t.string()) + .items(command) .default([]), }) .default(); @@ -142,7 +166,7 @@ export const projectConfig = t .default([]), commands: t .array() - .items(t.string()) + .items(command) .default([]), }) .default(); diff --git a/packages/cli/src/tools/config/types.flow.js b/packages/cli/src/tools/config/types.flow.js index 9e038d86b..93d6725c7 100644 --- a/packages/cli/src/tools/config/types.flow.js +++ b/packages/cli/src/tools/config/types.flow.js @@ -1,6 +1,22 @@ /** * @flow */ +export type CommandT = { + name: string, + description?: string, + usage?: string, + func: (argv: Array, ctx: ConfigT, args: Object) => ?Promise, + options?: Array<{ + command: string, + description?: string, + parse?: (val: string) => any, + default?: string | boolean | number, + }>, + examples?: Array<{ + desc: string, + cmd: string, + }>, +}; /** * Opaque type that describes the Inquirer question format. Not typed, since we just @@ -122,7 +138,7 @@ export type ConfigT = {| }, // An array of commands that are present in 3rd party packages - commands: string[], + commands: CommandT[], // Haste configuration resolved based on available plugins haste: { @@ -159,7 +175,7 @@ export type UserDependencyConfigT = { }, // An array of commands that ship with the dependency - commands: string[], + commands: CommandT[], // An array of extra platforms to load platforms: { diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 8a380f0d9..14c4c5b18 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -5,7 +5,7 @@ import path from 'path'; import {createBlacklist} from 'metro'; import {loadConfig} from 'metro-config'; -import {type ContextT} from './types.flow'; +import {type ConfigT} from './config/types.flow'; import findSymlinkedModules from './findSymlinkedModules'; const resolveSymlinksForRoots = roots => @@ -30,7 +30,7 @@ const getBlacklistRE = () => createBlacklist([/.*\/__fixtures__\/.*/]); * @todo(grabbou): As a separate PR, haste.platforms should be added before "native". * Otherwise, a.native.js will not load on Windows or other platforms */ -export const getDefaultConfig = (ctx: ContextT) => { +export const getDefaultConfig = (ctx: ConfigT) => { return { resolver: { resolverMainFields: ['react-native', 'browser', 'main'], @@ -80,7 +80,7 @@ export type ConfigOptionsT = {| * * This allows the CLI to always overwrite the file settings. */ -export default function load(ctx: ContextT, options?: ConfigOptionsT) { +export default function load(ctx: ConfigT, options?: ConfigOptionsT) { const defaultConfig = getDefaultConfig(ctx); return loadConfig({cwd: ctx.root, ...options}, defaultConfig); diff --git a/packages/cli/src/tools/types.flow.js b/packages/cli/src/tools/types.flow.js deleted file mode 100644 index 5926e655c..000000000 --- a/packages/cli/src/tools/types.flow.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @flow - */ - -import {type ConfigT} from './config/types.flow'; - -export type ContextT = ConfigT; - -export type LocalCommandT = { - name: string, - description?: string, - usage?: string, - func: (argv: Array, ctx: ContextT, args: Object) => ?Promise, - options?: Array<{ - command: string, - description?: string, - parse?: (val: string) => any, - default?: string | boolean | number, - }>, - examples?: Array<{ - desc: string, - cmd: string, - }>, -}; - -type Package = { - version: string, - name: string, -}; - -/** - * User can define command either as an object (RequiredCommandT) or - * as an array of commands (Array). - */ -export type ProjectCommandT = LocalCommandT & { - pkg: Package, -}; - -/** - * Main type. Can be either local or a project command. - */ -export type CommandT = LocalCommandT | ProjectCommandT; From ad702edc6ce71d6e10b98bd7df21155619661bd2 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 9 Apr 2019 15:10:29 +0200 Subject: [PATCH 065/234] fix: resolve relative paths for reactNativePath (#297) * Fix for relative paths * Update snapshots --- .../tools/config/__tests__/__snapshots__/index-test.js.snap | 4 ++-- packages/cli/src/tools/config/index.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index e2389afcb..27ab9e567 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -23,7 +23,7 @@ Object { }, "platforms": Object {}, "project": Object {}, - "reactNativePath": ".", + "reactNativePath": "<>", "root": "<>", } `; @@ -113,7 +113,7 @@ Object { "android": null, "ios": null, }, - "reactNativePath": ".", + "reactNativePath": "<>", "root": "<>", } `; diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index aa903cea7..c5beefef9 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -99,9 +99,9 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { ({ root: projectRoot, get reactNativePath() { - return ( - userConfig.reactNativePath || resolveReactNativePath(projectRoot) - ); + return userConfig.reactNativePath + ? path.resolve(projectRoot, userConfig.reactNativePath) + : resolveReactNativePath(projectRoot); }, dependencies: {}, commands: userConfig.commands, From fa08711ae68906d83091c569876e28e944d92aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Apr 2019 23:18:56 +0200 Subject: [PATCH 066/234] chore: bump Jest and Flow to latest (#304) --- package.json | 2 +- yarn.lock | 1566 +++++++++++++++++++++++++++----------------------- 2 files changed, 848 insertions(+), 720 deletions(-) diff --git a/package.json b/package.json index 308f6ed51..66efb935a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "chalk": "^2.4.2", "eslint": "^5.10.0", "execa": "^1.0.0", - "flow-bin": "^0.95.1", + "flow-bin": "^0.96.0", "flow-typed": "^2.5.1", "glob": "^7.1.3", "jest": "^24.6.0", diff --git a/yarn.lock b/yarn.lock index 3bae4772a..2c3426197 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,7 @@ "@babel/code-frame@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== dependencies: "@babel/highlight" "^7.0.0" @@ -28,51 +29,41 @@ source-map "^0.5.0" "@babel/core@^7.1.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" - integrity sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw== + version "7.4.3" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.3.tgz#198d6d3af4567be3989550d97e068de94503074f" + integrity sha512-oDpASqKFlbspQfzAE7yaeTmdljSH2ADIvBlb0RwbStltTuWa0+7CCI1fYVINNv9saHPa1W7oaKeuNuKj+RQCvA== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.2.2" - "@babel/helpers" "^7.2.0" - "@babel/parser" "^7.2.2" - "@babel/template" "^7.2.2" - "@babel/traverse" "^7.2.2" - "@babel/types" "^7.2.2" + "@babel/generator" "^7.4.0" + "@babel/helpers" "^7.4.3" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" convert-source-map "^1.1.0" debug "^4.1.0" json5 "^2.1.0" - lodash "^4.17.10" + lodash "^4.17.11" resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.0.0", "@babel/generator@^7.1.2", "@babel/generator@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.1.3.tgz#2103ec9c42d9bdad9190a6ad5ff2d456fd7b8673" - dependencies: - "@babel/types" "^7.1.3" - jsesc "^2.5.1" - lodash "^4.17.10" - source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/generator@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.1.5.tgz#615f064d13d95f8f9157c7261f68eddf32ec15b3" +"@babel/generator@^7.0.0", "@babel/generator@^7.4.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.0.tgz#c230e79589ae7a729fd4631b9ded4dc220418196" + integrity sha512-/v5I+a1jhGSKLgZDcmAUZ4K/VePi43eRkUs3yePW1HB1iANOD5tqJXwGSG4BZhSksP8J9ejSlwGeTiiOFZOrXQ== dependencies: - "@babel/types" "^7.1.5" + "@babel/types" "^7.4.0" jsesc "^2.5.1" - lodash "^4.17.10" + lodash "^4.17.11" source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.2.tgz#18c816c70962640eab42fe8cae5f3947a5c65ccc" - integrity sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg== +"@babel/generator@^7.1.2": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.1.3.tgz#2103ec9c42d9bdad9190a6ad5ff2d456fd7b8673" dependencies: - "@babel/types" "^7.2.2" + "@babel/types" "^7.1.3" jsesc "^2.5.1" lodash "^4.17.10" source-map "^0.5.0" @@ -124,6 +115,7 @@ "@babel/helper-function-name@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== dependencies: "@babel/helper-get-function-arity" "^7.0.0" "@babel/template" "^7.1.0" @@ -132,6 +124,7 @@ "@babel/helper-get-function-arity@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== dependencies: "@babel/types" "^7.0.0" @@ -173,6 +166,7 @@ "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== "@babel/helper-regex@^7.0.0": version "7.0.0" @@ -206,11 +200,12 @@ "@babel/template" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-split-export-declaration@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" +"@babel/helper-split-export-declaration@^7.0.0", "@babel/helper-split-export-declaration@^7.4.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.0.tgz#571bfd52701f492920d63b7f735030e9a3e10b55" + integrity sha512-7Cuc6JZiYShaZnybDmfwhY4UYHzI6rlqhWjaIqbsJGsIqPimEYy5uh3akSRLMg65LSdSEnJ8a8/bWQN6u2oMGw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.4.0" "@babel/helper-wrap-function@^7.1.0": version "7.1.0" @@ -229,40 +224,28 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.1.2" -"@babel/helpers@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.2.0.tgz#8335f3140f3144270dc63c4732a4f8b0a50b7a21" - integrity sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A== +"@babel/helpers@^7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.3.tgz#7b1d354363494b31cb9a2417ae86af32b7853a3b" + integrity sha512-BMh7X0oZqb36CfyhvtbSmcWc3GXocfxv3yNsAEuM0l+fAqSO22rQrUpijr3oE/10jCTrB6/0b9kzmG4VetCj8Q== dependencies: - "@babel/template" "^7.1.2" - "@babel/traverse" "^7.1.5" - "@babel/types" "^7.2.0" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" "@babel/highlight@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.2", "@babel/parser@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.3.tgz#2c92469bac2b7fbff810b67fca07bd138b48af77" - -"@babel/parser@^7.1.0": - version "7.4.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.2.tgz#b4521a400cb5a871eab3890787b4bc1326d38d91" - integrity sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g== - -"@babel/parser@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.5.tgz#20b7d5e7e1811ba996f8a868962ea7dd2bfcd2fc" - -"@babel/parser@^7.2.2", "@babel/parser@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.3.tgz#32f5df65744b70888d17872ec106b02434ba1489" - integrity sha512-0LyEcVlfCoFmci8mXx8A5oIkpkOgyo8dRHtxBnK9RRBwxO2+JZPNsqtVEZQ7mJFPxnXF9lfmU24mHOPI0qnlkA== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.2", "@babel/parser@^7.4.0", "@babel/parser@^7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.3.tgz#eb3ac80f64aa101c907d4ce5406360fe75b7895b" + integrity sha512-gxpEUhTS1sGA63EGQGuA+WESPR/6tz6ng7tSHFCmaTJK/cGK8y37cBTspX+U2xCAue2IQVvF6Z0oigmjwD8YGQ== "@babel/plugin-external-helpers@^7.0.0": version "7.0.0" @@ -415,13 +398,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz#37d8fbcaf216bd658ea1aebbeb8b75e88ebc549b" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-object-rest-spread@^7.2.0": +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== @@ -938,92 +915,31 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.1.2.tgz#090484a574fef5a2d2d7726a674eceda5c5b5644" - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.1.2" - "@babel/types" "^7.1.2" - -"@babel/template@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" - integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.2.2" - "@babel/types" "^7.2.2" - -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0": - version "7.1.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.1.4.tgz#f4f83b93d649b4b2c91121a9087fa2fa949ec2b4" - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.1.3" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.1.3" - "@babel/types" "^7.1.3" - debug "^3.1.0" - globals "^11.1.0" - lodash "^4.17.10" - -"@babel/traverse@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.1.5.tgz#5aafca2039aa058c104cf2bfeb9fc4a857ccbca9" +"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.4.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.0.tgz#12474e9c077bae585c5d835a95c0b0b790c25c8b" + integrity sha512-SOWwxxClTTh5NdbbYZ0BmaBVzxzTh2tO/TeLTbF6MO6EzVhHTnff8CdBXx3mEtazFBoysmEM6GU/wF+SuSx4Fw== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.1.5" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.1.5" - "@babel/types" "^7.1.5" - debug "^3.1.0" - globals "^11.1.0" - lodash "^4.17.10" + "@babel/parser" "^7.4.0" + "@babel/types" "^7.4.0" -"@babel/traverse@^7.2.2": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.3.tgz#7ff50cefa9c7c0bd2d81231fdac122f3957748d8" - integrity sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw== +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.3.tgz#1a01f078fc575d589ff30c0f71bf3c3d9ccbad84" + integrity sha512-HmA01qrtaCwwJWpSKpA948cBvU5BrmviAief/b3AVw936DtcdsTexlbyzNuDnthwhOQ37xshn7hvQaEQk7ISYQ== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.2.2" + "@babel/generator" "^7.4.0" "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.2.3" - "@babel/types" "^7.2.2" + "@babel/helper-split-export-declaration" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/types" "^7.4.0" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.10" - -"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.1.3.tgz#3a767004567060c2f40fca49a304712c525ee37d" - dependencies: - esutils "^2.0.2" - lodash "^4.17.10" - to-fast-properties "^2.0.0" - -"@babel/types@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.1.5.tgz#12fe64e91a431234b7017b4227a78cc0eec4e081" - dependencies: - esutils "^2.0.2" - lodash "^4.17.10" - to-fast-properties "^2.0.0" - -"@babel/types@^7.2.0", "@babel/types@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.2.tgz#44e10fc24e33af524488b716cdaee5360ea8ed1e" - integrity sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg== - dependencies: - esutils "^2.0.2" - lodash "^4.17.10" - to-fast-properties "^2.0.0" + lodash "^4.17.11" -"@babel/types@^7.3.0": +"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.1.3", "@babel/types@^7.3.0", "@babel/types@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.0.tgz#670724f77d24cce6cc7d8cf64599d511d164894c" integrity sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA== @@ -1040,41 +956,41 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@jest/console@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.6.0.tgz#63225e6889f3865ab5b7a0d8797e8aed417c4e0b" - integrity sha512-nNZbwtZwW6dr7bvZpRBCdBNvZYi+jr6lfnubSOCELk/Km/5csDmGdqeS4qKwGKIVlHTyZ95MYExYevpdh26tDA== +"@jest/console@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" + integrity sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg== dependencies: "@jest/source-map" "^24.3.0" chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.6.0.tgz#148c2dc60be7daef1e148bf8c0a01bb1391609df" - integrity sha512-rZ/5295Geou6o1+vp2+G+p7nV6wITrCR7KSnZc+Dru8QbWAR+M9SPb0BHiRTzQvfVQFkk0AkbTw1GWjCRUX/GA== - dependencies: - "@jest/console" "^24.6.0" - "@jest/reporters" "^24.6.0" - "@jest/test-result" "^24.6.0" - "@jest/transform" "^24.6.0" - "@jest/types" "^24.6.0" +"@jest/core@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.7.1.tgz#6707f50db238d0c5988860680e2e414df0032024" + integrity sha512-ivlZ8HX/FOASfHcb5DJpSPFps8ydfUYzLZfgFFqjkLijYysnIEOieg72YRhO4ZUB32xu40hsSMmaw+IGYeKONA== + dependencies: + "@jest/console" "^24.7.1" + "@jest/reporters" "^24.7.1" + "@jest/test-result" "^24.7.1" + "@jest/transform" "^24.7.1" + "@jest/types" "^24.7.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.6.0" - jest-config "^24.6.0" - jest-haste-map "^24.6.0" - jest-message-util "^24.6.0" + jest-changed-files "^24.7.0" + jest-config "^24.7.1" + jest-haste-map "^24.7.1" + jest-message-util "^24.7.1" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.6.0" - jest-runner "^24.6.0" - jest-runtime "^24.6.0" - jest-snapshot "^24.6.0" - jest-util "^24.6.0" - jest-validate "^24.6.0" - jest-watcher "^24.6.0" + jest-resolve-dependencies "^24.7.1" + jest-runner "^24.7.1" + jest-runtime "^24.7.1" + jest-snapshot "^24.7.1" + jest-util "^24.7.1" + jest-validate "^24.7.0" + jest-watcher "^24.7.1" micromatch "^3.1.10" p-each-series "^1.0.0" pirates "^4.0.1" @@ -1082,34 +998,34 @@ rimraf "^2.5.4" strip-ansi "^5.0.0" -"@jest/environment@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.6.0.tgz#6dea095baee2ce23ed05328468f945291f30ed30" - integrity sha512-LccuUfnREDNFbKmMWrtzUJu6fwU1E6ddYlYSDuClEQvboMKQQMUuCSYXvRUQFtDdeVjUfxkHqfSVvBzuph0b7w== - dependencies: - "@jest/fake-timers" "^24.6.0" - "@jest/transform" "^24.6.0" - "@jest/types" "^24.6.0" - jest-mock "^24.6.0" - -"@jest/fake-timers@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.6.0.tgz#4eb0b47539883742e9f969e983770230f5a57d7b" - integrity sha512-92nYqkZceki6knls7F6/FrPxKXnQl0QjYXbjLk/EFfp6xcg4ETLQSAur7pMZsiAzazAgQag/XDvMmKwMbunAeg== - dependencies: - "@jest/types" "^24.6.0" - jest-message-util "^24.6.0" - jest-mock "^24.6.0" - -"@jest/reporters@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.6.0.tgz#2b4d75255743cbc448ba0a4890912e1e148417b4" - integrity sha512-fx20elfvGcuImjQZrNPS1fl/uj3mjuSf0vQFUoAPhQDarMzSbekLfRH8ZWt4ir1kpE36dLdFeFkeB8dhaTueIA== - dependencies: - "@jest/environment" "^24.6.0" - "@jest/test-result" "^24.6.0" - "@jest/transform" "^24.6.0" - "@jest/types" "^24.6.0" +"@jest/environment@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.7.1.tgz#9b9196bc737561f67ac07817d4c5ece772e33135" + integrity sha512-wmcTTYc4/KqA+U5h1zQd5FXXynfa7VGP2NfF+c6QeGJ7c+2nStgh65RQWNX62SC716dTtqheTRrZl0j+54oGHw== + dependencies: + "@jest/fake-timers" "^24.7.1" + "@jest/transform" "^24.7.1" + "@jest/types" "^24.7.0" + jest-mock "^24.7.0" + +"@jest/fake-timers@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.7.1.tgz#56e5d09bdec09ee81050eaff2794b26c71d19db2" + integrity sha512-4vSQJDKfR2jScOe12L9282uiwuwQv9Lk7mgrCSZHA9evB9efB/qx8i0KJxsAKtp8fgJYBJdYY7ZU6u3F4/pyjA== + dependencies: + "@jest/types" "^24.7.0" + jest-message-util "^24.7.1" + jest-mock "^24.7.0" + +"@jest/reporters@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.7.1.tgz#38ac0b096cd691bbbe3051ddc25988d42e37773a" + integrity sha512-bO+WYNwHLNhrjB9EbPL4kX/mCCG4ZhhfWmO3m4FSpbgr7N83MFejayz30kKjgqr7smLyeaRFCBQMbXpUgnhAJw== + dependencies: + "@jest/environment" "^24.7.1" + "@jest/test-result" "^24.7.1" + "@jest/transform" "^24.7.1" + "@jest/types" "^24.7.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -1117,10 +1033,10 @@ istanbul-lib-coverage "^2.0.2" istanbul-lib-instrument "^3.0.1" istanbul-lib-source-maps "^3.0.1" - jest-haste-map "^24.6.0" - jest-resolve "^24.6.0" - jest-runtime "^24.6.0" - jest-util "^24.6.0" + jest-haste-map "^24.7.1" + jest-resolve "^24.7.1" + jest-runtime "^24.7.1" + jest-util "^24.7.1" jest-worker "^24.6.0" node-notifier "^5.2.1" slash "^2.0.0" @@ -1136,40 +1052,50 @@ graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.6.0.tgz#fd56c12b031601c282eede8a5ec1317ebe63bd11" - integrity sha512-k6pdgBBJIDbBgQGZgt8IbQC/KrOAC+fsSZrHw62R54FnfoYzuDqnrbB/AfPJS8T4RjDsWvnAHgXLH866yG10Pg== +"@jest/test-result@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.7.1.tgz#19eacdb29a114300aed24db651e5d975f08b6bbe" + integrity sha512-3U7wITxstdEc2HMfBX7Yx3JZgiNBubwDqQMh+BXmZXHa3G13YWF3p6cK+5g0hGkN3iufg/vGPl3hLxQXD74Npg== dependencies: - "@jest/console" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/console" "^24.7.1" + "@jest/types" "^24.7.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/transform@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.6.0.tgz#dc7a00591651b89c2582602fe5c4ce47a5398148" - integrity sha512-aC7Yff2XREV1C/RQCoP1WzO3NU4EtmImIJXnNm4tTgaLoGGv1HJuXziyd5v7zOjBzn96793rF0iLHlFT4w4ErA== +"@jest/test-sequencer@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.7.1.tgz#9c18e428e1ad945fa74f6233a9d35745ca0e63e0" + integrity sha512-84HQkCpVZI/G1zq53gHJvSmhUer4aMYp9tTaffW28Ih5OxfCg8hGr3nTSbL1OhVDRrFZwvF+/R9gY6JRkDUpUA== + dependencies: + "@jest/test-result" "^24.7.1" + jest-haste-map "^24.7.1" + jest-runner "^24.7.1" + jest-runtime "^24.7.1" + +"@jest/transform@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.7.1.tgz#872318f125bcfab2de11f53b465ab1aa780789c2" + integrity sha512-EsOUqP9ULuJ66IkZQhI5LufCHlTbi7hrcllRMUEV/tOgqBVQi93+9qEvkX0n8mYpVXQ8VjwmICeRgg58mrtIEw== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" babel-plugin-istanbul "^5.1.0" chalk "^2.0.1" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.15" - jest-haste-map "^24.6.0" + jest-haste-map "^24.7.1" jest-regex-util "^24.3.0" - jest-util "^24.6.0" + jest-util "^24.7.1" micromatch "^3.1.10" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.6.0": - version "24.6.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.6.0.tgz#cf018e56f3ef45e81119fd613fc20a9819f4eddd" - integrity sha512-hnCMhUokUm6A4HPE9j3pNG9N+bSFfhqje3EbIrW6YjUW2SXuyZxy1QsJdaICo1oN1o2vVSx6qlVqQYkmWVsjiA== +"@jest/types@^24.7.0": + version "24.7.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.7.0.tgz#c4ec8d1828cdf23234d9b4ee31f5482a3f04f48b" + integrity sha512-ipJUa2rFWiKoBqMKP63Myb6h9+iT3FHRTF2M8OR6irxWzItisa8i4dcSg14IbvmXUnBlHBlUQPYUHWyX3UPpYA== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/yargs" "^12.0.9" @@ -1925,9 +1851,9 @@ integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== "@types/yargs@^12.0.2", "@types/yargs@^12.0.9": - version "12.0.10" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.10.tgz#17a8ec65cd8e88f51b418ceb271af18d3137df67" - integrity sha512-WsVzTPshvCSbHThUduGGxbmnwcpkgSctHGHTqzWyFg4lYAuV5qXlyFPOsP3OWqCINfmg/8VXP+zJaa4OxEsBQQ== + version "12.0.12" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" + integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" @@ -1940,6 +1866,7 @@ JSONStream@^1.0.4, JSONStream@^1.3.4: abab@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" + integrity sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w== abbrev@1: version "1.1.1" @@ -1959,6 +1886,7 @@ accepts@~1.3.3, accepts@~1.3.5: acorn-globals@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.0.tgz#e3b6f8da3c1552a95ae627571f7dd6923bb54103" + integrity sha512-hMtHj3s5RnuhvHPowpBYvJVj3rAar82JiDQHvGs1zO0l10ocX/xEdBShNHTJaboucJUsScghp74pH3s7EnHHQw== dependencies: acorn "^6.0.1" acorn-walk "^6.0.1" @@ -1968,14 +1896,21 @@ acorn-jsx@^5.0.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.0.tgz#958584ddb60990c02c97c1bd9d521fce433bb101" acorn-walk@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.0.tgz#c957f4a1460da46af4a0388ce28b4c99355b0cbc" + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" + integrity sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== acorn@^5.5.3: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +acorn@^6.0.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" + integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== -acorn@^6.0.1, acorn@^6.0.2: +acorn@^6.0.2: version "6.0.4" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.4.tgz#77377e7353b72ec5104550aa2d2097a2fd40b754" @@ -1998,16 +1933,7 @@ ajv-keywords@^3.0.0: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.0.tgz#4b831e7b531415a7cc518cd404e73f6193c6349d" integrity sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw== -ajv@^5.3.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" - -ajv@^6.0.1: +ajv@^6.0.1, ajv@^6.5.5: version "6.10.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== @@ -2027,8 +1953,9 @@ ajv@^6.5.3: uri-js "^4.2.2" ansi-escapes@^3.0.0: - version "3.1.0" - resolved "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== ansi-fragments@^0.2.1: version "0.2.1" @@ -2042,16 +1969,14 @@ ansi-fragments@^0.2.1: ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" - -ansi-regex@^4.1.0: +ansi-regex@^4.0.0, ansi-regex@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== @@ -2063,12 +1988,14 @@ ansi-styles@^2.2.1: ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== dependencies: micromatch "^3.1.4" normalize-path "^2.1.1" @@ -2099,20 +2026,24 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= array-differ@^1.0.0: version "1.0.0" @@ -2122,6 +2053,7 @@ array-differ@^1.0.0: array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= array-filter@~0.0.0: version "0.0.1" @@ -2166,6 +2098,7 @@ array-uniq@^1.0.1: array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" @@ -2178,16 +2111,19 @@ asap@^2.0.0, asap@~2.0.3: asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== dependencies: safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= astral-regex@^1.0.0: version "1.0.0" @@ -2196,32 +2132,44 @@ astral-regex@^1.0.0: async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== async@0.2.x, async@~0.2.9: version "0.2.10" resolved "http://registry.npmjs.org/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" -async@^2.4.0, async@^2.6.1: +async@^2.4.0: version "2.6.1" resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" dependencies: lodash "^4.17.10" +async@^2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" + integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg== + dependencies: + lodash "^4.17.11" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== babel-eslint@10.0.1: version "10.0.1" @@ -2235,13 +2183,13 @@ babel-eslint@10.0.1: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babel-jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.6.0.tgz#58aa1e6a3d72fdd986644a92529f0ec7d2f1cf61" - integrity sha512-HpI/orChKlJZbWC2p52ghWeK+UYqU9ql+zYw+ctOr3vIuPZowcSL13RwReW5ZeYKxsRr8dZmQozGvPX93Gw1tw== +babel-jest@^24.6.0, babel-jest@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.7.1.tgz#73902c9ff15a7dfbdc9994b0b17fcefd96042178" + integrity sha512-GPnLqfk8Mtt0i4OemjWkChi73A3ALs4w2/QbG64uAj8b5mmwzxc7jbJVRZt8NJkxi6FopVHog9S3xX6UJKb2qg== dependencies: - "@jest/transform" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/transform" "^24.7.1" + "@jest/types" "^24.7.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" babel-preset-jest "^24.6.0" @@ -2249,9 +2197,9 @@ babel-jest@^24.6.0: slash "^2.0.0" babel-plugin-istanbul@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.0.tgz#6892f529eff65a3e2d33d87dc5888ffa2ecd4a30" - integrity sha512-CLoXPRSUWiR8yao8bShqZUIC6qLfZVVY3X1wj+QPNXu0wfmrRRfarh1LYy+dYMVI+bDj0ghy3tuqFFRFZmL1Nw== + version "5.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.1.tgz#7981590f1956d75d67630ba46f0c22493588c893" + integrity sha512-RNNVv2lsHAXJQsEJ5jonQwrJVWK8AcZpG1oxhnjCUaAjL7xahYLANhPUZbzEQHjKy1NMYUwn+0NPKQc8iSY4xQ== dependencies: find-up "^3.0.0" istanbul-lib-instrument "^3.0.0" @@ -2329,6 +2277,7 @@ babel-runtime@^6.26.0: balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base64-js@^1.2.3: version "1.3.0" @@ -2337,6 +2286,7 @@ base64-js@^1.2.3: base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -2355,6 +2305,7 @@ basic-auth@~2.0.0: bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" @@ -2412,6 +2363,7 @@ bplist-parser@0.1.1: brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -2419,6 +2371,7 @@ brace-expansion@^1.1.7: braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" @@ -2434,10 +2387,12 @@ braces@^2.3.1: browser-process-hrtime@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== browser-resolve@^1.11.3: version "1.11.3" resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== dependencies: resolve "1.1.7" @@ -2453,6 +2408,7 @@ browserslist@^4.3.4: bser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + integrity sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk= dependencies: node-int64 "^0.4.0" @@ -2468,6 +2424,7 @@ buffer-crc32@^0.2.13: buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== buffer-indexof-polyfill@~1.0.0: version "1.0.1" @@ -2487,6 +2444,7 @@ buffers@~0.1.1: builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= builtins@^1.0.3: version "1.0.3" @@ -2530,6 +2488,7 @@ cacache@^11.0.1, cacache@^11.3.2: cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -2575,9 +2534,9 @@ callsites@^2.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" callsites@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" - integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase-keys@^2.0.0: version "2.1.0" @@ -2611,9 +2570,9 @@ camelcase@^4.1.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" camelcase@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" - integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== caniuse-lite@^1.0.30000929: version "1.0.30000929" @@ -2636,6 +2595,7 @@ capture-exit@^2.0.0: caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= chainsaw@~0.1.0: version "0.1.0" @@ -2654,18 +2614,18 @@ chalk@^1.1.1: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^2.3.1, chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== +chalk@^2.1.0, chalk@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" @@ -2705,6 +2665,7 @@ circular-json@^0.3.1: class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" @@ -2737,6 +2698,7 @@ cliui@^3.2.0: cliui@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" @@ -2758,14 +2720,17 @@ cmd-shim@^2.0.2: co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" @@ -2773,12 +2738,14 @@ collection-visit@^1.0.0: color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= colorette@^1.0.7: version "1.0.7" @@ -2805,10 +2772,11 @@ columnify@^1.5.4: combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" + integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== dependencies: delayed-stream "~1.0.0" -commander@^2.19.0: +commander@^2.19.0, commander@~2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== @@ -2818,11 +2786,6 @@ commander@~2.13.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" integrity sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA== -commander@~2.17.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== - commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2844,6 +2807,7 @@ compare-versions@^3.2.1: component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + integrity sha1-E3kY1teCg/ffemt8WmPhQOaUJeY= compressible@~2.0.14: version "2.0.15" @@ -2866,6 +2830,7 @@ compression@^1.7.1: concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= concat-stream@^1.5.0, concat-stream@^1.6.0: version "1.6.2" @@ -2983,6 +2948,7 @@ conventional-recommended-bump@^4.0.4: convert-source-map@^1.1.0, convert-source-map@^1.4.0: version "1.6.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== dependencies: safe-buffer "~5.1.1" @@ -3001,6 +2967,7 @@ copy-concurrently@^1.0.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js@^2.2.2, core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.7: version "2.6.5" @@ -3014,6 +2981,7 @@ core-js@^2.4.1: core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= cosmiconfig@^5.0.5: version "5.0.6" @@ -3057,12 +3025,14 @@ crypt@~0.0.1: integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.4.tgz#8cd52e8a3acfd68d3aed38ee0a640177d2f9d797" + version "0.3.6" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad" + integrity sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A== cssstyle@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.1.1.tgz#18b038a9c44d65f7a8e428a653b9f6fe42faf5fb" + version "1.2.2" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.2.2.tgz#427ea4d585b18624f6fdbf9de7a2a1a3ba713077" + integrity sha512-43wY3kl1CVQSvL7wUY1qXkxVGkStjpkDmVjiIKX8R97uhajy8Bybay78uOtqvh7Q5GK75dNPfW0geWjE6qQQow== dependencies: cssom "0.3.x" @@ -3092,12 +3062,14 @@ dargs@^4.0.1: dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" data-urls@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== dependencies: abab "^2.0.0" whatwg-mimetype "^2.2.0" @@ -3124,6 +3096,7 @@ debug@3.1.0: debug@^3.1.0: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" @@ -3160,6 +3133,7 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= decompress-response@^3.2.0: version "3.3.0" @@ -3184,6 +3158,7 @@ deep-extend@^0.6.0: deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= deepmerge@3.2.0, deepmerge@^3.2.0: version "3.2.0" @@ -3207,24 +3182,28 @@ defaults@^1.0.3: define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" @@ -3244,6 +3223,7 @@ del@^2.0.2: delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" @@ -3278,6 +3258,7 @@ detect-libc@^1.0.2: detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= dezalgo@^1.0.0: version "1.0.3" @@ -3287,11 +3268,6 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" -diff-sequences@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.0.0.tgz#cdf8e27ed20d8b8d3caccb4e0c0d8fe31a173013" - integrity sha512-46OkIuVGBBnrC0soO/4LHu5LHGHx0uhP65OVz8XOrAJpqiCB2aVIuESvjI1F9oqebuvY8lekS1pt6TN7vt7qsw== - diff-sequences@^24.3.0: version "24.3.0" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" @@ -3319,6 +3295,7 @@ dom-walk@^0.1.0: domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== dependencies: webidl-conversions "^4.0.2" @@ -3366,6 +3343,7 @@ duplexify@^3.4.2, duplexify@^3.6.0: ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" safer-buffer "^2.1.0" @@ -3418,7 +3396,7 @@ errorhandler@^1.5.0: accepts "~1.3.3" escape-html "~1.0.3" -es-abstract@^1.11.0: +es-abstract@^1.11.0, es-abstract@^1.5.1: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== @@ -3430,7 +3408,7 @@ es-abstract@^1.11.0: is-regex "^1.0.4" object-keys "^1.0.12" -es-abstract@^1.5.1, es-abstract@^1.7.0: +es-abstract@^1.7.0: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" dependencies: @@ -3469,8 +3447,9 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" escodegen@^1.9.1: - version "1.11.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.0.tgz#b27a9389481d5bfd5bec76f7bb1eb3f8f4556589" + version "1.11.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" + integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw== dependencies: esprima "^3.1.3" estraverse "^4.2.0" @@ -3615,10 +3594,12 @@ espree@^5.0.0: esprima@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: version "1.0.1" @@ -3662,6 +3643,7 @@ exec-sh@^0.3.2: execa@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" + integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw== dependencies: cross-spawn "^6.0.0" get-stream "^3.0.0" @@ -3699,10 +3681,12 @@ execa@^1.0.0: exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -3712,27 +3696,29 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.6.0.tgz#0db9c0acd939d939426f7eef272dc69682b71bb0" - integrity sha512-kxe6ALQboiWfbAvY+ApKyQ42ZGksLPfUhF0Nf0k04aBcLjVxwwn47Uz9Kbv4pELUuzJaU7tvWbvzRpNrIXfcQw== +expect@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.7.1.tgz#d91defbab4e627470a152feaf35b3c31aa1c7c14" + integrity sha512-mGfvMTPduksV3xoI0xur56pQsg2vJjNf5+a+bXOjqCkiCBbmCayrBbHS/75y9K430cfqyocPr2ZjiNiRx4SRKw== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" ansi-styles "^3.2.0" jest-get-type "^24.3.0" - jest-matcher-utils "^24.6.0" - jest-message-util "^24.6.0" + jest-matcher-utils "^24.7.0" + jest-message-util "^24.7.1" jest-regex-util "^24.3.0" extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" @@ -3740,6 +3726,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== external-editor@^2.0.4: version "2.2.0" @@ -3760,6 +3747,7 @@ external-editor@^3.0.0: extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -3773,19 +3761,17 @@ extglob@^2.0.4: extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= extsprintf@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= eyes@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" - fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -3810,14 +3796,17 @@ fast-glob@^2.0.2: fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= dependencies: bser "^2.0.0" @@ -3859,6 +3848,7 @@ file-entry-cache@^2.0.0: fileset@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + integrity sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA= dependencies: glob "^7.0.3" minimatch "^3.0.3" @@ -3866,6 +3856,7 @@ fileset@^2.0.3: fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" @@ -3909,6 +3900,7 @@ find-up@^2.0.0, find-up@^2.1.0: find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== dependencies: locate-path "^3.0.0" @@ -3921,10 +3913,10 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.95.1: - version "0.95.1" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.95.1.tgz#633113831ccff4b7ee70a2730f63fc43b69ba85f" - integrity sha512-06IOC/pqPMNRYtC6AMZEWYR9Fi6UdBC7gImGinPuNUpPZFnP5E9/0cBCl3DWrH4zz/gSM2HdDilU7vPGpYIr2w== +flow-bin@^0.96.0: + version "0.96.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.96.0.tgz#3b0379d97304dc1879ae6db627cd2d6819998661" + integrity sha512-OSxERs0EdhVxEVCst/HmlT/RcnXsQQIRqcfK9J9wC8/93JQj+xQz4RtlsmYe1PSRYaozuDLyPS5pIA81Zwzaww== flow-typed@^2.5.1: version "2.5.1" @@ -3958,14 +3950,17 @@ flush-write-stream@^1.0.0: for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.6" @@ -3974,6 +3969,7 @@ form-data@~2.3.2: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" @@ -4034,6 +4030,7 @@ fs-write-stream-atomic@^1.0.8: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^1.2.3: version "1.2.4" @@ -4042,6 +4039,14 @@ fsevents@^1.2.3: nan "^2.9.2" node-pre-gyp "^0.10.0" +fsevents@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.7.tgz#4851b664a3783e52003b3c66eb0eee1074933aa4" + integrity sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw== + dependencies: + nan "^2.9.2" + node-pre-gyp "^0.10.0" + fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" @@ -4055,6 +4060,7 @@ fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" @@ -4081,6 +4087,7 @@ genfun@^5.0.0: get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== get-pkg-repo@^1.0.0: version "1.4.0" @@ -4105,7 +4112,8 @@ get-stdin@^4.0.1: get-stream@^3.0.0: version "3.0.0" - resolved "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= get-stream@^4.0.0, get-stream@^4.1.0: version "4.1.0" @@ -4116,10 +4124,12 @@ get-stream@^4.0.0, get-stream@^4.1.0: get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" @@ -4203,7 +4213,12 @@ global@^4.3.0: min-document "^2.19.0" process "~0.5.1" -globals@^11.1.0, globals@^11.7.0: +globals@^11.1.0: + version "11.11.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" + integrity sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw== + +globals@^11.7.0: version "11.8.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.8.0.tgz#c1ef45ee9bed6badf0663c5cb90e8d1adec1321d" @@ -4258,6 +4273,7 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3 growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= handlebars@^4.1.0: version "4.1.1" @@ -4273,12 +4289,14 @@ handlebars@^4.1.0: har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.0.tgz#44657f5688a22cfd4b72486e81b3a3fb11742c29" + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: - ajv "^5.3.0" + ajv "^6.5.5" har-schema "^2.0.0" has-ansi@^2.0.0: @@ -4290,6 +4308,7 @@ has-ansi@^2.0.0: has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-symbol-support-x@^1.4.1: version "1.4.2" @@ -4299,6 +4318,7 @@ has-symbol-support-x@^1.4.1: has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= has-to-string-tag-x@^1.2.0: version "1.4.1" @@ -4314,6 +4334,7 @@ has-unicode@^2.0.0, has-unicode@^2.0.1: has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -4322,6 +4343,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -4330,10 +4352,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -4361,6 +4385,7 @@ hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: html-encoding-sniffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== dependencies: whatwg-encoding "^1.0.1" @@ -4389,6 +4414,7 @@ http-proxy-agent@^2.1.0: http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -4467,6 +4493,7 @@ import-local@^1.0.0: import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== dependencies: pkg-dir "^3.0.0" resolve-cwd "^2.0.0" @@ -4474,6 +4501,7 @@ import-local@^2.0.0: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= indent-string@^2.1.0: version "2.1.0" @@ -4490,6 +4518,7 @@ indent-string@^3.0.0: inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" @@ -4585,6 +4614,7 @@ invert-kv@^1.0.0: invert-kv@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== ip@^1.1.5: version "1.1.5" @@ -4594,18 +4624,21 @@ ip@^1.1.5: is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" @@ -4613,13 +4646,15 @@ is-buffer@^1.1.5, is-buffer@~1.1.1: is-builtin-module@^1.0.0: version "1.0.0" - resolved "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + integrity sha1-VAVy0096wxGfj3bDDLwbHgN6/74= dependencies: builtin-modules "^1.0.0" is-callable@^1.1.3, is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== is-ci@^1.0.10: version "1.2.1" @@ -4638,22 +4673,26 @@ is-ci@^2.0.0: is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -4662,6 +4701,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -4674,10 +4714,12 @@ is-directory@^0.3.1: is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" @@ -4696,17 +4738,19 @@ is-finite@^1.0.0: is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= is-generator-fn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" - integrity sha512-elzyIdM7iKoFHzcrndIqjYomImhxrFRnGP3galODoII4TB9gI7mZ+FnlLQmmjf27SxHS2gKEeyhX5/+YRS6H9g== + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== is-glob@^3.1.0: version "3.1.0" @@ -4725,6 +4769,7 @@ is-glob@^4.0.0: is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" @@ -4762,6 +4807,7 @@ is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" @@ -4772,6 +4818,7 @@ is-promise@^2.1.0: is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= dependencies: has "^1.0.1" @@ -4799,6 +4846,7 @@ is-subset@^0.1.1: is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== dependencies: has-symbols "^1.0.0" @@ -4812,6 +4860,7 @@ is-text-path@^1.0.0: is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-utf8@^0.2.0: version "0.2.1" @@ -4821,10 +4870,17 @@ is-utf8@^0.2.0: is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isemail@3.x.x: version "3.2.0" @@ -4836,16 +4892,19 @@ isemail@3.x.x: isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isomorphic-fetch@^2.1.1: version "2.2.1" @@ -4877,17 +4936,7 @@ istanbul-api@^2.1.1: minimatch "^3.0.4" once "^1.4.0" -istanbul-lib-coverage@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#2aee0e073ad8c5f6a0b00e0dfbf52b4667472eda" - integrity sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA== - -istanbul-lib-coverage@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz#d5db9a7a4bb8fdbd62ec746226385987b73a8f43" - integrity sha512-4CsY730KHy12ya/YNKubrMlb7EZZVsEPhXntyRY/Cbs7HN5HdznLbI4UbvIGHgocxHx3VkGe7l6IN1lipetuGg== - -istanbul-lib-coverage@^2.0.3: +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#0b891e5ad42312c2b9488554f603795f9a2211ba" integrity sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw== @@ -4899,33 +4948,7 @@ istanbul-lib-hook@^2.0.3: dependencies: append-transform "^1.0.0" -istanbul-lib-instrument@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.0.tgz#b5f066b2a161f75788be17a9d556f40a0cf2afc9" - integrity sha512-eQY9vN9elYjdgN9Iv6NS/00bptm02EBBk70lRMaVjeA6QYocQgenVrSgC28TJurdnZa80AGO3ASdFN+w/njGiQ== - dependencies: - "@babel/generator" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - istanbul-lib-coverage "^2.0.1" - semver "^5.5.0" - -istanbul-lib-instrument@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.1.tgz#dd631e117dd9891e8bf1de7bb400cb8e491363af" - integrity sha512-/LTPhh1YKXjJlb5uggsiZjJHuViIljcIsB1zqmZegIw2yQ4l8LRksRGebJrZUFVEE28ZtKzmmT50W5tpAucfJg== - dependencies: - "@babel/generator" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - istanbul-lib-coverage "^2.0.2" - semver "^5.5.0" - -istanbul-lib-instrument@^3.1.0: +istanbul-lib-instrument@^3.0.0, istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz#a2b5484a7d445f1f311e93190813fa56dfb62971" integrity sha512-ooVllVGT38HIk8MxDj/OIHXSYvH+1tq/Vb38s8ixt9GoJadXska4WkGY+0wkmtYCZNYtaARniH/DixUGGLZ0uA== @@ -4947,18 +4970,7 @@ istanbul-lib-report@^2.0.4: make-dir "^1.3.0" supports-color "^6.0.0" -istanbul-lib-source-maps@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.1.tgz#002936e1106c4fa49714a946e6c63c1098b52e11" - integrity sha512-DBsZMpCwCPewRCmyd0FETHtzarQK/kKejQkDPBqKPwLYQmhs2p6a7yytfVDqib7PgXGSJZNTc1b6B3jl9G8FqA== - dependencies: - debug "^3.1.0" - istanbul-lib-coverage "^2.0.2" - make-dir "^1.3.0" - rimraf "^2.6.2" - source-map "^0.6.1" - -istanbul-lib-source-maps@^3.0.2: +istanbul-lib-source-maps@^3.0.1, istanbul-lib-source-maps@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz#f1e817229a9146e8424a28e5d69ba220fda34156" integrity sha512-JX4v0CiKTGp9fZPmoxpu9YEkPbEqCqBbO3403VabKjH+NRXo72HafD5UgnjTEqHL2SAjaZK1XDuDOkn6I5QVfQ== @@ -4984,75 +4996,66 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -jest-changed-files@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.6.0.tgz#37ff2a60a6057dedc068f26e9ed9b77fb21df828" - integrity sha512-Om7dJrGPcH6mMdEjMZ5XxRhCLk6qe1NVSJKOIn4twrtH7s8Nd++qULEH9bhRsdNduR2cMQOQwJ9GIVucWEKrsQ== +jest-changed-files@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.7.0.tgz#39d723a11b16ed7b373ac83adc76a69464b0c4fa" + integrity sha512-33BgewurnwSfJrW7T5/ZAXGE44o7swLslwh8aUckzq2e17/2Os1V0QU506ZNik3hjs8MgnEMKNkcud442NCDTw== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.6.0.tgz#af326435b6d331dd9868eed9b0b26d5113cb746e" - integrity sha512-0PDd5XgX/KXAAb00c5ATaCEjh7pw3r0D44K/7mqS9qT7ieawsjJe2bU7wDXkTOw4VhPtv9kK0FghIMqTruMDqg== +jest-cli@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.7.1.tgz#6093a539073b6f4953145abeeb9709cd621044f1" + integrity sha512-32OBoSCVPzcTslGFl6yVCMzB2SqX3IrWwZCY5mZYkb0D2WsogmU3eV2o8z7+gRQa4o4sZPX/k7GU+II7CxM6WQ== dependencies: - "@jest/core" "^24.6.0" - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/core" "^24.7.1" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.6.0" - jest-util "^24.6.0" - jest-validate "^24.6.0" + jest-config "^24.7.1" + jest-util "^24.7.1" + jest-validate "^24.7.0" prompts "^2.0.1" realpath-native "^1.1.0" yargs "^12.0.2" -jest-config@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.6.0.tgz#b8da6c4c2e37556b2a415174798eb7d256754dc1" - integrity sha512-NHXt65TlmwlJnTk2LbISFaL5h4sBLK2wDxw06H+ku9UwplEBYfbYg9//8PPDfx4XqF0QncegUD/bXeX0vJ9Euw== +jest-config@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.7.1.tgz#6c1dd4db82a89710a3cf66bdba97827c9a1cf052" + integrity sha512-8FlJNLI+X+MU37j7j8RE4DnJkvAghXmBWdArVzypW6WxfGuxiL/CCkzBg0gHtXhD2rxla3IMOSUAHylSKYJ83g== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.6.0" - babel-jest "^24.6.0" + "@jest/test-sequencer" "^24.7.1" + "@jest/types" "^24.7.0" + babel-jest "^24.7.1" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.6.0" - jest-environment-node "^24.6.0" + jest-environment-jsdom "^24.7.1" + jest-environment-node "^24.7.1" jest-get-type "^24.3.0" - jest-jasmine2 "^24.6.0" + jest-jasmine2 "^24.7.1" jest-regex-util "^24.3.0" - jest-resolve "^24.6.0" - jest-util "^24.6.0" - jest-validate "^24.6.0" + jest-resolve "^24.7.1" + jest-util "^24.7.1" + jest-validate "^24.7.0" micromatch "^3.1.10" - pretty-format "^24.6.0" + pretty-format "^24.7.0" realpath-native "^1.1.0" -jest-diff@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.0.0.tgz#a3e5f573dbac482f7d9513ac9cfa21644d3d6b34" - integrity sha512-XY5wMpRaTsuMoU+1/B2zQSKQ9RdE9gsLkGydx3nvApeyPijLA8GtEvIcPwISRCer+VDf9W1mStTYYq6fPt8ryA== - dependencies: - chalk "^2.0.1" - diff-sequences "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" - -jest-diff@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.6.0.tgz#35858787c07f94ce51df9f865f375c3b4046c25a" - integrity sha512-r+W4NHYot9ywuiO8JJ3WeDxV+8Bu9vNg7YLWmjLx9RQOC7UtiPcODgvLJIckJ2QIwJ4B/EfjiaLGN24Kew/Y2w== +jest-diff@^24.0.0, jest-diff@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.7.0.tgz#5d862899be46249754806f66e5729c07fcb3580f" + integrity sha512-ULQZ5B1lWpH70O4xsANC4tf4Ko6RrpwhE3PtG6ERjMg1TiYTC2Wp4IntJVGro6a8HG9luYHhhmF4grF0Pltckg== dependencies: chalk "^2.0.1" diff-sequences "^24.3.0" jest-get-type "^24.3.0" - pretty-format "^24.6.0" + pretty-format "^24.7.0" jest-docblock@^21.0.0: version "21.2.0" @@ -5066,44 +5069,39 @@ jest-docblock@^24.3.0: dependencies: detect-newline "^2.1.0" -jest-each@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.6.0.tgz#945699a577fd2362b620ddf31ad1f7699badb2da" - integrity sha512-+LiF4T/sgpAE4j2p449rwHEJUGPcT+aBOo9mbMSqafnOWGY7R4D1O3DZBGtW7ObumSHj7ZuQkigu9vNQqw5oPQ== +jest-each@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.7.1.tgz#fcc7dda4147c28430ad9fb6dc7211cd17ab54e74" + integrity sha512-4fsS8fEfLa3lfnI1Jw6NxjhyRTgfpuOVTeUZZFyVYqeTa4hPhr2YkToUhouuLTrL2eMGOfpbdMyRx0GQ/VooKA== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" chalk "^2.0.1" jest-get-type "^24.3.0" - jest-util "^24.6.0" - pretty-format "^24.6.0" - -jest-environment-jsdom@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.6.0.tgz#96307b56556fb3557dc90e488fdb901b7724c933" - integrity sha512-nRuKr5vKC9hXOGENgKja50SA0+wNEjsl73qqZV1jwzmMcdzOREuMZZ3jTLQT8/ScOo+SNo9q5YpAp0C+m34Rdw== - dependencies: - "@jest/environment" "^24.6.0" - "@jest/fake-timers" "^24.6.0" - "@jest/types" "^24.6.0" - jest-mock "^24.6.0" - jest-util "^24.6.0" + jest-util "^24.7.1" + pretty-format "^24.7.0" + +jest-environment-jsdom@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.7.1.tgz#a40e004b4458ebeb8a98082df135fd501b9fbbd6" + integrity sha512-Gnhb+RqE2JuQGb3kJsLF8vfqjt3PHKSstq4Xc8ic+ax7QKo4Z0RWGucU3YV+DwKR3T9SYc+3YCUQEJs8r7+Jxg== + dependencies: + "@jest/environment" "^24.7.1" + "@jest/fake-timers" "^24.7.1" + "@jest/types" "^24.7.0" + jest-mock "^24.7.0" + jest-util "^24.7.1" jsdom "^11.5.1" -jest-environment-node@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.6.0.tgz#51e5aa06da43cd0a9652e0072c8247844968c352" - integrity sha512-3JLQ7FVzOqzjCR3Knt7Nk+nYUaBEkS+H/paZDICzGpJidb/Z1tU4JJdM2G9umr08CyUNyH0LWiZ6yghlE2Kv3w== +jest-environment-node@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.7.1.tgz#fa2c047a31522a48038d26ee4f7c8fd9c1ecfe12" + integrity sha512-GJJQt1p9/C6aj6yNZMvovZuxTUd+BEJprETdvTKSb4kHcw4mFj8777USQV0FJoJ4V3djpOwA5eWyPwfq//PFBA== dependencies: - "@jest/environment" "^24.6.0" - "@jest/fake-timers" "^24.6.0" - "@jest/types" "^24.6.0" - jest-mock "^24.6.0" - jest-util "^24.6.0" - -jest-get-type@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.0.0.tgz#36e72930b78e33da59a4f63d44d332188278940b" - integrity sha512-z6/Eyf6s9ZDGz7eOvl+fzpuJmN9i0KyTt1no37/dHu8galssxz5ZEgnc1KaV8R31q1khxyhB4ui/X5ZjjPk77w== + "@jest/environment" "^24.7.1" + "@jest/fake-timers" "^24.7.1" + "@jest/types" "^24.7.0" + jest-mock "^24.7.0" + jest-util "^24.7.1" jest-get-type@^24.3.0: version "24.3.0" @@ -5124,101 +5122,84 @@ jest-haste-map@24.0.0: micromatch "^3.1.10" sane "^3.0.0" -jest-haste-map@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.6.0.tgz#c6aa40999129fd5cdb52af4ac6c1e8ab653c00d3" - integrity sha512-P0Lhy/vZ/4S7DzVS3KeWMT1FFQ9Qo3QdiqywPoG3FE74iNk44nGzwin3pYnR8dzrfd+SBmutdXLaIfywuU1XxQ== +jest-haste-map@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.7.1.tgz#772e215cd84080d4bbcb759cfb668ad649a21471" + integrity sha512-g0tWkzjpHD2qa03mTKhlydbmmYiA2KdcJe762SbfFo/7NIMgBWAA0XqQlApPwkWOF7Cxoi/gUqL0i6DIoLpMBw== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" + anymatch "^2.0.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" jest-serializer "^24.4.0" - jest-util "^24.6.0" + jest-util "^24.7.1" jest-worker "^24.6.0" micromatch "^3.1.10" sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" -jest-jasmine2@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.6.0.tgz#e8aa40497d7739de84b93af4383fc62381526a06" - integrity sha512-Tx1EqstTsiQ92J5vjHB357W87BrNIKaBab2xgG0Ffu7ZJx9R+RnCKuyKzkIEMRcSso+A70f3Memfsqp7idi4sw== +jest-jasmine2@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.7.1.tgz#01398686dabe46553716303993f3be62e5d9d818" + integrity sha512-Y/9AOJDV1XS44wNwCaThq4Pw3gBPiOv/s6NcbOAkVRRUEPu+36L2xoPsqQXsDrxoBerqeyslpn2TpCI8Zr6J2w== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.6.0" - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/environment" "^24.7.1" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.6.0" + expect "^24.7.1" is-generator-fn "^2.0.0" - jest-each "^24.6.0" - jest-matcher-utils "^24.6.0" - jest-message-util "^24.6.0" - jest-runtime "^24.6.0" - jest-snapshot "^24.6.0" - jest-util "^24.6.0" - pretty-format "^24.6.0" + jest-each "^24.7.1" + jest-matcher-utils "^24.7.0" + jest-message-util "^24.7.1" + jest-runtime "^24.7.1" + jest-snapshot "^24.7.1" + jest-util "^24.7.1" + pretty-format "^24.7.0" throat "^4.0.0" -jest-leak-detector@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.6.0.tgz#4e85938b754a7164271c1f8e3875f0321b37c43f" - integrity sha512-lBYsv8IyBjH4bVdMxT4tZRKwBMLIMl6tKyeQ9htSGkTatmnCI8cvRal/P1x8TJsxFvTo0HLhBUQdmkGWNMu2qg== - dependencies: - pretty-format "^24.6.0" - -jest-matcher-utils@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.0.0.tgz#fc9c41cfc49b2c3ec14e576f53d519c37729d579" - integrity sha512-LQTDmO+aWRz1Tf9HJg+HlPHhDh1E1c65kVwRFo5mwCVp5aQDzlkz4+vCvXhOKFjitV2f0kMdHxnODrXVoi+rlA== +jest-leak-detector@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.7.0.tgz#323ff93ed69be12e898f5b040952f08a94288ff9" + integrity sha512-zV0qHKZGXtmPVVzT99CVEcHE9XDf+8LwiE0Ob7jjezERiGVljmqKFWpV2IkG+rkFIEUHFEkMiICu7wnoPM/RoQ== dependencies: - chalk "^2.0.1" - jest-diff "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" + pretty-format "^24.7.0" -jest-matcher-utils@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.6.0.tgz#8562d38a760238656806df2f77daeca9a0c5851a" - integrity sha512-bXC5aDKXd1t7FfRiEahVoDWuvZI7NMWPd5u8Mn6aPMmQ0k+wG8RmASKjfuCGUOQJ4egV2hTx3wBQ8aipz3qFoA== +jest-matcher-utils@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.7.0.tgz#bbee1ff37bc8b2e4afcaabc91617c1526af4bcd4" + integrity sha512-158ieSgk3LNXeUhbVJYRXyTPSCqNgVXOp/GT7O94mYd3pk/8+odKTyR1JLtNOQSPzNi8NFYVONtvSWA/e1RDXg== dependencies: chalk "^2.0.1" - jest-diff "^24.6.0" + jest-diff "^24.7.0" jest-get-type "^24.3.0" - pretty-format "^24.6.0" - -jest-message-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.0.0.tgz#a07a141433b2c992dbaec68d4cbfe470ba289619" - integrity sha512-J9ROJIwz/IeC+eV1XSwnRK4oAwPuhmxEyYx1+K5UI+pIYwFZDSrfZaiWTdq0d2xYFw4Xiu+0KQWsdsQpgJMf3Q== - dependencies: - "@babel/code-frame" "^7.0.0" - chalk "^2.0.1" - micromatch "^3.1.10" - slash "^2.0.0" - stack-utils "^1.0.1" + pretty-format "^24.7.0" -jest-message-util@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.6.0.tgz#585b8dd65c34a9d0e6f68b3feeb46918ee40b976" - integrity sha512-5VEaI9jAm78YlMqNa92670QU/+d4F5TK0eiKEVQ3KwYbVL1kp8RmHg/2oqiKC3LMulyzlIiaqZTnJPk3hcqxwQ== +jest-message-util@^24.0.0, jest-message-util@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.7.1.tgz#f1dc3a6c195647096a99d0f1dadbc447ae547018" + integrity sha512-dk0gqVtyqezCHbcbk60CdIf+8UHgD+lmRHifeH3JRcnAqh4nEyPytSc9/L1+cQyxC+ceaeP696N4ATe7L+omcg== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.6.0.tgz#fd21d9f0c4b77d6b1cbd320223a56c5ae294b86b" - integrity sha512-GoJKwJrQUlI0yYLUO6fhR+s+aBqgCBERCdA8nDbMuqntkuydwLtMcYJI05eEWXL4zsH5Hw4Z5wfiMLjZsZZ3QA== +jest-mock@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.7.0.tgz#e49ce7262c12d7f5897b0d8af77f6db8e538023b" + integrity sha512-6taW4B4WUcEiT2V9BbOmwyGuwuAFT2G8yghF7nyNW1/2gq5+6aTqSPcS9lS6ArvEkX55vbPAS/Jarx5LSm4Fng== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -5230,84 +5211,75 @@ jest-regex-util@^24.3.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== -jest-resolve-dependencies@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.6.0.tgz#227c685b09a4a354615624069877de8070795daa" - integrity sha512-2QVOYOJVTI4sNcXAL1P22/qW7A2u2V7Y69OlVWAyUmN+XVoVjCbz7AwUCJjIOLyg5isxQqSJBPQC0tXUUGl0xA== +jest-resolve-dependencies@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.7.1.tgz#cf93bbef26999488a96a2b2012f9fe7375aa378f" + integrity sha512-2Eyh5LJB2liNzfk4eo7bD1ZyBbqEJIyyrFtZG555cSWW9xVHxII2NuOkSl1yUYTAYCAmM2f2aIT5A7HzNmubyg== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.6.0" - -jest-resolve@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.0.0.tgz#0206cfe842324f8796b01f706f4075309bf7b405" - integrity sha512-uKDGyJqNaBQKox1DJzm27CJobADsIMNgZGusXhtYzl98LKu/fKuokkRsd7EBVgoDA80HKHc3LOPKuYLryMu1vw== - dependencies: - browser-resolve "^1.11.3" - chalk "^2.0.1" - realpath-native "^1.0.0" + jest-snapshot "^24.7.1" -jest-resolve@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.6.0.tgz#7ab8e6b274d5dac6df5c4911f0cd0af0124b44f7" - integrity sha512-d72QLxKtVb4M+3GRyxSWMQ2umgTktleqrgarSwpRkRECYE7xg55655cgPEj2cfhBjFkj6Pq4mAU2P3GRploMmQ== +jest-resolve@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.7.1.tgz#e4150198299298380a75a9fd55043fa3b9b17fde" + integrity sha512-Bgrc+/UUZpGJ4323sQyj85hV9d+ANyPNu6XfRDUcyFNX1QrZpSoM0kE4Mb2vZMAYTJZsBFzYe8X1UaOkOELSbw== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.6.0.tgz#0ac88de5493333a2c8bd7254adfab8f547d37bef" - integrity sha512-CFvh7LT4ROqm6Nj0mynUSGA/6QXXoUHij+9GRE2YYp/oY5qntJPmwTXewrEH7bx5LBV8F3EEFSW0c5YavV5X6w== +jest-runner@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.7.1.tgz#41c8a02a06aa23ea82d8bffd69d7fa98d32f85bf" + integrity sha512-aNFc9liWU/xt+G9pobdKZ4qTeG/wnJrJna3VqunziDNsWT3EBpmxXZRBMKCsNMyfy+A/XHiV+tsMLufdsNdgCw== dependencies: - "@jest/console" "^24.6.0" - "@jest/environment" "^24.6.0" - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/console" "^24.7.1" + "@jest/environment" "^24.7.1" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.6.0" + jest-config "^24.7.1" jest-docblock "^24.3.0" - jest-haste-map "^24.6.0" - jest-jasmine2 "^24.6.0" - jest-leak-detector "^24.6.0" - jest-message-util "^24.6.0" - jest-resolve "^24.6.0" - jest-runtime "^24.6.0" - jest-util "^24.6.0" + jest-haste-map "^24.7.1" + jest-jasmine2 "^24.7.1" + jest-leak-detector "^24.7.0" + jest-message-util "^24.7.1" + jest-resolve "^24.7.1" + jest-runtime "^24.7.1" + jest-util "^24.7.1" jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.6.0.tgz#ec697c4a2b5e4128972c004a5dcfbbdd0979998b" - integrity sha512-DkMEP5ygtW1MSvjAEJ2euV8Z5UUm/G8RlJN2vH5kmsV+J/Snm32JD3LuaD8NuTeO7iKnUPEU70dFTtJsd8n5xg== +jest-runtime@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.7.1.tgz#2ffd70b22dd03a5988c0ab9465c85cdf5d25c597" + integrity sha512-0VAbyBy7tll3R+82IPJpf6QZkokzXPIS71aDeqh+WzPRXRCNz6StQ45otFariPdJ4FmXpDiArdhZrzNAC3sj6A== dependencies: - "@jest/console" "^24.6.0" - "@jest/environment" "^24.6.0" + "@jest/console" "^24.7.1" + "@jest/environment" "^24.7.1" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/transform" "^24.7.1" + "@jest/types" "^24.7.0" "@types/yargs" "^12.0.2" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.6.0" - jest-haste-map "^24.6.0" - jest-message-util "^24.6.0" - jest-mock "^24.6.0" + jest-config "^24.7.1" + jest-haste-map "^24.7.1" + jest-message-util "^24.7.1" + jest-mock "^24.7.0" jest-regex-util "^24.3.0" - jest-resolve "^24.6.0" - jest-snapshot "^24.6.0" - jest-util "^24.6.0" - jest-validate "^24.6.0" + jest-resolve "^24.7.1" + jest-snapshot "^24.7.1" + jest-util "^24.7.1" + jest-validate "^24.7.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" @@ -5323,38 +5295,22 @@ jest-serializer@^24.4.0: resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== -jest-snapshot@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.0.0.tgz#fb447a753a3271660b3d89d068698014eb14c414" - integrity sha512-7OcrckVnfzVYxSGPYl2Sn+HyT30VpDv+FMBFbQxSQ6DV2K9Js6vYT6d4SBPKp6DfDiEL2txNssJBxtlvF+Dymw== - dependencies: - "@babel/types" "^7.0.0" - chalk "^2.0.1" - jest-diff "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-resolve "^24.0.0" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - pretty-format "^24.0.0" - semver "^5.5.0" - -jest-snapshot@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.6.0.tgz#ec68e0982c1e38cbaefd2cff2c9ac99fdfe5c206" - integrity sha512-G+1q27n6lOdzqpcmP5GnpCfwz4t0E/wasoyNdqvjb6gbLCdfo6Y5ZcPxiclYNOBtGATbbb3IVXeR+ey3aWjSFg== +jest-snapshot@^24.0.0, jest-snapshot@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.7.1.tgz#bd5a35f74aedff070975e9e9c90024f082099568" + integrity sha512-8Xk5O4p+JsZZn4RCNUS3pxA+ORKpEKepE+a5ejIKrId9CwrVN0NY+vkqEkXqlstA5NMBkNahXkR/4qEBy0t5yA== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" chalk "^2.0.1" - expect "^24.6.0" - jest-diff "^24.6.0" - jest-matcher-utils "^24.6.0" - jest-message-util "^24.6.0" - jest-resolve "^24.6.0" + expect "^24.7.1" + jest-diff "^24.7.0" + jest-matcher-utils "^24.7.0" + jest-message-util "^24.7.1" + jest-resolve "^24.7.1" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.6.0" + pretty-format "^24.7.0" semver "^5.5.0" jest-util@^24.0.0: @@ -5371,16 +5327,16 @@ jest-util@^24.0.0: slash "^2.0.0" source-map "^0.6.0" -jest-util@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.6.0.tgz#725a380e8f21fcdf53bd5bd5829ee78903ffc756" - integrity sha512-f7JbP/tfJuc955+PMvCI49Mn8wCPe+5CV4vSfc2Pi06jrSDGlsTj6mmc5+UF8ApzIQ7ficTUv4JXXcjplbm9TA== +jest-util@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.7.1.tgz#b4043df57b32a23be27c75a2763d8faf242038ff" + integrity sha512-/KilOue2n2rZ5AnEBYoxOXkeTu6vi7cjgQ8MXEkih0oeAXT6JkS3fr7/j8+engCjciOU1Nq5loMSKe0A1oeX0A== dependencies: - "@jest/console" "^24.6.0" - "@jest/fake-timers" "^24.6.0" + "@jest/console" "^24.7.1" + "@jest/fake-timers" "^24.7.1" "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5389,29 +5345,29 @@ jest-util@^24.6.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.6.0.tgz#7ad68c68bf2639295cd727817f468e840e950507" - integrity sha512-iBbRzTCyjHidvRUor2KM8FeMAFDWok6/c39fGwRDaLwjlPhDVPy44RLZst8wMRSj1W/Ujdd570btK9SS71CKjw== +jest-validate@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.7.0.tgz#70007076f338528ee1b1c8a8258b1b0bb982508d" + integrity sha512-cgai/gts9B2chz1rqVdmLhzYxQbgQurh1PEQSvSgPZ8KGa1AqXsqC45W5wKEwzxKrWqypuQrQxnF4+G9VejJJA== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" camelcase "^5.0.0" chalk "^2.0.1" jest-get-type "^24.3.0" leven "^2.1.0" - pretty-format "^24.6.0" + pretty-format "^24.7.0" -jest-watcher@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.6.0.tgz#f66a49a4c89f60626730121d74e36dc006c53c2f" - integrity sha512-u9YFF8VjGh8vRwuNpuVUAwZFZno+lZuqayITjXkwEsWumuUNx0s9/6+DvB/AiQx/FxcpbXlMDNAflFa7vs7UHg== +jest-watcher@^24.7.1: + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.7.1.tgz#e161363d7f3f4e1ef3d389b7b3a0aad247b673f5" + integrity sha512-Wd6TepHLRHVKLNPacEsBwlp9raeBIO+01xrN24Dek4ggTS8HHnOzYSFnvp+6MtkkJ3KfMzy220KTi95e2rRkrw== dependencies: - "@jest/test-result" "^24.6.0" - "@jest/types" "^24.6.0" + "@jest/test-result" "^24.7.1" + "@jest/types" "^24.7.0" "@types/yargs" "^12.0.9" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.6.0" + jest-util "^24.7.1" string-length "^2.0.0" jest-worker@24.0.0, jest-worker@^24.0.0: @@ -5431,12 +5387,12 @@ jest-worker@^24.6.0: supports-color "^6.1.0" jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.6.0.tgz#133e46c3f92450402e5b6737f5a07620c3f8201e" - integrity sha512-09Y/1FUQIGRVY2hdt0VpiL5mH0MGKeNM+Rhd1qWUZEBI/HwI6upHQR5XxlTm5d0BpXvhB/8bDpHu5ehL7JGi1g== + version "24.7.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.7.1.tgz#0d94331cf510c75893ee32f87d7321d5bf8f2501" + integrity sha512-AbvRar5r++izmqo5gdbAjTeA6uNRGoNRuj5vHB0OnDXo2DXWZJVuaObiGgtlvhKb+cWy2oYbQSfxv7Q7GjnAtA== dependencies: import-local "^2.0.0" - jest-cli "^24.6.0" + jest-cli "^24.7.1" joi@^14.3.1: version "14.3.1" @@ -5454,8 +5410,17 @@ js-levenshtein@^1.1.3: "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.12.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" -js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.9.0: +js-yaml@^3.13.0, js-yaml@^3.9.0: version "3.13.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== @@ -5466,10 +5431,12 @@ js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.9.0: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdom@^11.5.1: version "11.12.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== dependencies: abab "^2.0.0" acorn "^5.5.3" @@ -5499,8 +5466,9 @@ jsdom@^11.5.1: xml-name-validator "^3.0.0" jsesc@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== jsesc@~0.5.0: version "0.5.0" @@ -5510,10 +5478,6 @@ json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -5521,6 +5485,7 @@ json-schema-traverse@^0.4.1: json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" @@ -5572,6 +5537,7 @@ jsonparse@^1.2.0: jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" @@ -5588,22 +5554,26 @@ jsx-ast-utils@^2.0.1: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== klaw@^1.0.0: version "1.3.1" @@ -5611,10 +5581,10 @@ klaw@^1.0.0: optionalDependencies: graceful-fs "^4.1.9" -kleur@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.1.tgz#4f5b313f5fa315432a400f19a24db78d451ede62" - integrity sha512-P3kRv+B+Ra070ng2VKQqW4qW7gd/v3iD8sy/zOdcYRsfiD+QBokQNOps/AfP6Hr48cBhIIBFWckB9aO+IZhrWg== +kleur@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== lcid@^1.0.0: version "1.0.0" @@ -5625,12 +5595,14 @@ lcid@^1.0.0: lcid@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== dependencies: invert-kv "^2.0.0" left-pad@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== lerna@^3.13.1: version "3.13.1" @@ -5658,6 +5630,7 @@ lerna@^3.13.1: leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -5736,6 +5709,7 @@ locate-path@^2.0.0: locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== dependencies: p-locate "^3.0.0" path-exists "^3.0.0" @@ -5768,6 +5742,7 @@ lodash.set@^4.3.2: lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= lodash.template@^4.0.2: version "4.4.0" @@ -5793,7 +5768,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -5884,18 +5859,21 @@ make-fetch-happen@^4.0.1: makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= dependencies: tmpl "1.0.x" map-age-cleaner@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz#098fb15538fd3dbe461f12745b0ca8568d4e3f74" + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== dependencies: p-defer "^1.0.0" map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" @@ -5910,6 +5888,7 @@ map-obj@^2.0.0: map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" @@ -5929,12 +5908,13 @@ mem@^1.1.0: mimic-fn "^1.0.0" mem@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.0.0.tgz#6437690d9471678f6cc83659c00cbafcd6b0cdaf" + version "4.3.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== dependencies: map-age-cleaner "^0.1.1" - mimic-fn "^1.0.0" - p-is-promise "^1.1.0" + mimic-fn "^2.0.0" + p-is-promise "^2.0.0" meow@^3.3.0: version "3.7.0" @@ -5970,6 +5950,7 @@ meow@^4.0.0: merge-stream@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= dependencies: readable-stream "^2.0.1" @@ -6219,13 +6200,25 @@ mime-db@~1.23.0: version "1.23.0" resolved "http://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz#a31b4070adaea27d732ea333740a64d0ec9a6659" +mime-db@~1.38.0: + version "1.38.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" + integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg== + mime-types@2.1.11: version "2.1.11" resolved "http://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz#c259c471bda808a85d6cd193b430a5fae4473b3c" dependencies: mime-db "~1.23.0" -mime-types@^2.1.12, mime-types@~2.1.18, mime-types@~2.1.19: +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.22" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.22.tgz#fe6b355a190926ab7698c9a0556a11199b2199bd" + integrity sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog== + dependencies: + mime-db "~1.38.0" + +mime-types@~2.1.18: version "2.1.21" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" dependencies: @@ -6242,6 +6235,12 @@ mime@^1.3.4: mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +mimic-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== mimic-response@^1.0.0: version "1.0.1" @@ -6278,7 +6277,8 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: minimist@~0.0.1: version "0.0.10" - resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= minipass@^2.2.1, minipass@^2.3.4, minipass@^2.3.5: version "2.3.5" @@ -6312,6 +6312,7 @@ mississippi@^3.0.0: mixin-deep@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" @@ -6353,6 +6354,7 @@ move-concurrently@^1.0.1: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.0.0, ms@^2.1.1: version "2.1.1" @@ -6379,6 +6381,7 @@ nan@^2.9.2: nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -6395,6 +6398,7 @@ nanomatch@^1.2.9: natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= ncp@0.4.x: version "0.4.2" @@ -6420,6 +6424,7 @@ neo-async@^2.6.0: nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch-npm@^2.0.2: version "2.0.2" @@ -6467,16 +6472,20 @@ node-gyp@^3.8.0: node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= node-notifier@^5.2.1: - version "5.3.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.3.0.tgz#c77a4a7b84038733d5fb351aafd8a268bfe19a01" + version "5.4.0" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" + integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== dependencies: growly "^1.3.0" + is-wsl "^1.1.0" semver "^5.5.0" shellwords "^0.1.1" which "^1.3.0" @@ -6517,7 +6526,7 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.4.0: +normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" dependencies: @@ -6526,9 +6535,20 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" @@ -6624,6 +6644,7 @@ npm-registry-fetch@^3.9.0: npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" @@ -6643,14 +6664,17 @@ nullthrows@^1.1.0: number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= nwsapi@^2.0.7: - version "2.0.9" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.9.tgz#77ac0cdfdcad52b6a1151a84e73254edc33ed016" + version "2.1.3" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.3.tgz#25f3a5cec26c654f7376df6659cdf84b99df9558" + integrity sha512-RowAaJGEgYXEZfQ7tvvdtAQUKPyTR6T6wNu0fwlNsGQYr/h3yQc6oI8WnVZh3Y/Sylwc+dtAlvPqfFZjhTyk3A== oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" @@ -6659,18 +6683,21 @@ object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" object-keys@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" @@ -6687,6 +6714,7 @@ object.fromentries@^2.0.0: object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= dependencies: define-properties "^1.1.2" es-abstract "^1.5.1" @@ -6694,6 +6722,7 @@ object.getownpropertydescriptors@^2.0.3: object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" @@ -6733,6 +6762,7 @@ opn@^3.0.2: optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" @@ -6784,10 +6814,11 @@ os-locale@^2.0.0: mem "^1.1.0" os-locale@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.0.1.tgz#3b014fbf01d87f60a1e5348d80fe870dc82c4620" + version "3.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== dependencies: - execa "^0.10.0" + execa "^1.0.0" lcid "^2.0.0" mem "^4.0.0" @@ -6818,6 +6849,7 @@ p-cancelable@^0.3.0: p-defer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= p-each-series@^1.0.0: version "1.0.0" @@ -6829,10 +6861,12 @@ p-each-series@^1.0.0: p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= -p-is-promise@^1.1.0: - version "1.1.0" - resolved "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" +p-is-promise@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== p-limit@^1.1.0: version "1.3.0" @@ -6841,8 +6875,9 @@ p-limit@^1.1.0: p-try "^1.0.0" p-limit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" + integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== dependencies: p-try "^2.0.0" @@ -6855,6 +6890,7 @@ p-locate@^2.0.0: p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== dependencies: p-limit "^2.0.0" @@ -6892,8 +6928,9 @@ p-try@^1.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" p-try@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== p-waterfall@^1.0.0: version "1.0.0" @@ -6958,6 +6995,7 @@ parse-json@^2.2.0: parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" @@ -6983,6 +7021,7 @@ parse-url@^5.0.0: parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== parseurl@~1.3.2: version "1.3.2" @@ -6991,6 +7030,7 @@ parseurl@~1.3.2: pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= path-dirname@^1.0.0: version "1.0.2" @@ -7006,10 +7046,12 @@ path-exists@^2.0.0: path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" @@ -7018,6 +7060,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2: path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" @@ -7048,6 +7091,7 @@ path-type@^3.0.0: performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= pify@^2.0.0, pify@^2.3.0: version "2.3.0" @@ -7056,6 +7100,7 @@ pify@^2.0.0, pify@^2.3.0: pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= pinkie-promise@^2.0.0: version "2.0.1" @@ -7089,6 +7134,7 @@ pkg-dir@^2.0.0: pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== dependencies: find-up "^3.0.0" @@ -7115,14 +7161,17 @@ pluralize@^7.0.0: pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= prepend-http@^1.0.1: version "1.0.4" @@ -7142,20 +7191,12 @@ pretty-format@24.0.0-alpha.6: ansi-regex "^4.0.0" ansi-styles "^3.2.0" -pretty-format@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.0.0.tgz#cb6599fd73ac088e37ed682f61291e4678f48591" - integrity sha512-LszZaKG665djUcqg5ZQq+XzezHLKrxsA86ZABTozp+oNhkdqa+tG2dX4qa6ERl5c/sRDrAa3lHmwnvKoP+OG/g== - dependencies: - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - -pretty-format@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.6.0.tgz#66124fe5ea5c4d473337a204ece220e8fdc9806c" - integrity sha512-xEeJZFqXgvzSEMxoZ3j4aTaax/pl1upVsfMstcIC048Id84Ve5aqX0WkAta/wFIBLDRz6Tbuj6HcoBXRNk7rtA== +pretty-format@^24.0.0, pretty-format@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.7.0.tgz#d23106bc2edcd776079c2daa5da02bcb12ed0c10" + integrity sha512-apen5cjf/U4dj7tHetpC7UEFCvtAgnNZnBDkfPv3fokzIqyOJckAG9OlAPC1BlFALnqT/lGB2tl9EJjlK6eCsA== dependencies: - "@jest/types" "^24.6.0" + "@jest/types" "^24.7.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" @@ -7172,6 +7213,7 @@ process-nextick-args@~1.0.6: process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== process@~0.5.1: version "0.5.2" @@ -7211,11 +7253,11 @@ prompt@^0.2.14: winston "0.8.x" prompts@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.1.tgz#201b3718b4276fb407f037db48c0029d6465245c" - integrity sha512-8lnEOSIGQbgbnO47+13S+H204L8ISogGulyi0/NNEFAQ9D1VMNTrJ9SBX2Ra03V4iPn/zt36HQMndRYkaPoWiQ== + version "2.0.4" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.4.tgz#179f9d4db3128b9933aa35f93a800d8fce76a682" + integrity sha512-HTzM3UWp/99A0gk51gAegwo1QRYA7xjcZufMNe33rCclFszUYAuHe1fIN/3ZmiHeGPkUsNaRyQm1hHOfM0PKxA== dependencies: - kleur "^3.0.0" + kleur "^3.0.2" sisteransi "^1.0.0" promzard@^0.3.0: @@ -7255,9 +7297,10 @@ pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" -psl@^1.1.24: - version "1.1.29" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67" +psl@^1.1.24, psl@^1.1.28: + version "1.1.31" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" + integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== pump@^2.0.0: version "2.0.1" @@ -7283,13 +7326,14 @@ pumpify@^1.3.3: inherits "^2.0.3" pump "^2.0.0" -punycode@2.x.x, punycode@^2.1.0: +punycode@2.x.x, punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= q@^1.5.1: version "1.5.1" @@ -7299,6 +7343,7 @@ q@^1.5.1: qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== quick-lru@^1.0.0: version "1.1.0" @@ -7328,9 +7373,9 @@ react-is@^16.8.1: integrity sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA== react-is@^16.8.4: - version "16.8.5" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.5.tgz#c54ac229dd66b5afe0de5acbe47647c3da692ff8" - integrity sha512-sudt2uq5P/2TznPV4Wtdi+Lnq3yaYW8LfvPKLM9BKD8jJNBkxMVyB0C9/GmVhLw7Jbdmndk/73n7XQGeN9A3QQ== + version "16.8.6" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" + integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== react-proxy@^1.1.7: version "1.1.8" @@ -7474,12 +7519,6 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -realpath-native@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.2.tgz#cd51ce089b513b45cf9b1516c82989b51ccc6560" - dependencies: - util.promisify "^1.0.0" - realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" @@ -7532,6 +7571,7 @@ regenerator-transform@^0.13.3: regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" @@ -7564,14 +7604,17 @@ regjsparser@^0.3.0: remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" @@ -7580,23 +7623,26 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request-promise-core@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" +request-promise-core@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.2.tgz#339f6aababcafdb31c799ff158700336301d3346" + integrity sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag== dependencies: - lodash "^4.13.1" + lodash "^4.17.11" request-promise-native@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.5.tgz#5281770f68e0c9719e5163fd3fab482215f4fda5" + version "1.0.7" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" + integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w== dependencies: - request-promise-core "1.1.1" - stealthy-require "^1.1.0" - tough-cookie ">=2.3.3" + request-promise-core "1.1.2" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -7622,10 +7668,12 @@ request@^2.87.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= require-uncached@^1.0.3: version "1.0.3" @@ -7637,6 +7685,7 @@ require-uncached@^1.0.3: resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= dependencies: resolve-from "^3.0.0" @@ -7647,6 +7696,7 @@ resolve-from@^1.0.0: resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= resolve-from@^4.0.0: version "4.0.0" @@ -7656,24 +7706,26 @@ resolve-from@^4.0.0: resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" - dependencies: - path-parse "^1.0.5" - -resolve@^1.9.0: +resolve@^1.10.0, resolve@^1.3.2, resolve@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== dependencies: path-parse "^1.0.6" +resolve@^1.5.0, resolve@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -7684,6 +7736,7 @@ restore-cursor@^2.0.0: ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== retry@^0.10.0: version "0.10.1" @@ -7694,14 +7747,14 @@ revalidator@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b" -rimraf@2, rimraf@^2.6.2: +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== dependencies: glob "^7.1.3" -rimraf@2.x.x, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@2.x.x, rimraf@^2.2.8, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: @@ -7762,13 +7815,15 @@ safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, s safe-regex@^1.1.0: version "1.1.0" - resolved "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== sane@^3.0.0: version "3.1.0" @@ -7804,12 +7859,18 @@ sane@^4.0.3: sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== sax@~1.1.1: version "1.1.6" resolved "http://registry.npmjs.org/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.3, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== + +"semver@2.x || 3.x || 4 || 5", semver@^5.0.3, semver@^5.3.0, semver@^5.5.1, semver@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" @@ -7856,6 +7917,7 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: set-value@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + integrity sha1-fbCPnT0i3H945Trzw79GZuzfzPE= dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -7865,6 +7927,7 @@ set-value@^0.4.3: set-value@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + integrity sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -7882,12 +7945,14 @@ setprototypeof@1.1.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= shell-quote@1.6.1: version "1.6.1" @@ -7901,10 +7966,12 @@ shell-quote@1.6.1: shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= simple-plist@^1.0.0: version "1.0.0" @@ -7918,6 +7985,7 @@ simple-plist@^1.0.0: sisteransi@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c" + integrity sha512-N+z4pHB4AmUv0SjveWRd6q1Nj5w62m5jodv+GD8lvmbY/83T/rpbJGZOnK5T149OldDj4Db07BSv9xY4K6NTPQ== slash@^1.0.0: version "1.0.0" @@ -7956,6 +8024,7 @@ smart-buffer@^4.0.1: snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -7964,12 +8033,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -7981,9 +8052,9 @@ snapdragon@^0.8.1: use "^3.1.0" snapshot-diff@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/snapshot-diff/-/snapshot-diff-0.5.0.tgz#f67f4441f0fed806ad759f937112cda8ba78ff2b" - integrity sha512-mDCiZCCPQb4JP8iD8+WRNo5snbcveQqmcm0uRiKedPn+8aIKhp1gvu8BQ3KE28XFT9fI0FChkMIr5zuQdYHlRw== + version "0.5.1" + resolved "https://registry.yarnpkg.com/snapshot-diff/-/snapshot-diff-0.5.1.tgz#8a74d11a4f89662d3f934dcbeccc4f773a817010" + integrity sha512-XBj1NE3oJiqdH/EcNzLSqSeCEnU458T57ZnbptrQ2/mKw+Z2Txu06vPMWG+morlbQp7nY6kkY7zPnHi1dgy6qg== dependencies: jest-diff "^24.0.0" jest-snapshot "^24.0.0" @@ -8016,6 +8087,7 @@ sort-keys@^2.0.0: source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: atob "^2.1.1" decode-uri-component "^0.2.0" @@ -8024,8 +8096,9 @@ source-map-resolve@^0.5.0: urix "^0.1.0" source-map-support@^0.5.6: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" + version "0.5.12" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" + integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -8041,18 +8114,22 @@ source-map-support@^0.5.9: source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== spdx-correct@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.2.tgz#19bb409e91b47b1ad54159243f7312a858db3c2e" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" @@ -8060,21 +8137,25 @@ spdx-correct@^3.0.0: spdx-exceptions@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz#a59efc09784c2a5bada13cfeaf5c75dd214044d2" + version "3.0.4" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz#75ecd1a88de8c184ef015eafb51b5b48bfd11bb1" + integrity sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" @@ -8095,10 +8176,12 @@ split@^1.0.0: sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.2.tgz#c946d6bd9b1a39d0e8635763f5242d6ed6dcb629" + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -8122,12 +8205,14 @@ stack-trace@0.0.x: resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" stack-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" @@ -8144,9 +8229,10 @@ statuses@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" -stealthy-require@^1.1.0: +stealthy-require@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= stream-buffers@~2.2.0: version "2.2.0" @@ -8176,6 +8262,7 @@ string-length@^2.0.0: string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" @@ -8196,28 +8283,25 @@ string_decoder@~0.10.x: string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== dependencies: safe-buffer "~5.1.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" - resolved "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.0.0.tgz#f78f68b5d0866c20b2c9b8c61b5298508dc8756f" - dependencies: - ansi-regex "^4.0.0" - -strip-ansi@^5.2.0: +strip-ansi@^5.0.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== @@ -8234,10 +8318,12 @@ strip-bom@^2.0.0: strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-eof@^1.0.0: version "1.0.0" - resolved "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= strip-indent@^1.0.1: version "1.0.1" @@ -8271,6 +8357,7 @@ supports-color@^2.0.0: supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" @@ -8289,6 +8376,7 @@ symbol-observable@1.0.1: symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= table@^4.0.2: version "4.0.3" @@ -8370,9 +8458,9 @@ temp@0.8.3: rimraf "~2.2.6" test-exclude@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.0.0.tgz#cdce7cece785e0e829cd5c2b27baf18bc583cfb7" - integrity sha512-bO3Lj5+qFa9YLfYW2ZcXMOV1pmQvw+KS/DpjqhyX6Y6UZ8zstpZJ+mA2ERkXfpOqhxsJlQiLeVXD3Smsrs6oLw== + version "5.1.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.1.0.tgz#6ba6b25179d2d38724824661323b73e03c0c1de1" + integrity sha512-gwf0S2fFsANC55fSeSqpb8BYk6w3FDvwZxfNjeF6FRgvFa43r+7wRiA/Q0IxoRU37wB/LE8IQ4221BsNucTaCA== dependencies: arrify "^1.0.1" minimatch "^3.0.4" @@ -8417,20 +8505,24 @@ tmp@^0.0.33: tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -8438,6 +8530,7 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" @@ -8451,9 +8544,18 @@ topo@3.x.x: dependencies: hoek "6.x.x" -tough-cookie@>=2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== dependencies: psl "^1.1.24" punycode "^1.4.1" @@ -8461,6 +8563,7 @@ tough-cookie@>=2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: tr46@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= dependencies: punycode "^2.1.0" @@ -8487,6 +8590,7 @@ trim-off-newlines@^1.0.0: trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= tslib@^1.9.0: version "1.9.3" @@ -8495,16 +8599,19 @@ tslib@^1.9.0: tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" @@ -8524,10 +8631,11 @@ uglify-es@^3.1.9: source-map "~0.6.1" uglify-js@^3.1.4: - version "3.4.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" + version "3.5.3" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.3.tgz#d490bb5347f23025f0c1bc0dee901d98e4d6b063" + integrity sha512-rIQPT2UMDnk4jRX+w4WO84/pebU2jiLsjgIyrCktYgSvx28enOE3iYQMr+BD1rHiitWnDmpu0cY/LfIEpKcjcw== dependencies: - commander "~2.17.1" + commander "~2.19.0" source-map "~0.6.1" uid-number@0.0.6: @@ -8566,6 +8674,7 @@ unicode-property-aliases-ecmascript@^1.0.4: union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + integrity sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ= dependencies: arr-union "^3.1.0" get-value "^2.0.6" @@ -8605,6 +8714,7 @@ unpipe@~1.0.0: unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" @@ -8633,6 +8743,7 @@ uri-js@^4.2.2: urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= url-parse-lax@^1.0.0: version "1.0.0" @@ -8654,14 +8765,17 @@ url-to-options@^1.0.1: use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= util.promisify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== dependencies: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" @@ -8706,6 +8820,7 @@ vary@~1.1.2: verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" @@ -8714,12 +8829,14 @@ verror@1.10.0: w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= dependencies: browser-process-hrtime "^0.1.2" -walker@~1.0.5: +walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= dependencies: makeerror "1.0.x" @@ -8740,10 +8857,12 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== dependencies: iconv-lite "0.4.24" @@ -8752,12 +8871,14 @@ whatwg-fetch@>=0.10.0: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz#a3d58ef10b76009b042d03e25591ece89b88d171" + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== dependencies: lodash.sortby "^4.7.0" tr46 "^1.0.1" @@ -8766,6 +8887,7 @@ whatwg-url@^6.4.1: whatwg-url@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + integrity sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ== dependencies: lodash.sortby "^4.7.0" tr46 "^1.0.1" @@ -8779,6 +8901,7 @@ which-module@^1.0.0: which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= which@1, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" @@ -8823,10 +8946,12 @@ wordwrap@^1.0.0, wordwrap@~1.0.0: wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= wrap-ansi@^2.0.0: version "2.1.0" - resolved "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -8834,6 +8959,7 @@ wrap-ansi@^2.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= write-file-atomic@2.4.1: version "2.4.1" @@ -8896,6 +9022,7 @@ ws@^1.1.0, ws@^1.1.5: ws@^5.2.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== dependencies: async-limiter "~1.0.0" @@ -8910,6 +9037,7 @@ xcode@^2.0.0: xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== xmlbuilder@^9.0.7: version "9.0.7" From 1440eb41636f83718d6d548c430e75a6ab629a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 10 Apr 2019 14:22:40 +0200 Subject: [PATCH 067/234] feat: infer package and project name for upgrade from config (#299) * feat: infer packageName and projectName for upgrade from config * extract merge to tools and use it in tests * warn if unsupported platform is being upgraded --- .../__snapshots__/upgrade.test.js.snap | 96 +++++++++++++++---- .../commands/upgrade/__tests__/sample.patch | 82 +++++++--------- .../upgrade/__tests__/upgrade.test.js | 36 ++++++- packages/cli/src/commands/upgrade/upgrade.js | 46 +++++++-- packages/cli/src/tools/config/index.js | 12 +-- packages/cli/src/tools/config/types.flow.js | 1 + packages/cli/src/tools/merge.js | 15 +++ packages/platform-android/src/config/index.js | 1 + 8 files changed, 197 insertions(+), 92 deletions(-) create mode 100644 packages/cli/src/tools/merge.js diff --git a/packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap b/packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap index 13c7caaa8..81f75152a 100644 --- a/packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap +++ b/packages/cli/src/commands/upgrade/__tests__/__snapshots__/upgrade.test.js.snap @@ -1,27 +1,85 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`fetches regular patch, adds remote, applies patch, installs deps, removes remote,: RnDiffApp is replaced with app name (TestApp) 1`] = ` +exports[`fetches regular patch, adds remote, applies patch, installs deps, removes remote,: RnDiffApp is replaced with app name (TestApp and com.testapp) 1`] = ` "Snapshot Diff: - First value + Second value -@@ -1,5 +1,5 @@ -- diff --git a/RnDiffApp/android/build.gradle b/RnDiffApp/android/build.gradle -+ diff --git a/TestApp/android/build.gradle b/TestApp/android/build.gradle - index 85d8f2f8..a1e80854 100644 -- --- a/RnDiffApp/android/build.gradle -- +++ b/RnDiffApp/android/build.gradle -+ --- a/TestApp/android/build.gradle -+ +++ b/TestApp/android/build.gradle - @@ -9,8 +9,8 @@ buildscript { -@@ -28,6 +28,6 @@ +@@ -1,9 +1,9 @@ +- diff --git a/RnDiffApp/android/app/src/main/AndroidManifest.xml b/RnDiffApp/android/app/src/main/AndroidManifest.xml ++ diff --git a/TestApp/android/app/src/main/AndroidManifest.xml b/TestApp/android/app/src/main/AndroidManifest.xml + index bc3a9310..f3e0d155 100644 +- --- a/RnDiffApp/android/app/src/main/AndroidManifest.xml +- +++ b/RnDiffApp/android/app/src/main/AndroidManifest.xml ++ --- a/TestApp/android/app/src/main/AndroidManifest.xml ++ +++ b/TestApp/android/app/src/main/AndroidManifest.xml + @@ -1,8 +1,7 @@ + +- + package=\\"com.rndiffapp\\"> ++ - package=\\"com.testapp\\"> ++ + package=\\"com.testapp\\"> -- diff --git a/RnDiffApp/package.json b/RnDiffApp/package.json -+ diff --git a/TestApp/package.json b/TestApp/package.json - index 4e617645..c82829bd 100644 -- --- a/RnDiffApp/package.json -- +++ b/RnDiffApp/package.json -+ --- a/TestApp/package.json -+ +++ b/TestApp/package.json - @@ -7,14 +7,14 @@" +@@ -14,6 +14,6 @@ + android:name=\\".MainApplication\\" +- diff --git a/RnDiffApp/ios/RnDiffApp/AppDelegate.h b/RnDiffApp/ios/RnDiffApp/AppDelegate.h ++ diff --git a/TestApp/ios/TestApp/AppDelegate.h b/TestApp/ios/TestApp/AppDelegate.h + index 4b5644f2..2726d5e1 100644 +- --- a/RnDiffApp/ios/RnDiffApp/AppDelegate.h +- +++ b/RnDiffApp/ios/RnDiffApp/AppDelegate.h ++ --- a/TestApp/ios/TestApp/AppDelegate.h ++ +++ b/TestApp/ios/TestApp/AppDelegate.h + @@ -5,9 +5,10 @@ +@@ -29,6 +29,6 @@ + @property (nonatomic, strong) UIWindow *window; +- diff --git a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java ++ diff --git a/TestApp/android/app/src/main/java/com/testapp/MainApplication.java b/TestApp/android/app/src/main/java/com/testapp/MainApplication.java + index bc3a9310..f3e0d155 100644 +- --- a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java +- +++ b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java ++ --- a/TestApp/android/app/src/main/java/com/testapp/MainApplication.java ++ +++ b/TestApp/android/app/src/main/java/com/testapp/MainApplication.java + " +`; + +exports[`works with --name-ios and --name-android: RnDiffApp is replaced with app name (CustomIos and co.uk.customandroid.app) 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -1,9 +1,9 @@ +- diff --git a/RnDiffApp/android/app/src/main/AndroidManifest.xml b/RnDiffApp/android/app/src/main/AndroidManifest.xml ++ diff --git a/CustomIos/android/app/src/main/AndroidManifest.xml b/CustomIos/android/app/src/main/AndroidManifest.xml + index bc3a9310..f3e0d155 100644 +- --- a/RnDiffApp/android/app/src/main/AndroidManifest.xml +- +++ b/RnDiffApp/android/app/src/main/AndroidManifest.xml ++ --- a/CustomIos/android/app/src/main/AndroidManifest.xml ++ +++ b/CustomIos/android/app/src/main/AndroidManifest.xml + @@ -1,8 +1,7 @@ + +- + package=\\"com.rndiffapp\\"> ++ - package=\\"co.uk.customandroid.app\\"> ++ + package=\\"co.uk.customandroid.app\\"> + +@@ -14,6 +14,6 @@ + android:name=\\".MainApplication\\" +- diff --git a/RnDiffApp/ios/RnDiffApp/AppDelegate.h b/RnDiffApp/ios/RnDiffApp/AppDelegate.h ++ diff --git a/CustomIos/ios/CustomIos/AppDelegate.h b/CustomIos/ios/CustomIos/AppDelegate.h + index 4b5644f2..2726d5e1 100644 +- --- a/RnDiffApp/ios/RnDiffApp/AppDelegate.h +- +++ b/RnDiffApp/ios/RnDiffApp/AppDelegate.h ++ --- a/CustomIos/ios/CustomIos/AppDelegate.h ++ +++ b/CustomIos/ios/CustomIos/AppDelegate.h + @@ -5,9 +5,10 @@ +@@ -29,6 +29,6 @@ + @property (nonatomic, strong) UIWindow *window; +- diff --git a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java ++ diff --git a/CustomIos/android/app/src/main/java/co/uk/customandroid/app/MainApplication.java b/CustomIos/android/app/src/main/java/co/uk/customandroid/app/MainApplication.java + index bc3a9310..f3e0d155 100644 +- --- a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java +- +++ b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java ++ --- a/CustomIos/android/app/src/main/java/co/uk/customandroid/app/MainApplication.java ++ +++ b/CustomIos/android/app/src/main/java/co/uk/customandroid/app/MainApplication.java + " `; diff --git a/packages/cli/src/commands/upgrade/__tests__/sample.patch b/packages/cli/src/commands/upgrade/__tests__/sample.patch index f5f8ef685..42c5efce4 100644 --- a/packages/cli/src/commands/upgrade/__tests__/sample.patch +++ b/packages/cli/src/commands/upgrade/__tests__/sample.patch @@ -1,51 +1,33 @@ -diff --git a/RnDiffApp/android/build.gradle b/RnDiffApp/android/build.gradle -index 85d8f2f8..a1e80854 100644 ---- a/RnDiffApp/android/build.gradle -+++ b/RnDiffApp/android/build.gradle -@@ -9,8 +9,8 @@ buildscript { - supportLibVersion = "27.1.1" - } - repositories { -- jcenter() - google() -+ jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' -@@ -23,12 +23,12 @@ buildscript { - allprojects { - repositories { - mavenLocal() -+ google() - jcenter() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url "$rootDir/../node_modules/react-native/android" - } -- google() - } - } +diff --git a/RnDiffApp/android/app/src/main/AndroidManifest.xml b/RnDiffApp/android/app/src/main/AndroidManifest.xml +index bc3a9310..f3e0d155 100644 +--- a/RnDiffApp/android/app/src/main/AndroidManifest.xml ++++ b/RnDiffApp/android/app/src/main/AndroidManifest.xml +@@ -1,8 +1,7 @@ + ++ package="com.rndiffapp"> -diff --git a/RnDiffApp/package.json b/RnDiffApp/package.json -index 4e617645..c82829bd 100644 ---- a/RnDiffApp/package.json -+++ b/RnDiffApp/package.json -@@ -7,14 +7,14 @@ - "test": "jest" - }, - "dependencies": { -- "react": "16.5.0", -- "react-native": "0.57.0" -+ "react": "16.6.1", -+ "react-native": "0.57.7" - }, - "devDependencies": { - "babel-jest": "23.6.0", - "jest": "23.6.0", -- "metro-react-native-babel-preset": "0.47.1", -- "react-test-renderer": "16.5.0" -+ "metro-react-native-babel-preset": "0.49.2", -+ "react-test-renderer": "16.6.1" - }, - "jest": { - "preset": "react-native" + +- + + + #import + +-@interface AppDelegate : UIResponder ++@interface AppDelegate : UIResponder + + @property (nonatomic, strong) UIWindow *window; +diff --git a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java +index bc3a9310..f3e0d155 100644 +--- a/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java ++++ b/RnDiffApp/android/app/src/main/java/com/rndiffapp/MainApplication.java diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index d66a4bb37..1147d629a 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -8,6 +8,7 @@ import upgrade from '../upgrade'; import {fetch} from '../../../tools/fetch'; import logger from '../../../tools/logger'; import loadConfig from '../../../tools/config'; +import merge from '../../../tools/merge'; jest.mock('https'); jest.mock('fs'); @@ -172,7 +173,16 @@ success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the test('fetches regular patch, adds remote, applies patch, installs deps, removes remote,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); - await upgrade.func([newVersion], ctx, opts); + await upgrade.func( + [newVersion], + merge(ctx, { + project: { + ios: {projectName: 'TestApp.xcodeproj'}, + android: {packageName: 'com.testapp'}, + }, + }), + opts, + ); expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch @@ -196,7 +206,9 @@ success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { contextLines: 1, }), - ).toMatchSnapshot('RnDiffApp is replaced with app name (TestApp)'); + ).toMatchSnapshot( + 'RnDiffApp is replaced with app name (TestApp and com.testapp)', + ); }, 60000); test('fetches regular patch, adds remote, applies patch, installs deps, removes remote when updated from nested directory', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); @@ -268,3 +280,23 @@ info You may find these resources helpful: • Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" `); }, 60000); +test('works with --name-ios and --name-android', async () => { + (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); + await upgrade.func( + [newVersion], + merge(ctx, { + project: { + ios: {projectName: 'CustomIos.xcodeproj'}, + android: {packageName: 'co.uk.customandroid.app'}, + }, + }), + opts, + ); + expect( + snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { + contextLines: 1, + }), + ).toMatchSnapshot( + 'RnDiffApp is replaced with app name (CustomIos and co.uk.customandroid.app)', + ); +}, 60000); diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index e321b801c..00e9f0f12 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -11,7 +11,7 @@ import {fetch} from '../../tools/fetch'; import legacyUpgrade from './legacyUpgrade'; type FlagsT = { - legacy: boolean, + legacy: boolean | void, }; const rnDiffPurgeUrl = @@ -38,12 +38,9 @@ const getRNPeerDeps = async ( return JSON.parse(stdout); }; -const getPatch = async (currentVersion, newVersion, projectDir) => { +const getPatch = async (currentVersion, newVersion, config) => { let patch; - const rnDiffAppName = 'RnDiffApp'; - const {name} = require(path.join(projectDir, 'package.json')); - logger.info(`Fetching diff between v${currentVersion} and v${newVersion}...`); try { @@ -60,9 +57,38 @@ const getPatch = async (currentVersion, newVersion, projectDir) => { return null; } - return patch - .replace(new RegExp(rnDiffAppName, 'g'), name) - .replace(new RegExp(rnDiffAppName.toLowerCase(), 'g'), name.toLowerCase()); + let patchWithRenamedProjects = patch; + + Object.keys(config.project).forEach(platform => { + if (!config.project[platform]) { + return; + } + if (platform === 'ios') { + patchWithRenamedProjects = patchWithRenamedProjects.replace( + new RegExp('RnDiffApp', 'g'), + // $FlowFixMe - poor typings of ProjectConfigIOST + config.project[platform].projectName.replace('.xcodeproj', ''), + ); + } else if (platform === 'android') { + patchWithRenamedProjects = patchWithRenamedProjects + .replace( + new RegExp('com\\.rndiffapp', 'g'), + // $FlowFixMe - poor typings of ProjectConfigAndroidT + config.project[platform].packageName, + ) + .replace( + new RegExp('com\\.rndiffapp'.split('.').join('/'), 'g'), + // $FlowFixMe - poor typings of ProjectConfigAndroidT + config.project[platform].packageName.split('.').join('/'), + ); + } else { + logger.warn( + `Unsupported platform: "${platform}". \`upgrade\` only supports iOS and Android.`, + ); + } + }); + + return patchWithRenamedProjects; }; const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => { @@ -214,7 +240,7 @@ async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { return; } - const patch = await getPatch(currentVersion, newVersion, projectDir); + const patch = await getPatch(currentVersion, newVersion, ctx); if (patch === null) { return; @@ -293,7 +319,7 @@ const upgradeCommand = { func: upgrade, options: [ { - command: '--legacy', + command: '--legacy [boolean]', description: "Legacy implementation. Upgrade your app's template files to the latest version; run this after " + 'updating the react-native version in your package.json and running npm install', diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index c5beefef9..4f7ecefc3 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -2,7 +2,6 @@ * @flow */ import path from 'path'; -import deepmerge from 'deepmerge'; import {mapValues} from 'lodash'; import findDependencies from './findDependencies'; @@ -18,22 +17,13 @@ import { import {type ConfigT} from './types.flow'; import assign from '../assign'; - +import merge from '../merge'; /** * Built-in platforms */ import * as ios from '@react-native-community/cli-platform-ios'; import * as android from '@react-native-community/cli-platform-android'; -/** - * `deepmerge` concatenates arrays by default instead of overwriting them. - * We define custom merging function for arrays to change that behaviour - */ -const merge = (...objs: Object[]) => - deepmerge(...objs, { - arrayMerge: (destinationArray, sourceArray, options) => sourceArray, - }); - /** * Loads CLI configuration */ diff --git a/packages/cli/src/tools/config/types.flow.js b/packages/cli/src/tools/config/types.flow.js index 93d6725c7..ec59790c5 100644 --- a/packages/cli/src/tools/config/types.flow.js +++ b/packages/cli/src/tools/config/types.flow.js @@ -52,6 +52,7 @@ type ProjectParamsAndroidT = { settingsGradlePath?: string, assetsPath?: string, buildGradlePath?: string, + packageName?: string, }; /** diff --git a/packages/cli/src/tools/merge.js b/packages/cli/src/tools/merge.js new file mode 100644 index 000000000..4439b50cc --- /dev/null +++ b/packages/cli/src/tools/merge.js @@ -0,0 +1,15 @@ +/** + * @flow + */ + +import deepmerge from 'deepmerge'; + +/** + * `deepmerge` concatenates arrays by default instead of overwriting them. + * We define custom merging function for arrays to change that behaviour + */ +export default function merge(...objs: Array<{[key: string]: any}>) { + return deepmerge(...objs, { + arrayMerge: (destinationArray, sourceArray, options) => sourceArray, + }); +} diff --git a/packages/platform-android/src/config/index.js b/packages/platform-android/src/config/index.js index c2534ddce..e6cbf5155 100644 --- a/packages/platform-android/src/config/index.js +++ b/packages/platform-android/src/config/index.js @@ -84,6 +84,7 @@ export function projectConfig(folder, userConfig = {}) { settingsGradlePath, assetsPath, mainFilePath, + packageName, }; } From 6343e2a89276f0c3e810645ba2e433645e8f54ce Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 10 Apr 2019 14:24:20 +0200 Subject: [PATCH 068/234] feat: extract commands out to platform packages (#302) * wip * Finish it up * Clean up packages * Move files around * Simplify regex * Remove unused type * Move packages around * Fix type * Update snapshot * Make snapshot even smaller * Throw unlink error --- .flowconfig | 1 + package.json | 1 + packages/cli/package.json | 10 +-- packages/cli/src/commands/index.js | 8 -- packages/cli/src/commands/link/link.js | 7 +- packages/cli/src/commands/link/linkAll.js | 5 +- packages/cli/src/commands/link/unlink.js | 11 ++- .../__snapshots__/index-test.js.snap | 73 +++++-------------- .../src/tools/config/__tests__/index-test.js | 6 +- packages/cli/src/tools/{ => config}/errors.js | 35 +-------- packages/cli/src/tools/config/index.js | 1 + .../src/tools/config/readConfigFromDisk.js | 2 +- .../tools/config/resolveReactNativePath.js | 4 +- packages/platform-android/package.json | 6 +- .../platform-android/src/commands/index.js | 7 ++ .../src/commands/logAndroid/index.js} | 0 .../__tests__/runOnAllDevices.test.js | 0 .../src/commands/runAndroid/adb.js | 0 .../src/commands/runAndroid/getAdbPath.js | 0 .../src/commands/runAndroid/index.js} | 7 +- .../commands/runAndroid}/isPackagerRunning.js | 0 .../commands/runAndroid/runOnAllDevices.js | 0 .../runAndroid/tryLaunchAppOnDevice.js | 0 .../commands/runAndroid/tryRunAdbReverse.js | 0 packages/platform-android/src/index.js | 1 + packages/platform-ios/package.json | 4 +- packages/platform-ios/src/commands/index.js | 7 ++ .../src/commands/logIOS/index.js} | 0 .../__tests__/findMatchingSimulator-test.js | 0 .../runIOS/__tests__/findXcodeProject-test.js | 0 .../__tests__/parseIOSDevicesList-test.js | 0 .../commands/runIOS/findMatchingSimulator.js | 0 .../src/commands/runIOS/findXcodeProject.js | 0 .../src/commands/runIOS/index.js} | 31 ++++---- .../commands/runIOS/parseIOSDevicesList.js | 0 packages/platform-ios/src/index.js | 1 + packages/tools/src/errors.js | 27 +++++++ packages/tools/src/index.js | 2 + 38 files changed, 115 insertions(+), 142 deletions(-) rename packages/cli/src/tools/{ => config}/errors.js (61%) create mode 100644 packages/platform-android/src/commands/index.js rename packages/{cli/src/commands/logAndroid/logAndroid.js => platform-android/src/commands/logAndroid/index.js} (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/__tests__/runOnAllDevices.test.js (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/adb.js (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/getAdbPath.js (100%) rename packages/{cli/src/commands/runAndroid/runAndroid.js => platform-android/src/commands/runAndroid/index.js} (97%) rename packages/{cli/src/tools => platform-android/src/commands/runAndroid}/isPackagerRunning.js (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/runOnAllDevices.js (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/tryLaunchAppOnDevice.js (100%) rename packages/{cli => platform-android}/src/commands/runAndroid/tryRunAdbReverse.js (100%) create mode 100644 packages/platform-ios/src/commands/index.js rename packages/{cli/src/commands/logIOS/logIOS.js => platform-ios/src/commands/logIOS/index.js} (100%) rename packages/{cli => platform-ios}/src/commands/runIOS/__tests__/findMatchingSimulator-test.js (100%) rename packages/{cli => platform-ios}/src/commands/runIOS/__tests__/findXcodeProject-test.js (100%) rename packages/{cli => platform-ios}/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js (100%) rename packages/{cli => platform-ios}/src/commands/runIOS/findMatchingSimulator.js (100%) rename packages/{cli => platform-ios}/src/commands/runIOS/findXcodeProject.js (100%) rename packages/{cli/src/commands/runIOS/runIOS.js => platform-ios/src/commands/runIOS/index.js} (94%) rename packages/{cli => platform-ios}/src/commands/runIOS/parseIOSDevicesList.js (100%) create mode 100644 packages/tools/src/errors.js diff --git a/.flowconfig b/.flowconfig index 87fb9288f..90bdd9049 100644 --- a/.flowconfig +++ b/.flowconfig @@ -23,6 +23,7 @@ flow-typed [options] emoji=true +esproposal.export_star_as=enable esproposal.optional_chaining=enable esproposal.nullish_coalescing=enable module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' diff --git a/package.json b/package.json index 66efb935a..9d1cb7ac7 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "glob": "^7.1.3", "jest": "^24.6.0", "lerna": "^3.13.1", + "metro-memory-fs": "^0.53.1", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", "string-length": "^2.0.0" diff --git a/packages/cli/package.json b/packages/cli/package.json index a40dab5de..e3217240c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,10 +28,8 @@ "connect": "^3.6.5", "cosmiconfig": "^5.1.0", "deepmerge": "^3.2.0", - "denodeify": "^1.2.1", "envinfo": "^7.1.0", "errorhandler": "^1.5.0", - "escape-string-regexp": "^1.0.5", "execa": "^1.0.0", "fs-extra": "^7.0.1", "glob": "^7.1.1", @@ -39,13 +37,10 @@ "inquirer": "^3.0.6", "joi": "^14.3.1", "lodash": "^4.17.5", - "logkitty": "^0.4.0", "metro": "^0.53.1", "metro-config": "^0.53.1", "metro-core": "^0.53.1", - "metro-memory-fs": "^0.53.1", "metro-react-native-babel-transformer": "^0.53.1", - "mime": "^1.3.4", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "morgan": "^1.9.0", @@ -57,10 +52,7 @@ "semver": "^5.0.3", "serve-static": "^1.13.1", "shell-quote": "1.6.1", - "slash": "^2.0.0", - "ws": "^1.1.0", - "xcode": "^2.0.0", - "xmldoc": "^0.4.0" + "ws": "^1.1.0" }, "peerDependencies": { "react-native": "^0.60.0" diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index 97e20dc6b..61e182705 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -4,8 +4,6 @@ import {type CommandT} from '../tools/config/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'; @@ -14,16 +12,12 @@ 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 info from './info/info'; import config from './config/config'; import init from './init'; export default ([ server, - runIOS, - runAndroid, library, bundle, ramBundle, @@ -32,8 +26,6 @@ export default ([ install, uninstall, upgrade, - logAndroid, - logIOS, info, config, init, diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 2be0d3f72..60b254629 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -8,14 +8,11 @@ */ import {pick} from 'lodash'; -import dedent from 'dedent'; import {type ConfigT} from '../../tools/config/types.flow'; -import {CLIError} from '../../tools/errors'; - import promiseWaterfall from './promiseWaterfall'; -import {logger} from '@react-native-community/cli-tools'; +import {logger, CLIError} from '@react-native-community/cli-tools'; import commandStub from './commandStub'; import promisify from './promisify'; import getPlatformName from './getPlatformName'; @@ -61,7 +58,7 @@ function link([rawPackageName]: Array, ctx: ConfigT, opts: FlagsType) { const packageName = rawPackageName.replace(/^(.+?)(@.+?)$/gi, '$1'); if (!Object.keys(ctx.dependencies).includes(packageName)) { - throw new CLIError(dedent` + throw new CLIError(` Unknown dependency. Make sure that the package you are trying to link is already installed in your "node_modules" and present in your "package.json" dependencies. `); diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index bd9f80a80..576a98531 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -5,8 +5,7 @@ import {uniqBy, flatMap} from 'lodash'; import path from 'path'; -import type {ConfigT, PlatformsT} from '../../tools/config/types.flow'; -import {CLIError} from '../../tools/errors'; +import type {ConfigT} from '../../tools/config/types.flow'; import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; @@ -15,6 +14,8 @@ import promisify from './promisify'; import linkAssets from './linkAssets'; import linkDependency from './linkDependency'; +import {CLIError} from '@react-native-community/cli-tools'; + const dedupeAssets = (assets: Array): Array => uniqBy(assets, asset => path.basename(asset)); diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 3bcf48758..e7991ac72 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -9,8 +9,7 @@ import {flatMap, values, difference} from 'lodash'; import type {ConfigT} from '../../tools/config/types.flow'; -import dedent from 'dedent'; -import {logger} from '@react-native-community/cli-tools'; +import {logger, CLIError} from '@react-native-community/cli-tools'; import promiseWaterfall from './promiseWaterfall'; import commandStub from './commandStub'; import promisify from './promisify'; @@ -83,7 +82,7 @@ function unlink(args: Array, ctx: ConfigT) { const {[packageName]: dependency, ...otherDependencies} = ctx.dependencies; if (!dependency) { - throw new Error(dedent` + throw new CLIError(` Failed to unlink "${packageName}". It appears that the project is not linked yet. `); } @@ -136,10 +135,10 @@ function unlink(args: Array, ctx: ConfigT) { ); }) .catch(err => { - logger.error( - `It seems something went wrong while unlinking. Error:\n${err.message}`, + throw new CLIError( + `Something went wrong while unlinking. Reason ${err.message}`, + err, ); - throw err; }); } diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 27ab9e567..7479bcbbe 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -57,64 +57,29 @@ Array [ ] `; -exports[`should merge project configuration with default values 1`] = ` +exports[`should merge project configuration with default values: snapshoting \`react-native-test\` config 1`] = ` Object { - "assets": Array [], - "commands": Array [], - "dependencies": Object { - "react-native": Object { - "assets": Array [], - "hooks": Object {}, - "name": "react-native", - "params": Array [], - "platforms": Object { - "android": null, - "ios": null, - }, - }, - "react-native-test": Object { - "assets": Array [ - "foo", - ], - "hooks": Object {}, - "name": "react-native-test", - "params": Array [], - "platforms": Object { - "android": null, - "ios": Object { - "folder": "<>/node_modules/react-native-test", - "libraryFolder": "Libraries", - "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", - "plist": Array [], - "podfile": null, - "podspec": null, - "projectName": "HelloWorld.xcodeproj", - "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", - "sharedLibraries": Array [], - "sourceDir": "./abc", - }, - }, - }, - }, - "haste": Object { - "platforms": Array [ - "ios", - "android", - ], - "providesModuleNodeModules": Array [ - "react-native", - ], - }, + "assets": Array [ + "foo", + ], + "hooks": Object {}, + "name": "react-native-test", + "params": Array [], "platforms": Object { - "android": Object {}, - "ios": Object {}, - }, - "project": Object { "android": null, - "ios": null, + "ios": Object { + "folder": "<>/node_modules/react-native-test", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspec": null, + "projectName": "HelloWorld.xcodeproj", + "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "./abc", + }, }, - "reactNativePath": "<>", - "root": "<>", } `; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index bb917ce9c..5ea4965f2 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -113,8 +113,10 @@ test('should merge project configuration with default values', () => { } }`, }); - const config = loadConfig(DIR); - expect(removeString(config, DIR)).toMatchSnapshot(); + const {dependencies} = loadConfig(DIR); + expect(removeString(dependencies['react-native-test'], DIR)).toMatchSnapshot( + 'snapshoting `react-native-test` config', + ); }); test('should read `rnpm` config from a dependency and transform it to a new format', () => { diff --git a/packages/cli/src/tools/errors.js b/packages/cli/src/tools/config/errors.js similarity index 61% rename from packages/cli/src/tools/errors.js rename to packages/cli/src/tools/config/errors.js index 6c2dfb159..3b1fbbc55 100644 --- a/packages/cli/src/tools/errors.js +++ b/packages/cli/src/tools/config/errors.js @@ -1,36 +1,7 @@ /** * @flow */ -import chalk from 'chalk'; -import dedent from 'dedent'; - -/** - * CLIError - * - * Features: - * - uses original stack trace when error object is passed - * - makes an inline string to match current styling inside CLI - */ -export class CLIError extends Error { - constructor(msg: string, error?: Error) { - super(msg.replace(/(\r\n|\n|\r)/gm, ' ')); - if (error) { - this.stack = error.stack - .split('\n') - .slice(0, 2) - .join('\n'); - } else { - Error.captureStackTrace(this, CLIError); - } - } -} - -export class ProcessError extends Error { - constructor(msg: string, processError: string) { - super(`${chalk.red(msg)}\n\n${chalk.gray(processError)}`); - Error.captureStackTrace(this, ProcessError); - } -} +import {CLIError} from '@react-native-community/cli-tools'; type JoiErrorDetails = { message: string, @@ -61,7 +32,7 @@ export class JoiError extends CLIError { switch (error.type) { case 'object.allowUnknown': { const value = JSON.stringify(error.context.value); - return dedent` + return ` Unknown option ${name} with value "${value}" was found. This is either a typing error or a user mistake. Fixing it will remove this message. `; @@ -70,7 +41,7 @@ export class JoiError extends CLIError { case 'string.base': { const expectedType = error.type.replace('.base', ''); const actualType = typeof error.context.value; - return dedent` + return ` Option ${name} must be a ${expectedType}, instead got ${actualType} `; } diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 4f7ecefc3..6f9bb880b 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -41,6 +41,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { // @todo: Move this to React Native in the future if (dependencyName === 'react-native') { config.platforms = {ios, android}; + config.commands = [...ios.commands, ...android.commands]; } const isPlatform = Object.keys(config.platforms).length > 0; diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index fda58d138..c4723afdf 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -13,7 +13,7 @@ import { type CommandT, } from './types.flow'; -import {JoiError} from '../errors'; +import {JoiError} from './errors'; import * as schema from './schema'; diff --git a/packages/cli/src/tools/config/resolveReactNativePath.js b/packages/cli/src/tools/config/resolveReactNativePath.js index bf1facd66..d814c2a6e 100644 --- a/packages/cli/src/tools/config/resolveReactNativePath.js +++ b/packages/cli/src/tools/config/resolveReactNativePath.js @@ -2,7 +2,7 @@ * @flow */ import path from 'path'; -import dedent from 'dedent'; +import {CLIError} from '@react-native-community/cli-tools'; /** * Finds path to React Native inside `node_modules` or throws @@ -17,7 +17,7 @@ export default function resolveReactNativePath(root: string) { }), ); } catch (_ignored) { - throw new Error(dedent` + throw new CLIError(` Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies. diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index e5c82060c..f964633ff 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -3,6 +3,10 @@ "version": "2.0.0-alpha.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.5" + "@react-native-community/cli-tools": "^2.0.0-alpha.5", + "node-fetch": "^2.2.0", + "logkitty": "^0.4.0", + "slash": "^2.0.0", + "xmldoc": "^0.4.0" } } diff --git a/packages/platform-android/src/commands/index.js b/packages/platform-android/src/commands/index.js new file mode 100644 index 000000000..01ef421d5 --- /dev/null +++ b/packages/platform-android/src/commands/index.js @@ -0,0 +1,7 @@ +/** + * @flow + */ +import logAndroid from './logAndroid'; +import runAndroid from './runAndroid'; + +export default [logAndroid, runAndroid]; diff --git a/packages/cli/src/commands/logAndroid/logAndroid.js b/packages/platform-android/src/commands/logAndroid/index.js similarity index 100% rename from packages/cli/src/commands/logAndroid/logAndroid.js rename to packages/platform-android/src/commands/logAndroid/index.js diff --git a/packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js b/packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js similarity index 100% rename from packages/cli/src/commands/runAndroid/__tests__/runOnAllDevices.test.js rename to packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js diff --git a/packages/cli/src/commands/runAndroid/adb.js b/packages/platform-android/src/commands/runAndroid/adb.js similarity index 100% rename from packages/cli/src/commands/runAndroid/adb.js rename to packages/platform-android/src/commands/runAndroid/adb.js diff --git a/packages/cli/src/commands/runAndroid/getAdbPath.js b/packages/platform-android/src/commands/runAndroid/getAdbPath.js similarity index 100% rename from packages/cli/src/commands/runAndroid/getAdbPath.js rename to packages/platform-android/src/commands/runAndroid/getAdbPath.js diff --git a/packages/cli/src/commands/runAndroid/runAndroid.js b/packages/platform-android/src/commands/runAndroid/index.js similarity index 97% rename from packages/cli/src/commands/runAndroid/runAndroid.js rename to packages/platform-android/src/commands/runAndroid/index.js index 9fc40a551..7a338060b 100644 --- a/packages/cli/src/commands/runAndroid/runAndroid.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -10,13 +10,12 @@ import path from 'path'; import {spawnSync, spawn, execFileSync} from 'child_process'; import fs from 'fs'; -import isString from 'lodash/isString'; -import isPackagerRunning from '../../tools/isPackagerRunning'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from '../../../../cli/src/tools/config/types.flow'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; +import isPackagerRunning from './isPackagerRunning'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; import getAdbPath from './getAdbPath'; @@ -87,7 +86,7 @@ function buildAndRun(args) { const adbPath = getAdbPath(); if (args.deviceId) { - if (isString(args.deviceId)) { + if (typeof args.deviceId === 'string') { return runOnSpecificDevice( args, cmd, diff --git a/packages/cli/src/tools/isPackagerRunning.js b/packages/platform-android/src/commands/runAndroid/isPackagerRunning.js similarity index 100% rename from packages/cli/src/tools/isPackagerRunning.js rename to packages/platform-android/src/commands/runAndroid/isPackagerRunning.js diff --git a/packages/cli/src/commands/runAndroid/runOnAllDevices.js b/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js similarity index 100% rename from packages/cli/src/commands/runAndroid/runOnAllDevices.js rename to packages/platform-android/src/commands/runAndroid/runOnAllDevices.js diff --git a/packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js b/packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js similarity index 100% rename from packages/cli/src/commands/runAndroid/tryLaunchAppOnDevice.js rename to packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js diff --git a/packages/cli/src/commands/runAndroid/tryRunAdbReverse.js b/packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js similarity index 100% rename from packages/cli/src/commands/runAndroid/tryRunAdbReverse.js rename to packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js diff --git a/packages/platform-android/src/index.js b/packages/platform-android/src/index.js index 88ea2ac7e..d7cabc044 100644 --- a/packages/platform-android/src/index.js +++ b/packages/platform-android/src/index.js @@ -5,4 +5,5 @@ */ export {default as linkConfig} from './link'; +export {default as commands} from './commands'; export {projectConfig, dependencyConfig} from './config'; diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 7c31f0d2b..8cfa37b8f 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -3,6 +3,8 @@ "version": "2.0.0-alpha.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.5" + "@react-native-community/cli-tools": "^2.0.0-alpha.5", + "chalk": "^1.1.1", + "xcode": "^2.0.0" } } diff --git a/packages/platform-ios/src/commands/index.js b/packages/platform-ios/src/commands/index.js new file mode 100644 index 000000000..dc8a7abab --- /dev/null +++ b/packages/platform-ios/src/commands/index.js @@ -0,0 +1,7 @@ +/** + * @flow + */ +import logIOS from './logIOS'; +import runIOS from './runIOS'; + +export default [logIOS, runIOS]; diff --git a/packages/cli/src/commands/logIOS/logIOS.js b/packages/platform-ios/src/commands/logIOS/index.js similarity index 100% rename from packages/cli/src/commands/logIOS/logIOS.js rename to packages/platform-ios/src/commands/logIOS/index.js diff --git a/packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js b/packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js similarity index 100% rename from packages/cli/src/commands/runIOS/__tests__/findMatchingSimulator-test.js rename to packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js diff --git a/packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js b/packages/platform-ios/src/commands/runIOS/__tests__/findXcodeProject-test.js similarity index 100% rename from packages/cli/src/commands/runIOS/__tests__/findXcodeProject-test.js rename to packages/platform-ios/src/commands/runIOS/__tests__/findXcodeProject-test.js diff --git a/packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js b/packages/platform-ios/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js similarity index 100% rename from packages/cli/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js rename to packages/platform-ios/src/commands/runIOS/__tests__/parseIOSDevicesList-test.js diff --git a/packages/cli/src/commands/runIOS/findMatchingSimulator.js b/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js similarity index 100% rename from packages/cli/src/commands/runIOS/findMatchingSimulator.js rename to packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js diff --git a/packages/cli/src/commands/runIOS/findXcodeProject.js b/packages/platform-ios/src/commands/runIOS/findXcodeProject.js similarity index 100% rename from packages/cli/src/commands/runIOS/findXcodeProject.js rename to packages/platform-ios/src/commands/runIOS/findXcodeProject.js diff --git a/packages/cli/src/commands/runIOS/runIOS.js b/packages/platform-ios/src/commands/runIOS/index.js similarity index 94% rename from packages/cli/src/commands/runIOS/runIOS.js rename to packages/platform-ios/src/commands/runIOS/index.js index 898b6697e..d5c8f2a5e 100644 --- a/packages/cli/src/commands/runIOS/runIOS.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -11,12 +11,13 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; -import type {ConfigT} from '../../tools/config/types.flow'; + +import type {ConfigT} from '../../../../cli/src/tools/config/types.flow'; + import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; -import {ProcessError} from '../../tools/errors'; -import {logger} from '@react-native-community/cli-tools'; +import {logger, CLIError} from '@react-native-community/cli-tools'; type FlagsT = { simulator: string, @@ -32,7 +33,7 @@ type FlagsT = { function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { if (!fs.existsSync(args.projectPath)) { - throw new Error( + throw new CLIError( 'iOS project folder not found. Are you sure this is a React Native project?', ); } @@ -41,7 +42,7 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { const xcodeProject = findXcodeProject(fs.readdirSync('.')); if (!xcodeProject) { - throw new Error( + throw new CLIError( `Could not find Xcode project files in "${args.projectPath}" folder`, ); } @@ -135,12 +136,12 @@ async function runOnSimulator(xcodeProject, args, scheme) { ), ); } catch (e) { - throw new Error('Could not parse the simulator list output'); + throw new CLIError('Could not parse the simulator list output'); } const selectedSimulator = findMatchingSimulator(simulators, args.simulator); if (!selectedSimulator) { - throw new Error(`Could not find ${args.simulator} simulator`); + throw new CLIError(`Could not find ${args.simulator} simulator`); } /** @@ -311,14 +312,14 @@ function buildProject( } if (code !== 0) { reject( - new ProcessError( - [ - 'Failed to build iOS project.', - `We ran "xcodebuild" command but it exited with error code ${code}.`, - `To debug build logs further, consider building your app with Xcode.app, by opening ${ - xcodeProject.name - }`, - ].join(' '), + new CLIError( + ` + Failed to build iOS project. + + We ran "xcodebuild" command but it exited with error code ${code}. To debug build + logs further, consider building your app with Xcode.app, by opening + ${xcodeProject.name}. + `, errorOutput, ), ); diff --git a/packages/cli/src/commands/runIOS/parseIOSDevicesList.js b/packages/platform-ios/src/commands/runIOS/parseIOSDevicesList.js similarity index 100% rename from packages/cli/src/commands/runIOS/parseIOSDevicesList.js rename to packages/platform-ios/src/commands/runIOS/parseIOSDevicesList.js diff --git a/packages/platform-ios/src/index.js b/packages/platform-ios/src/index.js index b0da4421c..40e87c381 100644 --- a/packages/platform-ios/src/index.js +++ b/packages/platform-ios/src/index.js @@ -5,4 +5,5 @@ */ export {default as linkConfig} from './link'; +export {default as commands} from './commands'; export {projectConfig, dependencyConfig} from './config'; diff --git a/packages/tools/src/errors.js b/packages/tools/src/errors.js new file mode 100644 index 000000000..0fdfbe82e --- /dev/null +++ b/packages/tools/src/errors.js @@ -0,0 +1,27 @@ +/** + * @flow + */ + +/** + * CLIError + * + * Features: + * - uses original stack trace when error object is passed + * - makes an inline string to match current styling inside CLI + */ +export class CLIError extends Error { + constructor(msg: string, originError?: Error | string) { + super(msg.replace(/(\s{2,})/gm, ' ').trim()); + if (originError) { + this.stack = + typeof originError === 'string' + ? originError + : originError.stack + .split('\n') + .slice(0, 2) + .join('\n'); + } else { + Error.captureStackTrace(this, CLIError); + } + } +} diff --git a/packages/tools/src/index.js b/packages/tools/src/index.js index 8568bba7e..d35508f2d 100644 --- a/packages/tools/src/index.js +++ b/packages/tools/src/index.js @@ -3,3 +3,5 @@ */ export {default as logger} from './logger'; export {default as groupFilesByType} from './groupFilesByType'; + +export * from './errors'; From f3e7717f43e9856f592d55738d9e50ccb5865ff9 Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Wed, 10 Apr 2019 10:02:46 -0400 Subject: [PATCH 069/234] fix: pass maxWorkers arg to server (#305) Summary: --------- I've noticed that the `max-workers` CLI flag is not behaving as expected for the bundle command. We need it in one of our CI builds where the container is a bit memory-starved and the default of `numberOfWorkers = numberOfCores` isn't always accurate in a virtualized environment. This fix ensures the flag makes it to the server config and that the number of node processes reflect the number provided + 1. Test Plan: ---------- I made a reproduction repo: https://github.com/sterlingwes/rn-cli-repro The values in the "expected output" reflect the fact: * i already have a node process running for an unrelated task * the number of node processes should be `maxWorkersValue + 1`, since there's a parent node process that spawns the child workers So in the success case, `maxWorkers: 2` would lead to 3 node processes for the RN cli --- packages/cli/src/commands/bundle/buildBundle.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index 89211c746..a966b241e 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -24,6 +24,7 @@ async function buildBundle( output: typeof outputBundle = outputBundle, ) { const config = await loadMetroConfig(ctx, { + maxWorkers: args.maxWorkers, resetCache: args.resetCache, config: args.config, }); From 51f4dcab34719244c39ef7eb68fee2a56b30bacc Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 10 Apr 2019 17:20:28 +0200 Subject: [PATCH 070/234] chore: don't apply RN config automatically (#306) Summary: --------- Thanks to this change, CLI will not add default React Native configuration when one is present. I can now go to React Native, add the configuration and release it and CLI will pick that one. The below temporary workaround allows us to run on 0.59, where config is not yet present. --- .../__snapshots__/index-test.js.snap | 9 +++++++++ .../src/tools/config/__tests__/index-test.js | 19 +++++++++++++++++++ packages/cli/src/tools/config/index.js | 14 +++++++++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 7479bcbbe..d695d85b0 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -83,6 +83,15 @@ Object { } `; +exports[`should not add default React Native config when one present 1`] = ` +Array [ + Object { + "func": [Function], + "name": "test", + }, +] +`; + exports[`should read \`rnpm\` config from a dependency and transform it to a new format 1`] = ` Object { "assets": Array [], diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index 5ea4965f2..cba33e1a2 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -217,3 +217,22 @@ test('should automatically put "react-native" into haste config', () => { const {haste} = loadConfig(DIR); expect(haste).toMatchSnapshot(); }); + +test('should not add default React Native config when one present', () => { + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native/react-native.config.js': `module.exports = { + commands: [{ + name: 'test', + func: () => {}, + }] + }`, + 'package.json': `{ + "dependencies": { + "react-native": "0.0.1" + } + }`, + }); + const {commands} = loadConfig(DIR); + expect(commands).toMatchSnapshot(); +}); diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 6f9bb880b..d1e31efde 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -38,10 +38,18 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { readLegacyDependencyConfigFromDisk(root) || readDependencyConfigFromDisk(root); - // @todo: Move this to React Native in the future + /** + * This workaround is neccessary for development only before + * first 0.60.0-rc.0 gets released and we can switch to it + * while testing. + */ if (dependencyName === 'react-native') { - config.platforms = {ios, android}; - config.commands = [...ios.commands, ...android.commands]; + if (Object.keys(config.platforms).length === 0) { + config.platforms = {ios, android}; + } + if (config.commands.length === 0) { + config.commands = [...ios.commands, ...android.commands]; + } } const isPlatform = Object.keys(config.platforms).length > 0; From 0a049714b061979abd7f9635f5f5fe784abf5668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 10 Apr 2019 17:21:42 +0200 Subject: [PATCH 071/234] v2.0.0-alpha.6 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 6 +++--- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lerna.json b/lerna.json index a1a5d44c3..00ff41d5d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.5", + "version": "2.0.0-alpha.6", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index e3217240c..5ee56d8cd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.5", + "version": "2.0.0-alpha.6", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -19,9 +19,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.5", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.5", - "@react-native-community/cli-tools": "^2.0.0-alpha.5", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.6", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.6", + "@react-native-community/cli-tools": "^2.0.0-alpha.6", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index f964633ff..53bf37121 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,11 +1,11 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.5", + "version": "2.0.0-alpha.6", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.5", - "node-fetch": "^2.2.0", + "@react-native-community/cli-tools": "^2.0.0-alpha.6", "logkitty": "^0.4.0", + "node-fetch": "^2.2.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" } diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 8cfa37b8f..ea5c85d4a 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.5", + "version": "2.0.0-alpha.6", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.5", + "@react-native-community/cli-tools": "^2.0.0-alpha.6", "chalk": "^1.1.1", "xcode": "^2.0.0" } diff --git a/packages/tools/package.json b/packages/tools/package.json index 5ef084e73..ac2083bbd 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.5", + "version": "2.0.0-alpha.6", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 5881ed560676e6104103e568e7fa9e4f685db379 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 10 Apr 2019 20:41:41 +0200 Subject: [PATCH 072/234] feat: skip packages that have invalid config instead of throwing an error (#309) * Do not throw on invalid packages * Fix type error * Update test * add dot * Update snapshots --- .../__snapshots__/index-test.js.snap | 4 ++++ .../src/tools/config/__tests__/index-test.js | 20 +++++++++++++++++ packages/cli/src/tools/config/index.js | 22 ++++++++++++++++--- .../src/tools/config/readConfigFromDisk.js | 7 +++--- packages/tools/src/errors.js | 5 ++++- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index d695d85b0..02aeb3db5 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -175,3 +175,7 @@ Object { }, } `; + +exports[`should skip packages that have invalid configuration: dependencies config 1`] = `Object {}`; + +exports[`should skip packages that have invalid configuration: logged warning 1`] = `"Package react-native has been ignored because it contains invalid configuration. Reason: Unknown option invalidProperty with value \\"5\\" was found. This is either a typing error or a user mistake. Fixing it will remove this message."`; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index cba33e1a2..8a58dd9b7 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -10,6 +10,8 @@ import { getTempDirectory, } from '../../../../../../jest/helpers'; +import {logger} from '@react-native-community/cli-tools'; + const DIR = getTempDirectory('resolve_config_path_test'); // Removes string from all key/values within an object @@ -236,3 +238,21 @@ test('should not add default React Native config when one present', () => { const {commands} = loadConfig(DIR); expect(commands).toMatchSnapshot(); }); + +test('should skip packages that have invalid configuration', () => { + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native/react-native.config.js': `module.exports = { + invalidProperty: 5 + }`, + 'package.json': `{ + "dependencies": { + "react-native": "0.0.1" + } + }`, + }); + const spy = jest.spyOn(logger, 'warn'); + const {dependencies} = loadConfig(DIR); + expect(dependencies).toMatchSnapshot('dependencies config'); + expect(spy.mock.calls[0][0]).toMatchSnapshot('logged warning'); +}); diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index d1e31efde..640d4d13b 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -3,6 +3,7 @@ */ import path from 'path'; import {mapValues} from 'lodash'; +import chalk from 'chalk'; import findDependencies from './findDependencies'; import resolveReactNativePath from './resolveReactNativePath'; @@ -23,6 +24,7 @@ import merge from '../merge'; */ import * as ios from '@react-native-community/cli-platform-ios'; import * as android from '@react-native-community/cli-platform-android'; +import {logger, inlineString} from '@react-native-community/cli-tools'; /** * Loads CLI configuration @@ -34,9 +36,23 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { (acc: ConfigT, dependencyName) => { const root = path.join(projectRoot, 'node_modules', dependencyName); - const config = - readLegacyDependencyConfigFromDisk(root) || - readDependencyConfigFromDisk(root); + let config; + try { + config = + readLegacyDependencyConfigFromDisk(root) || + readDependencyConfigFromDisk(root); + } catch (error) { + logger.warn( + inlineString(` + Package ${chalk.bold( + dependencyName, + )} has been ignored because it contains invalid configuration. + + Reason: ${chalk.dim(error.message)} + `), + ); + return acc; + } /** * This workaround is neccessary for development only before diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index c4723afdf..121937e2b 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -6,6 +6,7 @@ import Joi from 'joi'; import cosmiconfig from 'cosmiconfig'; import path from 'path'; +import chalk from 'chalk'; import { type UserDependencyConfigT, @@ -116,9 +117,9 @@ export function readLegacyDependencyConfigFromDisk( // @todo: paste a link to documentation that explains the migration steps logger.warn( - `Package '${path.basename( - name, - )}' is using deprecated "rnpm" config that will stop working from next release. Consider upgrading to the new config format.`, + `Package ${chalk.bold( + path.basename(name), + )} is using deprecated "rnpm" config that will stop working from next release. Consider upgrading to the new config format.`, ); const result = Joi.validate(transformedConfig, schema.dependencyConfig); diff --git a/packages/tools/src/errors.js b/packages/tools/src/errors.js index 0fdfbe82e..6cb5de299 100644 --- a/packages/tools/src/errors.js +++ b/packages/tools/src/errors.js @@ -11,7 +11,7 @@ */ export class CLIError extends Error { constructor(msg: string, originError?: Error | string) { - super(msg.replace(/(\s{2,})/gm, ' ').trim()); + super(inlineString(msg)); if (originError) { this.stack = typeof originError === 'string' @@ -25,3 +25,6 @@ export class CLIError extends Error { } } } + +export const inlineString = (str: string) => + str.replace(/(\s{2,})/gm, ' ').trim(); From c608a8827f18b7b77a3158f34fd482b6e9d261f9 Mon Sep 17 00:00:00 2001 From: Vance Hu Date: Thu, 11 Apr 2019 04:00:33 -0400 Subject: [PATCH 073/234] feat: skip successful Metro server requests if --verbose not set (#291) Summary: --------- Metro server can become too verbose if there are a lot of assets due to morgan verbosely logging every request. Trying to make use of `verbose` flag to allow users skipping successful requests if 'verbose' is set to false (default) Test Plan: ---------- 1. run `react-native start` Expected Result: no console output on a successful request 2. run `react-native start --verbose` Expected Result: console output for every request --- packages/cli/src/commands/server/runServer.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 586fb4274..181d8fd34 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -8,16 +8,14 @@ */ import Metro from 'metro'; - import {Terminal} from 'metro-core'; - import morgan from 'morgan'; import path from 'path'; +import {logger} from '@react-native-community/cli-tools'; import type {ConfigT} from '../../tools/config/types.flow'; import messageSocket from './messageSocket'; import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; - import loadMetroConfig from '../../tools/loadMetroConfig'; export type Args = {| @@ -62,7 +60,14 @@ async function runServer(argv: Array, ctx: ConfigT, args: Args) { watchFolders: metroConfig.watchFolders, }); - middlewareManager.getConnectInstance().use(morgan('combined')); + middlewareManager.getConnectInstance().use( + morgan( + 'combined', + !logger.isVerbose() && { + skip: (req, res) => res.statusCode < 400, + }, + ), + ); metroConfig.watchFolders.forEach( middlewareManager.serveStatic.bind(middlewareManager), From fc21e30f882ebc7d61fc3bf37dc96abfaf916d24 Mon Sep 17 00:00:00 2001 From: Shaun Donnelly Date: Thu, 11 Apr 2019 15:28:00 +0100 Subject: [PATCH 074/234] chore: fix typo in link debug message (#311) Typo --- packages/cli/src/commands/link/link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 60b254629..aef18442d 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -49,7 +49,7 @@ function link([rawPackageName]: Array, ctx: ConfigT, opts: FlagsType) { if (rawPackageName === undefined) { logger.debug( - 'No package name provided, will attemp to link all possible packages.', + 'No package name provided, will attempt to link all possible packages.', ); return linkAll(ctx); } From 964c45296dbb1bba14f1b9abc8fa1aa5b1141cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 13 Apr 2019 11:02:02 +0200 Subject: [PATCH 075/234] chore: use files instead of npmignore for publishing (#314) --- packages/cli/.npmignore | 4 ---- packages/cli/package.json | 4 ++++ packages/platform-android/package.json | 5 ++++- packages/platform-ios/package.json | 5 ++++- packages/tools/package.json | 5 ++++- 5 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 packages/cli/.npmignore diff --git a/packages/cli/.npmignore b/packages/cli/.npmignore deleted file mode 100644 index 11f4e9ffb..000000000 --- a/packages/cli/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -__fixtures__ -__tests__ -__mocks__ -src diff --git a/packages/cli/package.json b/packages/cli/package.json index 5ee56d8cd..a027d7856 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -7,6 +7,10 @@ "bin": { "react-native": "build/bin.js" }, + "files": [ + "build", + "setup_env.sh" + ], "engineStrict": true, "engines": { "node": ">=8.3" diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 53bf37121..f39938ed4 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -8,5 +8,8 @@ "node-fetch": "^2.2.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" - } + }, + "files": [ + "build" + ] } diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index ea5c85d4a..e1b40cb79 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -6,5 +6,8 @@ "@react-native-community/cli-tools": "^2.0.0-alpha.6", "chalk": "^1.1.1", "xcode": "^2.0.0" - } + }, + "files": [ + "build" + ] } diff --git a/packages/tools/package.json b/packages/tools/package.json index ac2083bbd..db92061aa 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -6,5 +6,8 @@ "chalk": "^1.1.1", "lodash": "^4.17.5", "mime": "^1.3.4" - } + }, + "files": [ + "build" + ] } From 7ac73fa5633c0d81057184cdfdefd4d38f3c4535 Mon Sep 17 00:00:00 2001 From: ifsnow Date: Tue, 16 Apr 2019 19:47:51 +0900 Subject: [PATCH 076/234] fix: add new line to the help message (#319) Summary: --------- There is a problem with the line break of command help as below. Test Plan: ---------- Not required. --- packages/cli/src/cliEntry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 81036907d..3e4294bbf 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -79,7 +79,7 @@ function printHelpInformation(examples, pkg) { output = output.concat([chalk.bold('\nExample usage:'), formattedUsage]); } - return output.join('\n'); + return output.join('\n').concat('\n'); } function printUnknownCommand(cmdName) { From 4036fc5eb20f1783d07dedc7045dfee5723287d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 16 Apr 2019 14:51:35 +0200 Subject: [PATCH 077/234] chore: add documentation on link, unlink, start, upgrade (#316) --- packages/cli/README.md | 116 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 18289bedb..1e49d90c4 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -17,7 +17,7 @@ CLI comes with a set of commands and flags you can pass to them. - [`ram-bundle`](#ram-bundle) - [`run-android`](#run-android) - [`run-ios`](#run-ios) -- [`server`](#server) +- [`start`](#start) - [`uninstall`](#uninstall) - [`unlink`](#unlink) - [`upgrade`](#upgrade) @@ -44,6 +44,20 @@ Installs single package from npm and then links native dependencies. If `install ### `link` +Usage: + +```sh +react-native link [packageName] +``` + +Link native dependency or all native dependencies if no `packageName` passed. + +#### Options + +#### `--platforms [list]` + +Pass comma-separated list of platforms to scope `link` to. + ### `log-android` ### `log-ios` @@ -112,7 +126,85 @@ Runs packager on specified port Default: `process.env.RCT_METRO_PORT || 8081` -### `server` +### `start` + +Usage: + +``` +react-native start [option] +``` + +Starts the server that communicates with connected devices + +#### Options + +#### `--port [number]` + +Specify port to listen on + +#### `--watchFolders [list]` + +Specify any additional folders to be added to the watch list + +#### `--assetExts [list]` + +Specify any additional asset extensions to be used by the packager + +#### `--sourceExts [list]` + +Specify any additional source extensions to be used by the packager + +#### `--platforms [list]` + +Specify any additional platforms to be used by the packager + +#### `--providesModuleNodeModules [list]` + +Specify any npm packages that import dependencies with providesModule + +#### `--max-workers [number]` + +Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine + +#### `--skipflow` + +Disable flow checks + +#### `--nonPersistent` + +Disable file watcher + +#### `--transformer [string]` + +Specify a custom transformer to be used + +#### `--reset-cache, --resetCache` + +Removes cached files + +#### `--custom-log-reporter-path, --customLogReporterPath [string]` + +Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter + +#### `--verbose` + +Enables logging + +#### `--https` + +Enables https connections to the server + +#### `--key [path]` + +Path to custom SSL key + +#### `--cert [path]` + +Path to custom SSL cert + +#### `--config [string]` + +Path to the CLI configuration file ### `uninstall` @@ -126,4 +218,24 @@ Unlinks single package native dependencies and then uninstalls it from `package. ### `unlink` +Usage: + +``` +react-native unlink +``` + +Unlink native dependency linked with the `link` command. + ### `upgrade` + +Usage: + +```sh +react-native upgrade [npm-version] +``` + +Upgrade your app's template files to the specified or latest npm version using [rn-diff-purge](https://github.com/react-native-community/rn-diff-purge) project. Only valid semver versions are allowed. + +Using this command is a recommended way of upgrading relatively simple React Native apps with not too many native libraries linked. The more iOS and Android build files are modified, the higher chance for a conflicts. The command will guide you on how to continue upgrade process manually in case of failure. + +_Note: If you'd like to upgrade using this method from React Native version lower than 0.59.0, you may use a standalone version of this CLI: `npx @react-native-community/cli upgrade`._ From 708211a6451ee6ac1d3575016a045b30982b3ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 16 Apr 2019 14:53:50 +0200 Subject: [PATCH 078/234] chore: move shared types to root; moar link styles; bye promiseWaterfall (#312) * chore: move shared types to root; moar link styles; bye promiseWaterfall * fix test * add alias for global types * bump Flow to 0.97 * add lint annotation to bin * enable babel module resolver plugin * import inquirer prompt type --- .eslintrc.js | 16 ++- .flowconfig | 1 + babel.config.js | 8 ++ package.json | 5 +- packages/cli/src/bin.js | 1 + packages/cli/src/cliEntry.js | 2 +- .../cli/src/commands/bundle/buildBundle.js | 2 +- packages/cli/src/commands/config/config.js | 2 +- packages/cli/src/commands/index.js | 2 +- packages/cli/src/commands/info/info.js | 2 +- .../errors/DirectoryAlreadyExistsError.js | 2 - packages/cli/src/commands/init/init.js | 2 +- packages/cli/src/commands/install/install.js | 2 +- .../cli/src/commands/install/uninstall.js | 2 +- .../src/commands/link/__tests__/link-test.js | 4 +- .../link/__tests__/promiseWaterfall-test.js | 46 -------- packages/cli/src/commands/link/commandStub.js | 10 -- packages/cli/src/commands/link/link.js | 38 +++---- packages/cli/src/commands/link/linkAll.js | 40 ++++--- packages/cli/src/commands/link/linkAssets.js | 2 +- .../cli/src/commands/link/linkDependency.js | 10 +- packages/cli/src/commands/link/pollParams.js | 6 +- .../cli/src/commands/link/promiseWaterfall.js | 23 ---- packages/cli/src/commands/link/promisify.js | 13 --- packages/cli/src/commands/link/unlink.js | 103 +++++++++--------- packages/cli/src/commands/server/runServer.js | 2 +- .../cli/src/commands/upgrade/legacyUpgrade.js | 2 +- packages/cli/src/commands/upgrade/upgrade.js | 2 +- packages/cli/src/tools/config/index.js | 2 +- .../src/tools/config/readConfigFromDisk.js | 2 +- packages/cli/src/tools/loadMetroConfig.js | 2 +- .../src/commands/runAndroid/index.js | 2 +- .../platform-ios/src/commands/runIOS/index.js | 2 +- .../src/config/findPodfilePath.js | 3 +- .../src/config/findPodspecName.js | 3 +- .../platform-ios/src/config/findProject.js | 3 +- packages/platform-ios/src/config/index.js | 12 +- packages/platform-ios/src/index.js | 4 +- .../platform-ios/src/link/addFileToProject.js | 3 +- .../config/types.flow.js => types/index.js | 58 ++++++++-- yarn.lock | 98 +++++++++++++++-- 41 files changed, 304 insertions(+), 240 deletions(-) delete mode 100644 packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js delete mode 100644 packages/cli/src/commands/link/commandStub.js delete mode 100644 packages/cli/src/commands/link/promiseWaterfall.js delete mode 100644 packages/cli/src/commands/link/promisify.js rename packages/cli/src/tools/config/types.flow.js => types/index.js (82%) diff --git a/.eslintrc.js b/.eslintrc.js index 291813410..602287973 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,19 +1,31 @@ module.exports = { - extends: '@react-native-community', + extends: ['@react-native-community', 'plugin:import/errors'], env: { node: true, }, rules: { 'prettier/prettier': [2, 'fb'], }, + // @todo: remove once we cover whole codebase with types + plugins: ['eslint-plugin-import'], settings: { react: { version: 'latest', }, + 'import/resolver': { + alias: { + map: [['types', './types/index.js']], + }, + }, }, overrides: [ { - files: ['**/__mocks__/**', '**/__fixtures__/**', '**/__e2e__/**', 'jest/**'], + files: [ + '**/__mocks__/**', + '**/__fixtures__/**', + '**/__e2e__/**', + 'jest/**', + ], env: { jest: true, }, diff --git a/.flowconfig b/.flowconfig index 90bdd9049..0563c1419 100644 --- a/.flowconfig +++ b/.flowconfig @@ -27,6 +27,7 @@ esproposal.export_star_as=enable esproposal.optional_chaining=enable esproposal.nullish_coalescing=enable module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.name_mapper='types' -> '/types/index.js' suppress_type=$FlowIssue suppress_type=$FlowFixMe diff --git a/babel.config.js b/babel.config.js index fd9551e17..bf19c198a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -13,5 +13,13 @@ module.exports = { plugins: [ require.resolve('@babel/plugin-transform-strict-mode'), [require.resolve('@babel/plugin-transform-modules-commonjs'), {lazy: true}], + [ + require.resolve('babel-plugin-module-resolver', { + root: ['.'], + alias: { + types: './types', + }, + }), + ], ], }; diff --git a/package.json b/package.json index 9d1cb7ac7..8501ffca0 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,13 @@ "@babel/preset-flow": "^7.0.0", "@react-native-community/eslint-config": "^0.0.3", "babel-jest": "^24.6.0", + "babel-plugin-module-resolver": "^3.2.0", "chalk": "^2.4.2", "eslint": "^5.10.0", + "eslint-import-resolver-alias": "^1.1.2", + "eslint-plugin-import": "^2.17.0", "execa": "^1.0.0", - "flow-bin": "^0.96.0", + "flow-bin": "^0.97.0", "flow-typed": "^2.5.1", "glob": "^7.1.3", "jest": "^24.6.0", diff --git a/packages/cli/src/bin.js b/packages/cli/src/bin.js index 78b528f7f..d8f99f54a 100755 --- a/packages/cli/src/bin.js +++ b/packages/cli/src/bin.js @@ -9,6 +9,7 @@ * @flow */ +// eslint-disable-next-line import/default import cliEntry from '.'; cliEntry.run(); diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 3e4294bbf..3d5a9ea0e 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -12,7 +12,7 @@ import childProcess from 'child_process'; import commander from 'commander'; import path from 'path'; -import type {CommandT, ConfigT} from './tools/config/types.flow'; +import type {CommandT, ConfigT} from 'types'; import commands from './commands'; import init from './commands/init/initCompat'; diff --git a/packages/cli/src/commands/bundle/buildBundle.js b/packages/cli/src/commands/bundle/buildBundle.js index a966b241e..97557b129 100644 --- a/packages/cli/src/commands/bundle/buildBundle.js +++ b/packages/cli/src/commands/bundle/buildBundle.js @@ -13,7 +13,7 @@ import outputBundle from 'metro/src/shared/output/bundle'; import path from 'path'; import chalk from 'chalk'; import type {CommandLineArgs} from './bundleCommandLineArgs'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import saveAssets from './saveAssets'; import loadMetroConfig from '../../tools/loadMetroConfig'; import {logger} from '@react-native-community/cli-tools'; diff --git a/packages/cli/src/commands/config/config.js b/packages/cli/src/commands/config/config.js index 83fa8bffb..36b0c7130 100644 --- a/packages/cli/src/commands/config/config.js +++ b/packages/cli/src/commands/config/config.js @@ -1,7 +1,7 @@ /** * @flow */ -import {type ConfigT} from '../../tools/config/types.flow'; +import {type ConfigT} from 'types'; export default { name: 'config', description: 'Print CLI configuration', diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index 61e182705..c76f1f2c9 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -1,7 +1,7 @@ /** * @flow */ -import {type CommandT} from '../tools/config/types.flow'; +import {type CommandT} from 'types'; import server from './server/server'; import library from './library/library'; diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index f404c5d92..4c5492763 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -9,7 +9,7 @@ import envinfo from 'envinfo'; import {logger} from '@react-native-community/cli-tools'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; const info = async function getInfo( argv: Array, diff --git a/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js b/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js index 4c7c7aabe..c24352d17 100644 --- a/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js +++ b/packages/cli/src/commands/init/errors/DirectoryAlreadyExistsError.js @@ -1,6 +1,4 @@ // @flow -import path from 'path'; - export default class DirectoryAlreadyExistsError extends Error { constructor(directory: string) { super( diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 35e2811a5..ddf9381be 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -2,7 +2,7 @@ import fs from 'fs-extra'; import minimist from 'minimist'; import semver from 'semver'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import {validateProjectName} from './validate'; import DirectoryAlreadyExistsError from './errors/DirectoryAlreadyExistsError'; import printRunInstructions from './printRunInstructions'; diff --git a/packages/cli/src/commands/install/install.js b/packages/cli/src/commands/install/install.js index 7b6e5d6f5..a15072ed1 100644 --- a/packages/cli/src/commands/install/install.js +++ b/packages/cli/src/commands/install/install.js @@ -7,7 +7,7 @@ * @flow */ -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/link'; diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index 85f4f4563..7c51a0a41 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -7,7 +7,7 @@ * @flow */ -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import link from '../link/unlink'; diff --git a/packages/cli/src/commands/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js index c409283f3..6f93f1180 100644 --- a/packages/cli/src/commands/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -55,8 +55,8 @@ describe('link', () => { }); it('should register native module when android/ios projects are present', done => { - const prelink = jest.fn().mockImplementation(cb => cb()); - const postlink = jest.fn().mockImplementation(cb => cb()); + const prelink = jest.fn(); + const postlink = jest.fn(); const registerNativeModule = jest.fn(); const config = { diff --git a/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js b/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js deleted file mode 100644 index 917977355..000000000 --- a/packages/cli/src/commands/link/__tests__/promiseWaterfall-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @emails oncall+javascript_foundation - */ - -import promiseWaterfall from '../promiseWaterfall'; - -describe('promiseWaterfall', () => { - it('should run promises in a sequence', async () => { - const tasks = [jest.fn(), jest.fn()]; - - await promiseWaterfall(tasks); - - // Check that tasks[0] is executed before tasks[1]. - expect(tasks[0].mock.invocationCallOrder[0]).toBeLessThan( - tasks[1].mock.invocationCallOrder[0], - ); - }); - - it('should resolve with last promise value', async () => { - const tasks = [jest.fn().mockReturnValue(1), jest.fn().mockReturnValue(2)]; - - expect(await promiseWaterfall(tasks)).toEqual(2); - }); - - it('should stop the sequence when one of promises is rejected', done => { - const error = new Error(); - const tasks = [ - jest.fn().mockImplementation(() => { - throw error; - }), - jest.fn().mockReturnValue(2), - ]; - - promiseWaterfall(tasks).catch(err => { - expect(err).toEqual(error); - expect(tasks[1].mock.calls).toHaveLength(0); - done(); - }); - }); -}); diff --git a/packages/cli/src/commands/link/commandStub.js b/packages/cli/src/commands/link/commandStub.js deleted file mode 100644 index 4b4cfda06..000000000 --- a/packages/cli/src/commands/link/commandStub.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -export default cb => cb(); diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index aef18442d..fbde1782c 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -8,15 +8,9 @@ */ import {pick} from 'lodash'; - -import {type ConfigT} from '../../tools/config/types.flow'; - -import promiseWaterfall from './promiseWaterfall'; import {logger, CLIError} from '@react-native-community/cli-tools'; -import commandStub from './commandStub'; -import promisify from './promisify'; +import {type ConfigT} from 'types'; import getPlatformName from './getPlatformName'; - import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; @@ -31,7 +25,11 @@ type FlagsType = { * @param args If optional argument [packageName] is provided, * only that package is processed. */ -function link([rawPackageName]: Array, ctx: ConfigT, opts: FlagsType) { +async function link( + [rawPackageName]: Array, + ctx: ConfigT, + opts: FlagsType, +) { let platforms = ctx.platforms; let project = ctx.project; @@ -68,19 +66,21 @@ function link([rawPackageName]: Array, ctx: ConfigT, opts: FlagsType) { logger.debug(`Package to link: ${rawPackageName}`); - const tasks = [ - () => promisify(dependency.hooks.prelink || commandStub), - () => linkDependency(platforms, project, dependency), - () => promisify(dependency.hooks.postlink || commandStub), - () => linkAssets(platforms, project, dependency.assets), - ]; - - return promiseWaterfall(tasks).catch(err => { + try { + if (dependency.hooks.prelink) { + await dependency.hooks.prelink(); + } + await linkDependency(platforms, project, dependency); + if (dependency.hooks.postlink) { + await dependency.hooks.postlink(); + } + await linkAssets(platforms, project, dependency.assets); + } catch (error) { throw new CLIError( - `Something went wrong while linking. Reason: ${err.message}`, - err, + `Something went wrong while linking. Reason: ${error.message}`, + error, ); - }); + } } export const func = link; diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 576a98531..478346b36 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -2,14 +2,10 @@ * @flow */ -import {uniqBy, flatMap} from 'lodash'; +import {uniqBy} from 'lodash'; import path from 'path'; -import type {ConfigT} from '../../tools/config/types.flow'; - -import promiseWaterfall from './promiseWaterfall'; -import commandStub from './commandStub'; -import promisify from './promisify'; +import type {ConfigT} from 'types'; import linkAssets from './linkAssets'; import linkDependency from './linkDependency'; @@ -19,7 +15,7 @@ import {CLIError} from '@react-native-community/cli-tools'; const dedupeAssets = (assets: Array): Array => uniqBy(assets, asset => path.basename(asset)); -function linkAll(config: ConfigT) { +async function linkAll(config: ConfigT) { const projectAssets = config.assets; const assets = dedupeAssets( @@ -29,22 +25,24 @@ function linkAll(config: ConfigT) { ), ); - const tasks = flatMap( - config.dependencies, - dependency => [ - () => promisify(dependency.hooks.prelink || commandStub), - () => linkDependency(config.platforms, config.project, dependency), - () => promisify(dependency.hooks.postlink || commandStub), - ], - () => linkAssets(config.platforms, config.project, assets), - ); - - return promiseWaterfall(tasks).catch(err => { + try { + Object.keys(config.dependencies).forEach(async key => { + const dependency = config.dependencies[key]; + if (dependency.hooks.prelink) { + await dependency.hooks.prelink(); + } + await linkDependency(config.platforms, config.project, dependency); + if (dependency.hooks.postlink) { + await dependency.hooks.postlink(); + } + }); + await linkAssets(config.platforms, config.project, assets); + } catch (error) { throw new CLIError( - `Something went wrong while linking. Reason: ${err.message}`, - err, + `Something went wrong while linking. Reason: ${error.message}`, + error, ); - }); + } } export default linkAll; diff --git a/packages/cli/src/commands/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js index f5a5d6404..c74148333 100644 --- a/packages/cli/src/commands/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -1,7 +1,7 @@ // @flow import {isEmpty} from 'lodash'; -import type {PlatformsT, ProjectConfigT} from '../../tools/config/types.flow'; +import type {PlatformsT, ProjectConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; diff --git a/packages/cli/src/commands/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js index c4081cf5e..80187b94a 100644 --- a/packages/cli/src/commands/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -1,10 +1,6 @@ // @flow -import type { - DependencyConfigT, - ProjectConfigT, - PlatformsT, -} from '../../tools/config/types.flow'; +import type {DependencyConfigT, ProjectConfigT, PlatformsT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import pollParams from './pollParams'; import getPlatformName from './getPlatformName'; @@ -34,8 +30,10 @@ const linkDependency = async ( } const isInstalled = linkConfig.isInstalled( + // $FlowFixMe projectConfig, name, + // $FlowFixMe dependencyConfig, ); @@ -47,7 +45,7 @@ const linkDependency = async ( } logger.info(`Linking "${name}" ${getPlatformName(platform)} dependency`); - + // $FlowFixMe linkConfig.register(name, dependencyConfig, params, projectConfig); logger.info( diff --git a/packages/cli/src/commands/link/pollParams.js b/packages/cli/src/commands/link/pollParams.js index 3ee296195..ed93ac813 100644 --- a/packages/cli/src/commands/link/pollParams.js +++ b/packages/cli/src/commands/link/pollParams.js @@ -5,12 +5,14 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import inquirer from 'inquirer'; +import type {InquirerPromptT} from 'types'; -export default questions => - new Promise((resolve, reject) => { +export default (questions: InquirerPromptT) => + new Promise((resolve, reject) => { if (!questions) { resolve({}); return; diff --git a/packages/cli/src/commands/link/promiseWaterfall.js b/packages/cli/src/commands/link/promiseWaterfall.js deleted file mode 100644 index bc6f2c5a8..000000000 --- a/packages/cli/src/commands/link/promiseWaterfall.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/** - * Given an array of promise creators, executes them in a sequence. - * - * If any of the promises in the chain fails, all subsequent promises - * will be skipped - * - * Returns the value last promise from a sequence resolved - */ -export default function promiseWaterfall(tasks) { - return tasks.reduce( - (prevTaskPromise, task) => prevTaskPromise.then(task), - Promise.resolve(), - ); -} diff --git a/packages/cli/src/commands/link/promisify.js b/packages/cli/src/commands/link/promisify.js deleted file mode 100644 index e4c2a97a2..000000000 --- a/packages/cli/src/commands/link/promisify.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -export default func => - new Promise((resolve, reject) => - func((err, res) => (err ? reject(err) : resolve(res))), - ); diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index e7991ac72..411b6d70b 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -8,11 +8,8 @@ */ import {flatMap, values, difference} from 'lodash'; -import type {ConfigT} from '../../tools/config/types.flow'; import {logger, CLIError} from '@react-native-community/cli-tools'; -import promiseWaterfall from './promiseWaterfall'; -import commandStub from './commandStub'; -import promisify from './promisify'; +import type {ConfigT} from 'types'; import getPlatformName from './getPlatformName'; const unlinkDependency = ( @@ -39,8 +36,10 @@ const unlinkDependency = ( } const isInstalled = linkConfig.isInstalled( + // $FlowFixMe projectConfig, packageName, + // $FlowFixMe dependencyConfig, ); @@ -57,7 +56,9 @@ const unlinkDependency = ( linkConfig.unregister( packageName, + // $FlowFixMe dependencyConfig, + // $FlowFixMe projectConfig, otherDependencies, ); @@ -76,7 +77,7 @@ const unlinkDependency = ( * If optional argument [packageName] is provided, it's the only one * that's checked */ -function unlink(args: Array, ctx: ConfigT) { +async function unlink(args: Array, ctx: ConfigT) { const packageName = args[0]; const {[packageName]: dependency, ...otherDependencies} = ctx.dependencies; @@ -88,58 +89,56 @@ function unlink(args: Array, ctx: ConfigT) { } const dependencies = values(otherDependencies); + try { + if (dependency.hooks.preulink) { + await dependency.hooks.preulink(); + } + unlinkDependency( + ctx.platforms, + ctx.project, + dependency, + packageName, + dependencies, + ); + if (dependency.hooks.postunlink) { + await dependency.hooks.postunlink(); + } + } catch (error) { + throw new CLIError( + `Something went wrong while unlinking. Reason ${error.message}`, + error, + ); + } - const tasks = [ - () => promisify(dependency.hooks.preulink || commandStub), - () => - unlinkDependency( - ctx.platforms, - ctx.project, - dependency, - packageName, - dependencies, - ), - () => promisify(dependency.hooks.postunlink || commandStub), - ]; - - return promiseWaterfall(tasks) - .then(() => { - // @todo move all these to `tasks` array - // @todo it is possible we could be unlinking some project assets in case of duplicate - const assets = difference( - dependency.assets, - flatMap(dependencies, d => d.assets), - ); - - if (assets.length === 0) { - return; - } + // @todo move all these to above try/catch + // @todo it is possible we could be unlinking some project assets in case of duplicate + const assets = difference( + dependency.assets, + flatMap(dependencies, d => d.assets), + ); - Object.keys(ctx.platforms || {}).forEach(platform => { - const projectConfig = ctx.project[platform]; - const linkConfig = - ctx.platforms[platform] && - ctx.platforms[platform].linkConfig && - ctx.platforms[platform].linkConfig(); - if (!linkConfig || !linkConfig.unlinkAssets || !projectConfig) { - return; - } + if (assets.length === 0) { + return; + } - logger.info(`Unlinking assets from ${platform} project`); + Object.keys(ctx.platforms || {}).forEach(platform => { + const projectConfig = ctx.project[platform]; + const linkConfig = + ctx.platforms[platform] && + ctx.platforms[platform].linkConfig && + ctx.platforms[platform].linkConfig(); + if (!linkConfig || !linkConfig.unlinkAssets || !projectConfig) { + return; + } - linkConfig.unlinkAssets(assets, projectConfig); - }); + logger.info(`Unlinking assets from ${platform} project`); + // $FlowFixMe + linkConfig.unlinkAssets(assets, projectConfig); + }); - logger.info( - `${packageName} assets has been successfully unlinked from your project`, - ); - }) - .catch(err => { - throw new CLIError( - `Something went wrong while unlinking. Reason ${err.message}`, - err, - ); - }); + logger.info( + `${packageName} assets has been successfully unlinked from your project`, + ); } export default { diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 181d8fd34..4fdb07a8d 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -12,7 +12,7 @@ import {Terminal} from 'metro-core'; import morgan from 'morgan'; import path from 'path'; import {logger} from '@react-native-community/cli-tools'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import messageSocket from './messageSocket'; import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; diff --git a/packages/cli/src/commands/upgrade/legacyUpgrade.js b/packages/cli/src/commands/upgrade/legacyUpgrade.js index a416d5098..679e7a44b 100644 --- a/packages/cli/src/commands/upgrade/legacyUpgrade.js +++ b/packages/cli/src/commands/upgrade/legacyUpgrade.js @@ -11,7 +11,7 @@ import fs from 'fs'; import path from 'path'; import semver from 'semver'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import copyProjectTemplateAndReplace from '../../tools/generator/copyProjectTemplateAndReplace'; diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 00e9f0f12..95682c320 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -4,7 +4,7 @@ import fs from 'fs'; import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; -import type {ConfigT} from '../../tools/config/types.flow'; +import type {ConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import {fetch} from '../../tools/fetch'; diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 640d4d13b..5e7e2e5ef 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -15,7 +15,7 @@ import { readLegacyDependencyConfigFromDisk, } from './readConfigFromDisk'; -import {type ConfigT} from './types.flow'; +import {type ConfigT} from 'types'; import assign from '../assign'; import merge from '../merge'; diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 121937e2b..b55833510 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -12,7 +12,7 @@ import { type UserDependencyConfigT, type UserConfigT, type CommandT, -} from './types.flow'; +} from 'types'; import {JoiError} from './errors'; diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 14c4c5b18..da713adfc 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -5,7 +5,7 @@ import path from 'path'; import {createBlacklist} from 'metro'; import {loadConfig} from 'metro-config'; -import {type ConfigT} from './config/types.flow'; +import {type ConfigT} from 'types'; import findSymlinkedModules from './findSymlinkedModules'; const resolveSymlinksForRoots = roots => diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 7a338060b..08d587e31 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -11,7 +11,7 @@ import path from 'path'; import {spawnSync, spawn, execFileSync} from 'child_process'; import fs from 'fs'; -import type {ConfigT} from '../../../../cli/src/tools/config/types.flow'; +import type {ConfigT} from 'types'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index d5c8f2a5e..3e716ba12 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -12,7 +12,7 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; -import type {ConfigT} from '../../../../cli/src/tools/config/types.flow'; +import type {ConfigT} from 'types'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; diff --git a/packages/platform-ios/src/config/findPodfilePath.js b/packages/platform-ios/src/config/findPodfilePath.js index bf30d67de..ab5e47fc7 100644 --- a/packages/platform-ios/src/config/findPodfilePath.js +++ b/packages/platform-ios/src/config/findPodfilePath.js @@ -5,12 +5,13 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import fs from 'fs'; import path from 'path'; -export default function findPodfilePath(projectFolder) { +export default function findPodfilePath(projectFolder: string) { const podFilePath = path.join(projectFolder, '..', 'Podfile'); const podFileExists = fs.existsSync(podFilePath); diff --git a/packages/platform-ios/src/config/findPodspecName.js b/packages/platform-ios/src/config/findPodspecName.js index 08b8ec83c..eb14ba8b5 100644 --- a/packages/platform-ios/src/config/findPodspecName.js +++ b/packages/platform-ios/src/config/findPodspecName.js @@ -5,12 +5,13 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import glob from 'glob'; import path from 'path'; -export default function findPodspecName(folder) { +export default function findPodspecName(folder: string): string | null { const podspecs = glob.sync('*.podspec', {cwd: folder}); let podspecFile = null; if (podspecs.length === 0) { diff --git a/packages/platform-ios/src/config/findProject.js b/packages/platform-ios/src/config/findProject.js index 3b1862f88..d798fea24 100644 --- a/packages/platform-ios/src/config/findProject.js +++ b/packages/platform-ios/src/config/findProject.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import glob from 'glob'; @@ -38,7 +39,7 @@ const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules)/**']; * * Note: `./ios/*.xcodeproj` are returned regardless of the name */ -export default function findProject(folder) { +export default function findProject(folder: string): string | null { const projects = glob .sync(GLOB_PATTERN, { cwd: folder, diff --git a/packages/platform-ios/src/config/index.js b/packages/platform-ios/src/config/index.js index bd33aa754..fd3e3a6b3 100644 --- a/packages/platform-ios/src/config/index.js +++ b/packages/platform-ios/src/config/index.js @@ -5,19 +5,21 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import path from 'path'; import findProject from './findProject'; import findPodfilePath from './findPodfilePath'; import findPodspecName from './findPodspecName'; +import type {UserConfigT} from 'types'; /** * For libraries specified without an extension, add '.tbd' for those that * start with 'lib' and '.framework' to the rest. */ const mapSharedLibaries = libraries => - libraries.map(name => { + libraries.map(name => { if (path.extname(name)) { return name; } @@ -28,7 +30,13 @@ const mapSharedLibaries = libraries => * Returns project config by analyzing given folder and applying some user defaults * when constructing final object */ -export function projectConfig(folder, userConfig) { +export function projectConfig( + folder: string, + userConfig: $PropertyType<$PropertyType, 'ios'>, +) { + if (!userConfig) { + return; + } const project = userConfig.project || findProject(folder); /** diff --git a/packages/platform-ios/src/index.js b/packages/platform-ios/src/index.js index 40e87c381..ced0990f6 100644 --- a/packages/platform-ios/src/index.js +++ b/packages/platform-ios/src/index.js @@ -1,7 +1,7 @@ /** - * @flow - * * iOS platform files + * + * @flow */ export {default as linkConfig} from './link'; diff --git a/packages/platform-ios/src/link/addFileToProject.js b/packages/platform-ios/src/link/addFileToProject.js index e5c617491..abcbc948b 100644 --- a/packages/platform-ios/src/link/addFileToProject.js +++ b/packages/platform-ios/src/link/addFileToProject.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow */ import PbxFile from 'xcode/lib/pbxFile'; @@ -14,7 +15,7 @@ import PbxFile from 'xcode/lib/pbxFile'; * from path provided, adds it to the project * and returns newly created instance of a file */ -export default function addFileToProject(project, filePath) { +export default function addFileToProject(project: any, filePath: string) { const file = new PbxFile(filePath); file.uuid = project.generateUuid(); file.fileRef = project.generateUuid(); diff --git a/packages/cli/src/tools/config/types.flow.js b/types/index.js similarity index 82% rename from packages/cli/src/tools/config/types.flow.js rename to types/index.js index ec59790c5..14dba0ff7 100644 --- a/packages/cli/src/tools/config/types.flow.js +++ b/types/index.js @@ -22,7 +22,7 @@ export type CommandT = { * Opaque type that describes the Inquirer question format. Not typed, since we just * pass it directly to Inquirer. Validation is done with Joi in `schema.js` */ -type InquirerPromptT = any; +export type InquirerPromptT = any; /** * Settings that a library author can define in the configuration bundled with @@ -65,6 +65,7 @@ type ProjectParamsIOST = { project?: string, sharedLibraries?: string[], libraryFolder?: string, + plist: any[], }; type PlatformConfig = { @@ -96,7 +97,7 @@ export type ConfigT = {| // Object that contains configuration for a project (null, when platform not available) project: { - android?: ?ProjectConfigAndroidT, + android?: ProjectConfigAndroidT, ios?: ?ProjectConfigIOST, [key: string]: ?Object, }, @@ -115,9 +116,9 @@ export type ConfigT = {| }, assets: string[], hooks: { - [key: string]: string, - prelink?: string, - postlink?: string, + [key: string]: () => void, + prelink?: () => void, + postlink?: () => void, }, params: InquirerPromptT[], }, @@ -205,7 +206,48 @@ export type UserConfigT = { // The following types are used in untyped-parts of the codebase, so I am leaving them // until we actually need them. -type ProjectConfigIOST = {}; +type ProjectConfigIOST = { + sourceDir: string, + folder: string, + pbxprojPath: string, + podfile: null, + podspec: null, + projectPath: string, + projectName: string, + libraryFolder: string, + sharedLibraries: Array, + plist: Array, +}; type DependencyConfigIOST = ProjectConfigIOST; -type ProjectConfigAndroidT = {}; -type DependencyConfigAndroidT = {}; +type ProjectConfigAndroidT = { + sourceDir: string, + isFlat: boolean, + folder: string, + stringsPath: string, + manifestPath: string, + buildGradlePath: string, + settingsGradlePath: string, + assetsPath: string, + mainFilePath: string, + packageName: string, +}; +type DependencyConfigAndroidT = { + sourceDir: string, + folder: string, + manifest: Manifest, + packageImportPath: string, + packageInstance: string, +}; + +type Manifest = { + name: string, + attr: { + [key: string]: string, + package: string, + }, + val: string, + isValCdata: boolean, + children: Array, + firstChild: Manifest, + lastChild: Manifest, +}; diff --git a/yarn.lock b/yarn.lock index 2c3426197..c3750962c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2212,6 +2212,17 @@ babel-plugin-jest-hoist@^24.6.0: dependencies: "@types/babel__traverse" "^7.0.6" +babel-plugin-module-resolver@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.2.0.tgz#ddfa5e301e3b9aa12d852a9979f18b37881ff5a7" + integrity sha512-tjR0GvSndzPew/Iayf4uICWZqjBwnlMWjSx6brryfQ81F9rxBVqwDJtFCV8oOs0+vJeefK9TmdZtkIFdFe1UnA== + dependencies: + find-babel-config "^1.1.0" + glob "^7.1.2" + pkg-up "^2.0.0" + reselect "^3.0.1" + resolve "^1.4.0" + babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" @@ -2862,6 +2873,11 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + conventional-changelog-angular@^5.0.3: version "5.0.3" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.3.tgz#299fdd43df5a1f095283ac16aeedfb0a682ecab0" @@ -3080,7 +3096,7 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: +debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -3281,6 +3297,14 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -3458,6 +3482,27 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" +eslint-import-resolver-alias@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz#297062890e31e4d6651eb5eba9534e1f6e68fc97" + integrity sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w== + +eslint-import-resolver-node@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== + dependencies: + debug "^2.6.9" + resolve "^1.5.0" + +eslint-module-utils@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz#546178dab5e046c8b562bbb50705e2456d7bda49" + integrity sha512-lmDJgeOOjk8hObTysjqH7wyMi+nsHwwvfBykwfhjR1LNdd7C2uFJBvx4OpWYpXOw4df1yE1cDEVd1yLHitk34w== + dependencies: + debug "^2.6.8" + pkg-dir "^2.0.0" + eslint-plugin-eslint-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.1.tgz#32ff0afba8a48e17073817e6d03fbc5622f735b7" @@ -3473,6 +3518,23 @@ eslint-plugin-flowtype@2.50.3: dependencies: lodash "^4.17.10" +eslint-plugin-import@^2.17.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.0.tgz#bdf6598aded839a27454d824b0758fd46f80eb72" + integrity sha512-JCsOtNwPYUoeZPlSr8t0+uCU5OVlHh+dIBn8Rw7FiOPjCECG+QzDIKDqshbyJE6CYoj9wpcstEl8vUY7rXkqVA== + dependencies: + array-includes "^3.0.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.3.0" + has "^1.0.3" + lodash "^4.17.11" + minimatch "^3.0.4" + read-pkg-up "^2.0.0" + resolve "^1.10.0" + eslint-plugin-jest@22.4.1: version "22.4.1" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz#a5fd6f7a2a41388d16f527073b778013c5189a9c" @@ -3875,6 +3937,14 @@ finalhandler@1.1.0: statuses "~1.3.1" unpipe "~1.0.0" +find-babel-config@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2" + integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA== + dependencies: + json5 "^0.5.1" + path-exists "^3.0.0" + find-cache-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" @@ -3913,10 +3983,10 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.96.0: - version "0.96.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.96.0.tgz#3b0379d97304dc1879ae6db627cd2d6819998661" - integrity sha512-OSxERs0EdhVxEVCst/HmlT/RcnXsQQIRqcfK9J9wC8/93JQj+xQz4RtlsmYe1PSRYaozuDLyPS5pIA81Zwzaww== +flow-bin@^0.97.0: + version "0.97.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.97.0.tgz#036ffcfc27503367a9d906ec9d843a0aa6f6bb83" + integrity sha512-jXjD05gkatLuC4+e28frH1hZoRwr1iASP6oJr61Q64+kR4kmzaS+AdFBhYgoYS5kpoe4UzwDebWK8ETQFNh00w== flow-typed@^2.5.1: version "2.5.1" @@ -4877,7 +4947,7 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -isarray@1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= @@ -5501,7 +5571,7 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" -json5@^0.5.0: +json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -7138,6 +7208,13 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" +pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= + dependencies: + find-up "^2.1.0" + pkginfo@0.3.x: version "0.3.1" resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" @@ -7682,6 +7759,11 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" +reselect@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147" + integrity sha1-79qpjqdFEyTQkrKyFjpqHXqaIUc= + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -7713,7 +7795,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.10.0, resolve@^1.3.2, resolve@^1.9.0: +resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== From fb94fef7120a4c3982020c790283919ae3c76f5c Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Tue, 16 Apr 2019 13:31:44 -0700 Subject: [PATCH 079/234] Add support for assetPlugins argument to start command (#318) * Add support for assetPlugins argument to start command * Add assetPlugins arg type --- packages/cli/src/commands/server/runServer.js | 7 +++++++ packages/cli/src/commands/server/server.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 4fdb07a8d..9d73050df 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -20,6 +20,7 @@ import loadMetroConfig from '../../tools/loadMetroConfig'; export type Args = {| assetExts?: string[], + assetPlugins?: string[], cert?: string, customLogReporterPath?: string, host?: string, @@ -54,6 +55,12 @@ async function runServer(argv: Array, ctx: ConfigT, args: Args) { reporter, }); + if (args.assetPlugins) { + metroConfig.transformer.assetPlugins = args.assetPlugins.map(plugin => + require.resolve(plugin), + ); + } + const middlewareManager = new MiddlewareManager({ host: args.host, port: metroConfig.server.port, diff --git a/packages/cli/src/commands/server/server.js b/packages/cli/src/commands/server/server.js index 6fe1adbb8..e4b5ac073 100644 --- a/packages/cli/src/commands/server/server.js +++ b/packages/cli/src/commands/server/server.js @@ -30,6 +30,12 @@ export default { 'Specify any additional folders to be added to the watch list', parse: (val: string) => val.split(','), }, + { + command: '--assetPlugins [list]', + description: + 'Specify any additional asset plugins to be used by the packager by full filepath', + parse: (val: string) => val.split(','), + }, { command: '--assetExts [list]', description: From 76f079ee8a2ebf9843a47422bdbcb86651b2b086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 16 Apr 2019 22:50:40 +0200 Subject: [PATCH 080/234] feat: autolink on iOS --- .circleci/config.yml | 10 + package.json | 1 + .../__snapshots__/index-test.js.snap | 7 +- .../src/tools/config/__tests__/index-test.js | 1 + packages/cli/src/tools/config/index.js | 3 +- .../src/tools/config/readConfigFromDisk.js | 2 +- packages/platform-ios/native_modules.rb | 237 ++++++++++++++++++ types/index.js | 1 + 8 files changed, 259 insertions(+), 3 deletions(-) create mode 100644 packages/platform-ios/native_modules.rb diff --git a/.circleci/config.yml b/.circleci/config.yml index 8bd31c04e..3cf675058 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,6 +37,13 @@ jobs: - attach_workspace: at: ~/react-native-cli - run: yarn flow-check + cocoa-pods: + <<: *defaults + docker: + - image: circleci/ruby:2.4-node + - attach_workspace: + at: ~/react-native-cli + - run: yarn test:ci:cocoapods unit-tests: <<: *defaults steps: @@ -70,3 +77,6 @@ workflows: - e2e-tests: requires: - install-dependencies + - cocoa-pods: + requires: + - install-dependencies diff --git a/package.json b/package.json index 8501ffca0..77f036c63 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "test": "jest", "test:ci:unit": "jest packages --ci --coverage", "test:ci:e2e": "jest e2e --ci -i", + "test:ci:cocoapods": "ruby packages/platform-ios/native_modules.rb", "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", "postinstall": "yarn build", diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 02aeb3db5..7c5496b7f 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -80,6 +80,7 @@ Object { "sourceDir": "./abc", }, }, + "root": "<>/node_modules/react-native-test", } `; @@ -113,6 +114,7 @@ Object { "sourceDir": "<>/node_modules/react-native-foo/customLocation", }, }, + "root": "<>/node_modules/react-native-foo", } `; @@ -130,13 +132,14 @@ Object { "pbxprojPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj/project.pbxproj", "plist": Array [], "podfile": null, - "podspec": null, + "podspec": "ReactNativeTest", "projectName": "customProject.xcodeproj", "projectPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj", "sharedLibraries": Array [], "sourceDir": "<>/node_modules/react-native-test/customLocation", }, }, + "root": "<>/node_modules/react-native-test", } `; @@ -151,6 +154,7 @@ Object { "android": null, "ios": null, }, + "root": "<>/node_modules/react-native", }, "react-native-test": Object { "assets": Array [], @@ -172,6 +176,7 @@ Object { "sourceDir": "<>/node_modules/react-native-test/ios", }, }, + "root": "<>/node_modules/react-native-test", }, } `; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index 8a58dd9b7..117cb393a 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -59,6 +59,7 @@ test('should return dependencies from package.json', () => { test('should read a config of a dependency and use it to load other settings', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native-test/ReactNativeTest.podspec': '', 'node_modules/react-native-test/package.json': `{ "react-native": { "dependency": { diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 5e7e2e5ef..f265a2a41 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -55,7 +55,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { } /** - * This workaround is neccessary for development only before + * This workaround is necessary for development only before * first 0.60.0-rc.0 gets released and we can switch to it * while testing. */ @@ -76,6 +76,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { get [dependencyName]() { return merge( { + root, name: dependencyName, platforms: Object.keys(finalConfig.platforms).reduce( (dependency, platform) => { diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index b55833510..58a99bf58 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -88,7 +88,7 @@ const loadProjectCommands = ( }; /** - * Reads a legacy configuaration from a `package.json` "rnpm" key. + * Reads a legacy configuration from a `package.json` "rnpm" key. */ export function readLegacyDependencyConfigFromDisk( rootFolder: string, diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb new file mode 100644 index 000000000..287468f95 --- /dev/null +++ b/packages/platform-ios/native_modules.rb @@ -0,0 +1,237 @@ +def use_native_modules!(packages = nil) + if (!packages) + cli_bin = Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('@react-native-community/cli/build/index.js'))"], true).strip + output = Pod::Executable.execute_command("node", [cli_bin, "config"], true) + json = [] + output.each_line do |line| + case line + when /^warn\s(.+)/ + Pod::UI.warn($1) + when /^(success|info|error|debug)\s(.+)/ + Pod::UI.message($1) + else + json << line + end + end + config = JSON.parse(json.join("\n")) + packages = config["dependencies"] + end + + found_pods = [] + + packages.each do |package_name, package| + next unless package_config = package["platforms"]["ios"] + + podspec_path = File.join(package["root"], "#{package_config["podspec"]}.podspec") + spec = Pod::Specification.from_file(podspec_path) + + # We want to do a look up inside the current CocoaPods target + # to see if it's already included, this: + # 1. Gives you the chance to define it beforehand + # 2. Ensures CocoaPods won't explode if it's included twice + # + this_target = current_target_definition + existing_deps = current_target_definition.dependencies + + # Skip dependencies that the user already activated themselves. + next if existing_deps.find do |existing_dep| + existing_dep.name.split('/').first == spec.name + end + + pod spec.name, :path => package["root"] + + if package_config["scriptPhases"] + # Can be either an object, or an array of objects + Array(package_config["scriptPhases"]).each do |phase| + # see https://www.rubydoc.info/gems/cocoapods-core/Pod/Podfile/DSL#script_phase-instance_method + # for the full object keys + + # Support passing in a path relative to the root of the package + if phase["path"] + phase["script"] = File.read(File.expand_path(phase["path"], package["root"])) + phase.delete("path") + end + + # Support converting the execution position into a symbol + if phase["execution_position"] + phase["execution_position"] = phase["execution_position"].to_sym + end + + script_phase phase + end + end + + found_pods.push spec + end + + if found_pods.size > 0 + pods = found_pods.map { |p| p.name }.sort.to_sentence + Pod::UI.puts "Detected React Native module #{"pod".pluralize(found_pods.size)} for #{pods}" + end +end + +# You can run the tests for this file by running: +# $ ruby use_native_modules.rb +if $0 == __FILE__ + require "minitest/spec" + require "minitest/autorun" + + # Define this here, because we’re not actually loading this code. + module Pod + class Specification + end + + module UI + end + end + + # CocoaPods loads ActiveSupport, but we’re not doing that here just for the test. + class Array + def to_sentence + size == 1 ? self[0] : "#{self[0..-2].join(", ")}, and #{self[-1]}" + end + end + class String + def pluralize(count) + count == 1 ? self : "#{self}s" + end + end + + describe "use_native_modules!" do + before do + @script_phase = { + "script" => "123", + "name" => "My Name", + "execution_position" => "before_compile", + "input" => "string" + } + + @ios_package = ios_package = { + "root" => "/Users/grabbou/Repositories/WebViewDemoApp/node_modules/react", + "platforms" => { + "ios" => { + "podspec" => "React", + }, + "android" => nil, + }, + } + @android_package = { + "root" => "/Users/grabbou/Repositories/WebViewDemoApp/node_modules/react-native-google-play-game-services", + "platforms" => { + "ios" => nil, + "android" => { + # This is where normally more config would be + }, + } + } + @config = { "ios-dep" => @ios_package, "android-dep" => @android_package } + + @activated_pods = activated_pods = [] + @current_target_definition_dependencies = current_target_definition_dependencies = [] + @printed_messages = printed_messages = [] + @added_scripts = added_scripts = [] + @target_definition = target_definition = Object.new + @podfile = podfile = Object.new + @spec = spec = Object.new + + spec.singleton_class.send(:define_method, :name) { "ios-dep" } + + podfile.singleton_class.send(:define_method, :use_native_modules) do |config| + use_native_modules!(config) + end + + Pod::Specification.singleton_class.send(:define_method, :from_file) do |podspec_path| + podspec_path.must_equal File.join(ios_package["root"], "#{ios_package["platforms"]["ios"]["podspec"]}.podspec") + spec + end + + Pod::UI.singleton_class.send(:define_method, :puts) do |message| + printed_messages << message + end + + podfile.singleton_class.send(:define_method, :pod) do |name, options| + activated_pods << { name: name, options: options } + end + + podfile.singleton_class.send(:define_method, :script_phase) do |options| + added_scripts << options + end + + target_definition.singleton_class.send(:define_method, :dependencies) do + current_target_definition_dependencies + end + + podfile.singleton_class.send(:define_method, :current_target_definition) do + target_definition + end + end + + it "activates iOS pods" do + @podfile.use_native_modules(@config) + @activated_pods.must_equal [{ + name: "ios-dep", + options: { path: @ios_package["root"] } + }] + end + + it "does not activate pods that were already activated previously (by the user in their Podfile)" do + activated_pod = Object.new + activated_pod.singleton_class.send(:define_method, :name) { "ios-dep" } + @current_target_definition_dependencies << activated_pod + @podfile.use_native_modules(@config) + @activated_pods.must_equal [] + end + + it "does not activate pods whose root spec were already activated previously (by the user in their Podfile)" do + activated_pod = Object.new + activated_pod.singleton_class.send(:define_method, :name) { "ios-dep/foo/bar" } + @current_target_definition_dependencies << activated_pod + @podfile.use_native_modules(@config) + @activated_pods.must_equal [] + end + + it "prints out the native module pods that were found" do + @podfile.use_native_modules({}) + @podfile.use_native_modules({ "pkg-1" => @ios_package }) + @podfile.use_native_modules({ "pkg-1" => @ios_package, "pkg-2" => @ios_package }) + @printed_messages.must_equal [ + "Detected native module pod for ios-dep", + "Detected native module pods for ios-dep, and ios-dep" + ] + end + + describe "concerning script_phases" do + it "uses the options directly" do + @config["ios-dep"]["platforms"]["ios"]["scriptPhases"] = [@script_phase] + @podfile.use_native_modules(@config) + @added_scripts.must_equal [{ + "script" => "123", + "name" => "My Name", + "execution_position" => :before_compile, + "input" => "string" + }] + end + + it "reads a script file relative to the package root" do + @script_phase.delete("script") + @script_phase["path"] = "./some_shell_script.sh" + @config["ios-dep"]["platforms"]["ios"]["scriptPhases"] = [@script_phase] + + file_read_mock = MiniTest::Mock.new + file_read_mock.expect(:call, "contents from file", [File.join(@ios_package["root"], "some_shell_script.sh")]) + + File.stub(:read, file_read_mock) do + @podfile.use_native_modules(@config) + end + + @added_scripts.must_equal [{ + "script" => "contents from file", + "name" => "My Name", + "execution_position" => :before_compile, + "input" => "string" + }] + file_read_mock.verify + end + end + end +end diff --git a/types/index.js b/types/index.js index 14dba0ff7..d90cb35f6 100644 --- a/types/index.js +++ b/types/index.js @@ -109,6 +109,7 @@ export type ConfigT = {| dependencies: { [key: string]: { name: string, + root: string, platforms: { android?: DependencyConfigAndroidT | null, ios?: DependencyConfigIOST | null, From 048ab93b4b81e0a6c3a60669932639df1393b6d5 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 16 Apr 2019 22:58:18 +0200 Subject: [PATCH 081/234] chore: fix CI --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3cf675058..80d4a907b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,6 +41,7 @@ jobs: <<: *defaults docker: - image: circleci/ruby:2.4-node + steps: - attach_workspace: at: ~/react-native-cli - run: yarn test:ci:cocoapods From be4be8af34ef6ea4e0e08c4fabcc6618cc125246 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 16 Apr 2019 23:41:40 +0200 Subject: [PATCH 082/234] fix: give a better error message when CocoaPods linking fails (#321) * initial commit * Remove log * fix: failing cocoa-pods tests * Improve accessibility --- packages/platform-ios/native_modules.rb | 4 ++-- .../src/link-pods/findLineToAddPod.js | 2 +- .../src/link-pods/findMarkedLinesInPodfile.js | 2 +- .../src/link-pods/registerNativeModule.js | 22 ++++++++++++++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index 287468f95..cff2a1b42 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -195,8 +195,8 @@ def pluralize(count) @podfile.use_native_modules({ "pkg-1" => @ios_package }) @podfile.use_native_modules({ "pkg-1" => @ios_package, "pkg-2" => @ios_package }) @printed_messages.must_equal [ - "Detected native module pod for ios-dep", - "Detected native module pods for ios-dep, and ios-dep" + "Detected React Native module pod for ios-dep", + "Detected React Native module pods for ios-dep, and ios-dep" ] end diff --git a/packages/platform-ios/src/link-pods/findLineToAddPod.js b/packages/platform-ios/src/link-pods/findLineToAddPod.js index 9f7a4c61a..691a6629c 100644 --- a/packages/platform-ios/src/link-pods/findLineToAddPod.js +++ b/packages/platform-ios/src/link-pods/findLineToAddPod.js @@ -15,7 +15,7 @@ export default function findLineToAddPod(podLines, firstTargetLine) { // match function definition, like: post_install do |installer| (some Podfiles have function defined inside main target const functionDefinition = /^\s*[a-z_]+\s+do(\s+\|[a-z]+\|)?/g; - for (let i = firstTargetLine, len = podLines.length; i < len; i++) { + for (let i = firstTargetLine; i < podLines.length - 1; i++) { const matchNextConstruct = podLines[i].match(nextTarget) || podLines[i].match(functionDefinition); const matchEnd = podLines[i].match(endOfCurrentTarget); diff --git a/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js b/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js index 3087937b7..05033817a 100644 --- a/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js +++ b/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js @@ -7,7 +7,7 @@ * @format */ -const MARKER_TEXT = '# Add new pods below this line'; +export const MARKER_TEXT = '# Add new pods below this line'; export default function findMarkedLinesInPodfile(podLines) { const result = []; diff --git a/packages/platform-ios/src/link-pods/registerNativeModule.js b/packages/platform-ios/src/link-pods/registerNativeModule.js index 5d8abca42..a3363e0a4 100644 --- a/packages/platform-ios/src/link-pods/registerNativeModule.js +++ b/packages/platform-ios/src/link-pods/registerNativeModule.js @@ -6,11 +6,15 @@ * * @format */ +import chalk from 'chalk'; +import {CLIError, inlineString} from '@react-native-community/cli-tools'; import readPodfile from './readPodfile'; import findPodTargetLine from './findPodTargetLine'; import findLineToAddPod from './findLineToAddPod'; -import findMarkedLinesInPodfile from './findMarkedLinesInPodfile'; +import findMarkedLinesInPodfile, { + MARKER_TEXT, +} from './findMarkedLinesInPodfile'; import addPodEntry from './addPodEntry'; import savePodFile from './savePodFile'; @@ -31,5 +35,21 @@ function getLinesToAddEntry(podLines, {projectName}) { return linesToAddPodWithMarker; } const firstTargetLined = findPodTargetLine(podLines, projectName); + if (firstTargetLined === null) { + throw new CLIError( + inlineString(` + We couldn't find a target to add a CocoaPods dependency. + + Make sure that you have a "${chalk.dim( + `target '${projectName.replace('.xcodeproj', '')}' do`, + )}" line in your Podfile. + + Alternatively, include "${chalk.dim( + MARKER_TEXT, + )}" in a Podfile where we should add + linked dependencies. + `), + ); + } return findLineToAddPod(podLines, firstTargetLined); } From 1b8c0978854917b946c381b26989a9d738351930 Mon Sep 17 00:00:00 2001 From: ifsnow Date: Wed, 17 Apr 2019 16:28:04 +0900 Subject: [PATCH 083/234] fix: prevent run-android failure when updating APK (#323) Summary: --------- If we run `react-native run-android` while it's already installed, it will fail with the following error. ```bash info Installing the app on the device (cd android && adb -s emulator-5554 install app/build/outputs/apk/debug/app-x86-debug.apk adb: failed to install app/build/outputs/apk/debug/app-x86-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install me.mycake without first uninstalling.] ``` In the development phase, I think using adb's install options below is much more efficient. ``` -r : Reinstall an existing app, keeping its data. -d : Allow version code downgrade. ``` Test Plan: ---------- Not required. --- packages/platform-android/src/commands/runAndroid/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 08d587e31..9248016af 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -166,9 +166,9 @@ function tryInstallAppOnDevice(args, adbPath, device) { ); const pathToApk = `${buildDirectory}/${apkFile}`; - const adbArgs = ['-s', device, 'install', pathToApk]; + const adbArgs = ['-s', device, 'install', '-rd', pathToApk]; logger.info( - `Installing the app on the device (cd android && adb -s ${device} install ${pathToApk}`, + `Installing the app on the device (cd android && adb -s ${device} install -rd ${pathToApk}`, ); execFileSync(adbPath, adbArgs, { stdio: [process.stdin, process.stdout, process.stderr], From 3a1eb61e620a21e4558e69fd425e4e5ab0d343c4 Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Wed, 17 Apr 2019 20:56:08 +0200 Subject: [PATCH 084/234] fix: open Metro in the correct terminal (#310) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Put `isPackagerRunning` function on `cli-tools` to share between iOS & Android * Fix `terminal` argument not working when not being provided * Fallback to the default terminal of the machine when starting the packager on `run-android` * Delete `isPackagerRunning` as it was moved to `tools` * Add `terminal` argument to `run-ios` * Launch Metro from within the `runIOS` command * Remove code & add `—terminal` argument * Try using `REACT_TERMINAL` before the default terminal * Put `isPackagerRunning` function on `cli-tools` to share between iOS & Android * Fix `terminal` argument not working when not being provided * Fallback to the default terminal of the machine when starting the packager on `run-android` * Delete `isPackagerRunning` as it was moved to `tools` * Add `terminal` argument to `run-ios` * Launch Metro from within the `runIOS` command * Remove code & add `—terminal` argument * Try using `REACT_TERMINAL` before the default terminal * Add tool function to get the default user terminal * Fix `terminal` arg type * Remove spread and specify entry twice instead * Improve `args` being passed through functions * Reduce code duplication * Put `device` and `udid` variable up in the scope --- .../src/commands/runAndroid/index.js | 15 +- .../platform-ios/src/commands/runIOS/index.js | 134 ++++++------------ packages/tools/src/getDefaultUserTerminal.js | 4 + packages/tools/src/index.js | 2 + .../src}/isPackagerRunning.js | 0 5 files changed, 60 insertions(+), 95 deletions(-) create mode 100644 packages/tools/src/getDefaultUserTerminal.js rename packages/{platform-android/src/commands/runAndroid => tools/src}/isPackagerRunning.js (100%) diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 9248016af..f11e44e34 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -15,11 +15,14 @@ import type {ConfigT} from 'types'; import adb from './adb'; import runOnAllDevices from './runOnAllDevices'; -import isPackagerRunning from './isPackagerRunning'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; import getAdbPath from './getAdbPath'; -import {logger} from '@react-native-community/cli-tools'; +import { + isPackagerRunning, + logger, + getDefaultUserTerminal, +} from '@react-native-community/cli-tools'; // Verifies this is an Android project function checkAndroid(root) { @@ -226,11 +229,7 @@ function installAndLaunchOnDevice( ); } -function startServerInNewWindow( - port, - terminal = process.env.REACT_TERMINAL, - reactNativePath, -) { +function startServerInNewWindow(port, terminal, reactNativePath) { /** * Set up OS-specific filenames and commands */ @@ -359,7 +358,7 @@ export default { command: '--terminal [string]', description: 'Launches the Metro Bundler in a new window using the specified terminal path.', - default: '', + default: getDefaultUserTerminal(), }, ], }; diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 3e716ba12..5a637cef1 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -17,18 +17,23 @@ import type {ConfigT} from 'types'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; -import {logger, CLIError} from '@react-native-community/cli-tools'; +import { + logger, + CLIError, + getDefaultUserTerminal, +} from '@react-native-community/cli-tools'; type FlagsT = { simulator: string, configuration: string, scheme: ?string, projectPath: string, - device: ?string, + device: ?(string | true), udid: ?string, packager: boolean, verbose: boolean, port: number, + terminal: ?string, }; function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { @@ -66,65 +71,36 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { }), ); - if (args.device) { - const selectedDevice = matchingDevice(devices, args.device); + const device = ((args.device: any): string); + const udid = ((args.udid: any): string); + if (device || udid) { + const selectedDevice = device + ? matchingDevice(devices, device) + : matchingDeviceByUdid(devices, udid); + if (selectedDevice) { - return runOnDevice( - selectedDevice, - scheme, - xcodeProject, - args.configuration, - args.packager, - args.verbose, - args.port, - ); + return runOnDevice(selectedDevice, scheme, xcodeProject, args); } + if (devices && devices.length > 0) { - // $FlowIssue: args.device is defined in this context - logger.error(`Could not find device with the name: "${args.device}". -Choose one of the following:${printFoundDevices(devices)}`); - } else { - logger.error('No iOS devices connected.'); + const message = device + ? `Could not find device with the name: "${device}". Choose one of the following:\n${printFoundDevices( + devices, + )}` + : `Could not find device with the udid: "${udid}". Choose one of the following:\n${printFoundDevices( + devices, + )}`; + + return logger.error(message); } - } else if (args.udid) { - // $FlowIssue: args.udid is defined in this context - return runOnDeviceByUdid(args, scheme, xcodeProject, devices); - } - return runOnSimulator(xcodeProject, args, scheme); -} - -function runOnDeviceByUdid( - args: FlagsT & {udid: string}, - scheme, - xcodeProject, - devices, -) { - const selectedDevice = matchingDeviceByUdid(devices, args.udid); - - if (selectedDevice) { - runOnDevice( - selectedDevice, - scheme, - xcodeProject, - args.configuration, - args.packager, - args.verbose, - args.port, - ); - return; + return logger.error('No iOS devices connected.'); } - if (devices && devices.length > 0) { - // $FlowIssue: args.udid is defined in this context - logger.error(`Could not find device with the udid: "${args.udid}". -Choose one of the following:\n${printFoundDevices(devices)}`); - } else { - logger.error('No iOS devices connected.'); - } + return runOnSimulator(xcodeProject, scheme, args); } -async function runOnSimulator(xcodeProject, args, scheme) { +async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { let simulators; try { simulators = JSON.parse( @@ -175,10 +151,7 @@ async function runOnSimulator(xcodeProject, args, scheme) { xcodeProject, selectedSimulator.udid, scheme, - args.configuration, - args.packager, - args.verbose, - args.port, + args, ); const appPath = getBuildPath(args.configuration, appName, false, scheme); @@ -213,34 +186,23 @@ async function runOnSimulator(xcodeProject, args, scheme) { ); } -async function runOnDevice( - selectedDevice, - scheme, - xcodeProject, - configuration, - launchPackager, - verbose, - port, -) { +async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) { const appName = await buildProject( xcodeProject, selectedDevice.udid, scheme, - configuration, - launchPackager, - verbose, - port, + args, ); const iosDeployInstallArgs = [ '--bundle', - getBuildPath(configuration, appName, true, scheme), + getBuildPath(args.configuration, appName, true, scheme), '--id', selectedDevice.udid, '--justlaunch', ]; - logger.info(`installing and launching your app on ${selectedDevice.name}...`); + logger.info(`Installing and launching your app on ${selectedDevice.name}...`); const iosDeployOutput = child_process.spawnSync( 'ios-deploy', @@ -257,21 +219,13 @@ async function runOnDevice( } } -function buildProject( - xcodeProject, - udid, - scheme, - configuration, - launchPackager = false, - verbose, - port, -) { +function buildProject(xcodeProject, udid, scheme, args: FlagsT) { return new Promise((resolve, reject) => { const xcodebuildArgs = [ xcodeProject.isWorkspace ? '-workspace' : '-project', xcodeProject.name, '-configuration', - configuration, + args.configuration, '-scheme', scheme, '-destination', @@ -281,7 +235,7 @@ function buildProject( ]; logger.info(`Building using "xcodebuild ${xcodebuildArgs.join(' ')}"`); let xcpretty; - if (!verbose) { + if (!args.verbose) { xcpretty = xcprettyAvailable() && child_process.spawn('xcpretty', [], { @@ -291,7 +245,7 @@ function buildProject( const buildProcess = child_process.spawn( 'xcodebuild', xcodebuildArgs, - getProcessOptions(launchPackager, port), + getProcessOptions(args), ); let buildOutput = ''; let errorOutput = ''; @@ -418,15 +372,15 @@ function printFoundDevices(devices) { return output; } -function getProcessOptions(launchPackager, port) { - if (launchPackager) { +function getProcessOptions({packager, terminal, port}) { + if (packager) { return { - env: {...process.env, RCT_METRO_PORT: port}, + env: {...process.env, RCT_TERMINAL: terminal, RCT_METRO_PORT: port}, }; } return { - env: {...process.env, RCT_NO_LAUNCH_PACKAGER: true}, + env: {...process.env, RCT_TERMINAL: terminal, RCT_NO_LAUNCH_PACKAGER: true}, }; } @@ -499,5 +453,11 @@ export default { default: process.env.RCT_METRO_PORT || 8081, parse: (val: string) => Number(val), }, + { + command: '--terminal [string]', + description: + 'Launches the Metro Bundler in a new window using the specified terminal path.', + default: getDefaultUserTerminal(), + }, ], }; diff --git a/packages/tools/src/getDefaultUserTerminal.js b/packages/tools/src/getDefaultUserTerminal.js new file mode 100644 index 000000000..48550b61b --- /dev/null +++ b/packages/tools/src/getDefaultUserTerminal.js @@ -0,0 +1,4 @@ +const getDefaultUserTerminal = (): ?string => + process.env.REACT_TERMINAL || process.env.TERM_PROGRAM; + +export default getDefaultUserTerminal; diff --git a/packages/tools/src/index.js b/packages/tools/src/index.js index d35508f2d..08c20616d 100644 --- a/packages/tools/src/index.js +++ b/packages/tools/src/index.js @@ -3,5 +3,7 @@ */ export {default as logger} from './logger'; export {default as groupFilesByType} from './groupFilesByType'; +export {default as isPackagerRunning} from './isPackagerRunning'; +export {default as getDefaultUserTerminal} from './getDefaultUserTerminal'; export * from './errors'; diff --git a/packages/platform-android/src/commands/runAndroid/isPackagerRunning.js b/packages/tools/src/isPackagerRunning.js similarity index 100% rename from packages/platform-android/src/commands/runAndroid/isPackagerRunning.js rename to packages/tools/src/isPackagerRunning.js From 60606efd56da6065d339100e42968c25b4dad182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 17 Apr 2019 22:20:33 +0200 Subject: [PATCH 085/234] v2.0.0-alpha.7 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 00ff41d5d..781a8addf 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.7", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index a027d7856..97fbfa75d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.7", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.6", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.6", - "@react-native-community/cli-tools": "^2.0.0-alpha.6", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.7", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.7", + "@react-native-community/cli-tools": "^2.0.0-alpha.7", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index f39938ed4..4cb657627 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.7", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.6", + "@react-native-community/cli-tools": "^2.0.0-alpha.7", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index e1b40cb79..aa5a5ebe8 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.7", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.6", + "@react-native-community/cli-tools": "^2.0.0-alpha.7", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index db92061aa..aecf9e031 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.7", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From d4c710448e13ff11d44f7bc11b0f3dd8d8532141 Mon Sep 17 00:00:00 2001 From: ifsnow Date: Thu, 18 Apr 2019 13:35:56 +0900 Subject: [PATCH 086/234] fix: prevent unnecessary actions if android build failed (#325) --- .../platform-android/src/commands/runAndroid/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index f11e44e34..e3e37b5ad 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -22,6 +22,7 @@ import { isPackagerRunning, logger, getDefaultUserTerminal, + CLIError, } from '@react-native-community/cli-tools'; // Verifies this is an Android project @@ -149,8 +150,11 @@ function buildApk(gradlew) { execFileSync(gradlew, ['build', '-x', 'lint'], { stdio: [process.stdin, process.stdout, process.stderr], }); - } catch (e) { - logger.error('Could not build the app, read the error above for details.'); + } catch (error) { + throw new CLIError( + 'Could not build the app, read the error above for details', + error, + ); } } From 7d9f8cd96f8e5abc5b7c517d02fb166f9e51b877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 18 Apr 2019 11:37:03 +0200 Subject: [PATCH 087/234] feat: refactor `run-ios` for readability and better error messages (#328) Summary: --------- Refactor `run-ios` for readability and better error messages: Screenshot 2019-04-17 at 22 04 38 Screenshot 2019-04-17 at 22 05 04 Screenshot 2019-04-17 at 22 08 00 Followup to #310 cc @lucasbento Test Plan: ---------- Verified that following commands work properly: - `run-ios` - `run-ios --device` - `run-ios --device phone-name` - `run-ios --uuid asd123` --- .../platform-ios/src/commands/runIOS/index.js | 91 +++++++++---------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 5a637cef1..777090cd3 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -11,9 +11,8 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; - +import chalk from 'chalk'; import type {ConfigT} from 'types'; - import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; @@ -64,6 +63,12 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { }`, ); + const {device, udid} = args; + + if (!device && !udid) { + return runOnSimulator(xcodeProject, scheme, args); + } + const devices = parseIOSDevicesList( // $FlowExpectedError https://github.com/facebook/flow/issues/5675 child_process.execFileSync('xcrun', ['instruments', '-s'], { @@ -71,33 +76,31 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { }), ); - const device = ((args.device: any): string); - const udid = ((args.udid: any): string); - if (device || udid) { - const selectedDevice = device - ? matchingDevice(devices, device) - : matchingDeviceByUdid(devices, udid); - - if (selectedDevice) { - return runOnDevice(selectedDevice, scheme, xcodeProject, args); - } + if (devices.length === 0) { + return logger.error('No iOS devices connected.'); + } - if (devices && devices.length > 0) { - const message = device - ? `Could not find device with the name: "${device}". Choose one of the following:\n${printFoundDevices( - devices, - )}` - : `Could not find device with the udid: "${udid}". Choose one of the following:\n${printFoundDevices( - devices, - )}`; + const selectedDevice = matchingDevice(devices, device, udid); - return logger.error(message); - } + if (selectedDevice) { + return runOnDevice(selectedDevice, scheme, xcodeProject, args); + } - return logger.error('No iOS devices connected.'); + if (device) { + return logger.error( + `Could not find a device named: "${chalk.bold( + device, + )}". ${printFoundDevices(devices)}`, + ); } - return runOnSimulator(xcodeProject, scheme, args); + if (udid) { + return logger.error( + `Could not find a device with udid: "${chalk.bold( + udid, + )}". ${printFoundDevices(devices)}`, + ); + } } async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { @@ -331,33 +334,26 @@ function xcprettyAvailable() { return true; } -function matchingDevice(devices, deviceName) { +function matchingDevice(devices, deviceName, udid) { + if (udid) { + return matchingDeviceByUdid(devices, udid); + } if (deviceName === true && devices.length === 1) { logger.info( - `Using first available device ${ - devices[0].name - } due to lack of name supplied.`, + `Using first available device named "${chalk.bold( + devices[0].name, + )}" due to lack of name supplied.`, ); return devices[0]; } - for (let i = devices.length - 1; i >= 0; i--) { - if ( - devices[i].name === deviceName || - formattedDeviceName(devices[i]) === deviceName - ) { - return devices[i]; - } - } - return null; + return devices.find( + device => + device.name === deviceName || formattedDeviceName(device) === deviceName, + ); } function matchingDeviceByUdid(devices, udid) { - for (let i = devices.length - 1; i >= 0; i--) { - if (devices[i].udid === udid) { - return devices[i]; - } - } - return null; + return devices.find(device => device.udid === udid); } function formattedDeviceName(simulator) { @@ -365,11 +361,10 @@ function formattedDeviceName(simulator) { } function printFoundDevices(devices) { - let output = ''; - for (let i = devices.length - 1; i >= 0; i--) { - output += `${devices[i].name} Udid: ${devices[i].udid}\n`; - } - return output; + return [ + 'Available devices:', + ...devices.map(device => ` - ${device.name} (${device.udid})`), + ].join('\n'); } function getProcessOptions({packager, terminal, port}) { From a759214c3880a0f42d1d1919de0b90559ef33151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 18 Apr 2019 12:19:17 +0200 Subject: [PATCH 088/234] fix: publish native_modules.rb file (#331) --- packages/platform-ios/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index aa5a5ebe8..6989a2dfa 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -8,6 +8,7 @@ "xcode": "^2.0.0" }, "files": [ - "build" + "build", + "native_modules.rb" ] } From 98d88d5f4312f09b01da5ac8a14648900176a114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 18 Apr 2019 16:32:28 +0200 Subject: [PATCH 089/234] v2.0.0-alpha.8 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 781a8addf..aa2554faf 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 97fbfa75d..01a5ea90f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.7", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.7", - "@react-native-community/cli-tools": "^2.0.0-alpha.7", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.8", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.8", + "@react-native-community/cli-tools": "^2.0.0-alpha.8", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 4cb657627..f762e3754 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.7", + "@react-native-community/cli-tools": "^2.0.0-alpha.8", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 6989a2dfa..ed9838239 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.7", + "@react-native-community/cli-tools": "^2.0.0-alpha.8", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index aecf9e031..baa6b3df4 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.8", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From c28fb93696fe34c9380d8b302c5138ca08068001 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 17:48:07 +0200 Subject: [PATCH 090/234] Support functions in default (#333) --- packages/cli/src/cliEntry.js | 2 +- packages/cli/src/tools/config/schema.js | 4 +++- packages/platform-android/src/commands/runAndroid/index.js | 2 +- packages/platform-ios/src/commands/runIOS/index.js | 2 +- types/index.js | 6 +++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 3d5a9ea0e..ad3eae7d5 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -125,7 +125,7 @@ const addCommand = (command: CommandT, ctx: ConfigT) => { opt.command, opt.description, opt.parse || defaultOptParser, - opt.default, + typeof opt.default === 'function' ? opt.default(ctx) : opt.default, ), ); }; diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 094c4e335..c55015d17 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -22,7 +22,9 @@ const command = t.object({ command: t.string().required(), description: t.string(), parse: t.func(), - default: t.alternatives().try([t.bool(), t.number(), t.string()]), + default: t + .alternatives() + .try([t.bool(), t.number(), t.string(), t.func()]), }), ), examples: t.array().items( diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index e3e37b5ad..f1553c51d 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -362,7 +362,7 @@ export default { command: '--terminal [string]', description: 'Launches the Metro Bundler in a new window using the specified terminal path.', - default: getDefaultUserTerminal(), + default: getDefaultUserTerminal, }, ], }; diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 777090cd3..5786c204c 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -452,7 +452,7 @@ export default { command: '--terminal [string]', description: 'Launches the Metro Bundler in a new window using the specified terminal path.', - default: getDefaultUserTerminal(), + default: getDefaultUserTerminal, }, ], }; diff --git a/types/index.js b/types/index.js index d90cb35f6..feef6bcd2 100644 --- a/types/index.js +++ b/types/index.js @@ -10,7 +10,11 @@ export type CommandT = { command: string, description?: string, parse?: (val: string) => any, - default?: string | boolean | number, + default?: + | string + | boolean + | number + | ((ctx: ConfigT) => string | boolean | number), }>, examples?: Array<{ desc: string, From e7eeea4a808ff002108f5ef4d7c79a23c334a642 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 17:48:52 +0200 Subject: [PATCH 091/234] v2.0.0-alpha.9 --- lerna.json | 2 +- packages/cli/package.json | 6 +++--- packages/platform-android/package.json | 2 +- packages/platform-ios/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index aa2554faf..2fb070b35 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.8", + "version": "2.0.0-alpha.9", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 01a5ea90f..e9f19477c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.8", + "version": "2.0.0-alpha.9", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,8 +23,8 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.8", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.8", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.9", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.9", "@react-native-community/cli-tools": "^2.0.0-alpha.8", "chalk": "^1.1.1", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index f762e3754..fd81ccacf 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.8", + "version": "2.0.0-alpha.9", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.0-alpha.8", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index ed9838239..af4f0d7dc 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.8", + "version": "2.0.0-alpha.9", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.0-alpha.8", From 365be100e7e280c86d7f646e99b1ab8aec4745bd Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 18:03:02 +0200 Subject: [PATCH 092/234] fix: allow empty strings to be used as defaults --- packages/cli/src/tools/config/schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index c55015d17..a46f03776 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -24,7 +24,7 @@ const command = t.object({ parse: t.func(), default: t .alternatives() - .try([t.bool(), t.number(), t.string(), t.func()]), + .try([t.bool(), t.number(), t.string().allow(''), t.func()]), }), ), examples: t.array().items( From cacaa075baa8a93fffbc4f2c329cf7db9d70c928 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 18:03:21 +0200 Subject: [PATCH 093/234] v2.0.0-alpha.10 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 2fb070b35..bde1f1604 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.9", + "version": "2.0.0-alpha.10", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index e9f19477c..005527075 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.9", + "version": "2.0.0-alpha.10", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From ac9a85e0ddcfe1ce650bae0fc4d1bd448956159b Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 22:06:50 +0200 Subject: [PATCH 094/234] feat: support platforms that ship with project (#335) * Project can also have platforms * strip unknown * Remove stripUnknown and prefer allowUnknown on one level only --- packages/cli/src/tools/config/index.js | 2 +- packages/cli/src/tools/config/schema.js | 12 +++++++++++- types/index.js | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index f265a2a41..0ba40ecec 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -124,7 +124,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { get assets() { return findAssets(projectRoot, userConfig.assets); }, - platforms: {}, + platforms: userConfig.platforms, haste: { providesModuleNodeModules: [], platforms: [], diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index a46f03776..cd2870afe 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -85,12 +85,13 @@ export const dependencyConfig = t projectConfig: t.func(), linkConfig: t.func(), }), - ).default(), + ).default({}), commands: t .array() .items(command) .default([]), }) + .unknown(true) .default(); /** @@ -170,5 +171,14 @@ export const projectConfig = t .array() .items(command) .default([]), + platforms: map( + t.string(), + t.object({ + dependencyConfig: t.func(), + projectConfig: t.func(), + linkConfig: t.func(), + }), + ).default({}), }) + .unknown(true) .default(); diff --git a/types/index.js b/types/index.js index feef6bcd2..67178942f 100644 --- a/types/index.js +++ b/types/index.js @@ -195,10 +195,10 @@ export type UserDependencyConfigT = { */ export type UserConfigT = { /** - * Shares some structure with ConfigT, except that haste, root, platforms + * Shares some structure with ConfigT, except that haste and root * are calculated and can't be defined */ - ...$Diff, + ...$Diff, reactNativePath: ?string, // Additional project settings From f7a7d4ca162bb589c13e05319a831bab8e82ed79 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 22:11:52 +0200 Subject: [PATCH 095/234] fix: update haste config with platforms too --- packages/cli/src/tools/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 0ba40ecec..3f0bbe9db 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -127,7 +127,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { platforms: userConfig.platforms, haste: { providesModuleNodeModules: [], - platforms: [], + platforms: Object.keys(userConfig.platforms), }, get project() { const project = {}; From a0b9e3154290019b599f2816dba8abdab7300bb7 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 22:12:34 +0200 Subject: [PATCH 096/234] v2.0.0-alpha.11 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index bde1f1604..f4479e95d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.10", + "version": "2.0.0-alpha.11", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 005527075..a7069d932 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.10", + "version": "2.0.0-alpha.11", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 9440b15c2df46a69f89bc77d26b299e5e91a9238 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 23:03:57 +0200 Subject: [PATCH 097/234] handle haste (#336) --- .../__snapshots__/index-test.js.snap | 16 ++++++++++++++- .../src/tools/config/__tests__/index-test.js | 11 ++++++++-- packages/cli/src/tools/config/index.js | 20 +++++++++++++++---- .../src/tools/config/readConfigFromDisk.js | 1 + types/index.js | 6 ++++++ 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 7c5496b7f..f59d7f2d3 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -93,7 +93,7 @@ Array [ ] `; -exports[`should read \`rnpm\` config from a dependency and transform it to a new format 1`] = ` +exports[`should read \`rnpm\` config from a dependency and transform it to a new format: foo config 1`] = ` Object { "assets": Array [], "hooks": Object {}, @@ -118,6 +118,20 @@ Object { } `; +exports[`should read \`rnpm\` config from a dependency and transform it to a new format: haste config 1`] = ` +Object { + "platforms": Array [ + "ios", + "android", + "dummy", + ], + "providesModuleNodeModules": Array [ + "react-native", + "react-native-dummy", + ], +} +`; + exports[`should read a config of a dependency and use it to load other settings 1`] = ` Object { "assets": Array [], diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index 117cb393a..635a21246 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -130,6 +130,10 @@ test('should read `rnpm` config from a dependency and transform it to a new form "rnpm": { "ios": { "project": "./customLocation/customProject.xcodeproj" + }, + "haste": { + "platforms": ["dummy"], + "providesModuleNodeModules": ["react-native-dummy"] } } }`, @@ -140,8 +144,11 @@ test('should read `rnpm` config from a dependency and transform it to a new form } }`, }); - const {dependencies} = loadConfig(DIR); - expect(removeString(dependencies['react-native-foo'], DIR)).toMatchSnapshot(); + const {dependencies, haste} = loadConfig(DIR); + expect(removeString(dependencies['react-native-foo'], DIR)).toMatchSnapshot( + 'foo config', + ); + expect(haste).toMatchSnapshot('haste config'); }); test('should load commands from "react-native-foo" and "react-native-bar" packages', () => { diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 3f0bbe9db..ad3be6707 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -70,6 +70,17 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { const isPlatform = Object.keys(config.platforms).length > 0; + /** + * Legacy `rnpm` config required `haste` to be defined. With new config, + * we do it automatically. + * + * Remove this once `rnpm` config is deprecated. + */ + const haste = config.haste || { + providesModuleNodeModules: isPlatform ? [dependencyName] : [], + platforms: Object.keys(config.platforms), + }; + return assign({}, acc, { dependencies: assign({}, acc.dependencies, { // $FlowExpectedError: Dynamic getters are not supported @@ -105,10 +116,11 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { ...config.platforms, }, haste: { - providesModuleNodeModules: acc.haste.providesModuleNodeModules.concat( - isPlatform ? dependencyName : [], - ), - platforms: [...acc.haste.platforms, ...Object.keys(config.platforms)], + providesModuleNodeModules: [ + ...acc.haste.providesModuleNodeModules, + ...haste.providesModuleNodeModules, + ], + platforms: [...acc.haste.platforms, ...haste.platforms], }, }); }, diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 58a99bf58..ebf7cade2 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -109,6 +109,7 @@ export function readLegacyDependencyConfigFromDisk( hooks: config.commands, params: config.params, }, + haste: config.haste, commands: loadProjectCommands(rootFolder, config.plugin), platforms: config.platform ? require(path.join(rootFolder, config.platform)) diff --git a/types/index.js b/types/index.js index 67178942f..4f066f669 100644 --- a/types/index.js +++ b/types/index.js @@ -188,6 +188,12 @@ export type UserDependencyConfigT = { platforms: { [name: string]: any, }, + + // Haste config defined by legacy `rnpm` + haste?: { + platforms: string[], + providesModuleNodeModules: string[], + }, }; /** From 15cea82c3e19cd4ecf446a808f252d53c658b3f9 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 23:05:23 +0200 Subject: [PATCH 098/234] v2.0.0-alpha.12 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index f4479e95d..849d47c00 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index a7069d932..d721b293c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.12", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 83d58a63ac07fe932c7b90aa05d004169e968d61 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 18 Apr 2019 23:19:17 +0200 Subject: [PATCH 099/234] chore: top-level unknown keys are now allowed, update test case --- .../tools/config/__tests__/__snapshots__/index-test.js.snap | 2 +- packages/cli/src/tools/config/__tests__/index-test.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index f59d7f2d3..64d600ea5 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -197,4 +197,4 @@ Object { exports[`should skip packages that have invalid configuration: dependencies config 1`] = `Object {}`; -exports[`should skip packages that have invalid configuration: logged warning 1`] = `"Package react-native has been ignored because it contains invalid configuration. Reason: Unknown option invalidProperty with value \\"5\\" was found. This is either a typing error or a user mistake. Fixing it will remove this message."`; +exports[`should skip packages that have invalid configuration: logged warning 1`] = `"Package react-native has been ignored because it contains invalid configuration. Reason: Unknown option dependency.invalidProperty with value \\"5\\" was found. This is either a typing error or a user mistake. Fixing it will remove this message."`; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index 635a21246..d4a11b453 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -251,7 +251,9 @@ test('should skip packages that have invalid configuration', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', 'node_modules/react-native/react-native.config.js': `module.exports = { - invalidProperty: 5 + dependency: { + invalidProperty: 5 + } }`, 'package.json': `{ "dependencies": { From 90a587e5832d2b8a484814fba1d6039979f0205e Mon Sep 17 00:00:00 2001 From: ifsnow Date: Fri, 19 Apr 2019 14:57:38 +0900 Subject: [PATCH 100/234] fix: modify wrong install arguments (#337) --- packages/platform-android/src/commands/runAndroid/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index f1553c51d..3f9d8ecc8 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -173,9 +173,9 @@ function tryInstallAppOnDevice(args, adbPath, device) { ); const pathToApk = `${buildDirectory}/${apkFile}`; - const adbArgs = ['-s', device, 'install', '-rd', pathToApk]; + const adbArgs = ['-s', device, 'install', '-r', '-d', pathToApk]; logger.info( - `Installing the app on the device (cd android && adb -s ${device} install -rd ${pathToApk}`, + `Installing the app on the device (cd android && adb -s ${device} install -r -d ${pathToApk}`, ); execFileSync(adbPath, adbArgs, { stdio: [process.stdin, process.stdout, process.stderr], From 256ae68244fc0c3957b47cb0a0cb3a6a3db7e52e Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Fri, 19 Apr 2019 14:35:47 +0200 Subject: [PATCH 101/234] feat: check `ios-deploy` installation before proceeding to build on device (#332) Summary: --------- This PR fixes #330, it checks if `ios-deploy` is installed or not before it actually starts building. Test Plan: ---------- - Run `npm uninstall -g ios-deploy`; - Run the CLI with `--device` argument and wait for it to fail; - Run `npm i -g ios-deploy`; - Run the CLI again and see it working. cc @thymikee --- ### Error about `ios-deploy` not installed ![image](https://user-images.githubusercontent.com/6207220/56423345-e7d5f800-62ab-11e9-9acf-e5336685904a.png) ### Random error when executing `ios-deploy` ![image](https://user-images.githubusercontent.com/6207220/56423377-12c04c00-62ac-11e9-863a-82c12800893a.png) --- .../platform-ios/src/commands/runIOS/index.js | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 5786c204c..97e0c865d 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -190,6 +190,20 @@ async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { } async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) { + const isIOSDeployInstalled = child_process.spawnSync( + 'ios-deploy', + ['--version'], + {encoding: 'utf8'}, + ); + + if (isIOSDeployInstalled.error) { + throw new CLIError( + `Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "${chalk.bold( + 'npm install -g ios-deploy', + )}" and try again.`, + ); + } + const appName = await buildProject( xcodeProject, selectedDevice.udid, @@ -214,12 +228,14 @@ async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) { ); if (iosDeployOutput.error) { - logger.error( - '** INSTALLATION FAILED **\nMake sure you have ios-deploy installed globally.\n(e.g "npm install -g ios-deploy")', + throw new CLIError( + `Failed to install the app on the device. We've encountered an error in "ios-deploy" command: ${ + iosDeployOutput.error.message + }`, ); - } else { - logger.info('** INSTALLATION SUCCEEDED **'); } + + return logger.success('Installed the app on the device.'); } function buildProject(xcodeProject, udid, scheme, args: FlagsT) { From 6c575fdb298d3d3a06167646538abaae4d9202b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 19 Apr 2019 19:47:52 +0200 Subject: [PATCH 102/234] feat: support init inside monorepos (#320) --- .../commands/init/__tests__/template.test.js | 15 +++++--- packages/cli/src/commands/init/init.js | 34 ++++++++++++------ packages/cli/src/commands/init/template.js | 35 +++++++++++++++---- packages/cli/src/tools/packageManager.js | 2 ++ 4 files changed, 65 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js index 829dcd2f6..3c5542202 100644 --- a/packages/cli/src/commands/init/__tests__/template.test.js +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -12,6 +12,7 @@ import { import * as copyFiles from '../../../tools/copyFiles'; const TEMPLATE_NAME = 'templateName'; +const TEMPLATE_SOURCE_DIR = '/tmp/rncli-init-template-123456'; afterEach(() => { jest.restoreAllMocks(); @@ -21,17 +22,18 @@ afterEach(() => { test('installTemplatePackage', async () => { jest.spyOn(PackageManger, 'install').mockImplementationOnce(() => {}); - await installTemplatePackage(TEMPLATE_NAME, true); + await installTemplatePackage(TEMPLATE_NAME, TEMPLATE_SOURCE_DIR, true); expect(PackageManger.install).toHaveBeenCalledWith([TEMPLATE_NAME], { preferYarn: false, silent: true, + cwd: TEMPLATE_SOURCE_DIR, }); }); test('getTemplateConfig', () => { jest.mock( - `node_modules/${TEMPLATE_NAME}/template.config`, + `${TEMPLATE_SOURCE_DIR}/node_modules/${TEMPLATE_NAME}/template.config`, () => ({ placeholderName: 'someName', templateDir: 'someDir', @@ -42,11 +44,12 @@ test('getTemplateConfig', () => { ); jest.spyOn(path, 'resolve').mockImplementationOnce((...e) => e.join('/')); - expect(getTemplateConfig(TEMPLATE_NAME)).toEqual({ + expect(getTemplateConfig(TEMPLATE_NAME, TEMPLATE_SOURCE_DIR)).toEqual({ placeholderName: 'someName', templateDir: 'someDir', }); expect(path.resolve).toHaveBeenCalledWith( + TEMPLATE_SOURCE_DIR, 'node_modules', TEMPLATE_NAME, 'template.config', @@ -61,9 +64,10 @@ test('copyTemplate', () => { jest.spyOn(copyFiles, 'default').mockImplementationOnce(() => {}); jest.spyOn(process, 'cwd').mockImplementationOnce(() => CWD); - copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR); + copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR, TEMPLATE_SOURCE_DIR); expect(path.resolve).toHaveBeenCalledWith( + TEMPLATE_SOURCE_DIR, 'node_modules', TEMPLATE_NAME, TEMPLATE_DIR, @@ -77,9 +81,10 @@ test('executePostInitScript', async () => { jest.spyOn(path, 'resolve').mockImplementationOnce(() => RESOLVED_PATH); - await executePostInitScript(TEMPLATE_NAME, SCRIPT_PATH); + await executePostInitScript(TEMPLATE_NAME, SCRIPT_PATH, TEMPLATE_SOURCE_DIR); expect(path.resolve).toHaveBeenCalledWith( + TEMPLATE_SOURCE_DIR, 'node_modules', TEMPLATE_NAME, SCRIPT_PATH, diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index ddf9381be..26a5cfed5 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -1,4 +1,6 @@ // @flow +import os from 'os'; +import path from 'path'; import fs from 'fs-extra'; import minimist from 'minimist'; import semver from 'semver'; @@ -49,16 +51,18 @@ async function createFromExternalTemplate( const loader = new Loader({text: 'Downloading template'}); loader.start(); + const templateSourceDir = fs.mkdtempSync( + path.join(os.tmpdir(), 'rncli-init-template-'), + ); try { let {uri, name} = await processTemplateName(templateName); - - await installTemplatePackage(uri, npm); + await installTemplatePackage(uri, templateSourceDir, npm); loader.succeed(); loader.start('Copying template'); name = adjustNameIfUrl(name); - const templateConfig = getTemplateConfig(name); - copyTemplate(name, templateConfig.templateDir); + const templateConfig = getTemplateConfig(name, templateSourceDir); + copyTemplate(name, templateConfig.templateDir, templateSourceDir); loader.succeed(); loader.start('Preparing template'); @@ -70,7 +74,7 @@ async function createFromExternalTemplate( if (postInitScript) { // Leaving trailing space because there may be stdout from the script loader.start('Executing post init script '); - await executePostInitScript(name, postInitScript); + await executePostInitScript(name, postInitScript, templateSourceDir); loader.succeed(); } @@ -80,6 +84,8 @@ async function createFromExternalTemplate( } catch (e) { loader.fail(); throw new Error(e); + } finally { + fs.removeSync(templateSourceDir); } } @@ -94,7 +100,9 @@ async function createFromReactNativeTemplate( const Loader = getLoader(); const loader = new Loader({text: 'Downloading template'}); loader.start(); - + const templateSourceDir = fs.mkdtempSync( + path.join(os.tmpdir(), 'rncli-init-template-'), + ); try { if (semver.valid(version) && !semver.gte(version, '0.60.0')) { throw new Error( @@ -106,13 +114,13 @@ async function createFromReactNativeTemplate( const {uri} = await processTemplateName(`${TEMPLATE_NAME}@${version}`); - await installTemplatePackage(uri, npm); + await installTemplatePackage(uri, templateSourceDir, npm); loader.succeed(); loader.start('Copying template'); - const templateConfig = getTemplateConfig(TEMPLATE_NAME); - copyTemplate(TEMPLATE_NAME, templateConfig.templateDir); + const templateConfig = getTemplateConfig(TEMPLATE_NAME, templateSourceDir); + copyTemplate(TEMPLATE_NAME, templateConfig.templateDir, templateSourceDir); loader.succeed(); loader.start('Processing template'); @@ -123,7 +131,11 @@ async function createFromReactNativeTemplate( const {postInitScript} = templateConfig; if (postInitScript) { loader.start('Executing post init script'); - await executePostInitScript(TEMPLATE_NAME, postInitScript); + await executePostInitScript( + TEMPLATE_NAME, + postInitScript, + templateSourceDir, + ); loader.succeed(); } @@ -133,6 +145,8 @@ async function createFromReactNativeTemplate( } catch (e) { loader.fail(); throw new Error(e); + } finally { + fs.removeSync(templateSourceDir); } } diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index d9c40a3b7..b797b647e 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -1,5 +1,4 @@ // @flow - import execa from 'execa'; import path from 'path'; import * as PackageManager from '../../tools/packageManager'; @@ -12,16 +11,25 @@ export type TemplateConfig = { postInitScript?: string, }; -export function installTemplatePackage(templateName: string, npm?: boolean) { +export function installTemplatePackage( + templateName: string, + cwd: string, + npm?: boolean, +) { logger.debug(`Installing template from ${templateName}`); return PackageManager.install([templateName], { preferYarn: !npm, silent: true, + cwd, }); } -export function getTemplateConfig(templateName: string): TemplateConfig { +export function getTemplateConfig( + templateName: string, + templateSourceDir: string, +): TemplateConfig { const configFilePath = path.resolve( + templateSourceDir, 'node_modules', templateName, 'template.config', @@ -32,8 +40,17 @@ export function getTemplateConfig(templateName: string): TemplateConfig { return require(configFilePath); } -export function copyTemplate(templateName: string, templateDir: string) { - const templatePath = path.resolve('node_modules', templateName, templateDir); +export function copyTemplate( + templateName: string, + templateDir: string, + templateSourceDir: string, +) { + const templatePath = path.resolve( + templateSourceDir, + 'node_modules', + templateName, + templateDir, + ); logger.debug(`Copying template from ${templatePath}`); @@ -43,8 +60,14 @@ export function copyTemplate(templateName: string, templateDir: string) { export function executePostInitScript( templateName: string, postInitScript: string, + templateSourceDir: string, ) { - const scriptPath = path.resolve('node_modules', templateName, postInitScript); + const scriptPath = path.resolve( + templateSourceDir, + 'node_modules', + templateName, + postInitScript, + ); logger.debug(`Executing post init script located ${scriptPath}`); diff --git a/packages/cli/src/tools/packageManager.js b/packages/cli/src/tools/packageManager.js index 941a218c7..b42519b68 100644 --- a/packages/cli/src/tools/packageManager.js +++ b/packages/cli/src/tools/packageManager.js @@ -6,6 +6,7 @@ import {getYarnVersionIfAvailable, isProjectUsingYarn} from './yarn'; type Options = {| preferYarn?: boolean, silent?: boolean, + cwd?: string, |}; let projectDir; @@ -18,6 +19,7 @@ function executeCommand( return execa(command, args, { stdio: options && options.silent && !logger.isVerbose() ? 'pipe' : 'inherit', + cwd: options && options.cwd, }); } From f1105bcf9aa9cb04bb9d036756bab81470cf5303 Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Fri, 19 Apr 2019 18:48:16 +0100 Subject: [PATCH 103/234] feat: autolinking for Android with Gradle (#258) Provides the Android/Gradle functionality to go with https://github.com/react-native-community/react-native-cli/pull/256 & https://github.com/react-native-community/react-native-cli/pull/254 ## CLI Changes - Updated `react-native config` to include the android `sourceDir` for react native module packages ---- ## Usage These are the one-off changes required to enable this in the React Native init template (or for existing user projects). ### Modify `android/settings.gradle` Include the following line in your Android projects `settings.gradle` file: ```groovy apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) ``` ### Modify `android/app/build.gradle` Add the following line at the bottom of your Android projects `android/app/build.gradle` file: ```groovy apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` ### Modify `MainApplication.java` Import the PackageList class; ```java import com.facebook.react.PackageList; ``` Replace the `protected List getPackages()` method with the following: ```java @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); // additional non auto detected packages can still be added here: // packages.add(new SomeReactNativePackage()); return packages; } ``` ### Testing I've tested the following scenarios locally: - User has no React Native global CLI installed - Will warn but continue without issue - User has no React Native packages installed yet - Continues as normal with no warning - User has more than one React Native package installed - Correctly adds multiple packages without issue - User has a package installed that does not support autodetection (config == null) - Prints a warning but continues gracefully - User has custom/non-linked React Native packages - Can be sucessfully manually added via `packages.add(new SomeReactNativePackage());` as documented above in `MainApplication.java` To test this in a new `react-native init` project locally: - Clone the CLI project - Run `yarn` in the CLI project - Run `cd packages/cli && yarn && yarn link` in the CLI project - (a little hacky as it's a mono-repo) - Run `yarn link "@react-native-community/cli"` on your React Native project - Make the required changes as above to your React Native project ---- ### Codegen Output Example An example of the generated `PackageList.java` class: ```java package com.facebook.react; import android.app.Application; import android.content.Context; import android.content.res.Resources; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; import java.util.List; import com.test.BuildConfig; // react-native-webview import com.reactnativecommunity.webview.RNCWebViewPackage; public class PackageList { private ReactNativeHost reactNativeHost; public PackageList(ReactNativeHost reactNativeHost) { this.reactNativeHost = reactNativeHost; } private ReactNativeHost getReactNativeHost() { return this.reactNativeHost; } private Resources getResources() { return this.getApplication().getResources(); } private Application getApplication() { return this.reactNativeHost.getApplication(); } private Context getApplicationContext() { return this.getApplication().getApplicationContext(); } public List getPackages() { return Arrays.asList( new MainReactPackage(), new RNCWebViewPackage() ); } } ``` --- .../editTemplate/node_modules/PlaceholderName | 0 .../platform-android/native_modules.gradle | 250 ++++++++++++++++++ packages/platform-android/package.json | 3 +- 3 files changed, 252 insertions(+), 1 deletion(-) delete mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName create mode 100644 packages/platform-android/native_modules.gradle diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName b/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle new file mode 100644 index 000000000..757ccf113 --- /dev/null +++ b/packages/platform-android/native_modules.gradle @@ -0,0 +1,250 @@ +import groovy.json.JsonSlurper +import org.gradle.initialization.DefaultSettings + +def generatedFileName = "PackageList.java" +def generatedFileContentsTemplate = """ +package com.facebook.react; + +import android.app.Application; +import android.content.Context; +import android.content.res.Resources; + +import com.facebook.react.ReactPackage; +import com.facebook.react.shell.MainReactPackage; +import java.util.Arrays; +import java.util.List; + +{{ packageImports }} + +public class PackageList { + private ReactNativeHost reactNativeHost; + public PackageList(ReactNativeHost reactNativeHost) { + this.reactNativeHost = reactNativeHost; + } + + private ReactNativeHost getReactNativeHost() { + return this.reactNativeHost; + } + + private Resources getResources() { + return this.getApplication().getResources(); + } + + private Application getApplication() { + return this.reactNativeHost.getApplication(); + } + + private Context getApplicationContext() { + return this.getApplication().getApplicationContext(); + } + + public List getPackages() { + return Arrays.asList( + new MainReactPackage(){{ packageClassInstances }} + ); + } +} +""" + +class ReactNativeModules { + private Logger logger + private Project project + private DefaultSettings defaultSettings + private ExtraPropertiesExtension extension + private ArrayList> reactNativeModules + + private static String LOG_PREFIX = ":ReactNative:" + private static String REACT_NATIVE_CLI_BIN = "node_modules${File.separator}@react-native-community${File.separator}cli${File.separator}build${File.separator}index.js" + private static String REACT_NATIVE_CONFIG_CMD = "node ${REACT_NATIVE_CLI_BIN} config" + + ReactNativeModules(Logger logger) { + this.logger = logger + } + + void applySettingsGradle(DefaultSettings defaultSettings, ExtraPropertiesExtension extraPropertiesExtension) { + this.defaultSettings = defaultSettings + this.extension = extraPropertiesExtension + this.reactNativeModules = this.getReactNativeConfig() + + addReactNativeModuleProjects() + } + + void applyBuildGradle(Project project, ExtraPropertiesExtension extraPropertiesExtension) { + this.project = project + this.extension = extraPropertiesExtension + this.reactNativeModules = this.getReactNativeConfig() + + addReactNativeModuleDependencies() + } + + /** + * Include the react native modules android projects and specify their project directory + */ + void addReactNativeModuleProjects() { + reactNativeModules.forEach { reactNativeModule -> + String name = reactNativeModule["name"] + String androidSourceDir = reactNativeModule["androidSourceDir"] + defaultSettings.include(":${name}") + defaultSettings.project(":${name}").projectDir = new File("${androidSourceDir}") + } + } + + /** + * Adds the react native modules as dependencies to the users `app` project + */ + void addReactNativeModuleDependencies() { + reactNativeModules.forEach { reactNativeModule -> + def name = reactNativeModule["name"] + project.dependencies { + // TODO(salakar): are other dependency scope methods such as `api` required? + implementation project(path: ":${name}") + } + } + } + + /** + * This returns the users project root (e.g. where the node_modules dir is located). + * + * This defaults to up one directory from the root android directory unless the user has defined + * a `ext.reactNativeProjectRoot` extension property + * + * @return + */ + File getReactNativeProjectRoot() { + if (this.extension.has("reactNativeProjectRoot")) { + File rnRoot = File(this.extension.get("reactNativeProjectRoot")) + // allow custom React Native project roots for non-standard directory structures + this.logger.debug("${LOG_PREFIX}Using custom React Native project root path '${rnRoot.toString()}'") + return rnRoot + } + + File androidRoot + + if (this.project) { + androidRoot = this.project.rootProject.projectDir + } else { + androidRoot = this.defaultSettings.rootProject.projectDir + } + + this.logger.debug("${LOG_PREFIX}Using default React Native project root path '${androidRoot.parentFile.toString()}'") + return androidRoot.parentFile + } + + /** + * Code-gen a java file with all the detected ReactNativePackage instances automatically added + * + * @param outputDir + * @param generatedFileName + * @param generatedFileContentsTemplate + * @param applicationId + */ + void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate, String applicationId) { + ArrayList>[] packages = this.reactNativeModules + + String packageImports = "" + String packageClassInstances = "" + + if (packages.size() > 0) { + packageImports = "import ${applicationId}.BuildConfig;\n\n" + packageImports = packageImports + packages.collect { + "// ${it.name}\n${it.packageImportPath}" + }.join(';\n') + packageClassInstances = ",\n " + packages.collect { it.packageInstance }.join(',') + } + + String generatedFileContents = generatedFileContentsTemplate + .replace("{{ packageImports }}", packageImports) + .replace("{{ packageClassInstances }}", packageClassInstances) + + outputDir.mkdirs() + final FileTreeBuilder treeBuilder = new FileTreeBuilder(outputDir) + treeBuilder.file(generatedFileName).newWriter().withWriter { w -> + w << generatedFileContents + } + } + + /** + * Runs a process to call the React Native CLI Config command and parses the output + * + * @return ArrayList < HashMap < String , String > > + */ + ArrayList> getReactNativeConfig() { + if (this.reactNativeModules != null) return this.reactNativeModules + ArrayList> reactNativeModules = new ArrayList>() + + def cmdProcess + + try { + cmdProcess = Runtime.getRuntime().exec(REACT_NATIVE_CONFIG_CMD, null, getReactNativeProjectRoot()) + cmdProcess.waitFor() + } catch (Exception exception) { + this.logger.warn("${LOG_PREFIX}${exception.message}") + this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed. (UNKNOWN)") + return reactNativeModules + } + + def reactNativeConfigOutput = cmdProcess.in.text + def json = new JsonSlurper().parseText(reactNativeConfigOutput) + def dependencies = json["dependencies"] + + dependencies.each { name, value -> + def platformsConfig = value["platforms"]; + def androidConfig = platformsConfig["android"] + + if (androidConfig != null && androidConfig["sourceDir"] != null) { + this.logger.info("${LOG_PREFIX}Automatically adding native module '${name}'") + + HashMap reactNativeModuleConfig = new HashMap() + reactNativeModuleConfig.put("name", name) + reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"]) + reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"]) + reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"]) + this.logger.trace("${LOG_PREFIX}'${name}': ${reactNativeModuleConfig.toMapString()}") + + reactNativeModules.add(reactNativeModuleConfig) + } else { + this.logger.info("${LOG_PREFIX}Skipping native module '${name}'") + } + } + + return reactNativeModules + } +} + +/** ----------------------- + * Exported Extensions + * ------------------------ */ + +def autoModules = new ReactNativeModules(logger) + +ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings -> + autoModules.applySettingsGradle(defaultSettings, ext) +} + +ext.applyNativeModulesAppBuildGradle = { Project project -> + autoModules.applyBuildGradle(project, ext) + + def applicationId + def generatedSrcDir = new File(buildDir, "generated/rncli/src/main/java/com/facebook/react") + + // TODO(salakar): not sure if this is the best way of getting the package name (used to import BuildConfig) + project.android.applicationVariants.all { variant -> + applicationId = [variant.mergedFlavor.applicationId, variant.buildType.applicationIdSuffix].findAll().join() + } + + task generatePackageList << { + autoModules.generatePackagesFile(generatedSrcDir, generatedFileName, generatedFileContentsTemplate, applicationId) + } + + preBuild.dependsOn generatePackageList + + android { + sourceSets { + main { + java { + srcDirs += generatedSrcDir + } + } + } + } +} diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index fd81ccacf..367335869 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -10,6 +10,7 @@ "xmldoc": "^0.4.0" }, "files": [ - "build" + "build", + "native_modules.gradle" ] } From 827daa4c1687f8d17eb7df46e1a2ec25640c7797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 19 Apr 2019 19:51:30 +0200 Subject: [PATCH 104/234] v2.0.0-alpha.13 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 849d47c00..6aae4342c 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index d721b293c..b795abd47 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.9", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.9", - "@react-native-community/cli-tools": "^2.0.0-alpha.8", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.13", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.13", + "@react-native-community/cli-tools": "^2.0.0-alpha.13", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 367335869..eac8ab380 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.9", + "version": "2.0.0-alpha.13", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.8", + "@react-native-community/cli-tools": "^2.0.0-alpha.13", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index af4f0d7dc..ed58b57b6 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.9", + "version": "2.0.0-alpha.13", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.8", + "@react-native-community/cli-tools": "^2.0.0-alpha.13", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index baa6b3df4..681a1893b 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.8", + "version": "2.0.0-alpha.13", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 7839c05ac944559920410b9ac911d7b3d94f6709 Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Sat, 20 Apr 2019 10:49:10 +0100 Subject: [PATCH 105/234] fix(autolinking): remove deprecated Gradle task syntax (#339) Summary: --------- Gradle 5 no longer supports the `<<` syntax - swapped to the non-shorthand syntax of `doLast {}` Test Plan: ---------- Builds successfully with the updated syntax and `PackageList.java` file generated ![image](https://user-images.githubusercontent.com/5347038/56444115-57b9a200-62ef-11e9-94bc-16818c33e65e.png) ![image](https://user-images.githubusercontent.com/5347038/56444122-5f794680-62ef-11e9-962a-5beb06e90667.png) --- packages/platform-android/native_modules.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 757ccf113..b1f30defd 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -232,8 +232,10 @@ ext.applyNativeModulesAppBuildGradle = { Project project -> applicationId = [variant.mergedFlavor.applicationId, variant.buildType.applicationIdSuffix].findAll().join() } - task generatePackageList << { - autoModules.generatePackagesFile(generatedSrcDir, generatedFileName, generatedFileContentsTemplate, applicationId) + task generatePackageList { + doLast { + autoModules.generatePackagesFile(generatedSrcDir, generatedFileName, generatedFileContentsTemplate, applicationId) + } } preBuild.dependsOn generatePackageList From 513d27bd4c06067819a7f73e26749e2d91e010a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 20 Apr 2019 11:50:31 +0200 Subject: [PATCH 106/234] v2.0.0-alpha.14 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 6aae4342c..6d0b2d485 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.13", + "version": "2.0.0-alpha.14", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index b795abd47..3c53766e0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.13", + "version": "2.0.0-alpha.14", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.13", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.13", - "@react-native-community/cli-tools": "^2.0.0-alpha.13", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.14", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.14", + "@react-native-community/cli-tools": "^2.0.0-alpha.14", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index eac8ab380..a982bc3f1 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.13", + "version": "2.0.0-alpha.14", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.13", + "@react-native-community/cli-tools": "^2.0.0-alpha.14", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index ed58b57b6..20728f1f1 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.13", + "version": "2.0.0-alpha.14", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.13", + "@react-native-community/cli-tools": "^2.0.0-alpha.14", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 681a1893b..a486f546f 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.13", + "version": "2.0.0-alpha.14", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 2943ec76afabe1f04574a75cc27802d3ebca337a Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Sat, 20 Apr 2019 11:34:26 +0100 Subject: [PATCH 107/234] fix: [android] remove forward slashes from package name (#340) Summary: --------- The previous CLI config use to return names with `/`'s replaced with `_`'s - it no longer does this so I've moved the replacing logic into the auto-linking build script so as to avoid breaking on Gradle 5+: ![image](https://user-images.githubusercontent.com/5347038/56455870-2b883a80-635c-11e9-90ef-53f00282391f.png) Test Plan: ---------- After change build no longer fails: ![image](https://user-images.githubusercontent.com/5347038/56455888-8883f080-635c-11e9-9bda-905baf83d3bd.png) ![image](https://user-images.githubusercontent.com/5347038/56455892-98033980-635c-11e9-9cc6-8005e866bc2b.png) --- packages/platform-android/native_modules.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index b1f30defd..3e925a62e 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -82,10 +82,10 @@ class ReactNativeModules { */ void addReactNativeModuleProjects() { reactNativeModules.forEach { reactNativeModule -> - String name = reactNativeModule["name"] + String nameCleansed = reactNativeModule["nameCleansed"] String androidSourceDir = reactNativeModule["androidSourceDir"] - defaultSettings.include(":${name}") - defaultSettings.project(":${name}").projectDir = new File("${androidSourceDir}") + defaultSettings.include(":${nameCleansed}") + defaultSettings.project(":${nameCleansed}").projectDir = new File("${androidSourceDir}") } } @@ -94,10 +94,10 @@ class ReactNativeModules { */ void addReactNativeModuleDependencies() { reactNativeModules.forEach { reactNativeModule -> - def name = reactNativeModule["name"] + def nameCleansed = reactNativeModule["nameCleansed"] project.dependencies { // TODO(salakar): are other dependency scope methods such as `api` required? - implementation project(path: ":${name}") + implementation project(path: ":${nameCleansed}") } } } @@ -196,6 +196,7 @@ class ReactNativeModules { HashMap reactNativeModuleConfig = new HashMap() reactNativeModuleConfig.put("name", name) + reactNativeModuleConfig.put("nameCleansed", name.replaceAll('/', '_')) reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"]) reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"]) reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"]) From 1040959a30c1aa061fc0d772aa4f2ac002dbc451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 22 Apr 2019 21:37:54 +0200 Subject: [PATCH 108/234] fix: stop resolving "react-native" from package.json as a config (#341) * fix: stop resolving "react-native" as a valid package.json config property * add missing editTemplate file --- .../editTemplate/node_modules/PlaceholderName | 0 .../src/tools/config/__tests__/index-test.js | 72 +++++++++++-------- .../src/tools/config/readConfigFromDisk.js | 2 +- 3 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName diff --git a/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName b/packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules/PlaceholderName new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index d4a11b453..a3d75b472 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -23,16 +23,15 @@ const removeString = (config, str) => beforeEach(() => { cleanup(DIR); jest.resetModules(); + jest.clearAllMocks(); }); afterEach(() => cleanup(DIR)); test('should have a valid structure by default', () => { writeFiles(DIR, { - 'package.json': `{ - "react-native": { - "reactNativePath": "." - } + 'react-native.config.js': `module.exports = { + reactNativePath: "." }`, }); const config = loadConfig(DIR); @@ -59,14 +58,13 @@ test('should return dependencies from package.json', () => { test('should read a config of a dependency and use it to load other settings', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', + 'node_modules/react-native-test/package.json': '{}', 'node_modules/react-native-test/ReactNativeTest.podspec': '', - 'node_modules/react-native-test/package.json': `{ - "react-native": { - "dependency": { - "platforms": { - "ios": { - "project": "./customLocation/customProject.xcodeproj" - } + 'node_modules/react-native-test/react-native.config.js': `module.exports = { + dependency: { + platforms: { + ios: { + project: "./customLocation/customProject.xcodeproj" } } } @@ -87,11 +85,10 @@ test('should read a config of a dependency and use it to load other settings', ( test('should merge project configuration with default values', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', - 'node_modules/react-native-test/package.json': `{ - "react-native": { - "dependency": { - "assets": ["foo", "baz"] - } + 'node_modules/react-native-test/package.json': '{}', + 'node_modules/react-native-test/react-native.config.js': `module.exports = { + dependency: { + assets: ["foo", "baz"] } }`, 'node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj': @@ -100,18 +97,18 @@ test('should merge project configuration with default values', () => { "dependencies": { "react-native": "0.0.1", "react-native-test": "0.0.1" - }, - "react-native": { - "reactNativePath": ".", - "dependencies": { - "react-native-test": { - "platforms": { - "ios": { - "sourceDir": "./abc" - } - }, - "assets": ["foo"] - } + } + }`, + 'react-native.config.js': `module.exports = { + reactNativePath: ".", + dependencies: { + "react-native-test": { + platforms: { + ios: { + sourceDir: "./abc" + } + }, + assets: ["foo"] } } }`, @@ -266,3 +263,22 @@ test('should skip packages that have invalid configuration', () => { expect(dependencies).toMatchSnapshot('dependencies config'); expect(spy.mock.calls[0][0]).toMatchSnapshot('logged warning'); }); + +test('does not use restricted "react-native" key to resolve config from package.json', () => { + jest.resetModules(); + + writeFiles(DIR, { + 'node_modules/react-native-netinfo/package.json': `{ + "react-native": "src/index.js" + }`, + 'package.json': `{ + "dependencies": { + "react-native-netinfo": "0.0.1" + } + }`, + }); + const spy = jest.spyOn(logger, 'warn'); + const {dependencies} = loadConfig(DIR); + expect(dependencies).toHaveProperty('react-native-netinfo'); + expect(spy).not.toHaveBeenCalled(); +}); diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index ebf7cade2..130b37a04 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -23,7 +23,7 @@ import {logger} from '@react-native-community/cli-tools'; /** * Places to look for the new configuration */ -const searchPlaces = ['react-native.config.js', 'package.json']; +const searchPlaces = ['react-native.config.js']; /** * Reads a project configuration as defined by the user in the current From b306c99fda3057e6ffda36c5d1958339815dcc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 23 Apr 2019 12:26:19 +0200 Subject: [PATCH 109/234] docs: update and rearrange documentation (#338) * docs: update and rearrange documentation * add autolinking base docs * add init docs --- README.md | 41 +- docs/autolinking.md | 67 +++ docs/commands.md | 487 ++++++++++++++++++ docs/plugins.md | 3 + packages/cli/README.md | 238 +-------- packages/cli/src/commands/server/runServer.js | 3 - packages/cli/src/commands/server/server.js | 8 - .../src/commands/logAndroid/index.js | 2 +- 8 files changed, 595 insertions(+), 254 deletions(-) create mode 100644 docs/autolinking.md create mode 100644 docs/commands.md create mode 100644 docs/plugins.md diff --git a/README.md b/README.md index adef7f5bd..e8b403f32 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,56 @@ # React Native CLI -Command Line Interface for React Native. +Command line tools to interact with React Native projects. [![Build Status][build-badge]][build] [![Version][version-badge]][package] [![MIT License][license-badge]][license] [![PRs Welcome][prs-welcome-badge]][prs-welcome] _Note: CLI has been extracted from core `react-native` as a part of "[Lean Core](https://github.com/facebook/react-native/issues/23313)" effort. Please read [this blog post](https://blog.callstack.io/the-react-native-cli-has-a-new-home-79b63838f0e6) for more details._ +## Compatibility + +This CLI is intended to be used with a certain version of React Native. You'll find the support table with compatible versions below. + +| CLI | React Native | +| ------ | ------------ | +| ^2.0.0 | ^0.60.0 | +| ^1.0.0 | ^0.59.0 | + +## Documentation + +- [commands](./docs/commands.md) +- [autolinking](./docs/autolinking.md) +- [plugins](./docs/plugins.md) + ## About This repository contains tools and helpers for React Native projects in form of a CLI. We want to make a couple of things clear for you first: - this is a monorepo; -- there are currently two CLIs: the actual one called [`@react-native-community/cli`](./packages/cli) that does all the job and global `react-native-cli` which is used as its proxy; +- there are currently two CLIs: the actual one called [`@react-native-community/cli`](./packages/cli) that does all the job and global [`react-native-cli`](./packages/global-cli) which is used as its proxy and installation helper; We know it's confusing, but we're actively working to make this indirection gone. ## Creating a new React Native project -To start a new React Native project, you'll need to install a global module [`react-native-cli`](./packages/global-cli) and follow instructions there. +There are two ways to start a React Native project. + +### Using `npx` + +> Available since `react-native@0.60` + +This method is preferred if you don't want to install global packages. + +```sh +npx react-native init MyApp +``` + +### Using global CLI + +You'll need to install a global module [`react-native-cli`](./packages/global-cli) and follow instructions there. We strongly encourage you to **only use global `react-native-cli` for bootstrapping new projects**. Use local version for everything else. -## Usage in existing React Native project +## Usage in an existing React Native project Once you're inside an existing project, a local `react-native` binary will be available for you to use. Feel free to use Yarn to call it directly. @@ -49,8 +78,8 @@ Everything inside this repository is [MIT licensed](./LICENSE). -[build-badge]: https://img.shields.io/circleci/project/github/react-native-community/react-native-cli/master.svg?style=flat-square -[build]: https://circleci.com/gh/react-native-community/react-native-cli/tree/master +[build-badge]: https://img.shields.io/circleci/project/github/react-native-community/cli/master.svg?style=flat-square +[build]: https://circleci.com/gh/react-native-community/cli/tree/master [version-badge]: https://img.shields.io/npm/v/@react-native-community/cli.svg?style=flat-square [package]: https://www.npmjs.com/package/@react-native-community/cli.svg [license-badge]: https://img.shields.io/npm/l/@react-native-community/cli.svg?style=flat-square diff --git a/docs/autolinking.md b/docs/autolinking.md new file mode 100644 index 000000000..9fd5ff862 --- /dev/null +++ b/docs/autolinking.md @@ -0,0 +1,67 @@ +# Autolinking + +Autolinking is a mechanism built into CLI that allows adding a dependency with native components for React Native to be as simple as: + +```sh +yarn add react-native-firebase +``` + +## How does it work + +React Native CLI provides a [`config`](./commands.md#config) command which grabs all of the configuration for React Native packages installed in the project (by scanning dependenecies in `package.json`) and outputs it in JSON format. + +This information is then used by the projects advertised as platforms (with `react-native` being a default project supporting both iOS and Android platforms) that implement their autolinking behavior. + +This design ensures consistent settings for any platform and allows `react-native config` to update the implementation of how to source this information (be it specified filenames, entries in the module’s package.json, etc). + +## Platform iOS + +The `Podfile` gets the package metadata from `react-native config` and: + +1. Adds dependencies via CocoaPods dev pods (using files from a local path). +1. Adds build phase scripts to the App project’s build phase. (see examples below) + +This means that all libraries need to ship a Podspec in the root of their folder to work seamlessly. This references the native code that your library depends on, and notes any of its other native dependencies. + +The implementation ensures that a library is imported only once, so if you need to have a custom `pod` directive then including it above the function `use_native_modules!`. + +Script Phases +A project which wants to add an Xcode script phase to a user's app can use the custom support in iOS auto-linking via custom settings in either the project's `package.json` under `"react-native"` or via a `react-native.config.js` file in the root. + +The options for the build phase are passed more-or-less directly to the `Podfile` via `build_phase`. Here's an example of adding the settings in your `package.json`: + +```json +{ + "react-native": + "ios": + "scriptPhases": { + "name": "My Dep pre-parser", + "path": "relative/path/to/script.sh", + "execution_position": "after_compile" + } + } + } +} +``` + +`"path"` is an extra option provided to simplify storing the scripts in your repo, it sets `"script"` for you. You can see all available options [here](https://www.rubydoc.info/gems/cocoapods-core/Pod/Podfile/DSL#script_phase-instance_method). + +See implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). + +## Platform Android + +1. At build time, before the build script is run, a first gradle plugin (`settings.gradle`) is ran that takes the package metadata from `react-native config` to dynamically include Android library projects into the build. +1. A second plugin then adds those dependencies to the app project and generates a manifest of React Native packages to include in the fully generated file `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java`. +1. Finally, at runtime (on startup) the list of React Native packages, generated in step 2, is used to instruct the React Native runtime of what native modules are available. + +See implementation of [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle). + +## What do I need to have in my package to make it work? + +You’re already using Gradle, so Android support will work by default. + +On the iOS side, you will need to ensure you have a Podspec to the root of your repo. The `react-native-webview` Podspec is a good example of a [`package.json`](https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec)-driven Podspec. + +## How can I customize how autolinking works for my package? + +A library can add a `react-native.config.js` configuration file, which will customize the defaults. diff --git a/docs/commands.md b/docs/commands.md new file mode 100644 index 000000000..e34f8a76f --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,487 @@ +# Commands + +React Native CLI comes with following commands: + +- [`bundle`](#bundle) +- [`config`](#config) +- [`init`](#init) +- [`info`](#info) +- [`install`](#install) +- [`library`](#library) +- [`link`](#link) +- [`log-android`](#log-android) +- [`log-ios`](#log-ios) +- [`ram-bundle`](#ram-bundle) +- [`run-android`](#run-android) +- [`run-ios`](#run-ios) +- [`start`](#start) +- [`uninstall`](#uninstall) +- [`unlink`](#unlink) +- [`upgrade`](#upgrade) + +### `bundle` + +Usage: + +```sh +react-native bundle +``` + +Builds the JavaScript bundle for offline use. + +#### `--entry-file ` + +Path to the root JS file, either absolute or relative to JS root. + +#### `--platform [string]` + +> default: ios + +Either "ios" or "android". + +#### `--transformer [string]` + +Specify a custom transformer to be used. + +#### `--dev [boolean]` + +> default: true + +If false, warnings are disabled and the bundle is minified. + +#### `--minify [boolean]` + +Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes. + +#### `--bundle-output ` + +File name where to store the resulting bundle, ex. `/tmp/groups.bundle`. + +#### `--bundle-encoding [string]` + +> default: utf8 + +Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). + +#### `--max-workers [number]` + +Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine. + +#### `--sourcemap-output [string]` + +File name where to store the sourcemap file for resulting bundle, ex. `/tmp/groups.map`. + +#### `--sourcemap-sources-root [string]` + +Path to make sourcemaps sources entries relative to, ex. `/root/dir`. + +#### `--sourcemap-use-absolute-path` + +> default: false + +Report SourceMapURL using its full path. + +#### `--assets-dest [string]` + +Directory name where to store assets referenced in the bundle. + +#### `--reset-cache` + +> default: false + +Removes cached files. + +#### `--read-global-cache` + +> default: false + +Try to fetch transformed JS code from the global cache, if configured. + +#### `--config [string]` + +Path to the CLI configuration file. + +### `config` + +Usage: + +```sh +react-native config +``` + +Output project and dependencies configuration in JSON format to stdout. Used by [autolinking](./autolinking.md). + +### `init` + +> Available since 0.60.0 + +Usage: + +```sh +react-native init [options] +``` + +Initialize new React Native project. + +#### Options + +#### `--version [string]` + +Uses a valid semver version of React Native as a template. + +#### `--template [string]` + +Uses a custom template. Accepts either an npm package name or an absolute path to local directory. + +Example: + +```sh +react-native init MyApp --template react-native-custom-template +react-native init MyApp --template file:///Users/name/template-path +``` + +A template is any directory or npm package that contains a `template.config.js` file in the root with following of the following type: + +```ts +type Template = { + // Placeholder used to rename and replace in files + // package.json, index.json, android/, ios/ + placeholderName: string; + // Directory with template + templateDir: string; + // Path to script, which will be executed after init + postInitScript?: string; +}; +``` + +Example `template.config.js`: + +```js +module.exports = { + placeholderName: "ProjectName", + templateDir: "./template", + postInitScript: "./script.js", +}; +``` + +#### `--npm` + +Force use of npm during initialization + +### `info` + +Usage: + +```sh +react-native info +``` + +Get relevant version info about OS, toolchain and libraries. Useful when sending bug reports. + +### `install` + +Usage: + +```sh +react-native install +``` + +Installs single package from npm and then links native dependencies. If `install` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. + +### `library` + +Usage: + +```sh +react-native library +``` + +Generates a native library bridge. + +#### `--name ` + +Name of the library to generate. + +### `link` + +> Will be replaced by [autolinking](./autolinking.md) soon. + +Usage: + +```sh +react-native link [packageName] +``` + +Link native dependency or all native dependencies if no `packageName` passed. + +#### Options + +#### `--platforms [list]` + +Pass comma-separated list of platforms to scope `link` to. + +### `log-android` + +Usage: + +```sh +react-native log-android +``` + +Starts [`logkitty`](https://github.com/zamotany/logkitty) displaying pretty Android logs. + +### `log-ios` + +Usage: + +```sh +react-native log-ios +``` + +Starts iOS device syslog tail. + +### `ram-bundle` + +Usage: + +```sh +react-native ram-bundle [options] +``` + +Builds JavaScript as a "Random Access Module" bundle for offline use. + +#### Options + +Accepts all of [bundle commands](#bundle) and following: + +#### `--indexed-ram-bundle` + +Force the "Indexed RAM" bundle file format, even when building for Android. + +### `run-android` + +Usage: + +```sh +react-native run-android [options] +``` + +Builds your app and starts it on a connected Android emulator or device. + +#### Options + +#### `--install-debug` + +#### `--root [string]` + +Override the root directory for the Android build (which contains the android directory)'. + +#### `--variant [string]` + +> default: 'debug' + +#### `--appFolder [string]` + +> default: 'app' + +Specify a different application folder name for the Android source. If not, we assume is "app". + +#### `--appId [string]` + +Specify an `applicationId` to launch after build. + +#### `--appIdSuffix [string]` + +Specify an `applicationIdSuffix` to launch after build. + +#### `--main-activity [string]` + +> default: 'MainActivity' + +Name of the activity to start. + +#### `--deviceId [string]` + +builds your app and starts it on a specific device/simulator with the given device id (listed by running "adb devices" on the command line). + +#### `--no-packager` + +Do not launch packager while building. + +#### `--port [number]` + +> default: process.env.RCT_METRO_PORT || 8081, + +#### `--terminal [string]` + +> default: process.env.REACT_TERMINAL || process.env.TERM_PROGRAM + +Launches the Metro Bundler in a new window using the specified terminal path. + +### `run-ios` + +Usage: + +```sh +react-native run-ios [options] +``` + +Builds your app and starts it on iOS simulator. + +#### Options + +#### `--simulator [simulator_name]` + +Explicitly set the simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version, e.g. `"iPhone 6 (10.0)"`. + +Default: `"iPhone X"` + +Notes: `simulator_name` must be a valid iOS simulator name. If in doubt, open your AwesomeApp/ios/AwesomeApp.xcodeproj folder on XCode and unroll the dropdown menu containing the simulator list. The dropdown menu is situated on the right hand side of the play button (top left corner). + +Example: this will launch your projet directly onto the iPhone XS Max simulator: + +```sh +react-native run-ios --simulator "iPhone XS Max" +``` + +#### `--configuration [string]` + +Explicitly set the scheme configuration to use default: 'Debug'. + +#### `--scheme [string]` + +Explicitly set Xcode scheme to use. + +#### `--project-path [string]` + +Path relative to project root where the Xcode project (.xcodeproj) lives. default: 'ios'. + +#### `--device [string]` + +Explicitly set device to use by name. The value is not required if you have a single device connected. + +#### `--udid [string]` + +Explicitly set device to use by udid. + +#### `--no-packager` + +Do not launch packager while building. + +#### `--verbose` + +Do not use `xcpretty` even if installed. + +#### `--port [number]` + +Runs packager on specified port + +Default: `process.env.RCT_METRO_PORT || 8081` + +### `start` + +Usage: + +``` +react-native start [option] +``` + +Starts the server that communicates with connected devices + +#### Options + +#### `--port [number]` + +Specify port to listen on + +#### `--watchFolders [list]` + +Specify any additional folders to be added to the watch list + +#### `--assetExts [list]` + +Specify any additional asset extensions to be used by the packager + +#### `--sourceExts [list]` + +Specify any additional source extensions to be used by the packager + +#### `--platforms [list]` + +Specify any additional platforms to be used by the packager + +#### `--providesModuleNodeModules [list]` + +Specify any npm packages that import dependencies with providesModule + +#### `--max-workers [number]` + +Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine + +#### `--transformer [string]` + +Specify a custom transformer to be used + +#### `--reset-cache, --resetCache` + +Removes cached files + +#### `--custom-log-reporter-path, --customLogReporterPath [string]` + +Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter + +#### `--verbose` + +Enables logging + +#### `--https` + +Enables https connections to the server + +#### `--key [path]` + +Path to custom SSL key + +#### `--cert [path]` + +Path to custom SSL cert + +#### `--config [string]` + +Path to the CLI configuration file + +### `uninstall` + +Usage: + +```sh +react-native uninstall +``` + +Unlinks single package native dependencies and then uninstalls it from `package.json`. If `uninstall` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. + +### `unlink` + +> Will be replaced by [autolinking](./autolinking.md) soon. + +Usage: + +``` +react-native unlink +``` + +Unlink native dependency linked with the `link` command. + +### `upgrade` + +Usage: + +```sh +react-native upgrade [npm-version] +``` + +Upgrade your app's template files to the specified or latest npm version using [rn-diff-purge](https://github.com/react-native-community/rn-diff-purge) project. Only valid semver versions are allowed. + +Using this command is a recommended way of upgrading relatively simple React Native apps with not too many native libraries linked. The more iOS and Android build files are modified, the higher chance for a conflicts. The command will guide you on how to continue upgrade process manually in case of failure. + +_Note: If you'd like to upgrade using this method from React Native version lower than 0.59.0, you may use a standalone version of this CLI: `npx @react-native-community/cli upgrade`._ diff --git a/docs/plugins.md b/docs/plugins.md new file mode 100644 index 000000000..88db0a547 --- /dev/null +++ b/docs/plugins.md @@ -0,0 +1,3 @@ +# Plugins + +TBD diff --git a/packages/cli/README.md b/packages/cli/README.md index 1e49d90c4..09780d1a5 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -2,240 +2,6 @@ Command line tools to interact with React Native projects. -## Commands +This package contains source code for `@react-native-community/cli`, the actual CLI that comes bundled with React Native. You don't need to install it separately in your project. -CLI comes with a set of commands and flags you can pass to them. - -- [`bundle`](#bundle) -- [`dependencies`](#dependencies) -- [`info`](#info) -- [`install`](#install) -- [`library`](#library) -- [`link`](#link) -- [`log-android`](#log-android) -- [`log-ios`](#log-ios) -- [`ram-bundle`](#ram-bundle) -- [`run-android`](#run-android) -- [`run-ios`](#run-ios) -- [`start`](#start) -- [`uninstall`](#uninstall) -- [`unlink`](#unlink) -- [`upgrade`](#upgrade) - -_Note: This document is still under development and doesn't represent the full API area._ - -### `bundle` - -### `dependencies` - -### `info` - -### `install` - -Usage: - -```sh -react-native install -``` - -Installs single package from npm and then links native dependencies. If `install` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. - -### `library` - -### `link` - -Usage: - -```sh -react-native link [packageName] -``` - -Link native dependency or all native dependencies if no `packageName` passed. - -#### Options - -#### `--platforms [list]` - -Pass comma-separated list of platforms to scope `link` to. - -### `log-android` - -### `log-ios` - -### `ram-bundle` - -### `run-android` - -### `run-ios` - -Usage: - -```sh -react-native run-ios [options] -``` - -Builds your app and starts it on iOS simulator. - -#### Options - -#### `--simulator [simulator_name]` - -Explicitly set the simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version, e.g. `"iPhone 6 (10.0)"`. - -Default: `"iPhone X"` - -Notes: `simulator_name` must be a valid iOS simulator name. If in doubt, open your AwesomeApp/ios/AwesomeApp.xcodeproj folder on XCode and unroll the dropdown menu containing the simulator list. The dropdown menu is situated on the right hand side of the play button (top left corner). - -Example: this will launch your projet directly onto the iPhone XS Max simulator: - -```sh -react-native run-ios --simulator "iPhone XS Max" -``` - -#### `--configuration [string]` - -Explicitly set the scheme configuration to use default: 'Debug'. - -#### `--scheme [string]` - -Explicitly set Xcode scheme to use. - -#### `--project-path [string]` - -Path relative to project root where the Xcode project (.xcodeproj) lives. default: 'ios'. - -#### `--device [string]` - -Explicitly set device to use by name. The value is not required if you have a single device connected. - -#### `--udid [string]` - -Explicitly set device to use by udid. - -#### `--no-packager` - -Do not launch packager while building. - -#### `--verbose` - -Do not use `xcpretty` even if installed. - -#### `--port [number]` - -Runs packager on specified port - -Default: `process.env.RCT_METRO_PORT || 8081` - -### `start` - -Usage: - -``` -react-native start [option] -``` - -Starts the server that communicates with connected devices - -#### Options - -#### `--port [number]` - -Specify port to listen on - -#### `--watchFolders [list]` - -Specify any additional folders to be added to the watch list - -#### `--assetExts [list]` - -Specify any additional asset extensions to be used by the packager - -#### `--sourceExts [list]` - -Specify any additional source extensions to be used by the packager - -#### `--platforms [list]` - -Specify any additional platforms to be used by the packager - -#### `--providesModuleNodeModules [list]` - -Specify any npm packages that import dependencies with providesModule - -#### `--max-workers [number]` - -Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine - -#### `--skipflow` - -Disable flow checks - -#### `--nonPersistent` - -Disable file watcher - -#### `--transformer [string]` - -Specify a custom transformer to be used - -#### `--reset-cache, --resetCache` - -Removes cached files - -#### `--custom-log-reporter-path, --customLogReporterPath [string]` - -Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter - -#### `--verbose` - -Enables logging - -#### `--https` - -Enables https connections to the server - -#### `--key [path]` - -Path to custom SSL key - -#### `--cert [path]` - -Path to custom SSL cert - -#### `--config [string]` - -Path to the CLI configuration file - -### `uninstall` - -Usage: - -```sh -react-native uninstall -``` - -Unlinks single package native dependencies and then uninstalls it from `package.json`. If `uninstall` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. - -### `unlink` - -Usage: - -``` -react-native unlink -``` - -Unlink native dependency linked with the `link` command. - -### `upgrade` - -Usage: - -```sh -react-native upgrade [npm-version] -``` - -Upgrade your app's template files to the specified or latest npm version using [rn-diff-purge](https://github.com/react-native-community/rn-diff-purge) project. Only valid semver versions are allowed. - -Using this command is a recommended way of upgrading relatively simple React Native apps with not too many native libraries linked. The more iOS and Android build files are modified, the higher chance for a conflicts. The command will guide you on how to continue upgrade process manually in case of failure. - -_Note: If you'd like to upgrade using this method from React Native version lower than 0.59.0, you may use a standalone version of this CLI: `npx @react-native-community/cli upgrade`._ +See the [list of available commands](../../docs/commands.md). diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 9d73050df..535955ef5 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -19,7 +19,6 @@ import MiddlewareManager from './middleware/MiddlewareManager'; import loadMetroConfig from '../../tools/loadMetroConfig'; export type Args = {| - assetExts?: string[], assetPlugins?: string[], cert?: string, customLogReporterPath?: string, @@ -27,10 +26,8 @@ export type Args = {| https?: boolean, maxWorkers?: number, key?: string, - nonPersistent?: boolean, platforms?: string[], port?: number, - providesModuleNodeModules?: string[], resetCache?: boolean, sourceExts?: string[], transformer?: string, diff --git a/packages/cli/src/commands/server/server.js b/packages/cli/src/commands/server/server.js index e4b5ac073..d5184ac6f 100644 --- a/packages/cli/src/commands/server/server.js +++ b/packages/cli/src/commands/server/server.js @@ -68,14 +68,6 @@ export default { 'cores available on your machine.', parse: (workers: string) => Number(workers), }, - { - command: '--skipflow', - description: 'Disable flow checks', - }, - { - command: '--nonPersistent', - description: 'Disable file watcher', - }, { command: '--transformer [string]', description: 'Specify a custom transformer to be used', diff --git a/packages/platform-android/src/commands/logAndroid/index.js b/packages/platform-android/src/commands/logAndroid/index.js index b17f56b3d..bdeff9190 100644 --- a/packages/platform-android/src/commands/logAndroid/index.js +++ b/packages/platform-android/src/commands/logAndroid/index.js @@ -34,6 +34,6 @@ async function logAndroid() { export default { name: 'log-android', - description: 'starts adb logcat', + description: 'starts logkitty', func: logAndroid, }; From 29ae2531393d42758b49a1b18a31f2ef0f897b64 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 12:32:44 +0200 Subject: [PATCH 110/234] chore: remove unsupported CocoaPods options from a documentation This is currently not supported. Let's have it as a "todo" for the future releases, ideally, upon request from someone. --- docs/autolinking.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index 9fd5ff862..50bb0cb04 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -25,27 +25,6 @@ This means that all libraries need to ship a Podspec in the root of their folder The implementation ensures that a library is imported only once, so if you need to have a custom `pod` directive then including it above the function `use_native_modules!`. -Script Phases -A project which wants to add an Xcode script phase to a user's app can use the custom support in iOS auto-linking via custom settings in either the project's `package.json` under `"react-native"` or via a `react-native.config.js` file in the root. - -The options for the build phase are passed more-or-less directly to the `Podfile` via `build_phase`. Here's an example of adding the settings in your `package.json`: - -```json -{ - "react-native": - "ios": - "scriptPhases": { - "name": "My Dep pre-parser", - "path": "relative/path/to/script.sh", - "execution_position": "after_compile" - } - } - } -} -``` - -`"path"` is an extra option provided to simplify storing the scripts in your repo, it sets `"script"` for you. You can see all available options [here](https://www.rubydoc.info/gems/cocoapods-core/Pod/Podfile/DSL#script_phase-instance_method). - See implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). ## Platform Android From bca56c9f3c5ce5b55a4b88e1b661962c32d72090 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 19:41:42 +0200 Subject: [PATCH 111/234] docs: initial documentation of plugins (#345) * fix: typos in Autolinking & use same repo for both examples * structure new files * Add documentation for plugins and update naming in one place * Update index.js * Fix flow and update docs * Update * Prefix * Updates * Take advantage of Joi * Update docs/plugins.md Co-Authored-By: grabbou * Update docs/plugins.md Co-Authored-By: grabbou * Some other tweaks * Placeholder for dependency * Updates * Delete linking.md * fix tests --- docs/autolinking.md | 6 +- docs/configuration.md | 3 + docs/dependency.md | 3 + docs/platforms.md | 3 + docs/plugins.md | 150 +++++++++++++++++- packages/cli/src/cliEntry.js | 4 +- .../commands/bundle/bundleCommandLineArgs.js | 30 ++-- packages/cli/src/commands/bundle/ramBundle.js | 2 +- packages/cli/src/commands/init/index.js | 6 +- packages/cli/src/commands/library/library.js | 2 +- packages/cli/src/commands/link/link.js | 2 +- packages/cli/src/commands/server/server.js | 34 ++-- packages/cli/src/commands/upgrade/upgrade.js | 2 +- .../cli/src/tools/assertRequiredOptions.js | 2 +- packages/cli/src/tools/config/schema.js | 18 ++- .../src/commands/runAndroid/index.js | 24 +-- .../platform-ios/src/commands/runIOS/index.js | 20 +-- types/index.js | 3 +- 18 files changed, 237 insertions(+), 77 deletions(-) create mode 100644 docs/configuration.md create mode 100644 docs/dependency.md create mode 100644 docs/platforms.md diff --git a/docs/autolinking.md b/docs/autolinking.md index 50bb0cb04..23cde5620 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -3,12 +3,14 @@ Autolinking is a mechanism built into CLI that allows adding a dependency with native components for React Native to be as simple as: ```sh -yarn add react-native-firebase +yarn add react-native-webview ``` +> Autolinking is a replacement for [`react-native link`](./linking.md) that brings new features (such as ability to easily integrate native dependencies on iOS) and fixes some of the long-standing issues. + ## How does it work -React Native CLI provides a [`config`](./commands.md#config) command which grabs all of the configuration for React Native packages installed in the project (by scanning dependenecies in `package.json`) and outputs it in JSON format. +React Native CLI provides a [`config`](./commands.md#config) command which grabs all of the configuration for React Native packages installed in the project (by scanning dependencies in `package.json`) and outputs it in JSON format. This information is then used by the projects advertised as platforms (with `react-native` being a default project supporting both iOS and Android platforms) that implement their autolinking behavior. diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 000000000..79de38b76 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,3 @@ +# Configuration + +TBD diff --git a/docs/dependency.md b/docs/dependency.md new file mode 100644 index 000000000..4c02d82b9 --- /dev/null +++ b/docs/dependency.md @@ -0,0 +1,3 @@ +# Dependency + +TBD diff --git a/docs/platforms.md b/docs/platforms.md new file mode 100644 index 000000000..d1c77678f --- /dev/null +++ b/docs/platforms.md @@ -0,0 +1,3 @@ +# Platforms + +TBD diff --git a/docs/plugins.md b/docs/plugins.md index 88db0a547..b5f0dc1d4 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -1,3 +1,151 @@ # Plugins -TBD +Plugin is a JavaScript package that extends built-in React Native CLI features. It can provide an array of additional commands to run or platforms to target. + +For example, `react-native-windows` package is a plugin that provides `react-native run-windows` command and `windows` platform. + +Details of this particular integration as well as how to provide an additional platform for React Native were described in a [`dedicated section`](./platforms.md) about platforms. + +## How does it work? + +Except for React Native dependencies, where configuration is implicit, each package needs to have a `react-native.config.js` at the root folder in order to be discovered by the CLI as a plugin. + +```js +module.exports = { + commands: [ + { + name: 'foo-command', + func: () => console.log('It worked') + } + ] +}; +``` + +> Above is an example of a plugin that exports a command named `foo-command` that can be executed with `react-native foo-command` and logs "It worked" and exits. + + +At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. + +At the end, an array of commands concatenated from all plugins is passed on to the CLI to be loaded after built-in commands. + +## Command interface + +```ts +type Command = { + name: string, + description?: string, + func: (argv: Array, config: ConfigT, args: Object) => ?Promise, + options?: Array<{ + name: string, + description?: string, + parse?: (val: string) => any, + default?: + | string + | boolean + | number + | ((config: ConfigT) => string | boolean | number), + }>, + examples?: Array<{ + desc: string, + cmd: string, + }>, +}; +``` + +> Note: `ConfigT` is described in [`configuration`](./configuration.md) section + +#### `name` + +A name that will be used in order to run the command. + +Note: If you want your command to accept additional arguments, make sure to include them in the name. + +For example, `my-command ` will require an argument to be provided and will throw a validation error otherwise. Alternatively, `my-command [argument]` will accept an argument, but will not throw when run without it. In that case, make sure to check for its presence. + +#### `func` + +Function that will be run when this command is executed. Receives an array of arguments, in order they were provided, a config object (see [`configuration` section](./configuration.md)) and options, that were passed to your command. + +You can return a Promise if your command is async. + +All errors are handled by the built-in logger. Prefer throwing instead of implementing your own logging mechanism. + +#### `options` + +An array of options that your command accepts. + +##### `options.name` + +Name of the option. + +For example, a `--reset-cache` option will result in a `resetCache: true` or `resetCache: false` present in the `options` object - passed to a command function as a last argument. + +Just like with a [command name](#name), your option can require a value (e.g. `--port `) or accept an optional one (e.g. `--host [host]`). In this case, you may find [`default`](#optionsdefault) value useful. + +##### `options.description` + +Optional description of your option. When provided, will be used to output a better help information. + +##### `options.parse` + +Parsing function that can be used to transform a raw (string) option as passed by the user into a format expected by your function. + +##### `options.default` + +Default value for the option when not provided. Can be either a primitive value or a function, that receives a configuration and returns a primitive. + +Useful when you want to use project settings as default value for your option. + +#### `examples` + +An array of example usage of the command to be printed to the user. + +##### `examples.desc` + +String that describes this particular usage. + +##### `examples.cmd` + +A command with arguments and options (if applicable) that can be run in order to achieve the desired goal. + +## Migrating from `rnpm` configuration + +The changes are mostly cosmetic so the migration should be pretty straight-forward. + +### Changing the configuration + +A `plugin` property should be renamed to `commands`. + +For example, the following `rnpm` configuration inside `package.json`: +```json +{ + "rnpm": { + "plugin": "./path-to-commands.js", + } +} +``` +should be moved to a `react-native.config.js`: +```js +module.exports = { + commands: require('./path-to-commands.js') +}; +``` +provided that `./path-to-commands.js` returns an array of commands. + +### Renaming command options + +If your command accepts options, rename `command` property of each of them to `name`. + +```diff + module.exports = { + name: 'foo', + func: () => console.log('My work'), + options: [ + { +- command: '--reset-cache, --resetCache', ++ name: '--reset-cache, --resetCache', + description: 'Removes cached files', + } + ] + } +``` diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index ad3eae7d5..f8a59ed6d 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -64,7 +64,7 @@ function printHelpInformation(examples, pkg) { : []; let output = [ - chalk.bold(`react-native ${cmdName} ${this.usage()}`), + chalk.bold(`react-native ${cmdName}`), this._description ? `\n${this._description}\n` : '', ...sourceInformation, `${chalk.bold('Options:')}`, @@ -122,7 +122,7 @@ const addCommand = (command: CommandT, ctx: ConfigT) => { options.forEach(opt => cmd.option( - opt.command, + opt.name, opt.description, opt.parse || defaultOptParser, typeof opt.default === 'function' ? opt.default(ctx) : opt.default, diff --git a/packages/cli/src/commands/bundle/bundleCommandLineArgs.js b/packages/cli/src/commands/bundle/bundleCommandLineArgs.js index f347eb009..465e12b33 100644 --- a/packages/cli/src/commands/bundle/bundleCommandLineArgs.js +++ b/packages/cli/src/commands/bundle/bundleCommandLineArgs.js @@ -30,27 +30,27 @@ export type CommandLineArgs = { export default [ { - command: '--entry-file ', + name: '--entry-file ', description: 'Path to the root JS file, either absolute or relative to JS root', }, { - command: '--platform [string]', + name: '--platform [string]', description: 'Either "ios" or "android"', default: 'ios', }, { - command: '--transformer [string]', + name: '--transformer [string]', description: 'Specify a custom transformer to be used', }, { - command: '--dev [boolean]', + name: '--dev [boolean]', description: 'If false, warnings are disabled and the bundle is minified', parse: (val: string) => val !== 'false', default: true, }, { - command: '--minify [boolean]', + name: '--minify [boolean]', description: 'Allows overriding whether bundle is minified. This defaults to ' + 'false if dev is true, and true if dev is false. Disabling minification ' + @@ -58,18 +58,18 @@ export default [ parse: (val: string) => val !== 'false', }, { - command: '--bundle-output ', + name: '--bundle-output ', description: 'File name where to store the resulting bundle, ex. /tmp/groups.bundle', }, { - command: '--bundle-encoding [string]', + name: '--bundle-encoding [string]', description: 'Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).', default: 'utf8', }, { - command: '--max-workers [number]', + name: '--max-workers [number]', description: 'Specifies the maximum number of workers the worker-pool ' + 'will spawn for transforming files. This defaults to the number of the ' + @@ -77,38 +77,38 @@ export default [ parse: (workers: string) => Number(workers), }, { - command: '--sourcemap-output [string]', + name: '--sourcemap-output [string]', description: 'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map', }, { - command: '--sourcemap-sources-root [string]', + name: '--sourcemap-sources-root [string]', description: "Path to make sourcemap's sources entries relative to, ex. /root/dir", }, { - command: '--sourcemap-use-absolute-path', + name: '--sourcemap-use-absolute-path', description: 'Report SourceMapURL using its full path', default: false, }, { - command: '--assets-dest [string]', + name: '--assets-dest [string]', description: 'Directory name where to store assets referenced in the bundle', }, { - command: '--reset-cache', + name: '--reset-cache', description: 'Removes cached files', default: false, }, { - command: '--read-global-cache', + name: '--read-global-cache', description: 'Try to fetch transformed JS code from the global cache, if configured.', default: false, }, { - command: '--config [string]', + name: '--config [string]', description: 'Path to the CLI configuration file', parse: (val: string) => path.resolve(val), }, diff --git a/packages/cli/src/commands/bundle/ramBundle.js b/packages/cli/src/commands/bundle/ramBundle.js index 6b5e5a1af..c9420ad8b 100644 --- a/packages/cli/src/commands/bundle/ramBundle.js +++ b/packages/cli/src/commands/bundle/ramBundle.js @@ -24,7 +24,7 @@ export default { 'builds javascript as a "Random Access Module" bundle for offline use', func: ramBundle, options: bundleCommandLineArgs.concat({ - command: '--indexed-ram-bundle', + name: '--indexed-ram-bundle', description: 'Force the "Indexed RAM" bundle file format, even when building for android', default: false, diff --git a/packages/cli/src/commands/init/index.js b/packages/cli/src/commands/init/index.js index 23e409f78..464d572a9 100644 --- a/packages/cli/src/commands/init/index.js +++ b/packages/cli/src/commands/init/index.js @@ -7,15 +7,15 @@ export default { description: 'initialize new React Native project', options: [ { - command: '--version [string]', + name: '--version [string]', description: 'Version of RN', }, { - command: '--template [string]', + name: '--template [string]', description: 'Custom template', }, { - command: '--npm', + name: '--npm', description: 'Force use of npm during initialization', }, ], diff --git a/packages/cli/src/commands/library/library.js b/packages/cli/src/commands/library/library.js index 026d151aa..0aa1b9fab 100644 --- a/packages/cli/src/commands/library/library.js +++ b/packages/cli/src/commands/library/library.js @@ -70,7 +70,7 @@ export default { description: 'generates a native library bridge', options: [ { - command: '--name ', + name: '--name ', description: 'name of the library to generate', default: null, }, diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index fbde1782c..5fe49362b 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -91,7 +91,7 @@ export default { name: 'link [packageName]', options: [ { - command: '--platforms [list]', + name: '--platforms [list]', description: 'If you want to link dependencies only for specific platforms', parse: (val: string) => val.toLowerCase().split(','), diff --git a/packages/cli/src/commands/server/server.js b/packages/cli/src/commands/server/server.js index d5184ac6f..ad2deeb7e 100644 --- a/packages/cli/src/commands/server/server.js +++ b/packages/cli/src/commands/server/server.js @@ -17,51 +17,51 @@ export default { description: 'starts the webserver', options: [ { - command: '--port [number]', + name: '--port [number]', parse: (val: string) => Number(val), }, { - command: '--host [string]', + name: '--host [string]', default: '', }, { - command: '--watchFolders [list]', + name: '--watchFolders [list]', description: 'Specify any additional folders to be added to the watch list', parse: (val: string) => val.split(','), }, { - command: '--assetPlugins [list]', + name: '--assetPlugins [list]', description: 'Specify any additional asset plugins to be used by the packager by full filepath', parse: (val: string) => val.split(','), }, { - command: '--assetExts [list]', + name: '--assetExts [list]', description: 'Specify any additional asset extensions to be used by the packager', parse: (val: string) => val.split(','), }, { - command: '--sourceExts [list]', + name: '--sourceExts [list]', description: 'Specify any additional source extensions to be used by the packager', parse: (val: string) => val.split(','), }, { - command: '--platforms [list]', + name: '--platforms [list]', description: 'Specify any additional platforms to be used by the packager', parse: (val: string) => val.split(','), }, { - command: '--providesModuleNodeModules [list]', + name: '--providesModuleNodeModules [list]', description: 'Specify any npm packages that import dependencies with providesModule', parse: (val: string) => val.split(','), }, { - command: '--max-workers [number]', + name: '--max-workers [number]', description: 'Specifies the maximum number of workers the worker-pool ' + 'will spawn for transforming files. This defaults to the number of the ' + @@ -69,36 +69,36 @@ export default { parse: (workers: string) => Number(workers), }, { - command: '--transformer [string]', + name: '--transformer [string]', description: 'Specify a custom transformer to be used', }, { - command: '--reset-cache, --resetCache', + name: '--reset-cache, --resetCache', description: 'Removes cached files', }, { - command: '--custom-log-reporter-path, --customLogReporterPath [string]', + name: '--custom-log-reporter-path, --customLogReporterPath [string]', description: 'Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter', }, { - command: '--verbose', + name: '--verbose', description: 'Enables logging', }, { - command: '--https', + name: '--https', description: 'Enables https connections to the server', }, { - command: '--key [path]', + name: '--key [path]', description: 'Path to custom SSL key', }, { - command: '--cert [path]', + name: '--cert [path]', description: 'Path to custom SSL cert', }, { - command: '--config [string]', + name: '--config [string]', description: 'Path to the CLI configuration file', parse: (val: string) => path.resolve(val), }, diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 95682c320..f1da828c2 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -319,7 +319,7 @@ const upgradeCommand = { func: upgrade, options: [ { - command: '--legacy [boolean]', + name: '--legacy [boolean]', description: "Legacy implementation. Upgrade your app's template files to the latest version; run this after " + 'updating the react-native version in your package.json and running npm install', diff --git a/packages/cli/src/tools/assertRequiredOptions.js b/packages/cli/src/tools/assertRequiredOptions.js index c4de673c0..fb5a941ad 100644 --- a/packages/cli/src/tools/assertRequiredOptions.js +++ b/packages/cli/src/tools/assertRequiredOptions.js @@ -15,7 +15,7 @@ import {camelCase} from 'lodash'; // https://github.com/tj/commander.js/issues/230 export default function assertRequiredOptions(options, passedOptions) { options.forEach(opt => { - const option = new Option(opt.command); + const option = new Option(opt.name); if (!option.required) { return; diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index cd2870afe..362a6eb3c 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -18,14 +18,16 @@ const command = t.object({ usage: t.string(), func: t.func().required(), options: t.array().items( - t.object({ - command: t.string().required(), - description: t.string(), - parse: t.func(), - default: t - .alternatives() - .try([t.bool(), t.number(), t.string().allow(''), t.func()]), - }), + t + .object({ + name: t.string().required(), + description: t.string(), + parse: t.func(), + default: t + .alternatives() + .try([t.bool(), t.number(), t.string().allow(''), t.func()]), + }) + .rename('command', 'name'), ), examples: t.array().items( t.object({ diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 3f9d8ecc8..09c7f71c5 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -306,60 +306,60 @@ export default { func: runAndroid, options: [ { - command: '--install-debug', + name: '--install-debug', }, { - command: '--root [string]', + name: '--root [string]', description: 'Override the root directory for the android build (which contains the android directory)', default: '', }, { - command: '--flavor [string]', + name: '--flavor [string]', description: '--flavor has been deprecated. Use --variant instead', }, { - command: '--variant [string]', + name: '--variant [string]', default: 'debug', }, { - command: '--appFolder [string]', + name: '--appFolder [string]', description: 'Specify a different application folder name for the android source. If not, we assume is "app"', default: 'app', }, { - command: '--appId [string]', + name: '--appId [string]', description: 'Specify an applicationId to launch after build.', default: '', }, { - command: '--appIdSuffix [string]', + name: '--appIdSuffix [string]', description: 'Specify an applicationIdSuffix to launch after build.', default: '', }, { - command: '--main-activity [string]', + name: '--main-activity [string]', description: 'Name of the activity to start', default: 'MainActivity', }, { - command: '--deviceId [string]', + name: '--deviceId [string]', description: 'builds your app and starts it on a specific device/simulator with the ' + 'given device id (listed by running "adb devices" on the command line).', }, { - command: '--no-packager', + name: '--no-packager', description: 'Do not launch packager while building', }, { - command: '--port [number]', + name: '--port [number]', default: process.env.RCT_METRO_PORT || 8081, parse: (val: string) => Number(val), }, { - command: '--terminal [string]', + name: '--terminal [string]', description: 'Launches the Metro Bundler in a new window using the specified terminal path.', default: getDefaultUserTerminal, diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 97e0c865d..b5f5a760c 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -420,52 +420,52 @@ export default { ], options: [ { - command: '--simulator [string]', + name: '--simulator [string]', description: 'Explicitly set simulator to use. Optionally include iOS version between' + 'parenthesis at the end to match an exact version: "iPhone 6 (10.0)"', default: 'iPhone X', }, { - command: '--configuration [string]', + name: '--configuration [string]', description: 'Explicitly set the scheme configuration to use', default: 'Debug', }, { - command: '--scheme [string]', + name: '--scheme [string]', description: 'Explicitly set Xcode scheme to use', }, { - command: '--project-path [string]', + name: '--project-path [string]', description: 'Path relative to project root where the Xcode project ' + '(.xcodeproj) lives.', default: 'ios', }, { - command: '--device [string]', + name: '--device [string]', description: 'Explicitly set device to use by name. The value is not required if you have a single device connected.', }, { - command: '--udid [string]', + name: '--udid [string]', description: 'Explicitly set device to use by udid', }, { - command: '--no-packager', + name: '--no-packager', description: 'Do not launch packager while building', }, { - command: '--verbose', + name: '--verbose', description: 'Do not use xcpretty even if installed', }, { - command: '--port [number]', + name: '--port [number]', default: process.env.RCT_METRO_PORT || 8081, parse: (val: string) => Number(val), }, { - command: '--terminal [string]', + name: '--terminal [string]', description: 'Launches the Metro Bundler in a new window using the specified terminal path.', default: getDefaultUserTerminal, diff --git a/types/index.js b/types/index.js index 4f066f669..b0fa6d58f 100644 --- a/types/index.js +++ b/types/index.js @@ -4,10 +4,9 @@ export type CommandT = { name: string, description?: string, - usage?: string, func: (argv: Array, ctx: ConfigT, args: Object) => ?Promise, options?: Array<{ - command: string, + name: string, description?: string, parse?: (val: string) => any, default?: From 86986a1c2ef6f21794d4d6ff90a12cedf21d2226 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Tue, 23 Apr 2019 19:54:31 +0200 Subject: [PATCH 112/234] docs: add init documentation (#347) * docs: add init documentation * docs: add mentions in other files * docs: revert * Update docs/init.md Co-Authored-By: Esemesek --- README.md | 5 +- docs/commands.md | 2 +- docs/init.md | 81 ++++++++++++++++++++++++++ packages/cli/src/commands/init/init.js | 2 +- 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 docs/init.md diff --git a/README.md b/README.md index e8b403f32..47ea151eb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ This CLI is intended to be used with a certain version of React Native. You'll f ## Documentation - [commands](./docs/commands.md) +- [init](./docs/init.md) - [autolinking](./docs/autolinking.md) - [plugins](./docs/plugins.md) @@ -48,7 +49,9 @@ npx react-native init MyApp You'll need to install a global module [`react-native-cli`](./packages/global-cli) and follow instructions there. -We strongly encourage you to **only use global `react-native-cli` for bootstrapping new projects**. Use local version for everything else. +> We strongly encourage you to **only use global `react-native-cli` for bootstrapping new projects**. Use local version for everything else. + +You can find out more about init command from the [documentation](./docs/init.md) ## Usage in an existing React Native project diff --git a/docs/commands.md b/docs/commands.md index e34f8a76f..f1a7a3246 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -121,7 +121,7 @@ Usage: react-native init [options] ``` -Initialize new React Native project. +Initialize new React Native project. You can find out more use cases in [init docs](./init.md). #### Options diff --git a/docs/init.md b/docs/init.md new file mode 100644 index 000000000..bbc4bdff5 --- /dev/null +++ b/docs/init.md @@ -0,0 +1,81 @@ +# Initializing new project + +There are couple of ways to initialize new React Native projects. + +### For `react-native@0.60.0` or greater + +#### Using `npx` utility: + +```sh +npx react-native init ProjectName +``` + +> Note: If you have both `yarn` and `npm` installed on your machine, React Native CLI will always try to use `yarn`, so even if you use `npx` utility, only `react-native` executable will be installed using `npm` and the rest of the work will be delegated to `yarn`. You can force usage of `npm` adding `--npm` flag to the command. + +> Note: for Yarn users, `yarn dlx` command similar to `npx` will be featured in Yarn 2.0: https://github.com/yarnpkg/berry/pull/40 so we’ll be able to use it in a similar fashion. + +#### Installing `react-native` and invoking `init` command: + +```sh +yarn init && yarn add react-native && yarn react-native init ProjectName +``` + +#### Initializing project with custom version of `react-native`: + +```sh +# This will use the latest init command but will install react-native@VERSION and use its template +npx react-native init ProjectName --version ${VERSION} + +# This will use init command from react-native@VERSION +npx react-native@${VERSION} init ProjectName +``` + +#### Initializing project with custom template. + +In following examples `TEMPLATE_NAME` can be either: +- Full package name, eg. `react-native-template-typescript`. +- Shorthand name of template, eg. `typescript`. +- Absolute path to directory containing template, eg. `file:///Users/username/project/some-template`. + +```sh +# This will initialize new project using template from TEMPLATE_NAME package +npx react-native init ProjectName --template ${TEMPLATE_NAME} + +# This will initialize new project using init command from react-native@VERSION but will use TEMPLATE_NAME custom template +npx react-native@${VERSION} init ProjectName --template ${TEMPLATE_NAME} +``` + +You can force usage of `npm` if you have both `yarn` and `npm` installed on your machine: +```sh +npx react-native init ProjectName --npm +``` + +### For older `react-native` versions + +Using legacy `react-native-cli` package: + +```sh +yarn global add react-native-cli +react-native init ProjectName +``` + +> Note: It is not recommended, but you can also use legacy `react-native-cli` package to initialize projects using latest `react-native` versions. + +# Creating custom template + +Every custom template needs to have configuration file called `template.config.js` in the root of the project: + +```js +module.exports = { + // Placeholder name that will be replaced in package.json, index.json, android/, ios/ for a project name. + placeholderName: "ProjectName", + + // Directory with the template which will be copied and processed by React Native CLI. Template directory should have package.json with all dependencies specified, including `react-native`. + templateDir: "./template", + + // Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template. + postInitScript: "./script.js", +}; +``` + +You can find example custom template [here](https://github.com/Esemesek/react-native-new-template). diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 26a5cfed5..19639c58f 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -106,7 +106,7 @@ async function createFromReactNativeTemplate( try { if (semver.valid(version) && !semver.gte(version, '0.60.0')) { throw new Error( - 'Cannot use React Native CLI to initialize project with version less than 0.60.0', + 'Cannot use React Native CLI to initialize project with version lower than 0.60.0', ); } From 34f7df2bfe492ea4dbe438528101e5474c1ecfd8 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 21:02:13 +0200 Subject: [PATCH 113/234] feat: add `platforms` doc (#349) * Add platforms doc * Migration guide * Update docs/platforms.md Co-Authored-By: grabbou --- docs/platforms.md | 215 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 1 deletion(-) diff --git a/docs/platforms.md b/docs/platforms.md index d1c77678f..6d01cf086 100644 --- a/docs/platforms.md +++ b/docs/platforms.md @@ -1,3 +1,216 @@ # Platforms -TBD +A platform is a React Native package that enables writing and shipping React Native applications to a new target. + +For example, React Native Windows is a platform, because it allows to run React Native apps on Windows. At the same time, React Native itself is also a platform - it allows to run React Native apps on Android, iOS and tvOS. + +Each platform can have an additional configuration for the CLI to enable bundling apps and linking packages for targets it provides. + +## How does it work? + +A platform can define the following `react-native.config.js` at the root: +```js +const ios = require('@react-native-community/cli-platform-ios'); +const android = require('@react-native-community/cli-platform-android'); + +module.exports = { + platforms: { + ios: { + linkConfig: ios.linkConfig, + projectConfig: ios.projectConfig, + dependencyConfig: ios.dependencyConfig + }, + android: { + linkConfig: android.linkConfig, + projectConfig: android.projectConfig, + dependencyConfig: android.dependencyConfig + } + } +} +``` +> The above config adds support for linking Android and iOS dependencies by the CLI as well as bundling code for these platforms. This config can be found in [React Native repository](https://github.com/facebook/react-native/blob/0.60-stable/react-native.config.js) from 0.60 version on. + +At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. + +At the end, a map of available platforms is passed to the bundler (Metro) to make it aware of the platforms available. This allows APIs such as `Platform.select` and requiring files with platform extensions to work properly. + +## Platform interface + +```ts +type PlatformConfig = { + projectConfig: (string, ProjectParams) => ?ProjectConfig, + dependencyConfig: (string, ProjectParams) => ?DependencyConfig, + linkConfig: () => { + isInstalled: (ProjectConfig, string, DependencyConfig) => boolean, + register: (string, DependencyConfig, Object, ProjectConfig) => void, + unregister: ( + string, + DependencyConfig, + ProjectConfig, + Array, + ) => void, + copyAssets: (string[], ProjectConfig) => void, + unlinkAssets: (string[], ProjectConfig) => void, + }, +}; +``` + +### projectConfig + +Returns a project configuration for a given platform. This is later used inside `linkConfig` to perform linking and unlinking. + +First argument is a root folder where the project is located. + +Second argument is everything that users defined under: +```js +module.exports = { + project: { + [yourPlatformKey]: {} + } +} +``` + +> Note: You may find this useful in order to alter the default behavior of your function. For example, on iOS, we find an `.xcodeproj` by globbing the project files and taking the first match. There's a possibility we pick the wrong one in case the project has multiple `.xcodeproj` files. In order to support this use-case, we have allowed users to define an exact path to an iOS project in order to overwrite our `glob` mechanism. + +We suggest performing all side-effects inside this function (such as resolving paths to native files) and making `linkConfig` functions pure, operating on provided data. + +### dependencyConfig + +Similar to [`projectConfig`](#projectconfig) above, but for a dependency of a project. + +First argument is a path to a root folder of a dependency. + +Second argument is everything that dependency authors defined under: +```js +module.exports = { + dependency: { + [yourPlatformKey]: {} + } +} +``` + +### linkConfig + +Returns an object with utilities that are run by the CLI while linking. + +> Note: The following is deprecated and will stop working in the future. Consider providing a [`autolinking`](./autolinking.md) support. + +#### linkConfig.isInstalled + +Returns true if a library is already linked to a given project. False otherwise. + +#### linkConfig.register + +Performs platform-specific steps in order to link a library. + +#### linkConfig.unregister + +Performs platform-specific steps in order to unlink a library. + +#### linkConfig.copyAssets + +Performs platform-specific steps in order to copy assets of a library to a project. + +#### linkConfig.unlinkAssets + +Performs platform-specific steps in order to unlink assets of a library from a project. + +## Migrating from `rnpm` configuration + +The changes are mostly cosmetic so the migration should be pretty straight-forward. + +### Changing the configuration for a platform + +A `platform` property would need to be renamed to `platforms`. `haste` is no longer supported - we are able to infer that automatically. + +For example: + +```json +{ + "rnpm": { + "haste": { + "platforms": [ + "windows" + ], + "providesModuleNodeModules": [ + "react-native-windows" + ] + }, + "platform": "./local-cli/platform.js" + } +} +``` + +to `react-native.config.js` + +```js +module.exports = { + platforms: { + windows: require('./local-cli/platform.js').windows, + } +}; +``` + +> The above configuration is taken from `react-native-windows` and adds support for `windows` platform. + +### Changing platform configuration for a dependency + +Platform keys are now under `dependency.platforms`. + +For example: + +```json +{ + "rnpm": { + "ios": { + "project": "PathToCustomProject.xcodeproj" + } + } +} +``` + +to `react-native.config.js` + +```js +module.exports = { + dependency: { + platforms: { + ios: { + project: 'PathToCustomProject.xcodeproj' + } + } + } +} +``` + +> The above is a configuration of a dependency that explicitly sets a path to `.xcodeproj`. + +### Changing platform configuration for a project + +Platform keys are now under `project.platforms`. + +For example: + +```json +{ + "rnpm": { + "ios": { + "project": "PathToCustomProject.xcodeproj" + } + } +} +``` + +to `react-native.config.js` + +```js +module.exports = { + project: { + ios: { + project: 'PathToCustomProject.xcodeproj' + } + } +} +``` + +> The above is a configuration of a project that explicitly sets its main `.xcodeproj` project. From 527d81dbab21891fcecbe4f7a0a3df4b5428ea59 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 22:58:59 +0200 Subject: [PATCH 114/234] feat: add dependency and project documentation (#350) * Add dependency documentation and links * Update * Update * Add project desc * Move notice above * add catch-all doc * Typo * Rename the type * Update docs/configuration.md Co-Authored-By: grabbou * Update docs/configuration.md Co-Authored-By: grabbou * Do where not when * Plural --- docs/configuration.md | 14 +++- docs/dependencies.md | 154 +++++++++++++++++++++++++++++++++++++++++ docs/dependency.md | 3 - docs/platforms.md | 50 +++++++++++++- docs/projects.md | 155 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 369 insertions(+), 7 deletions(-) create mode 100644 docs/dependencies.md delete mode 100644 docs/dependency.md create mode 100644 docs/projects.md diff --git a/docs/configuration.md b/docs/configuration.md index 79de38b76..acff3c023 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,3 +1,15 @@ # Configuration -TBD +React Native CLI has a configuration mechanism that allows changing its behavior and providing additional features. + +> Note: Configuring CLI used to be possible via `rn-cli.config.js` (that has been renamed to `metro.config.js`) and never documented `rnpm` entry on the `package.json`. We have provided migration guides where possible. + +React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on a type of a package, this file can have a different set properties. + +Check the documentation for: +- [projects](./projects.md) +- [dependencies](./dependencies.md) +- [platforms](./platforms.md) +- [plugins](./plugins.md) + +to learn more about different types of configuration and features available. diff --git a/docs/dependencies.md b/docs/dependencies.md new file mode 100644 index 000000000..bfd20cbdb --- /dev/null +++ b/docs/dependencies.md @@ -0,0 +1,154 @@ +# Dependency + +A dependency is a JavaScript package that is listed under dependencies present in the project's `package.json`. It can also contain native, platform-specific files that should be linked. + +For example, `lodash` is a dependency that doesn't have any native code to link. On the other hand, `react-native-vector-icons` is a dependency that contains not only native code, but also font assets that the CLI should link. + +By default, CLI analyses the folder structure inside the dependency and looks for assets and native files to link. This simple heuristic works in most of the cases. + +At the same time, a dependency can explicitly set its configuration in case CLI cannot infer it properly. A dependency can also define additional settings, such as a script to run after linking, in order to support some advanced use-cases. + +## How does it work? + +A dependency can define the following `react-native.config.js` at the root: + +```js +module.exports = { + dependency: { + platforms: { + ios: { + project: './Custom.xcodeproj' + } + } + assets: ['./assets'] + } +}; +``` + +> The above configuration informs CLI of the additional assets to link and about a custom project location. + +## Dependency interface + +The following type describes the configuration of a dependency that can be set under `dependency` key inside `react-native.config.js`. + +```ts +type DependencyConfigT = { + platforms: { + [key: string]: any, + }, + assets: string[], + hooks: { + [key: string]: string, + } +}; +``` + +> Note: This interface is subject to breaking changes. We may consider renaming some keys to simplify the configuration further. If you are going to use it, be prepared to update before we ship a stable 0.60.0 release. + +### platforms + +A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. + +In most cases, as a library author, you should not need to define any of these. + +The following settings are available on iOS and Android: + +```ts +type DependencyParamsIOST = { + project?: string, + sharedLibraries?: string[], +}; + +type DependencyParamsAndroidT = { + sourceDir?: string, + manifestPath?: string, + packageImportPath?: string, + packageInstance?: string +}; +``` + +#### platforms.ios.project + +Custom path to `.xcodeproj` + +#### platforms.ios.sharedLibraries + +An array of shared iOS libraries to link with the dependency. E.g. `libc++`. This is mostly a requirement of the native code that a dependency ships with. + +#### platforms.android.sourceDir + +Path to a folder with source files. + +#### platforms.android.manifestPath + +Path to a custom `AndroidManifest.xml` + +#### platforms.android.packageImportPath + +Custom package import. For example: `import com.acme.AwesomePackage;`. + +#### platforms.android.packageInstance + +Custom syntax to instantiate a package. By default, it's a `new AwesomePackage()`. It can be useful when your package requires additional arguments while initializing. + +For settings applicable on other platforms, please consult their respective documentation. + +### assets + +An array of assets folders to glob for files to link. + +### hooks + +A map where key is the name of a hook and value is the path to a file to execute. + +For example, `link` command supports `prelink` and `postlink` hooks to run before and after linking is done. + +These are the only ones supported by CLI at the moment. Depending on the packages used in your project, you may find other hooks supported to. + +> Note: This has nothing to do with React Hooks. + +## Migrating from `rnpm` configuration + +The changes are mostly cosmetic so the migration should be pretty straight-forward. + +> Note: We read `rnpm` configuration to remain backwards-compatible. Dependency maintainers should update their configuration in the nearest future. + +### Changing the configuration + +Properties were renamed. Look at the following example for the differences. + +```json +{ + "rnpm": { + "ios": {}, + "android": {}, + "assets": ["./path-to-assets"], + "hooks": { + "prelink": "./path-to-a-postlink-hook" + } + } +} +``` + +to a `react-native.config.js` + +```js +module.exports = { + dependency: { + platforms: { + ios: {}, + android: {}, + }, + assets: ['./path-to-assets'], + hooks: { + prelink: './path-to-a-postlink-hook' + } + } +}; +``` + +### Asking for params while linking has been removed + +If your library needs it, do not upgrade over to the new config format. + +If you want to ask users for additional settings, consider setting a custom `postlink` hook, just like [`react-native-code-push`](https://github.com/Microsoft/react-native-code-push/blob/master/package.json#L53). diff --git a/docs/dependency.md b/docs/dependency.md deleted file mode 100644 index 4c02d82b9..000000000 --- a/docs/dependency.md +++ /dev/null @@ -1,3 +0,0 @@ -# Dependency - -TBD diff --git a/docs/platforms.md b/docs/platforms.md index 6d01cf086..23f6c2d0b 100644 --- a/docs/platforms.md +++ b/docs/platforms.md @@ -57,7 +57,7 @@ type PlatformConfig = { ### projectConfig -Returns a project configuration for a given platform. This is later used inside `linkConfig` to perform linking and unlinking. +Returns a project configuration for a given platform or `null`, when no project found. This is later used inside `linkConfig` to perform linking and unlinking. First argument is a root folder where the project is located. @@ -72,6 +72,36 @@ module.exports = { > Note: You may find this useful in order to alter the default behavior of your function. For example, on iOS, we find an `.xcodeproj` by globbing the project files and taking the first match. There's a possibility we pick the wrong one in case the project has multiple `.xcodeproj` files. In order to support this use-case, we have allowed users to define an exact path to an iOS project in order to overwrite our `glob` mechanism. +On Android and iOS, this function returns: + +```ts +type ProjectConfigIOST = { + sourceDir: string, + folder: string, + pbxprojPath: string, + podfile: null, + podspec: null, + projectPath: string, + projectName: string, + libraryFolder: string, + sharedLibraries: Array, + plist: Array, +}; + +type ProjectConfigAndroidT = { + sourceDir: string, + isFlat: boolean, + folder: string, + stringsPath: string, + manifestPath: string, + buildGradlePath: string, + settingsGradlePath: string, + assetsPath: string, + mainFilePath: string, + packageName: string, +}; +``` + We suggest performing all side-effects inside this function (such as resolving paths to native files) and making `linkConfig` functions pure, operating on provided data. ### dependencyConfig @@ -89,6 +119,20 @@ module.exports = { } ``` +On Android and iOS, this function returns: + +```ts +type DependencyConfigIOST = ProjectConfigIOST; + +type DependencyConfigAndroidT = { + sourceDir: string, + folder: string, + manifest: Manifest, + packageImportPath: string, + packageInstance: string, +}; +``` + ### linkConfig Returns an object with utilities that are run by the CLI while linking. @@ -153,7 +197,7 @@ module.exports = { > The above configuration is taken from `react-native-windows` and adds support for `windows` platform. -### Changing platform configuration for a dependency +### Changing platform configuration for a [`dependency`](./dependencies.md) Platform keys are now under `dependency.platforms`. @@ -185,7 +229,7 @@ module.exports = { > The above is a configuration of a dependency that explicitly sets a path to `.xcodeproj`. -### Changing platform configuration for a project +### Changing platform configuration for a [`project`](./projects.md) Platform keys are now under `project.platforms`. diff --git a/docs/projects.md b/docs/projects.md new file mode 100644 index 000000000..1a2a681ff --- /dev/null +++ b/docs/projects.md @@ -0,0 +1,155 @@ +# Project + +A project is an app that contains React code and has a dependency on `react-native`. + +Projects can provide additional properties to alter the CLI behavior, such as custom location of React Native files (this is useful when running RNTester from source) or a non-standard location of a project (useful when working in a brownfield app). + +## How does it work? + +A project can define a `react-native.config.js` at the root with custom configuration to be picked up by the CLI. + +For example, below configuration informs CLI of the additional assets to link and about a custom project location. + +```js +module.exports = { + project: { + ios: { + project: './CustomProject.xcodeproj' + } + }, + assets: ['./assets'] +}; +``` + +You can check all available options below. + +## Project interface + +```ts +type ProjectConfigT = { + reactNativePath: ?string, + project: { + android?: ProjectParamsAndroidT, + ios?: ProjectParamsIOST, + [key: string]: any, + }, + assets: string[], + platforms: PlatformT, + dependencies: { + [key: string]: { + name: string, + root: string, + platforms: { + [key: string]: PlatformSettingsT + }, + assets: string[], + hooks: { + [key: string]: string + } + }, + }, + commands: CommandT[] +}; +``` + +### reactNativePath + +A custom path to React Native, in case `require('react-native')` would throw. Useful when running +React Native from a (custom) source. + +### project + +A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. + +In most cases, as a React Native developer, you should not need to define any of these. + +The following settings are available on iOS and Android: + +```ts +type ProjectParamsAndroidT = { + sourceDir?: string, + manifestPath?: string, + packageName?: string, + packageFolder?: string, + mainFilePath?: string, + stringsPath?: string, + settingsGradlePath?: string, + assetsPath?: string, + buildGradlePath?: string, + packageName?: string, +}; + +type ProjectParamsIOST = { + project?: string, + sharedLibraries?: string[], + libraryFolder?: string, + plist: any[], +}; +``` + +### assets + +An array of folders to check for project assets + +### platforms + +A object with platforms defined inside a project. You can check the format and options available [`here`](platforms.md#platform-interface) + +### commands + +An array of commands defined inside a project. You can check the format and options available [`here`](plugins.md#command-interface) + +### dependencies + +Dependencies is a map where key is the name of the dependency and value is an object that can override any of the resolved settings for a particular package. + +For example, you could set: +```js +module.exports = { + dependencies: { + ['react-native-webview']: { + platforms: { + ios: null + } + } + } +} +``` +in order to disable linking of React Native WebView on iOS. + +The object provided here is deep merged with the dependency config. Check [`projectConfig`](platforms.md#projectconfig) and [`dependencyConfig`](platforms.md#dependencyConfig) return values for a full list of properties that you can override. + +> Note: This is an advanced feature and you should not need to use it mos of the time. + +## Migrating from `rnpm` configuration + +The changes are mostly cosmetic so the migration should be pretty straight-forward. + +### Changing the configuration + +Properties `ios` and `android` were moved under `project`. Take a look at the following example for the differences. + +```json +{ + "rnpm": { + "ios": {}, + "android": {}, + "assets": ["./path-to-assets"] + } +} +``` + +to a `react-native.config.js` + +```js +module.exports = { + project: { + ios: {}, + android: {}, + }, + assets: ['./path-to-assets'], +}; +``` + + + From 58b9143fc36da72646e5bc79ec56d7ce1d520a60 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 23:04:02 +0200 Subject: [PATCH 115/234] v2.0.0-alpha.15 --- lerna.json | 2 +- packages/cli/package.json | 6 +++--- packages/platform-android/package.json | 2 +- packages/platform-ios/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index 6d0b2d485..52accfef1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.14", + "version": "2.0.0-alpha.15", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 3c53766e0..ccb5b0e46 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.14", + "version": "2.0.0-alpha.15", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,8 +23,8 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.14", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.14", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.15", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.15", "@react-native-community/cli-tools": "^2.0.0-alpha.14", "chalk": "^1.1.1", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index a982bc3f1..2ea75c2a5 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.14", + "version": "2.0.0-alpha.15", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.0-alpha.14", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 20728f1f1..8068c6342 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.14", + "version": "2.0.0-alpha.15", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.0-alpha.14", From 477ecc9bdf974965771771600dc86f608564f618 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 23:18:22 +0200 Subject: [PATCH 116/234] fix: ignore undefined when renaming --- packages/cli/src/tools/config/schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 362a6eb3c..2991ccee6 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -27,7 +27,7 @@ const command = t.object({ .alternatives() .try([t.bool(), t.number(), t.string().allow(''), t.func()]), }) - .rename('command', 'name'), + .rename('command', 'name', {ignoreUndefined: true}), ), examples: t.array().items( t.object({ From 89a1420f3d302e2cc25beb51784b8b2ed8677109 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 23 Apr 2019 23:22:34 +0200 Subject: [PATCH 117/234] chore: update wording in docs --- docs/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index acff3c023..173f4df37 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -4,9 +4,9 @@ React Native CLI has a configuration mechanism that allows changing its behavior > Note: Configuring CLI used to be possible via `rn-cli.config.js` (that has been renamed to `metro.config.js`) and never documented `rnpm` entry on the `package.json`. We have provided migration guides where possible. -React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on a type of a package, this file can have a different set properties. +React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on the type of a package, the set of valid properties is different. -Check the documentation for: +Check the documentation for - [projects](./projects.md) - [dependencies](./dependencies.md) - [platforms](./platforms.md) From 53d8f78719436085132c6e6c0742a055017014d9 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Wed, 24 Apr 2019 10:56:31 +0200 Subject: [PATCH 118/234] chore: change `upgrade` to use new diff files approach (#348) * use diff files and dont rely on gh * lint * update snapshots * update link to diff table --- .../upgrade/__tests__/upgrade.test.js | 124 +++++++++--------- packages/cli/src/commands/upgrade/upgrade.js | 12 +- 2 files changed, 70 insertions(+), 66 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 1147d629a..f64b4c47e 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -159,16 +159,16 @@ test('fetches empty patch and installs deps', async () => { (fetch: any).mockImplementation(() => Promise.resolve('')); await upgrade.func([newVersion], ctx, opts); expect(flushOutput()).toMatchInlineSnapshot(` -"info Fetching diff between v0.57.8 and v0.58.4... -info Diff has no changes to apply, proceeding further -info Installing \\"react-native@0.58.4\\" and its peer dependencies... -$ execa npm info react-native@0.58.4 peerDependencies --json -$ yarn add react-native@0.58.4 react@16.6.3 -$ execa git add package.json -$ execa git add yarn.lock -$ execa git add package-lock.json -success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" -`); + "info Fetching diff between v0.57.8 and v0.58.4... + info Diff has no changes to apply, proceeding further + info Installing \\"react-native@0.58.4\\" and its peer dependencies... + $ execa npm info react-native@0.58.4 peerDependencies --json + $ yarn add react-native@0.58.4 react@16.6.3 + $ execa git add package.json + $ execa git add yarn.lock + $ execa git add package-lock.json + success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" + `); }, 60000); test('fetches regular patch, adds remote, applies patch, installs deps, removes remote,', async () => { @@ -184,24 +184,24 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes opts, ); expect(flushOutput()).toMatchInlineSnapshot(` -"info Fetching diff between v0.57.8 and v0.58.4... -[fs] write tmp-upgrade-rn.patch -$ execa git rev-parse --show-prefix -$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= -info Applying diff... -$ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= -[fs] unlink tmp-upgrade-rn.patch -$ execa git status -s -info Installing \\"react-native@0.58.4\\" and its peer dependencies... -$ execa npm info react-native@0.58.4 peerDependencies --json -$ yarn add react-native@0.58.4 react@16.6.3 -$ execa git add package.json -$ execa git add yarn.lock -$ execa git add package-lock.json -info Running \\"git status\\" to check what changed... -$ execa git status -success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" -`); + "info Fetching diff between v0.57.8 and v0.58.4... + [fs] write tmp-upgrade-rn.patch + $ execa git rev-parse --show-prefix + $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= + info Applying diff... + $ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= + [fs] unlink tmp-upgrade-rn.patch + $ execa git status -s + info Installing \\"react-native@0.58.4\\" and its peer dependencies... + $ execa npm info react-native@0.58.4 peerDependencies --json + $ yarn add react-native@0.58.4 react@16.6.3 + $ execa git add package.json + $ execa git add yarn.lock + $ execa git add package-lock.json + info Running \\"git status\\" to check what changed... + $ execa git status + success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" + `); expect( snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { contextLines: 1, @@ -216,24 +216,24 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes const config = {...ctx, root: '/project/root/NestedApp'}; await upgrade.func([newVersion], config, opts); expect(flushOutput()).toMatchInlineSnapshot(` -"info Fetching diff between v0.57.8 and v0.58.4... -[fs] write tmp-upgrade-rn.patch -$ execa git rev-parse --show-prefix -$ execa git apply --check tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ -info Applying diff... -$ execa git apply tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ -[fs] unlink tmp-upgrade-rn.patch -$ execa git status -s -info Installing \\"react-native@0.58.4\\" and its peer dependencies... -$ execa npm info react-native@0.58.4 peerDependencies --json -$ yarn add react-native@0.58.4 react@16.6.3 -$ execa git add package.json -$ execa git add yarn.lock -$ execa git add package-lock.json -info Running \\"git status\\" to check what changed... -$ execa git status -success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" -`); + "info Fetching diff between v0.57.8 and v0.58.4... + [fs] write tmp-upgrade-rn.patch + $ execa git rev-parse --show-prefix + $ execa git apply --check tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ + info Applying diff... + $ execa git apply tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ + [fs] unlink tmp-upgrade-rn.patch + $ execa git status -s + info Installing \\"react-native@0.58.4\\" and its peer dependencies... + $ execa npm info react-native@0.58.4 peerDependencies --json + $ yarn add react-native@0.58.4 react@16.6.3 + $ execa git add package.json + $ execa git add yarn.lock + $ execa git add package-lock.json + info Running \\"git status\\" to check what changed... + $ execa git status + success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" + `); }, 60000); test('cleans up if patching fails,', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); @@ -263,22 +263,22 @@ test('cleans up if patching fails,', async () => { ); } expect(flushOutput()).toMatchInlineSnapshot(` -"info Fetching diff between v0.57.8 and v0.58.4... -[fs] write tmp-upgrade-rn.patch -$ execa git rev-parse --show-prefix -$ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= -info Applying diff (excluding: package.json, .flowconfig)... -$ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way --directory= -error: .flowconfig: does not exist in index -error Automatically applying diff failed -[fs] unlink tmp-upgrade-rn.patch -$ execa git status -s -error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading -info You may find these resources helpful: -• Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 -• Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 -• Git diff: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4.diff" -`); + "info Fetching diff between v0.57.8 and v0.58.4... + [fs] write tmp-upgrade-rn.patch + $ execa git rev-parse --show-prefix + $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= + info Applying diff (excluding: package.json, .flowconfig)... + $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way --directory= + error: .flowconfig: does not exist in index + error Automatically applying diff failed + [fs] unlink tmp-upgrade-rn.patch + $ execa git status -s + error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading + info You may find these resources helpful: + • Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 + • Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/release/0.57.8..release/0.58.4 + • Git diff: https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.57.8..0.58.4.diff" + `); }, 60000); test('works with --name-ios and --name-android', async () => { (fetch: any).mockImplementation(() => Promise.resolve(samplePatch)); diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index f1da828c2..8f48537b8 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -16,6 +16,8 @@ type FlagsT = { const rnDiffPurgeUrl = 'https://github.com/react-native-community/rn-diff-purge'; +const rnDiffPurgeRawDiffsUrl = + 'https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs'; const getLatestRNVersion = async (): Promise => { logger.info('No version passed. Fetching latest...'); @@ -45,14 +47,16 @@ const getPatch = async (currentVersion, newVersion, config) => { try { patch = await fetch( - `${rnDiffPurgeUrl}/compare/version/${currentVersion}...version/${newVersion}.diff`, + `${rnDiffPurgeRawDiffsUrl}/${currentVersion}..${newVersion}.diff`, ); } catch (error) { logger.error( `Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?`, ); logger.info( - 'For available releases to diff see: https://github.com/react-native-community/rn-diff-purge#version-changes', + `For available releases to diff see: ${chalk.underline.dim( + 'https://github.com/react-native-community/rn-diff-purge#diff-table-full-table-here', + )}`, ); return null; } @@ -297,10 +301,10 @@ async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { `https://github.com/facebook/react-native/releases/tag/v${newVersion}`, )} • Comparison between versions: ${chalk.underline.dim( - `${rnDiffPurgeUrl}/compare/version/${currentVersion}..version/${newVersion}`, + `${rnDiffPurgeUrl}/compare/release/${currentVersion}..release/${newVersion}`, )} • Git diff: ${chalk.underline.dim( - `${rnDiffPurgeUrl}/compare/version/${currentVersion}..version/${newVersion}.diff`, + `${rnDiffPurgeRawDiffsUrl}/${currentVersion}..${newVersion}.diff`, )}`); throw new Error( From afa9680253426c214aeb390ba7c6fd8a645d817e Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Wed, 24 Apr 2019 20:33:31 +0200 Subject: [PATCH 119/234] feat: improve copying binary files in `init` (#353) --- packages/cli/package.json | 1 + packages/cli/src/tools/copyAndReplace.js | 8 ++---- yarn.lock | 34 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index ccb5b0e46..f86cbcfae 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -39,6 +39,7 @@ "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", + "istextorbinary": "^2.5.1", "joi": "^14.3.1", "lodash": "^4.17.5", "metro": "^0.53.1", diff --git a/packages/cli/src/tools/copyAndReplace.js b/packages/cli/src/tools/copyAndReplace.js index 1feb0e6f2..09deb7ad9 100644 --- a/packages/cli/src/tools/copyAndReplace.js +++ b/packages/cli/src/tools/copyAndReplace.js @@ -8,10 +8,7 @@ */ import fs from 'fs'; -import path from 'path'; - -// Binary files, don't process these (avoid decoding as utf8) -const binaryExtensions = ['.png', '.jar', '.keystore']; +import {isBinarySync} from 'istextorbinary'; /** * Copy a file to given destination, replacing parts of its contents. @@ -39,8 +36,7 @@ function copyAndReplace( return; } - const extension = path.extname(srcPath); - if (binaryExtensions.indexOf(extension) !== -1) { + if (isBinarySync(srcPath)) { // Binary file let shouldOverwrite = 'overwrite'; if (contentChangedCallback) { diff --git a/yarn.lock b/yarn.lock index c3750962c..820d64cb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2342,6 +2342,11 @@ binary@~0.3.0: buffers "~0.1.1" chainsaw "~0.1.0" +binaryextensions@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-2.1.2.tgz#c83c3d74233ba7674e4f313cb2a2b70f54e94b7c" + integrity sha512-xVNN69YGDghOqCCtA6FI7avYrr02mTJjOgB0/f1VPD3pJC8QEvjTKWc4epDx8AqxxA75NI0QpVM2gPJXUbE4Tg== + block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" @@ -3372,6 +3377,14 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +editions@^2.1.2, editions@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/editions/-/editions-2.1.3.tgz#727ccf3ec2c7b12dcc652c71000f16c4824d6f7d" + integrity sha512-xDZyVm0A4nLgMNWVVLJvcwMjI80ShiH/27RyLiCnW1L273TcJIA25C4pwJ33AWV01OX6UriP35Xu+lH4S7HWQw== + dependencies: + errlop "^1.1.1" + semver "^5.6.0" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -3407,6 +3420,13 @@ err-code@^1.0.0: resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= +errlop@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.1.1.tgz#d9ae4c76c3e64956c5d79e6e035d6343bfd62250" + integrity sha512-WX7QjiPHhsny7/PQvrhS5VMizXXKoKCS3udaBp8gjlARdbn+XmK300eKBAAN0hGyRaTCtRpOaxK+xFVPUJ3zkw== + dependencies: + editions "^2.1.2" + error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -5058,6 +5078,15 @@ istanbul-reports@^2.1.1: dependencies: handlebars "^4.1.0" +istextorbinary@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/istextorbinary/-/istextorbinary-2.5.1.tgz#14a33824cf6b9d5d7743eac1be2bd2c310d0ccbd" + integrity sha512-pv/JNPWnfpwGjPx7JrtWTwsWsxkrK3fNzcEVnt92YKEIErps4Fsk49+qzCe9iQF2hjqK8Naqf8P9kzoeCuQI1g== + dependencies: + binaryextensions "^2.1.2" + editions "^2.1.3" + textextensions "^2.4.0" + isurl@^1.0.0-alpha5: version "1.0.0" resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" @@ -8558,6 +8587,11 @@ text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" +textextensions@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.4.0.tgz#6a143a985464384cc2cff11aea448cd5b018e72b" + integrity sha512-qftQXnX1DzpSV8EddtHIT0eDDEiBF8ywhFYR2lI9xrGtxqKN+CvLXhACeCIGbCpQfxxERbrkZEFb8cZcDKbVZA== + throat@^4.0.0, throat@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" From 9315f05de2043fc49a6bbfdb1ef0ef6d0e4168d0 Mon Sep 17 00:00:00 2001 From: Orta Date: Thu, 25 Apr 2019 01:47:34 -0400 Subject: [PATCH 120/234] Update autolinking.md (#355) --- docs/autolinking.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index 23cde5620..4be45cde1 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -41,7 +41,7 @@ See implementation of [native_modules.gradle](https://github.com/react-native-co You’re already using Gradle, so Android support will work by default. -On the iOS side, you will need to ensure you have a Podspec to the root of your repo. The `react-native-webview` Podspec is a good example of a [`package.json`](https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec)-driven Podspec. +On the iOS side, you will need to ensure you have a Podspec to the root of your repo. The `react-native-webview` Podspec is a good example of a [`package.json`](https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec)-driven Podspec. Note that CocoaPods does not support having `/`s in the name of a dependency, so if you are using scoped packages - you may need to change the name for the Podspec. ## How can I customize how autolinking works for my package? From c1a8ec8861c84d1e650c19712e54f7dcf6acf745 Mon Sep 17 00:00:00 2001 From: Orta Date: Thu, 25 Apr 2019 10:15:30 -0400 Subject: [PATCH 121/234] [ios] Ensure that the right cwd is set up for auto-linking dependencies (#354) * [ios] Ensure that the right cwd is set up for auto-linking dependencies * [autolink] Switch to DIing in the root path as a param in to use_native_modules * [autolink] Docs for autolink root changes --- docs/autolinking.md | 2 ++ packages/platform-ios/native_modules.rb | 37 ++++++++++++++++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index 4be45cde1..c052d8232 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -29,6 +29,8 @@ The implementation ensures that a library is imported only once, so if you need See implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). +_Notes_: Auto-linking assumes your Podfile is in a sub-folder from your `package.json` - if this is not the case, use the first parameter to tell the linker where to find the `package.json` e.g. `use_native_modules!("../../")`. + ## Platform Android 1. At build time, before the build script is run, a first gradle plugin (`settings.gradle`) is ran that takes the package metadata from `react-native config` to dynamically include Android library projects into the build. diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index cff2a1b42..63d8c296e 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -1,7 +1,18 @@ -def use_native_modules!(packages = nil) +# This is a function which is used inside your Podfile. +# It uses `react-native config` to grab a list of dependencies, and pulls out.all of the ones +# which declare themselves to be iOS dependencies (via having a Podspec) and automatically +# imports those into your current target. +# +def use_native_modules!(root = "..", packages = nil) if (!packages) + # Resolve the CLI's main index file cli_bin = Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('@react-native-community/cli/build/index.js'))"], true).strip - output = Pod::Executable.execute_command("node", [cli_bin, "config"], true) + output = "" + # Make sure `react-native config` is ran from your project root + Dir.chdir(root) do + output = Pod::Executable.execute_command("node", [cli_bin, "config"], true) + end + json = [] output.each_line do |line| case line @@ -71,7 +82,7 @@ def use_native_modules!(packages = nil) end # You can run the tests for this file by running: -# $ ruby use_native_modules.rb +# $ ruby packages/platform-ios/native_modules.rb if $0 == __FILE__ require "minitest/spec" require "minitest/autorun" @@ -136,8 +147,8 @@ def pluralize(count) spec.singleton_class.send(:define_method, :name) { "ios-dep" } - podfile.singleton_class.send(:define_method, :use_native_modules) do |config| - use_native_modules!(config) + podfile.singleton_class.send(:define_method, :use_native_modules) do |path, config| + use_native_modules!('..', config) end Pod::Specification.singleton_class.send(:define_method, :from_file) do |podspec_path| @@ -167,7 +178,7 @@ def pluralize(count) end it "activates iOS pods" do - @podfile.use_native_modules(@config) + @podfile.use_native_modules('..', @config) @activated_pods.must_equal [{ name: "ios-dep", options: { path: @ios_package["root"] } @@ -178,7 +189,7 @@ def pluralize(count) activated_pod = Object.new activated_pod.singleton_class.send(:define_method, :name) { "ios-dep" } @current_target_definition_dependencies << activated_pod - @podfile.use_native_modules(@config) + @podfile.use_native_modules('..', @config) @activated_pods.must_equal [] end @@ -186,14 +197,14 @@ def pluralize(count) activated_pod = Object.new activated_pod.singleton_class.send(:define_method, :name) { "ios-dep/foo/bar" } @current_target_definition_dependencies << activated_pod - @podfile.use_native_modules(@config) + @podfile.use_native_modules('..', @config) @activated_pods.must_equal [] end it "prints out the native module pods that were found" do - @podfile.use_native_modules({}) - @podfile.use_native_modules({ "pkg-1" => @ios_package }) - @podfile.use_native_modules({ "pkg-1" => @ios_package, "pkg-2" => @ios_package }) + @podfile.use_native_modules('..', {}) + @podfile.use_native_modules('..', { "pkg-1" => @ios_package }) + @podfile.use_native_modules('..', { "pkg-1" => @ios_package, "pkg-2" => @ios_package }) @printed_messages.must_equal [ "Detected React Native module pod for ios-dep", "Detected React Native module pods for ios-dep, and ios-dep" @@ -203,7 +214,7 @@ def pluralize(count) describe "concerning script_phases" do it "uses the options directly" do @config["ios-dep"]["platforms"]["ios"]["scriptPhases"] = [@script_phase] - @podfile.use_native_modules(@config) + @podfile.use_native_modules('..', @config) @added_scripts.must_equal [{ "script" => "123", "name" => "My Name", @@ -221,7 +232,7 @@ def pluralize(count) file_read_mock.expect(:call, "contents from file", [File.join(@ios_package["root"], "some_shell_script.sh")]) File.stub(:read, file_read_mock) do - @podfile.use_native_modules(@config) + @podfile.use_native_modules('..', @config) end @added_scripts.must_equal [{ From 483003e5d6ad4769067bb12e6feb3790cd759046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 25 Apr 2019 16:17:49 +0200 Subject: [PATCH 122/234] v2.0.0-alpha.17 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 52accfef1..7cf6a6a66 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.15", + "version": "2.0.0-alpha.17", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index f86cbcfae..7a4b466a6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.15", + "version": "2.0.0-alpha.17", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.15", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.15", - "@react-native-community/cli-tools": "^2.0.0-alpha.14", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.17", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.17", + "@react-native-community/cli-tools": "^2.0.0-alpha.17", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 2ea75c2a5..c15269034 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.15", + "version": "2.0.0-alpha.17", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.14", + "@react-native-community/cli-tools": "^2.0.0-alpha.17", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 8068c6342..eddbd3258 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.15", + "version": "2.0.0-alpha.17", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.14", + "@react-native-community/cli-tools": "^2.0.0-alpha.17", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index a486f546f..37e4c326b 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.14", + "version": "2.0.0-alpha.17", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From dbe2fd867f2c3de9baca6c5c17250dc4d0beef20 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Fri, 26 Apr 2019 15:19:03 +0200 Subject: [PATCH 123/234] feat(breaking): remove legacy `library` command (#358) feat(breaking): remove legacy `library` command --- docs/commands.md | 15 ---- packages/cli/src/commands/index.js | 2 - packages/cli/src/commands/library/library.js | 78 -------------------- 3 files changed, 95 deletions(-) delete mode 100644 packages/cli/src/commands/library/library.js diff --git a/docs/commands.md b/docs/commands.md index f1a7a3246..dfdcd835f 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -7,7 +7,6 @@ React Native CLI comes with following commands: - [`init`](#init) - [`info`](#info) - [`install`](#install) -- [`library`](#library) - [`link`](#link) - [`log-android`](#log-android) - [`log-ios`](#log-ios) @@ -188,20 +187,6 @@ react-native install Installs single package from npm and then links native dependencies. If `install` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used. -### `library` - -Usage: - -```sh -react-native library -``` - -Generates a native library bridge. - -#### `--name ` - -Name of the library to generate. - ### `link` > Will be replaced by [autolinking](./autolinking.md) soon. diff --git a/packages/cli/src/commands/index.js b/packages/cli/src/commands/index.js index c76f1f2c9..6c56740c4 100644 --- a/packages/cli/src/commands/index.js +++ b/packages/cli/src/commands/index.js @@ -4,7 +4,6 @@ import {type CommandT} from 'types'; import server from './server/server'; -import library from './library/library'; import bundle from './bundle/bundle'; import ramBundle from './bundle/ramBundle'; import link from './link/link'; @@ -18,7 +17,6 @@ import init from './init'; export default ([ server, - library, bundle, ramBundle, link, diff --git a/packages/cli/src/commands/library/library.js b/packages/cli/src/commands/library/library.js deleted file mode 100644 index 0aa1b9fab..000000000 --- a/packages/cli/src/commands/library/library.js +++ /dev/null @@ -1,78 +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 - */ - -import fs from 'fs'; -import path from 'path'; -import copyAndReplace from '../../tools/copyAndReplace'; -import isValidPackageName from '../../tools/isValidPackageName'; -import walk from '../../tools/walk'; -import {logger} from '@react-native-community/cli-tools'; - -/** - * Creates a new native library with the given name - */ -async function library(argv, ctx, args) { - if (!isValidPackageName(args.name)) { - throw new Error( - `${args.name} is not a valid name for a project. Please use a valid ` + - 'identifier name (alphanumeric).', - ); - } - - const libraries = path.resolve(ctx.root, 'Libraries'); - const libraryDest = path.resolve(libraries, args.name); - const source = path.resolve( - 'node_modules', - 'react-native', - 'Libraries', - 'Sample', - ); - - if (!fs.existsSync(libraries)) { - fs.mkdirSync(libraries); - } - - if (fs.existsSync(libraryDest)) { - throw new Error(`Library already exists in ${libraryDest}`); - } - - walk(source).forEach(f => { - if ( - f.indexOf('project.xcworkspace') !== -1 || - f.indexOf('.xcodeproj/xcuserdata') !== -1 - ) { - return; - } - - const dest = path.relative( - source, - f.replace(/Sample/g, args.name).replace(/^_/, '.'), - ); - copyAndReplace(path.resolve(source, f), path.resolve(libraryDest, dest), { - Sample: args.name, - }); - }); - - logger.info(`Created library in ${libraryDest}. -Now it needs to be linked in Xcode: -https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content`); -} - -export default { - name: 'new-library', - func: library, - description: 'generates a native library bridge', - options: [ - { - name: '--name ', - description: 'name of the library to generate', - default: null, - }, - ], -}; From 267d3680d7bf4f70b5dcf13f061c47ac86604a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 29 Apr 2019 10:58:28 +0200 Subject: [PATCH 124/234] fix: init from url (#361) --- packages/cli/src/commands/init/init.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 19639c58f..80fe8079d 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -26,13 +26,14 @@ type Options = {| npm?: boolean, |}; -function adjustNameIfUrl(name) { +function adjustNameIfUrl(name, cwd) { // We use package manager to infer the name of the template module for us. // That's why we get it from temporary package.json, where the name is the // first and only dependency (hence 0). if (name.match(/https?:/)) { name = Object.keys( - JSON.parse(fs.readFileSync('./package.json', 'utf8')).dependencies, + JSON.parse(fs.readFileSync(path.join(cwd, './package.json'), 'utf8')) + .dependencies, )[0]; } return name; @@ -60,7 +61,7 @@ async function createFromExternalTemplate( loader.succeed(); loader.start('Copying template'); - name = adjustNameIfUrl(name); + name = adjustNameIfUrl(name, templateSourceDir); const templateConfig = getTemplateConfig(name, templateSourceDir); copyTemplate(name, templateConfig.templateDir, templateSourceDir); From 93e3eb687338b5ed4bbcbb9c91217a576ccdfcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 29 Apr 2019 11:37:17 +0200 Subject: [PATCH 125/234] feat: init from tarball (#362) * feat: init from tarball * adjust error message * skip flaky config test * update docs * update snapshots --- docs/commands.md | 9 ++++++++- docs/init.md | 1 + .../init/__tests__/templateName.test.js | 8 ++++++++ .../cli/src/commands/init/templateName.js | 20 +++++++++++++++++++ .../__snapshots__/index-test.js.snap | 4 ---- .../src/tools/config/__tests__/index-test.js | 3 ++- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/docs/commands.md b/docs/commands.md index dfdcd835f..7ba65c626 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -130,13 +130,20 @@ Uses a valid semver version of React Native as a template. #### `--template [string]` -Uses a custom template. Accepts either an npm package name or an absolute path to local directory. +Uses a custom template. Accepts following template sources: + +- an npm package name +- a shorthand name for packages prefixed with `react-native-template-` +- an absolute path to a local directory +- an absolute path to a tarball created using `npm pack` Example: ```sh react-native init MyApp --template react-native-custom-template +react-native init MyApp --template typescript react-native init MyApp --template file:///Users/name/template-path +react-native init MyApp --template file:///Users/name/template-name-1.0.0.tgz ``` A template is any directory or npm package that contains a `template.config.js` file in the root with following of the following type: diff --git a/docs/init.md b/docs/init.md index bbc4bdff5..8bd4e5d3b 100644 --- a/docs/init.md +++ b/docs/init.md @@ -36,6 +36,7 @@ In following examples `TEMPLATE_NAME` can be either: - Full package name, eg. `react-native-template-typescript`. - Shorthand name of template, eg. `typescript`. - Absolute path to directory containing template, eg. `file:///Users/username/project/some-template`. +- Absolute path to a tarball created using `npm pack`. ```sh # This will initialize new project using template from TEMPLATE_NAME package diff --git a/packages/cli/src/commands/init/__tests__/templateName.test.js b/packages/cli/src/commands/init/__tests__/templateName.test.js index 513d3c0cb..358bd76bd 100644 --- a/packages/cli/src/commands/init/__tests__/templateName.test.js +++ b/packages/cli/src/commands/init/__tests__/templateName.test.js @@ -7,6 +7,7 @@ jest.mock('../../../tools/fetch', () => ({fetch: jest.fn()})); const VERSION = '0.58.0'; const RN_WITH_VERSION = 'react-native@0.58.0'; const ABS_RN_PATH = '/path/to/react-native'; +const ABS_RN_TARBALL_PATH = '/path/to/react-native/react-native-1.2.3-rc.0.tgz'; const PACKAGE_NAME = 'react-native'; test('should support file protocol with absolute path', async () => { @@ -58,3 +59,10 @@ test('should get package if none protocols were handled', async () => { name: RN_WITH_VERSION, }); }); + +test('should support path to tgz archives', async () => { + expect(await processTemplateName(`file://${ABS_RN_TARBALL_PATH}`)).toEqual({ + uri: `file://${ABS_RN_TARBALL_PATH}`, + name: 'react-native', + }); +}); diff --git a/packages/cli/src/commands/init/templateName.js b/packages/cli/src/commands/init/templateName.js index 7692cf28c..e71351b26 100644 --- a/packages/cli/src/commands/init/templateName.js +++ b/packages/cli/src/commands/init/templateName.js @@ -5,6 +5,8 @@ import {fetch} from '../../tools/fetch'; const FILE_PROTOCOL = /file:/; const HTTP_PROTOCOL = /https?:/; +const TARBALL = /\.tgz$/; +const VERSION_POSTFIX = /(.*)(-\d+\.\d+\.\d+)/; function handleFileProtocol(filePath: string) { const uri = new URL(filePath).pathname; @@ -15,7 +17,25 @@ function handleFileProtocol(filePath: string) { }; } +function handleTarball(filePath: string) { + const nameWithVersion = path.parse(path.basename(filePath)).name; + const tarballVersionMatch = nameWithVersion.match(VERSION_POSTFIX); + if (!tarballVersionMatch) { + throw new Error( + `Failed to retrieve tarball name. We expect the tarball to include package name and version, e.g.: "template-name-1.2.3-rc.0.tgz", but received: "${nameWithVersion}".`, + ); + } + + return { + uri: filePath, + name: tarballVersionMatch[1], + }; +} + export async function processTemplateName(templateName: string) { + if (templateName.match(TARBALL)) { + return handleTarball(templateName); + } if (templateName.match(FILE_PROTOCOL)) { return handleFileProtocol(templateName); } diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 64d600ea5..75ec236d6 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -194,7 +194,3 @@ Object { }, } `; - -exports[`should skip packages that have invalid configuration: dependencies config 1`] = `Object {}`; - -exports[`should skip packages that have invalid configuration: logged warning 1`] = `"Package react-native has been ignored because it contains invalid configuration. Reason: Unknown option dependency.invalidProperty with value \\"5\\" was found. This is either a typing error or a user mistake. Fixing it will remove this message."`; diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index a3d75b472..bc4821f65 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -244,7 +244,8 @@ test('should not add default React Native config when one present', () => { expect(commands).toMatchSnapshot(); }); -test('should skip packages that have invalid configuration', () => { +// @todo: figure out why this test is so flaky +test.skip('should skip packages that have invalid configuration', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', 'node_modules/react-native/react-native.config.js': `module.exports = { From c7fe3a33ce9b764d1be5c2b1dc9ce8d192e08ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 30 Apr 2019 18:01:21 +0200 Subject: [PATCH 126/234] feat: copy all files in `init` through streams (#363) * feat: copy all files in init through streams * fix asynchrony * only replace file if necessary --- packages/cli/package.json | 1 - .../init/__tests__/editTemplate.test.js | 18 +++-- .../commands/init/__tests__/template.test.js | 4 +- .../cli/src/commands/init/editTemplate.js | 13 ++-- packages/cli/src/commands/init/init.js | 8 ++- packages/cli/src/commands/init/template.js | 4 +- packages/cli/src/tools/copyAndReplace.js | 8 ++- packages/cli/src/tools/copyFiles.js | 71 ++++++++++++++++--- yarn.lock | 34 --------- 9 files changed, 97 insertions(+), 64 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 7a4b466a6..4feb0411f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -39,7 +39,6 @@ "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", - "istextorbinary": "^2.5.1", "joi": "^14.3.1", "lodash": "^4.17.5", "metro": "^0.53.1", diff --git a/packages/cli/src/commands/init/__tests__/editTemplate.test.js b/packages/cli/src/commands/init/__tests__/editTemplate.test.js index f664d2557..f59c52abc 100644 --- a/packages/cli/src/commands/init/__tests__/editTemplate.test.js +++ b/packages/cli/src/commands/init/__tests__/editTemplate.test.js @@ -16,20 +16,28 @@ const FIXTURE_DIR = path.resolve( const PLACEHOLDER_NAME = 'PlaceholderName'; const PROJECT_NAME = 'ProjectName'; -function createTestEnv() { +async function createTestEnv() { const TEST_DIR = `rncli-should-edit-template-${Date.now()}`; const tmpDir = os.tmpdir(); const testPath = path.resolve(tmpDir, TEST_DIR); fs.mkdirSync(testPath); - copyFiles(FIXTURE_DIR, testPath); + await copyFiles(FIXTURE_DIR, testPath); return testPath; } -test('should edit template', () => { - const testPath = createTestEnv(); +let testPath; + +beforeEach(async () => { + testPath = await createTestEnv(); +}); +afterEach(() => { + fs.removeSync(testPath); +}); + +test('should edit template', () => { jest.spyOn(process, 'cwd').mockImplementation(() => testPath); changePlaceholderInTemplate(PROJECT_NAME, PLACEHOLDER_NAME); @@ -74,6 +82,4 @@ test('should edit template', () => { expect( snapshotDiff(fixtureTree, transformedTree, {contextLines: 1}), ).toMatchSnapshot(); - - fs.removeSync(testPath); }); diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js index 3c5542202..3af48b748 100644 --- a/packages/cli/src/commands/init/__tests__/template.test.js +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -56,7 +56,7 @@ test('getTemplateConfig', () => { ); }); -test('copyTemplate', () => { +test('copyTemplate', async () => { const TEMPLATE_DIR = 'some/dir'; const CWD = '.'; @@ -64,7 +64,7 @@ test('copyTemplate', () => { jest.spyOn(copyFiles, 'default').mockImplementationOnce(() => {}); jest.spyOn(process, 'cwd').mockImplementationOnce(() => CWD); - copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR, TEMPLATE_SOURCE_DIR); + await copyTemplate(TEMPLATE_NAME, TEMPLATE_DIR, TEMPLATE_SOURCE_DIR); expect(path.resolve).toHaveBeenCalledWith( TEMPLATE_SOURCE_DIR, diff --git a/packages/cli/src/commands/init/editTemplate.js b/packages/cli/src/commands/init/editTemplate.js index 10c0e9df3..a72ca07f3 100644 --- a/packages/cli/src/commands/init/editTemplate.js +++ b/packages/cli/src/commands/init/editTemplate.js @@ -1,5 +1,5 @@ // @flow -import fs from 'fs-extra'; +import fs from 'fs'; import path from 'path'; import walk from '../../tools/walk'; import {logger} from '@react-native-community/cli-tools'; @@ -10,16 +10,17 @@ function replaceNameInUTF8File( templateName: string, ) { logger.debug(`Replacing in ${filePath}`); - - const content = fs - .readFileSync(filePath, 'utf8') + const fileContent = fs.readFileSync(filePath, 'utf8'); + const replacedFileContent = fileContent .replace(new RegExp(templateName, 'g'), projectName) .replace( new RegExp(templateName.toLowerCase(), 'g'), projectName.toLowerCase(), ); - fs.writeFileSync(filePath, content, 'utf8'); + if (fileContent !== replacedFileContent) { + fs.writeFileSync(filePath, replacedFileContent, 'utf8'); + } } function renameFile(filePath: string, oldName: string, newName: string) { @@ -30,7 +31,7 @@ function renameFile(filePath: string, oldName: string, newName: string) { logger.debug(`Renaming ${filePath} -> file:${newFileName}`); - fs.moveSync(filePath, newFileName); + fs.renameSync(filePath, newFileName); } function shouldRenameFile(filePath: string, nameToReplace: string) { diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 80fe8079d..c3b306b71 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -63,7 +63,7 @@ async function createFromExternalTemplate( name = adjustNameIfUrl(name, templateSourceDir); const templateConfig = getTemplateConfig(name, templateSourceDir); - copyTemplate(name, templateConfig.templateDir, templateSourceDir); + await copyTemplate(name, templateConfig.templateDir, templateSourceDir); loader.succeed(); loader.start('Preparing template'); @@ -121,7 +121,11 @@ async function createFromReactNativeTemplate( loader.start('Copying template'); const templateConfig = getTemplateConfig(TEMPLATE_NAME, templateSourceDir); - copyTemplate(TEMPLATE_NAME, templateConfig.templateDir, templateSourceDir); + await copyTemplate( + TEMPLATE_NAME, + templateConfig.templateDir, + templateSourceDir, + ); loader.succeed(); loader.start('Processing template'); diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index b797b647e..8e2f9dede 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -40,7 +40,7 @@ export function getTemplateConfig( return require(configFilePath); } -export function copyTemplate( +export async function copyTemplate( templateName: string, templateDir: string, templateSourceDir: string, @@ -54,7 +54,7 @@ export function copyTemplate( logger.debug(`Copying template from ${templatePath}`); - copyFiles(templatePath, process.cwd()); + await copyFiles(templatePath, process.cwd()); } export function executePostInitScript( diff --git a/packages/cli/src/tools/copyAndReplace.js b/packages/cli/src/tools/copyAndReplace.js index 09deb7ad9..1feb0e6f2 100644 --- a/packages/cli/src/tools/copyAndReplace.js +++ b/packages/cli/src/tools/copyAndReplace.js @@ -8,7 +8,10 @@ */ import fs from 'fs'; -import {isBinarySync} from 'istextorbinary'; +import path from 'path'; + +// Binary files, don't process these (avoid decoding as utf8) +const binaryExtensions = ['.png', '.jar', '.keystore']; /** * Copy a file to given destination, replacing parts of its contents. @@ -36,7 +39,8 @@ function copyAndReplace( return; } - if (isBinarySync(srcPath)) { + const extension = path.extname(srcPath); + if (binaryExtensions.indexOf(extension) !== -1) { // Binary file let shouldOverwrite = 'overwrite'; if (contentChangedCallback) { diff --git a/packages/cli/src/tools/copyFiles.js b/packages/cli/src/tools/copyFiles.js index c94581f78..795f6862c 100644 --- a/packages/cli/src/tools/copyFiles.js +++ b/packages/cli/src/tools/copyFiles.js @@ -7,22 +7,75 @@ * @flow */ +import fs from 'fs'; import path from 'path'; -import copyAndReplace from './copyAndReplace'; import walk from './walk'; /** * Copy files (binary included) recursively. */ -function copyFiles(srcPath: string, destPath: string) { - walk(srcPath).forEach(absoluteSrcFilePath => { - const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); - copyAndReplace( - absoluteSrcFilePath, - path.resolve(destPath, relativeFilePath), - {}, // no replacements - ); +async function copyFiles(srcPath: string, destPath: string) { + return Promise.all( + walk(srcPath).map(async absoluteSrcFilePath => { + const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); + await copyFile( + absoluteSrcFilePath, + path.resolve(destPath, relativeFilePath), + ); + }), + ); +} + +/** + * Copy a file to given destination. + */ +function copyFile(srcPath: string, destPath: string) { + if (fs.lstatSync(srcPath).isDirectory()) { + if (!fs.existsSync(destPath)) { + fs.mkdirSync(destPath); + } + // Not recursive + return; + } + + return new Promise((resolve, reject) => { + copyBinaryFile(srcPath, destPath, err => { + if (err) { + reject(err); + } + resolve(destPath); + }); + }); +} + +/** + * Same as 'cp' on Unix. Don't do any replacements. + */ +function copyBinaryFile(srcPath, destPath, cb) { + let cbCalled = false; + // const {mode} = fs.statSync(srcPath); + const readStream = fs.createReadStream(srcPath); + const writeStream = fs.createWriteStream(destPath); + readStream.on('error', err => { + done(err); + }); + writeStream.on('error', err => { + done(err); + }); + readStream.on('close', () => { + done(); + // We may revisit setting mode to original later, however this fn is used + // before "replace placeholder in template" step, which expects files to be + // writable. + // fs.chmodSync(destPath, mode); }); + readStream.pipe(writeStream); + function done(err) { + if (!cbCalled) { + cb(err); + cbCalled = true; + } + } } export default copyFiles; diff --git a/yarn.lock b/yarn.lock index 820d64cb9..c3750962c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2342,11 +2342,6 @@ binary@~0.3.0: buffers "~0.1.1" chainsaw "~0.1.0" -binaryextensions@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-2.1.2.tgz#c83c3d74233ba7674e4f313cb2a2b70f54e94b7c" - integrity sha512-xVNN69YGDghOqCCtA6FI7avYrr02mTJjOgB0/f1VPD3pJC8QEvjTKWc4epDx8AqxxA75NI0QpVM2gPJXUbE4Tg== - block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" @@ -3377,14 +3372,6 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -editions@^2.1.2, editions@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/editions/-/editions-2.1.3.tgz#727ccf3ec2c7b12dcc652c71000f16c4824d6f7d" - integrity sha512-xDZyVm0A4nLgMNWVVLJvcwMjI80ShiH/27RyLiCnW1L273TcJIA25C4pwJ33AWV01OX6UriP35Xu+lH4S7HWQw== - dependencies: - errlop "^1.1.1" - semver "^5.6.0" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -3420,13 +3407,6 @@ err-code@^1.0.0: resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= -errlop@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.1.1.tgz#d9ae4c76c3e64956c5d79e6e035d6343bfd62250" - integrity sha512-WX7QjiPHhsny7/PQvrhS5VMizXXKoKCS3udaBp8gjlARdbn+XmK300eKBAAN0hGyRaTCtRpOaxK+xFVPUJ3zkw== - dependencies: - editions "^2.1.2" - error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -5078,15 +5058,6 @@ istanbul-reports@^2.1.1: dependencies: handlebars "^4.1.0" -istextorbinary@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/istextorbinary/-/istextorbinary-2.5.1.tgz#14a33824cf6b9d5d7743eac1be2bd2c310d0ccbd" - integrity sha512-pv/JNPWnfpwGjPx7JrtWTwsWsxkrK3fNzcEVnt92YKEIErps4Fsk49+qzCe9iQF2hjqK8Naqf8P9kzoeCuQI1g== - dependencies: - binaryextensions "^2.1.2" - editions "^2.1.3" - textextensions "^2.4.0" - isurl@^1.0.0-alpha5: version "1.0.0" resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" @@ -8587,11 +8558,6 @@ text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" -textextensions@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.4.0.tgz#6a143a985464384cc2cff11aea448cd5b018e72b" - integrity sha512-qftQXnX1DzpSV8EddtHIT0eDDEiBF8ywhFYR2lI9xrGtxqKN+CvLXhACeCIGbCpQfxxERbrkZEFb8cZcDKbVZA== - throat@^4.0.0, throat@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" From a851637bd8a8c423e959eb014a5b2823d7b4790b Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 6 May 2019 13:59:36 +0200 Subject: [PATCH 127/234] docs: add `maintainers` section (#369) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add `maintainers` section * Update README.md * Polacy nie gęsi, swój język mają xd --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 47ea151eb..aa36c7094 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,12 @@ You can also add npm scripts to call it with whichever package manager you use: } ``` +## Maintainers + +- Michał Pierzchała ([**@thymikee**](https://github.com/thymikee)) - [Callstack](https://callstack.com) +- Mike Grabowski ([**@grabbou**](https://github.com/grabbou)) - [Callstack](https://callstack.com) +- Kacper Wiszczuk ([**@esemesek**](https://github.com/esemesek)) - [Callstack](https://callstack.com) + ## License Everything inside this repository is [MIT licensed](./LICENSE). From 8ba322ebbaccd2d0ae7dece5859c1d1f99d49dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 6 May 2019 16:30:05 +0200 Subject: [PATCH 128/234] fix: refactor init for less duplication; fix handling versioned templates (#364) * chore: refactor init for less duplication * fix handling versioned packages * polish error messages a bit * support npm tags --- .../init/__tests__/templateName.test.js | 45 +++---- packages/cli/src/commands/init/init.js | 112 ++++++------------ .../cli/src/commands/init/templateName.js | 17 +++ 3 files changed, 75 insertions(+), 99 deletions(-) diff --git a/packages/cli/src/commands/init/__tests__/templateName.test.js b/packages/cli/src/commands/init/__tests__/templateName.test.js index 358bd76bd..db972581b 100644 --- a/packages/cli/src/commands/init/__tests__/templateName.test.js +++ b/packages/cli/src/commands/init/__tests__/templateName.test.js @@ -4,13 +4,10 @@ import {fetch} from '../../../tools/fetch'; jest.mock('../../../tools/fetch', () => ({fetch: jest.fn()})); -const VERSION = '0.58.0'; -const RN_WITH_VERSION = 'react-native@0.58.0'; +const RN_NPM_PACKAGE = 'react-native'; const ABS_RN_PATH = '/path/to/react-native'; -const ABS_RN_TARBALL_PATH = '/path/to/react-native/react-native-1.2.3-rc.0.tgz'; -const PACKAGE_NAME = 'react-native'; -test('should support file protocol with absolute path', async () => { +test('supports file protocol with absolute path', async () => { jest.mock( `${ABS_RN_PATH}/package.json`, () => ({ @@ -20,18 +17,11 @@ test('should support file protocol with absolute path', async () => { ); expect(await processTemplateName(`file://${ABS_RN_PATH}`)).toEqual({ uri: ABS_RN_PATH, - name: PACKAGE_NAME, + name: RN_NPM_PACKAGE, }); }); -test('should get default package if none protocols were handled', async () => { - expect(await processTemplateName(VERSION)).toEqual({ - uri: VERSION, - name: VERSION, - }); -}); - -test('should support shorthand templates', async () => { +test('supports shorthand templates', async () => { const templateName = 'typescript'; (fetch: any).mockImplementationOnce(() => { return Promise.resolve(`{"name": "react-native-template-${templateName}"}`); @@ -42,7 +32,7 @@ test('should support shorthand templates', async () => { }); }); -test('should support not-found shorthand templates', async () => { +test('supports not-found shorthand templates', async () => { const templateName = 'typescriptz'; (fetch: any).mockImplementationOnce(() => { return Promise.resolve('Not found'); @@ -53,14 +43,29 @@ test('should support not-found shorthand templates', async () => { }); }); -test('should get package if none protocols were handled', async () => { - expect(await processTemplateName(RN_WITH_VERSION)).toEqual({ - uri: RN_WITH_VERSION, - name: RN_WITH_VERSION, +test('supports npm packages as template names', async () => { + expect(await processTemplateName(RN_NPM_PACKAGE)).toEqual({ + uri: RN_NPM_PACKAGE, + name: RN_NPM_PACKAGE, }); }); -test('should support path to tgz archives', async () => { +test.each` + templateName | uri | name + ${'react-native@0.58.0'} | ${'react-native@0.58.0'} | ${'react-native'} + ${'some-name@latest'} | ${'some-name@latest'} | ${'some-name'} + ${'@scoped/name@0.58.0'} | ${'@scoped/name@0.58.0'} | ${'@scoped/name'} + ${'@scoped/name@tag'} | ${'@scoped/name@tag'} | ${'@scoped/name'} +`( + 'supports versioned npm package "$templateName" as template name', + async ({templateName, uri, name}) => { + expect(await processTemplateName(templateName)).toEqual({uri, name}); + }, +); + +test('supports path to tgz archives', async () => { + const ABS_RN_TARBALL_PATH = + '/path/to/react-native/react-native-1.2.3-rc.0.tgz'; expect(await processTemplateName(`file://${ABS_RN_TARBALL_PATH}`)).toEqual({ uri: `file://${ABS_RN_TARBALL_PATH}`, name: 'react-native', diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index c3b306b71..c88d4fddf 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -39,93 +39,45 @@ function adjustNameIfUrl(name, cwd) { return name; } -async function createFromExternalTemplate( +async function createFromTemplate({ + projectName, + templateName, + version, + npm, +}: { projectName: string, templateName: string, + version?: string, npm?: boolean, -) { - logger.debug('Initializing new project from external template'); +}) { + logger.debug('Initializing new project'); logger.log(banner); - const Loader = getLoader(); - const loader = new Loader({text: 'Downloading template'}); - loader.start(); - const templateSourceDir = fs.mkdtempSync( path.join(os.tmpdir(), 'rncli-init-template-'), ); - try { - let {uri, name} = await processTemplateName(templateName); - await installTemplatePackage(uri, templateSourceDir, npm); - loader.succeed(); - loader.start('Copying template'); - - name = adjustNameIfUrl(name, templateSourceDir); - const templateConfig = getTemplateConfig(name, templateSourceDir); - await copyTemplate(name, templateConfig.templateDir, templateSourceDir); - - loader.succeed(); - loader.start('Preparing template'); - changePlaceholderInTemplate(projectName, templateConfig.placeholderName); - - loader.succeed(); - const {postInitScript} = templateConfig; - if (postInitScript) { - // Leaving trailing space because there may be stdout from the script - loader.start('Executing post init script '); - await executePostInitScript(name, postInitScript, templateSourceDir); - loader.succeed(); - } - - loader.start('Installing all required dependencies'); - await PackageManager.installAll({preferYarn: !npm, silent: true}); - loader.succeed(); - } catch (e) { - loader.fail(); - throw new Error(e); - } finally { - fs.removeSync(templateSourceDir); + if (version && semver.valid(version) && !semver.gte(version, '0.60.0-rc.0')) { + throw new Error( + 'Cannot use React Native CLI to initialize project with version lower than 0.60.0.', + ); } -} -async function createFromReactNativeTemplate( - projectName: string, - version: string, - npm?: boolean, -) { - logger.debug('Initializing new project'); - logger.log(banner); - - const Loader = getLoader(); - const loader = new Loader({text: 'Downloading template'}); - loader.start(); - const templateSourceDir = fs.mkdtempSync( - path.join(os.tmpdir(), 'rncli-init-template-'), - ); try { - if (semver.valid(version) && !semver.gte(version, '0.60.0')) { - throw new Error( - 'Cannot use React Native CLI to initialize project with version lower than 0.60.0', - ); - } - - const TEMPLATE_NAME = 'react-native'; - - const {uri} = await processTemplateName(`${TEMPLATE_NAME}@${version}`); + loader.start(); + let {uri, name} = await processTemplateName( + version ? `${templateName}@${version}` : templateName, + ); await installTemplatePackage(uri, templateSourceDir, npm); loader.succeed(); loader.start('Copying template'); - const templateConfig = getTemplateConfig(TEMPLATE_NAME, templateSourceDir); - await copyTemplate( - TEMPLATE_NAME, - templateConfig.templateDir, - templateSourceDir, - ); + name = adjustNameIfUrl(name, templateSourceDir); + const templateConfig = getTemplateConfig(name, templateSourceDir); + await copyTemplate(name, templateConfig.templateDir, templateSourceDir); loader.succeed(); loader.start('Processing template'); @@ -135,12 +87,9 @@ async function createFromReactNativeTemplate( loader.succeed(); const {postInitScript} = templateConfig; if (postInitScript) { - loader.start('Executing post init script'); - await executePostInitScript( - TEMPLATE_NAME, - postInitScript, - templateSourceDir, - ); + // Leaving trailing space because there may be stdout from the script + loader.start('Executing post init script '); + await executePostInitScript(name, postInitScript, templateSourceDir); loader.succeed(); } @@ -160,14 +109,19 @@ function createProject(projectName: string, options: Options, version: string) { process.chdir(projectName); if (options.template) { - return createFromExternalTemplate( + return createFromTemplate({ projectName, - options.template, - options.npm, - ); + templateName: options.template, + npm: options.npm, + }); } - return createFromReactNativeTemplate(projectName, version, options.npm); + return createFromTemplate({ + projectName, + templateName: 'react-native', + version, + npm: options.npm, + }); } export default (async function initialize( diff --git a/packages/cli/src/commands/init/templateName.js b/packages/cli/src/commands/init/templateName.js index e71351b26..d2b8b7e98 100644 --- a/packages/cli/src/commands/init/templateName.js +++ b/packages/cli/src/commands/init/templateName.js @@ -7,6 +7,7 @@ const FILE_PROTOCOL = /file:/; const HTTP_PROTOCOL = /https?:/; const TARBALL = /\.tgz$/; const VERSION_POSTFIX = /(.*)(-\d+\.\d+\.\d+)/; +const VERSIONED_PACKAGE = /(@?.*)(@)(.*)/; function handleFileProtocol(filePath: string) { const uri = new URL(filePath).pathname; @@ -32,6 +33,19 @@ function handleTarball(filePath: string) { }; } +function handleVersionedPackage(versionedPackage: string) { + const versionedPackageMatch = versionedPackage.match(VERSIONED_PACKAGE); + if (!versionedPackageMatch) { + throw new Error( + `Failed to retrieve package name. We expect the package to include name and version, e.g.: "template-name@1.2.3-rc.0", but received: "${versionedPackage}".`, + ); + } + return { + uri: versionedPackage, + name: versionedPackageMatch[1], + }; +} + export async function processTemplateName(templateName: string) { if (templateName.match(TARBALL)) { return handleTarball(templateName); @@ -39,6 +53,9 @@ export async function processTemplateName(templateName: string) { if (templateName.match(FILE_PROTOCOL)) { return handleFileProtocol(templateName); } + if (templateName.match(VERSIONED_PACKAGE)) { + return handleVersionedPackage(templateName); + } const name = await tryTemplateShorthand(templateName); From 809aef93f20b676bcf6ede7a795cb9ff62c23cd9 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Mon, 6 May 2019 21:14:40 +0300 Subject: [PATCH 129/234] fix: reporter config option (#370) The `loadConfig` function in `metro-config` reads the `reporter` option from the second argument (`defaultConfigOverrides`) instead of the first argument (`argv`), so we need to pass it in that object to make the `customLogReporterPath` CLI option work. --- packages/cli/src/tools/loadMetroConfig.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index da713adfc..882dccfd5 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -82,6 +82,8 @@ export type ConfigOptionsT = {| */ export default function load(ctx: ConfigT, options?: ConfigOptionsT) { const defaultConfig = getDefaultConfig(ctx); - - return loadConfig({cwd: ctx.root, ...options}, defaultConfig); + return loadConfig( + {cwd: ctx.root, ...options}, + {...defaultConfig, reporter: options && options.reporter}, + ); } From 093ce51172fc751f8c7ae81d00dc51c05f8b7c9c Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Wed, 8 May 2019 15:15:48 -0400 Subject: [PATCH 130/234] chore: Update prettier config (#379) --- .prettierrc.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 50e441707..78d515160 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,5 +1,6 @@ -// added for Jest inline snapshots to not use default Prettier config module.exports = { + singleQuote: true, + trailingComma: 'all', bracketSpacing: false, - trailingComma: "all" -} + jsxBracketSameLine: true, +}; From c3ed10c0e2d5c7bfe68312093347fbf7e61aa7a7 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Wed, 8 May 2019 17:38:37 -0400 Subject: [PATCH 131/234] Use `require.resolve` to resolve package path (#378) * Use `require.resolve` to resolve package path * resolveNodeModule -> resolveNodeModuleDir --- .../config/__mocks__/resolveNodeModuleDir.js | 12 ++++++++++++ .../config/__tests__/findDependencies-test.js | 2 ++ .../src/tools/config/__tests__/index-test.js | 2 ++ packages/cli/src/tools/config/index.js | 5 +++-- .../src/tools/config/resolveNodeModuleDir.js | 19 +++++++++++++++++++ .../tools/config/resolveReactNativePath.js | 10 +++------- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 packages/cli/src/tools/config/__mocks__/resolveNodeModuleDir.js create mode 100644 packages/cli/src/tools/config/resolveNodeModuleDir.js diff --git a/packages/cli/src/tools/config/__mocks__/resolveNodeModuleDir.js b/packages/cli/src/tools/config/__mocks__/resolveNodeModuleDir.js new file mode 100644 index 000000000..d85dee2ae --- /dev/null +++ b/packages/cli/src/tools/config/__mocks__/resolveNodeModuleDir.js @@ -0,0 +1,12 @@ +/** + * @flow + */ + +const path = require('path'); + +export default function resolveNodeModuleDir( + root: string, + packageName: string, +): string { + return path.join(root, 'node_modules', packageName); +} diff --git a/packages/cli/src/tools/config/__tests__/findDependencies-test.js b/packages/cli/src/tools/config/__tests__/findDependencies-test.js index d807cad03..779aeeb19 100644 --- a/packages/cli/src/tools/config/__tests__/findDependencies-test.js +++ b/packages/cli/src/tools/config/__tests__/findDependencies-test.js @@ -10,6 +10,8 @@ import { getTempDirectory, } from '../../../../../../jest/helpers'; +jest.mock('../resolveNodeModuleDir'); + beforeEach(() => { cleanup(DIR); jest.resetModules(); diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index bc4821f65..5a1953b3a 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -12,6 +12,8 @@ import { import {logger} from '@react-native-community/cli-tools'; +jest.mock('../resolveNodeModuleDir'); + const DIR = getTempDirectory('resolve_config_path_test'); // Removes string from all key/values within an object diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index ad3be6707..9c402b84e 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -19,6 +19,7 @@ import {type ConfigT} from 'types'; import assign from '../assign'; import merge from '../merge'; +import resolveNodeModuleDir from './resolveNodeModuleDir'; /** * Built-in platforms */ @@ -34,10 +35,10 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { const finalConfig = findDependencies(projectRoot).reduce( (acc: ConfigT, dependencyName) => { - const root = path.join(projectRoot, 'node_modules', dependencyName); - + let root; let config; try { + root = resolveNodeModuleDir(projectRoot, dependencyName); config = readLegacyDependencyConfigFromDisk(root) || readDependencyConfigFromDisk(root); diff --git a/packages/cli/src/tools/config/resolveNodeModuleDir.js b/packages/cli/src/tools/config/resolveNodeModuleDir.js new file mode 100644 index 000000000..09a0e4917 --- /dev/null +++ b/packages/cli/src/tools/config/resolveNodeModuleDir.js @@ -0,0 +1,19 @@ +/** + * @flow + */ +import path from 'path'; + +/** + * Finds a path inside `node_modules` + */ +export default function resolveNodeModuleDir( + root: string, + packageName: string, +): string { + return path.dirname( + // $FlowIssue: Wrong `require.resolve` type definition + require.resolve(path.join(packageName, 'package.json'), { + paths: [root], + }), + ); +} diff --git a/packages/cli/src/tools/config/resolveReactNativePath.js b/packages/cli/src/tools/config/resolveReactNativePath.js index d814c2a6e..dbce4e5c8 100644 --- a/packages/cli/src/tools/config/resolveReactNativePath.js +++ b/packages/cli/src/tools/config/resolveReactNativePath.js @@ -1,21 +1,17 @@ /** * @flow */ -import path from 'path'; import {CLIError} from '@react-native-community/cli-tools'; +import resolveNodeModuleDir from './resolveNodeModuleDir'; + /** * Finds path to React Native inside `node_modules` or throws * an error otherwise. */ export default function resolveReactNativePath(root: string) { try { - return path.dirname( - // $FlowIssue: Wrong `require.resolve` type definition - require.resolve('react-native/package.json', { - paths: [root], - }), - ); + return resolveNodeModuleDir(root, 'react-native'); } catch (_ignored) { throw new CLIError(` Unable to find React Native files. Make sure "react-native" module is installed From bae68953cd6c257d67a3b8f2917a7d95a0786836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 10 May 2019 15:19:52 +0200 Subject: [PATCH 132/234] feat: improve `run-android` error messages; rename "installDebug" -> "task" (#372) * chore: cleanup run-android implementation * feat: overhaul gradle install errors * fix copying executables by bringing back chmod * rename 'installDebug' -> 'task' * cleanup unused args from refactor * use inherit and don't show null error * simplify creating gradle args * adjust descriptions * use logger * Add support for multiple tasks * Change function name to match current functionality * Change task to tasks --- docs/commands.md | 13 +- packages/cli/src/tools/copyFiles.js | 7 +- .../__tests__/runOnAllDevices.test.js | 52 +++---- .../src/commands/runAndroid/adb.js | 1 - .../src/commands/runAndroid/index.js | 90 +++++------ .../commands/runAndroid/runOnAllDevices.js | 140 ++++++++---------- .../runAndroid/tryLaunchAppOnDevice.js | 20 +-- .../commands/runAndroid/tryRunAdbReverse.js | 15 +- 8 files changed, 162 insertions(+), 176 deletions(-) diff --git a/docs/commands.md b/docs/commands.md index 7ba65c626..d6ae064bd 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -262,8 +262,6 @@ Builds your app and starts it on a connected Android emulator or device. #### Options -#### `--install-debug` - #### `--root [string]` Override the root directory for the Android build (which contains the android directory)'. @@ -272,6 +270,8 @@ Override the root directory for the Android build (which contains the android di > default: 'debug' +Specify your app's build variant. + #### `--appFolder [string]` > default: 'app' @@ -302,7 +302,7 @@ Do not launch packager while building. #### `--port [number]` -> default: process.env.RCT_METRO_PORT || 8081, +> default: process.env.RCT_METRO_PORT || 8081 #### `--terminal [string]` @@ -310,6 +310,13 @@ Do not launch packager while building. Launches the Metro Bundler in a new window using the specified terminal path. +#### `--tasks [list]` + +> default: 'installDebug' + +Run custom gradle tasks. If this argument is provided, then `--variant` option is ignored. +Example: `yarn react-native run-android --tasks clean,installDebug`. + ### `run-ios` Usage: diff --git a/packages/cli/src/tools/copyFiles.js b/packages/cli/src/tools/copyFiles.js index 795f6862c..6f8206a05 100644 --- a/packages/cli/src/tools/copyFiles.js +++ b/packages/cli/src/tools/copyFiles.js @@ -53,7 +53,7 @@ function copyFile(srcPath: string, destPath: string) { */ function copyBinaryFile(srcPath, destPath, cb) { let cbCalled = false; - // const {mode} = fs.statSync(srcPath); + const {mode} = fs.statSync(srcPath); const readStream = fs.createReadStream(srcPath); const writeStream = fs.createWriteStream(destPath); readStream.on('error', err => { @@ -64,10 +64,7 @@ function copyBinaryFile(srcPath, destPath, cb) { }); readStream.on('close', () => { done(); - // We may revisit setting mode to original later, however this fn is used - // before "replace placeholder in template" step, which expects files to be - // writable. - // fs.chmodSync(destPath, mode); + fs.chmodSync(destPath, mode); }); readStream.pipe(writeStream); function done(err) { diff --git a/packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js b/packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js index 840e5cb54..86cd9948b 100644 --- a/packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js +++ b/packages/platform-android/src/commands/runAndroid/__tests__/runOnAllDevices.test.js @@ -21,8 +21,10 @@ describe('--appFolder', () => { jest.clearAllMocks(); }); - it('uses installDebug as default if no arguments', () => { - runOnAllDevices({}); + it('uses task "install[Variant]" as default task', () => { + runOnAllDevices({ + variant: 'debug', + }); expect(execFileSync.mock.calls[0][1]).toContain('installDebug'); }); @@ -30,59 +32,51 @@ describe('--appFolder', () => { it('uses appFolder and default variant', () => { runOnAllDevices({ appFolder: 'someApp', + variant: 'debug', }); expect(execFileSync.mock.calls[0][1]).toContain('someApp:installDebug'); }); - it('uses appFolder and variant', () => { - runOnAllDevices({ - appFolder: 'app', - variant: 'debug', - }); - - expect(execFileSync.mock.calls[0][1]).toContain('app:installDebug'); - - runOnAllDevices({ - appFolder: 'anotherApp', - variant: 'debug', - }); - - expect(execFileSync.mock.calls[1][1]).toContain('anotherApp:installDebug'); - + it('uses appFolder and custom variant', () => { runOnAllDevices({ appFolder: 'anotherApp', variant: 'staging', }); - expect(execFileSync.mock.calls[2][1]).toContain( + expect(execFileSync.mock.calls[0][1]).toContain( 'anotherApp:installStaging', ); }); - it('uses appFolder and flavor', () => { + it('uses only task argument', () => { runOnAllDevices({ - appFolder: 'app', - flavor: 'someFlavor', + tasks: ['someTask'], + variant: 'debug', }); - expect(execFileSync.mock.calls[0][1]).toContain('app:installSomeFlavor'); + expect(execFileSync.mock.calls[0][1]).toContain('someTask'); }); - it('uses only installDebug argument', () => { + it('uses appFolder and custom task argument', () => { runOnAllDevices({ - installDebug: 'someCommand', + appFolder: 'anotherApp', + tasks: ['someTask'], + variant: 'debug', }); - expect(execFileSync.mock.calls[0][1]).toContain('someCommand'); + expect(execFileSync.mock.calls[0][1]).toContain('anotherApp:someTask'); }); - it('uses appFolder and custom installDebug argument', () => { + it('uses multiple tasks', () => { runOnAllDevices({ - appFolder: 'anotherApp', - installDebug: 'someCommand', + appFolder: 'app', + tasks: ['clean', 'someTask'], }); - expect(execFileSync.mock.calls[0][1]).toContain('anotherApp:someCommand'); + expect(execFileSync.mock.calls[0][1]).toContain( + 'app:clean', + 'app:someTask', + ); }); }); diff --git a/packages/platform-android/src/commands/runAndroid/adb.js b/packages/platform-android/src/commands/runAndroid/adb.js index d526829bc..c67f467c6 100644 --- a/packages/platform-android/src/commands/runAndroid/adb.js +++ b/packages/platform-android/src/commands/runAndroid/adb.js @@ -70,7 +70,6 @@ function getAvailableCPUs(adbPath: string, device: string): Array { } export default { - parseDevicesResult, getDevices, getAvailableCPUs, }; diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 09c7f71c5..096da3991 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -30,10 +30,24 @@ function checkAndroid(root) { return fs.existsSync(path.join(root, 'android/gradlew')); } +export type FlagsT = {| + tasks?: Array, + root: string, + variant: string, + appFolder: string, + appId: string, + appIdSuffix: string, + mainActivity: string, + deviceId?: string, + packager: boolean, + port: number, + terminal: string, +|}; + /** * Starts the app on a connected Android emulator or device. */ -function runAndroid(argv: Array, ctx: ConfigT, args: Object) { +function runAndroid(argv: Array, config: ConfigT, args: FlagsT) { if (!checkAndroid(args.root)) { logger.error( 'Android project not found. Are you sure this is a React Native project?', @@ -53,7 +67,7 @@ function runAndroid(argv: Array, ctx: ConfigT, args: Object) { } else { // result == 'not_running' logger.info('Starting JS server...'); - startServerInNewWindow(args.port, args.terminal, ctx.reactNativePath); + startServerInNewWindow(args.port, args.terminal, config.reactNativePath); } return buildAndRun(args); }); @@ -90,16 +104,13 @@ function buildAndRun(args) { const adbPath = getAdbPath(); if (args.deviceId) { - if (typeof args.deviceId === 'string') { - return runOnSpecificDevice( - args, - cmd, - packageNameWithSuffix, - packageName, - adbPath, - ); - } - logger.error('Argument missing for parameter --deviceId'); + return runOnSpecificDevice( + args, + cmd, + packageNameWithSuffix, + packageName, + adbPath, + ); } else { return runOnAllDevices( args, @@ -119,21 +130,20 @@ function runOnSpecificDevice( adbPath, ) { const devices = adb.getDevices(adbPath); - if (devices && devices.length > 0) { - if (devices.indexOf(args.deviceId) !== -1) { + const {deviceId} = args; + if (devices.length > 0 && deviceId) { + if (devices.indexOf(deviceId) !== -1) { buildApk(gradlew); installAndLaunchOnDevice( args, - args.deviceId, + deviceId, packageNameWithSuffix, packageName, adbPath, ); } else { logger.error( - `Could not find device with the id: "${ - args.deviceId - }". Choose one of the following:`, + `Could not find device with the id: "${deviceId}". Please choose one of the following:`, ...devices, ); } @@ -144,17 +154,13 @@ function runOnSpecificDevice( function buildApk(gradlew) { try { - logger.info('Building the app...'); - // using '-x lint' in order to ignore linting errors while building the apk - execFileSync(gradlew, ['build', '-x', 'lint'], { - stdio: [process.stdin, process.stdout, process.stderr], - }); + const gradleArgs = ['build', '-x', 'lint']; + logger.info('Building the app...'); + logger.debug(`Running command "${gradlew} ${gradleArgs.join(' ')}"`); + execFileSync(gradlew, gradleArgs, {stdio: 'inherit'}); } catch (error) { - throw new CLIError( - 'Could not build the app, read the error above for details', - error, - ); + throw new CLIError('Failed to build the app.', error); } } @@ -174,18 +180,13 @@ function tryInstallAppOnDevice(args, adbPath, device) { const pathToApk = `${buildDirectory}/${apkFile}`; const adbArgs = ['-s', device, 'install', '-r', '-d', pathToApk]; - logger.info( - `Installing the app on the device (cd android && adb -s ${device} install -r -d ${pathToApk}`, - ); - execFileSync(adbPath, adbArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - logger.error( - `${ - e.message - }\nCould not install the app on the device, read the error above for details.`, + logger.info(`Installing the app on the device "${device}"...`); + logger.debug( + `Running command "cd android && adb -s ${device} install -r -d ${pathToApk}"`, ); + execFileSync(adbPath, adbArgs, {stdio: 'inherit'}); + } catch (error) { + throw new CLIError('Failed to install the app on the device.', error); } } @@ -305,21 +306,15 @@ export default { 'builds your app and starts it on a connected Android emulator or device', func: runAndroid, options: [ - { - name: '--install-debug', - }, { name: '--root [string]', description: 'Override the root directory for the android build (which contains the android directory)', default: '', }, - { - name: '--flavor [string]', - description: '--flavor has been deprecated. Use --variant instead', - }, { name: '--variant [string]', + description: "Specify your app's build variant", default: 'debug', }, { @@ -364,5 +359,10 @@ export default { 'Launches the Metro Bundler in a new window using the specified terminal path.', default: getDefaultUserTerminal, }, + { + name: '--tasks [list]', + description: 'Run custom Gradle tasks. By default it\'s "installDebug"', + parse: (val: string) => val.split(','), + }, ], }; diff --git a/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js b/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js index 3eb59ae44..a4e9b2fff 100644 --- a/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js +++ b/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js @@ -7,103 +7,87 @@ * @flow */ -import {spawnSync, execFileSync} from 'child_process'; -import {logger} from '@react-native-community/cli-tools'; +import chalk from 'chalk'; +import {execFileSync} from 'child_process'; +import {logger, CLIError} from '@react-native-community/cli-tools'; import adb from './adb'; import tryRunAdbReverse from './tryRunAdbReverse'; import tryLaunchAppOnDevice from './tryLaunchAppOnDevice'; +import type {FlagsT} from '.'; -function getCommand(appFolder, command) { - return appFolder ? `${appFolder}:${command}` : command; +function getTaskNames( + appFolder: string, + commands: Array, +): Array { + return appFolder + ? commands.map(command => `${appFolder}:${command}`) + : commands; +} + +function toPascalCase(value: string) { + return value[0].toUpperCase() + value.slice(1); } function runOnAllDevices( - args: Object, + args: FlagsT, cmd: string, packageNameWithSuffix: string, packageName: string, adbPath: string, ) { try { - const gradleArgs = []; - - if (args.installDebug) { - gradleArgs.push(getCommand(args.appFolder, args.installDebug)); - } else if (args.variant) { - gradleArgs.push( - `${getCommand( - args.appFolder, - 'install', - )}${args.variant[0].toUpperCase()}${args.variant.slice(1)}`, - ); - } else if (args.flavor) { - logger.warn('--flavor has been deprecated. Use --variant instead'); - gradleArgs.push( - `${getCommand( - args.appFolder, - 'install', - )}${args.flavor[0].toUpperCase()}${args.flavor.slice(1)}`, - ); - } else { - gradleArgs.push(getCommand(args.appFolder, 'installDebug')); - } + const tasks = args.tasks || ['install' + toPascalCase(args.variant)]; + const gradleArgs = getTaskNames(args.appFolder, tasks); - logger.info( - `Building and installing the app on the device (cd android && ${cmd} ${gradleArgs.join( - ' ', - )})...`, + logger.info('Installing the app...'); + logger.debug( + `Running command "cd android && ${cmd} ${gradleArgs.join(' ')}"`, ); - execFileSync(cmd, gradleArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); - } catch (e) { - logger.error( - 'Could not install the app on the device, read the error above for details.\n' + - 'Make sure you have an Android emulator running or a device connected and have\n' + - 'set up your Android development environment:\n' + - 'https://facebook.github.io/react-native/docs/getting-started.html', - ); - // stderr is automatically piped from the gradle process, so the user - // should see the error already, there is no need to do - // `logger.info(e.stderr)` - return Promise.reject(e); + execFileSync(cmd, gradleArgs, {stdio: ['inherit', 'inherit', 'pipe']}); + } catch (error) { + throw createInstallError(error); } const devices = adb.getDevices(adbPath); - if (devices && devices.length > 0) { - devices.forEach(device => { - tryRunAdbReverse(args.port, device); - tryLaunchAppOnDevice( - device, - packageNameWithSuffix, - packageName, - adbPath, - args.mainActivity, - ); - }); - } else { - try { - // If we cannot execute based on adb devices output, fall back to - // shell am start - const fallbackAdbArgs = [ - 'shell', - 'am', - 'start', - '-n', - `${packageNameWithSuffix}/${packageName}.MainActivity`, - ]; - logger.info( - `Starting the app (${adbPath} ${fallbackAdbArgs.join(' ')}...`, - ); - spawnSync(adbPath, fallbackAdbArgs, {stdio: 'inherit'}); - } catch (e) { - logger.error('adb invocation failed. Do you have adb in your PATH?'); - // stderr is automatically piped from the gradle process, so the user - // should see the error already, there is no need to do - // `logger.info(e.stderr)` - return Promise.reject(e); - } + + (devices.length > 0 ? devices : [undefined]).forEach(device => { + tryRunAdbReverse(args.port, device); + tryLaunchAppOnDevice( + device, + packageNameWithSuffix, + packageName, + adbPath, + args.mainActivity, + ); + }); +} + +function createInstallError(error) { + const stderr = (error.stderr || '').toString(); + const docs = + 'https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment'; + let message = `Make sure you have the Android development environment set up: ${chalk.underline.dim( + docs, + )}`; + + // Pass the error message from the command to stdout because we pipe it to + // parent process so it's not visible + logger.log(stderr); + + // Handle some common failures and make the errors more helpful + if (stderr.includes('No connected devices')) { + message = + 'Make sure you have an Android emulator running or a device connected'; + } else if ( + stderr.includes('licences have not been accepted') || + stderr.includes('accept the SDK license') + ) { + message = `Please accept all necessary SDK licenses using SDK Manager: "${chalk.bold( + '$ANDROID_HOME/tools/bin/sdkmanager --licenses', + )}"`; } + + return new CLIError(`Failed to install the app. ${message}.`, error); } export default runOnAllDevices; diff --git a/packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js b/packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js index a2b88d021..4fd39fbec 100644 --- a/packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js +++ b/packages/platform-android/src/commands/runAndroid/tryLaunchAppOnDevice.js @@ -8,10 +8,10 @@ */ import {spawnSync} from 'child_process'; -import {logger} from '@react-native-community/cli-tools'; +import {logger, CLIError} from '@react-native-community/cli-tools'; function tryLaunchAppOnDevice( - device: string, + device?: string, packageNameWithSuffix: string, packageName: string, adbPath: string, @@ -19,20 +19,22 @@ function tryLaunchAppOnDevice( ) { try { const adbArgs = [ - '-s', - device, 'shell', 'am', 'start', '-n', `${packageNameWithSuffix}/${packageName}.${mainActivity}`, ]; - logger.info( - `Starting the app on ${device} (${adbPath} ${adbArgs.join(' ')})...`, - ); + if (device) { + adbArgs.unshift('-s', device); + logger.info(`Starting the app on "${device}"...`); + } else { + logger.info('Starting the app...'); + } + logger.debug(`Running command "${adbPath} ${adbArgs.join(' ')}"`); spawnSync(adbPath, adbArgs, {stdio: 'inherit'}); - } catch (e) { - logger.error('adb invocation failed. Do you have adb in your PATH?'); + } catch (error) { + throw new CLIError('Failed to start the app.', error); } } diff --git a/packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js b/packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js index 58c443b67..ffb021540 100644 --- a/packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js +++ b/packages/platform-android/src/commands/runAndroid/tryRunAdbReverse.js @@ -12,7 +12,7 @@ import {logger} from '@react-native-community/cli-tools'; import getAdbPath from './getAdbPath'; // Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager -function tryRunAdbReverse(packagerPort: number | string, device: string) { +function tryRunAdbReverse(packagerPort: number | string, device?: string) { try { const adbPath = getAdbPath(); const adbArgs = ['reverse', `tcp:${packagerPort}`, `tcp:${packagerPort}`]; @@ -22,13 +22,16 @@ function tryRunAdbReverse(packagerPort: number | string, device: string) { adbArgs.unshift('-s', device); } - logger.info(`Running ${adbPath} ${adbArgs.join(' ')}`); + logger.info('Connecting to the development server...'); + logger.debug(`Running command "${adbPath} ${adbArgs.join(' ')}"`); - execFileSync(adbPath, adbArgs, { - stdio: [process.stdin, process.stdout, process.stderr], - }); + execFileSync(adbPath, adbArgs, {stdio: 'inherit'}); } catch (e) { - logger.info(`Could not run adb reverse: ${e.message}`); + logger.warn( + `Failed to connect to development server using "adb reverse": ${ + e.message + }`, + ); } } From 1e60601fac5e5a6d5bd4a55b98ba73aa6c23633f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 10 May 2019 15:21:25 +0200 Subject: [PATCH 133/234] v2.0.0-alpha.18 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 7cf6a6a66..ee6ed131e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 4feb0411f..7a5aec501 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.17", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.17", - "@react-native-community/cli-tools": "^2.0.0-alpha.17", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.18", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.18", + "@react-native-community/cli-tools": "^2.0.0-alpha.18", "chalk": "^1.1.1", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index c15269034..e91c5503e 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.17", + "@react-native-community/cli-tools": "^2.0.0-alpha.18", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index eddbd3258..bb5ff7868 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.17", + "@react-native-community/cli-tools": "^2.0.0-alpha.18", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 37e4c326b..164906fde 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 23c52cfbd10d28912c0da7268ee0b28b7b116ef9 Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Sun, 12 May 2019 09:38:08 +0200 Subject: [PATCH 134/234] feat: automatically run `pod install` when running `init` command (#373) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Specify `.xcworkspace` on run instructions instead of `.xcodeproj` * Add `command-exists` package * Remove unneeded space after log message * Run `pod install` and check for cocoa pods when running `init` command * Put pods installation directly on `init` file and verify if `Podfile` exists before running * Revert change to space * Remove unneeded `console.log` * `cd` back to the directory after pod installation * Throw with `CLIError` instead of `Error` * Remove unneeded `try…catch` * Fix wrong uppercased word * Try to install `cocoapods` without sudo before trying with it * Run pods installation only on macOS * Check which extension for the project to print out on the run instructions for iOS * Use `fs` instead of `fs-extra` * Move `installPods` to separate file * Add missing `logger` import * Fix warnings on duplicated variable declaration * fixups --- packages/cli/package.json | 1 + packages/cli/src/commands/init/init.js | 29 ++++++- .../src/commands/init/printRunInstructions.js | 15 ++-- packages/cli/src/tools/installPods.js | 83 +++++++++++++++++++ yarn.lock | 5 ++ 5 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 packages/cli/src/tools/installPods.js diff --git a/packages/cli/package.json b/packages/cli/package.json index 7a5aec501..cb91643d3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -27,6 +27,7 @@ "@react-native-community/cli-platform-ios": "^2.0.0-alpha.18", "@react-native-community/cli-tools": "^2.0.0-alpha.18", "chalk": "^1.1.1", + "command-exists": "^1.2.8", "commander": "^2.19.0", "compression": "^1.7.1", "connect": "^3.6.5", diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index c88d4fddf..288214046 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -2,6 +2,7 @@ import os from 'os'; import path from 'path'; import fs from 'fs-extra'; +import Ora from 'ora'; import minimist from 'minimist'; import semver from 'semver'; import type {ConfigT} from 'types'; @@ -17,6 +18,7 @@ import { } from './template'; import {changePlaceholderInTemplate} from './editTemplate'; import * as PackageManager from '../../tools/packageManager'; +import installPods from '../../tools/installPods'; import {processTemplateName} from './templateName'; import banner from './banner'; import {getLoader} from '../../tools/loader'; @@ -93,9 +95,7 @@ async function createFromTemplate({ loader.succeed(); } - loader.start('Installing all required dependencies'); - await PackageManager.installAll({preferYarn: !npm, silent: true}); - loader.succeed(); + await installDependencies({projectName, npm, loader}); } catch (e) { loader.fail(); throw new Error(e); @@ -104,6 +104,29 @@ async function createFromTemplate({ } } +async function installDependencies({ + projectName, + npm, + loader, +}: { + projectName: string, + npm?: boolean, + loader: typeof Ora, +}) { + loader.start('Installing all required dependencies'); + + await PackageManager.installAll({ + preferYarn: !npm, + silent: true, + }); + + if (process.platform === 'darwin') { + await installPods({projectName, loader}); + } + + loader.succeed(); +} + function createProject(projectName: string, options: Options, version: string) { fs.mkdirSync(projectName); process.chdir(projectName); diff --git a/packages/cli/src/commands/init/printRunInstructions.js b/packages/cli/src/commands/init/printRunInstructions.js index 220c146fe..43258c85a 100644 --- a/packages/cli/src/commands/init/printRunInstructions.js +++ b/packages/cli/src/commands/init/printRunInstructions.js @@ -9,19 +9,22 @@ */ import path from 'path'; +import fs from 'fs'; import chalk from 'chalk'; import {logger} from '@react-native-community/cli-tools'; function printRunInstructions(projectDir: string, projectName: string) { const absoluteProjectDir = path.resolve(projectDir); - const xcodeProjectPath = `${path.resolve( - projectDir, - 'ios', - projectName, - )}.xcodeproj`; + const iosProjectDir = path.resolve(projectDir, 'ios'); + + const iosPodsFile = path.resolve(iosProjectDir, `${projectName}.xcworkspace`); + const isUsingPods = fs.existsSync(iosPodsFile); + const relativeXcodeProjectPath = path.relative( process.cwd(), - xcodeProjectPath, + isUsingPods + ? iosPodsFile + : path.resolve(iosProjectDir, `${projectName}.xcodeproj`), ); logger.log(` diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js new file mode 100644 index 000000000..d59b7781e --- /dev/null +++ b/packages/cli/src/tools/installPods.js @@ -0,0 +1,83 @@ +// @flow +import fs from 'fs-extra'; +import execa from 'execa'; +import chalk from 'chalk'; +import Ora from 'ora'; +import inquirer from 'inquirer'; +import commandExists from 'command-exists'; +import {logger} from '@react-native-community/cli-tools'; + +async function installPods({ + projectName, + loader, +}: { + projectName: string, + loader: typeof Ora, +}) { + try { + process.chdir('ios'); + + const hasPods = await fs.pathExists('Podfile'); + + if (!hasPods) { + return; + } + + try { + await commandExists('pod'); + } catch (e) { + loader.stop(); + + const {shouldInstallCocoaPods} = await inquirer.prompt([ + { + type: 'confirm', + name: 'shouldInstallCocoaPods', + message: 'CocoaPods is not installed, do you want to install it?', + }, + ]); + + if (shouldInstallCocoaPods) { + try { + // First attempt to install `cocoapods` + await execa('gem', ['install', 'cocoapods']); + } catch (_error) { + try { + // If that doesn't work then try with sudo + await execa('sudo', ['gem', 'install', 'cocoapods']); + } catch (error) { + logger.log(error.stderr); + + throw new Error( + `Error occured while trying to install CocoaPods, which is required by this template.\nPlease try again manually: "sudo gem install cocoapods".\nCocoaPods documentation: ${chalk.dim.underline( + 'https://cocoapods.org/', + )}`, + ); + } + } + + // This only shows when `CocoaPods` is automatically installed, + // if it's already installed then we just show the `Installing dependencies` step + loader.start('Installing CocoaPods dependencies'); + } + } + + try { + await execa('pod', ['install']); + } catch (error) { + // "pod" command outputs errors to stdout (at least some of them) + logger.log(error.stderr || error.stdout); + + throw new Error( + `Failed to install CocoaPods dependencies for iOS project, which is required by this template.\nPlease try again manually: "cd ./${projectName}/ios && pod install".\nCocoaPods documentation: ${chalk.dim.underline( + 'https://cocoapods.org/', + )}`, + ); + } + } catch (error) { + throw error; + } finally { + process.chdir('..'); + } +} + +export default installPods; diff --git a/yarn.lock b/yarn.lock index c3750962c..2b6b68669 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2787,6 +2787,11 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +command-exists@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291" + integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw== + commander@^2.19.0, commander@~2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" From c423d2031794b9a83424a8ac96290c5e4227647a Mon Sep 17 00:00:00 2001 From: Eric Lewis Date: Mon, 13 May 2019 06:22:31 -0400 Subject: [PATCH 135/234] Add openURLMiddleware (#383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add openURLMiddleware This allow’s react-native to open Chrome windows arbitrarily. * Upgrade open, add launchBrowser command. --- packages/cli/package.json | 2 +- .../cli/src/commands/server/launchBrowser.js | 22 ++++++++++++++++ .../cli/src/commands/server/launchChrome.js | 4 +-- .../server/middleware/MiddlewareManager.js | 2 ++ .../server/middleware/openURLMiddleware.js | 25 +++++++++++++++++++ yarn.lock | 9 ++++--- 6 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 packages/cli/src/commands/server/launchBrowser.js create mode 100644 packages/cli/src/commands/server/middleware/openURLMiddleware.js diff --git a/packages/cli/package.json b/packages/cli/package.json index cb91643d3..8a00a3559 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -51,7 +51,7 @@ "morgan": "^1.9.0", "node-fetch": "^2.2.0", "node-notifier": "^5.2.1", - "opn": "^3.0.2", + "open": "^6.2.0", "ora": "^3.4.0", "plist": "^3.0.0", "semver": "^5.0.3", diff --git a/packages/cli/src/commands/server/launchBrowser.js b/packages/cli/src/commands/server/launchBrowser.js new file mode 100644 index 000000000..06152765d --- /dev/null +++ b/packages/cli/src/commands/server/launchBrowser.js @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +import open from 'open'; +import {logger} from '@react-native-community/cli-tools'; + +function launchBrowser(url: string) { + open(url, err => { + if (err) { + logger.error('Browser exited with error:', err); + } + }); +} + +export default launchBrowser; diff --git a/packages/cli/src/commands/server/launchChrome.js b/packages/cli/src/commands/server/launchChrome.js index dfe045469..87d880a93 100644 --- a/packages/cli/src/commands/server/launchChrome.js +++ b/packages/cli/src/commands/server/launchChrome.js @@ -8,7 +8,7 @@ * @flow */ -import opn from 'opn'; +import open from 'open'; import {execSync} from 'child_process'; import {logger} from '@react-native-community/cli-tools'; @@ -45,7 +45,7 @@ function getChromeAppName(): string { } function launchChrome(url: string) { - opn(url, {app: [getChromeAppName()]}, err => { + open(url, {app: [getChromeAppName()]}, err => { if (err) { logger.error('Google Chrome exited with error:', err); } diff --git a/packages/cli/src/commands/server/middleware/MiddlewareManager.js b/packages/cli/src/commands/server/middleware/MiddlewareManager.js index a132b43b6..735554de7 100644 --- a/packages/cli/src/commands/server/middleware/MiddlewareManager.js +++ b/packages/cli/src/commands/server/middleware/MiddlewareManager.js @@ -20,6 +20,7 @@ import copyToClipBoardMiddleware from './copyToClipBoardMiddleware'; import getSecurityHeadersMiddleware from './getSecurityHeadersMiddleware'; import loadRawBodyMiddleware from './loadRawBodyMiddleware'; import openStackFrameInEditorMiddleware from './openStackFrameInEditorMiddleware'; +import openURLMiddleware from './openURLMiddleware'; import statusPageMiddleware from './statusPageMiddleware'; import systraceProfileMiddleware from './systraceProfileMiddleware'; import getDevToolsMiddleware from './getDevToolsMiddleware'; @@ -51,6 +52,7 @@ export default class MiddlewareManager { .use(compression()) .use('/debugger-ui', serveStatic(debuggerUIFolder)) .use(openStackFrameInEditorMiddleware(this.options)) + .use(openURLMiddleware) .use(copyToClipBoardMiddleware) .use(statusPageMiddleware) .use(systraceProfileMiddleware) diff --git a/packages/cli/src/commands/server/middleware/openURLMiddleware.js b/packages/cli/src/commands/server/middleware/openURLMiddleware.js new file mode 100644 index 000000000..fa0f716b3 --- /dev/null +++ b/packages/cli/src/commands/server/middleware/openURLMiddleware.js @@ -0,0 +1,25 @@ +/** + * 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 + */ + +import launchBrowser from '../launchBrowser'; +import {logger} from '@react-native-community/cli-tools'; + +/** + * Handle request from JS to open an arbitrary URL in Chrome + */ +export default function openURLMiddleware(req, res, next) { + if (req.url === '/open-url') { + const {url} = JSON.parse(req.rawBody); + logger.info(`Opening ${url}...`); + launchBrowser(url); + res.end('OK'); + } else { + next(); + } +} diff --git a/yarn.lock b/yarn.lock index 2b6b68669..7a5f9ec87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6828,11 +6828,12 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -opn@^3.0.2: - version "3.0.3" - resolved "http://registry.npmjs.org/opn/-/opn-3.0.3.tgz#b6d99e7399f78d65c3baaffef1fb288e9b85243a" +open@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/open/-/open-6.2.0.tgz#7cf92cb961b5d8498b071e64098bf5e27f57230c" + integrity sha512-Vxf6HJkwrqmvh9UAID3MnMYXntbTxKLOSfOnO7LJdzPf3NE3KQYFNV0/Lcz2VAndbRFil58XVCyh8tiX11fiYw== dependencies: - object-assign "^4.0.1" + is-wsl "^1.1.0" optimist@^0.6.1: version "0.6.1" From 6947ae28941359dc3bdcc19c7c23ea4882d70dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 13 May 2019 12:25:44 +0200 Subject: [PATCH 136/234] v2.0.0-alpha.19 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index ee6ed131e..d0c7402e4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.18", + "version": "2.0.0-alpha.19", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 8a00a3559..775f83f8f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.18", + "version": "2.0.0-alpha.19", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -23,9 +23,9 @@ "testEnvironment": "node" }, "dependencies": { - "@react-native-community/cli-platform-android": "^2.0.0-alpha.18", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.18", - "@react-native-community/cli-tools": "^2.0.0-alpha.18", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.19", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.19", + "@react-native-community/cli-tools": "^2.0.0-alpha.19", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index e91c5503e..aef283f84 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.18", + "version": "2.0.0-alpha.19", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.18", + "@react-native-community/cli-tools": "^2.0.0-alpha.19", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index bb5ff7868..197d3397c 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.18", + "version": "2.0.0-alpha.19", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.18", + "@react-native-community/cli-tools": "^2.0.0-alpha.19", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 164906fde..b68b7ade3 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.18", + "version": "2.0.0-alpha.19", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 7de5c3e1721a102975a639873769bd712c5ae13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 14 May 2019 12:30:37 +0200 Subject: [PATCH 137/234] fix: run "config" from react-native binary in autolinking scripts (#384) * fix: run "config" from react-native binary * use yarn run when necessary and fallback to accessing binary with Node * filter out non-json stuff in gradle implementation * use yarn --silent --- packages/platform-android/native_modules.gradle | 14 +++++++++++--- packages/platform-ios/native_modules.rb | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 3e925a62e..e7e00e20a 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -54,8 +54,8 @@ class ReactNativeModules { private ArrayList> reactNativeModules private static String LOG_PREFIX = ":ReactNative:" - private static String REACT_NATIVE_CLI_BIN = "node_modules${File.separator}@react-native-community${File.separator}cli${File.separator}build${File.separator}index.js" - private static String REACT_NATIVE_CONFIG_CMD = "node ${REACT_NATIVE_CLI_BIN} config" + private static String REACT_NATIVE_CONFIG_CMD = "yarn run --silent react-native config" + private static String REACT_NATIVE_CONFIG_CMD_FALLBACK = "node ./node_modules/.bin/react-native config" ReactNativeModules(Logger logger) { this.logger = logger @@ -173,9 +173,17 @@ class ReactNativeModules { ArrayList> reactNativeModules = new ArrayList>() def cmdProcess + def root = getReactNativeProjectRoot() + def command = REACT_NATIVE_CONFIG_CMD_FALLBACK try { - cmdProcess = Runtime.getRuntime().exec(REACT_NATIVE_CONFIG_CMD, null, getReactNativeProjectRoot()) + try { + // Check if project uses Yarn + def isYarnProject = Runtime.getRuntime().exec("node -e console.log(require.resolve('./yarn.lock'))", null, root) + isYarnProject.waitFor() + command = REACT_NATIVE_CONFIG_CMD + } catch(Exception exception) {} + cmdProcess = Runtime.getRuntime().exec(command, null, root) cmdProcess.waitFor() } catch (Exception exception) { this.logger.warn("${LOG_PREFIX}${exception.message}") diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index 63d8c296e..0df725e74 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -5,12 +5,20 @@ # def use_native_modules!(root = "..", packages = nil) if (!packages) - # Resolve the CLI's main index file - cli_bin = Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('@react-native-community/cli/build/index.js'))"], true).strip + command = "node" + args = ["./node_modules/.bin/react-native", "config"] + begin + # Check if project uses Yarn + Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('#{root}/yarn.lock'))"], true) + command = "yarn" + args = ["run", "--silent", "react-native", "config"] + rescue + end + output = "" # Make sure `react-native config` is ran from your project root Dir.chdir(root) do - output = Pod::Executable.execute_command("node", [cli_bin, "config"], true) + output = Pod::Executable.execute_command(command, args, true) end json = [] From 5612dde7ccd54f488a220722c6f06f10ee48c5df Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Wed, 15 May 2019 09:25:00 +0200 Subject: [PATCH 138/234] Improve CocoaPods prompt question when running `init` (#389) --- packages/cli/src/tools/installPods.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js index d59b7781e..a0b4dc2fc 100644 --- a/packages/cli/src/tools/installPods.js +++ b/packages/cli/src/tools/installPods.js @@ -32,7 +32,11 @@ async function installPods({ { type: 'confirm', name: 'shouldInstallCocoaPods', - message: 'CocoaPods is not installed, do you want to install it?', + message: `CocoaPods ${chalk.dim.underline( + '(https://cocoapods.org/)', + )} ${chalk.reset.bold( + "is not installed. It's necessary for iOS project to run correctly. Do you want to install it?", + )}`, }, ]); From a41b7a3198f8dca4cba5b9e10867f5b2e023a486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 15 May 2019 15:00:37 +0200 Subject: [PATCH 139/234] chore: upgrade joi to @hapi/joi to remove npm warnings (#388) --- packages/cli/package.json | 2 +- .../src/tools/config/readConfigFromDisk.js | 2 +- packages/cli/src/tools/config/schema.js | 2 +- yarn.lock | 62 +++++++++---------- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 775f83f8f..a33f8d8c9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -23,6 +23,7 @@ "testEnvironment": "node" }, "dependencies": { + "@hapi/joi": "^15.0.3", "@react-native-community/cli-platform-android": "^2.0.0-alpha.19", "@react-native-community/cli-platform-ios": "^2.0.0-alpha.19", "@react-native-community/cli-tools": "^2.0.0-alpha.19", @@ -40,7 +41,6 @@ "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", - "joi": "^14.3.1", "lodash": "^4.17.5", "metro": "^0.53.1", "metro-config": "^0.53.1", diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 130b37a04..dc2688fa9 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -3,7 +3,7 @@ * * Loads and validates a project configuration */ -import Joi from 'joi'; +import Joi from '@hapi/joi'; import cosmiconfig from 'cosmiconfig'; import path from 'path'; import chalk from 'chalk'; diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 2991ccee6..f5575fce5 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -1,7 +1,7 @@ /** * @flow */ -import t from 'joi'; +import t from '@hapi/joi'; const map = (key, value) => t diff --git a/yarn.lock b/yarn.lock index 7a5f9ec87..017639d86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -956,6 +956,32 @@ exec-sh "^0.3.2" minimist "^1.2.0" +"@hapi/address@2.x.x": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a" + integrity sha512-mV6T0IYqb0xL1UALPFplXYQmR0twnXG0M6jUswpquqT2sD12BOiCiLy3EvMp/Fy7s3DZElC4/aPjEjo2jeZpvw== + +"@hapi/hoek@6.x.x": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-6.2.1.tgz#d3a66329159af879bfdf0b0cff2229c43c5a3451" + integrity sha512-+ryw4GU9pjr1uT6lBuErHJg3NYqzwJTvZ75nKuJijEzpd00Uqi6oiawTGDDf5Hl0zWmI7qHfOtaqB0kpQZJQzA== + +"@hapi/joi@^15.0.3": + version "15.0.3" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.0.3.tgz#e94568fd859e5e945126d5675e7dd218484638a7" + integrity sha512-z6CesJ2YBwgVCi+ci8SI8zixoj8bGFn/vZb9MBPbSyoxsS2PnWYjHcyTM17VLK6tx64YVK38SDIh10hJypB+ig== + dependencies: + "@hapi/address" "2.x.x" + "@hapi/hoek" "6.x.x" + "@hapi/topo" "3.x.x" + +"@hapi/topo@3.x.x": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.0.tgz#5c47cd9637c2953db185aa957a27bcb2a8b7a6f8" + integrity sha512-gZDI/eXOIk8kP2PkUKjWu9RW8GGVd2Hkgjxyr/S7Z+JF+0mr7bAlbw+DkTRxnD580o8Kqxlnba9wvqp5aOHBww== + dependencies: + "@hapi/hoek" "6.x.x" + "@jest/console@^24.7.1": version "24.7.1" resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" @@ -4443,11 +4469,6 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -hoek@6.x.x: - version "6.1.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c" - integrity sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ== - home-or-tmp@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" @@ -4957,13 +4978,6 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isemail@3.x.x: - version "3.2.0" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c" - integrity sha512-zKqkK+O+dGqevc93KNsbZ/TqTUFd46MwWjYOoMrjIMZ51eU7DtQG3Wmd9SQQT7i7RVnuTPEiYEWHU3MSbxC1Tg== - dependencies: - punycode "2.x.x" - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -5469,15 +5483,6 @@ jest@^24.6.0: import-local "^2.0.0" jest-cli "^24.7.1" -joi@^14.3.1: - version "14.3.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c" - integrity sha512-LQDdM+pkOrpAn4Lp+neNIFV3axv1Vna3j38bisbQhETPMANYRbFJFUyOZcOClYvM/hppMhGWuKSFEK9vjrB+bQ== - dependencies: - hoek "6.x.x" - isemail "3.x.x" - topo "3.x.x" - js-levenshtein@^1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.4.tgz#3a56e3cbf589ca0081eb22cd9ba0b1290a16d26e" @@ -7409,15 +7414,15 @@ pumpify@^1.3.3: inherits "^2.0.3" pump "^2.0.0" -punycode@2.x.x, punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -8625,13 +8630,6 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -topo@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c" - integrity sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ== - dependencies: - hoek "6.x.x" - tough-cookie@^2.3.3, tough-cookie@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" From 6fb96af8d36987fb9f842c69b23f4bf3f97b853f Mon Sep 17 00:00:00 2001 From: yinhf Date: Wed, 15 May 2019 21:38:24 +0800 Subject: [PATCH 140/234] fix: config.reporter undefined bug (#376) * fix: config.reporter undefined bug * refactor * Update loadMetroConfig.js --- packages/cli/src/tools/loadMetroConfig.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 882dccfd5..08497faa0 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -82,8 +82,18 @@ export type ConfigOptionsT = {| */ export default function load(ctx: ConfigT, options?: ConfigOptionsT) { const defaultConfig = getDefaultConfig(ctx); - return loadConfig( - {cwd: ctx.root, ...options}, - {...defaultConfig, reporter: options && options.reporter}, - ); + if (options && options.reporter) { + /** + * $FlowIssue: Metro doesn't accept `reporter` to be passed along other options + * and will ignore the value, if provided. + * + * We explicitly read `reporter` value and set it on a default configuration. Note + * that all other options described in the `ConfigOptionsT` are handled by Metro + * automatically. + * + * This is a temporary workaround. + */ + defaultConfig.reporter = options.reporter; + } + return loadConfig({cwd: ctx.root, ...options}, defaultConfig); } From 875a025d6f84bb9fd9efb38db24e081dc6bc50e3 Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Wed, 15 May 2019 16:53:53 +0200 Subject: [PATCH 141/234] feat: automatically install pods in legacy init (#386) --- packages/cli/src/commands/init/initCompat.js | 8 ++++++++ packages/cli/src/tools/installPods.js | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/init/initCompat.js b/packages/cli/src/commands/init/initCompat.js index caf66b8c2..3116f130b 100644 --- a/packages/cli/src/commands/init/initCompat.js +++ b/packages/cli/src/commands/init/initCompat.js @@ -15,6 +15,7 @@ import printRunInstructions from './printRunInstructions'; import {createProjectFromTemplate} from '../../tools/generator/templates'; import * as PackageManager from '../../tools/packageManager'; import {logger} from '@react-native-community/cli-tools'; +import installPods from '../../tools/installPods'; /** * Creates the template for a React Native project given the provided @@ -76,6 +77,13 @@ async function generateProject(destinationRoot, newProjectName, options) { ]); addJestToPackageJson(destinationRoot); + + if (process.platform === 'darwin') { + logger.info('Installing required CocoaPods dependencies'); + + await installPods({projectName: newProjectName}); + } + printRunInstructions(destinationRoot, newProjectName); } diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js index a0b4dc2fc..88eed2522 100644 --- a/packages/cli/src/tools/installPods.js +++ b/packages/cli/src/tools/installPods.js @@ -12,7 +12,7 @@ async function installPods({ loader, }: { projectName: string, - loader: typeof Ora, + loader?: typeof Ora, }) { try { process.chdir('ios'); @@ -26,7 +26,9 @@ async function installPods({ try { await commandExists('pod'); } catch (e) { - loader.stop(); + if (loader) { + loader.stop(); + } const {shouldInstallCocoaPods} = await inquirer.prompt([ { @@ -61,7 +63,9 @@ async function installPods({ // This only shows when `CocoaPods` is automatically installed, // if it's already installed then we just show the `Installing dependencies` step - loader.start('Installing CocoaPods dependencies'); + if (loader) { + loader.start('Installing CocoaPods dependencies'); + } } } From 27b2b52aa44c0d227d4b363636f12a43b5d75065 Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Wed, 15 May 2019 17:03:39 +0200 Subject: [PATCH 142/234] feat: Show message if CocoaPods installation takes long (#390) * Add message that shows only if `cocoapods` installation take more than 30 seconds * adjustments --- packages/cli/src/tools/installPods.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js index 88eed2522..c5818d35b 100644 --- a/packages/cli/src/tools/installPods.js +++ b/packages/cli/src/tools/installPods.js @@ -7,6 +7,8 @@ import inquirer from 'inquirer'; import commandExists from 'command-exists'; import {logger} from '@react-native-community/cli-tools'; +const COCOAPODS_INSTALLATION_TIMEOUT = 30000; + async function installPods({ projectName, loader, @@ -43,6 +45,12 @@ async function installPods({ ]); if (shouldInstallCocoaPods) { + // Show a helpful notice when installation takes more than usually + const cocoaPodsInstallationTimeMessage = setTimeout( + () => + logger.info('Installing CocoaPods, this may take a few minutes'), + COCOAPODS_INSTALLATION_TIMEOUT, + ); try { // First attempt to install `cocoapods` await execa('gem', ['install', 'cocoapods']); @@ -59,6 +67,8 @@ async function installPods({ )}`, ); } + } finally { + clearTimeout(cocoaPodsInstallationTimeMessage); } // This only shows when `CocoaPods` is automatically installed, From 287fecfed8ed8f638805d4b0b6573b21175c6847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 15 May 2019 17:13:51 +0200 Subject: [PATCH 143/234] chore: bump lerna to latest --- package.json | 2 +- yarn.lock | 602 +++++++++++++++++++++++++++------------------------ 2 files changed, 322 insertions(+), 282 deletions(-) diff --git a/package.json b/package.json index 77f036c63..4993f4365 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "flow-typed": "^2.5.1", "glob": "^7.1.3", "jest": "^24.6.0", - "lerna": "^3.13.1", + "lerna": "^3.14.0", "metro-memory-fs": "^0.53.1", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", diff --git a/yarn.lock b/yarn.lock index 017639d86..42ac30ffd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1126,14 +1126,14 @@ "@types/istanbul-lib-coverage" "^2.0.0" "@types/yargs" "^12.0.9" -"@lerna/add@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.13.1.tgz#2cd7838857edb3b43ed73e3c21f69a20beb9b702" - integrity sha512-cXk42YbuhzEnADCK8Qte5laC9Qo03eJLVnr0qKY85jQUM/T4URe3IIUemqpg0CpVATrB+Vz+iNdeqw9ng1iALw== - dependencies: - "@lerna/bootstrap" "3.13.1" - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" +"@lerna/add@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.14.0.tgz#799d416e67d48c285967abf883be746557aefa48" + integrity sha512-Sa79Ju6HqF3heSVpBiYPNrGtuS56U/jMzVq4CcVvhNwB34USLrzJJncGFVcfnuUvsjKeFJv+jHxUycHeRE8XYw== + dependencies: + "@lerna/bootstrap" "3.14.0" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" "@lerna/npm-conf" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" @@ -1142,32 +1142,31 @@ pacote "^9.5.0" semver "^5.5.0" -"@lerna/batch-packages@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.13.0.tgz#697fde5be28822af9d9dca2f750250b90a89a000" - integrity sha512-TgLBTZ7ZlqilGnzJ3xh1KdAHcySfHytgNRTdG9YomfriTU6kVfp1HrXxKJYVGs7ClPUNt2CTFEOkw0tMBronjw== +"@lerna/batch-packages@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.14.0.tgz#0208663bab3ddbf57956b370aaec4c9ebee6c800" + integrity sha512-RlBkQVNTqk1qvn6PFWiWNiskllUHh6tXbTVm43mZRNd+vhAyvrQC8RWJxH0ECVvnFAt9rSNGRIVbEJ31WnNQLg== dependencies: - "@lerna/package-graph" "3.13.0" - "@lerna/validation-error" "3.13.0" + "@lerna/package-graph" "3.14.0" npmlog "^4.1.2" -"@lerna/bootstrap@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.13.1.tgz#f2edd7c8093c8b139e78b0ca5f845f23efd01f08" - integrity sha512-mKdi5Ds5f82PZwEFyB9/W60I3iELobi1i87sTeVrbJh/um7GvqpSPy7kG/JPxyOdMpB2njX6LiJgw+7b6BEPWw== - dependencies: - "@lerna/batch-packages" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" - "@lerna/has-npm-version" "3.13.0" - "@lerna/npm-install" "3.13.0" - "@lerna/package-graph" "3.13.0" +"@lerna/bootstrap@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.14.0.tgz#dde35eac0a912097033e1daea237a50e5c3cb75b" + integrity sha512-AvnuDp8b0kX4zZgqD3v7ItPABhUsN5CmTEvZBD2JqM+xkQKhzCfz5ABcHEwDwOPWnNQmtH+/2iQdwaD7xBcAXw== + dependencies: + "@lerna/batch-packages" "3.14.0" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" + "@lerna/has-npm-version" "3.13.3" + "@lerna/npm-install" "3.13.3" + "@lerna/package-graph" "3.14.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.13.0" - "@lerna/run-lifecycle" "3.13.0" + "@lerna/rimraf-dir" "3.13.3" + "@lerna/run-lifecycle" "3.14.0" "@lerna/run-parallel-batches" "3.13.0" - "@lerna/symlink-binary" "3.13.0" - "@lerna/symlink-dependencies" "3.13.0" + "@lerna/symlink-binary" "3.14.0" + "@lerna/symlink-dependencies" "3.14.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" get-port "^3.2.0" @@ -1181,44 +1180,45 @@ read-package-tree "^5.1.6" semver "^5.5.0" -"@lerna/changed@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.13.1.tgz#dc92476aad43c932fe741969bbd0bcf6146a4c52" - integrity sha512-BRXitEJGOkoudbxEewW7WhjkLxFD+tTk4PrYpHLyCBk63pNTWtQLRE6dc1hqwh4emwyGncoyW6RgXfLgMZgryw== +"@lerna/changed@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.14.0.tgz#b3cff6e5d9f1b0c46fb66ede3e95b12ca3b6038f" + integrity sha512-K8PG1iSYhfVt09yQIteO/qwWBIGTeukYx93LQjiTyC8IqLEvjByajN9YH4Gpu1ADKCHeChlwnCHr+2UwQkm0RQ== dependencies: - "@lerna/collect-updates" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/listable" "3.13.0" + "@lerna/collect-updates" "3.14.0" + "@lerna/command" "3.14.0" + "@lerna/listable" "3.14.0" "@lerna/output" "3.13.0" - "@lerna/version" "3.13.1" + "@lerna/version" "3.14.0" -"@lerna/check-working-tree@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.13.0.tgz#1ddcd4d9b1aceb65efaaa4cd1333a66706d67c9c" - integrity sha512-dsdO15NXX5To+Q53SYeCrBEpiqv4m5VkaPZxbGQZNwoRen1MloXuqxSymJANQn+ZLEqarv5V56gydebeROPH5A== +"@lerna/check-working-tree@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.14.0.tgz#b37c35376b176fa2378a13f009a7575ea0c73bea" + integrity sha512-8PIy2Ia02a0OKES1TiktTIxovzJaFqJcJujBbjjjxaFsXbvSgKp8x1oEHuGIWqPogcxWrmzNd8KAqQMc7iespw== dependencies: - "@lerna/describe-ref" "3.13.0" + "@lerna/collect-uncommitted" "3.14.0" + "@lerna/describe-ref" "3.13.3" "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.13.0.tgz#84e35adf3217a6983edd28080657b9596a052674" - integrity sha512-0iDS8y2jiEucD4fJHEzKoc8aQJgm7s+hG+0RmDNtfT0MM3n17pZnf5JOMtS1FJp+SEXOjMKQndyyaDIPFsnp6A== +"@lerna/child-process@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.13.3.tgz#6c084ee5cca9fc9e04d6bf4fc3f743ed26ff190c" + integrity sha512-3/e2uCLnbU+bydDnDwyadpOmuzazS01EcnOleAnuj9235CU2U97DH6OyoG1EW/fU59x11J+HjIqovh5vBaMQjQ== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.13.1.tgz#9a7432efceccd720a51da5c76f849fc59c5a14ce" - integrity sha512-myGIaXv7RUO2qCFZXvx8SJeI+eN6y9SUD5zZ4/LvNogbOiEIlujC5lUAqK65rAHayQ9ltSa/yK6Xv510xhZXZQ== +"@lerna/clean@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.14.0.tgz#4399f4a3289106b0b8ffbffd4a6cfd2e3fe935f2" + integrity sha512-wEuAqOS9VMqh2C20KD63IySzyEnyVDqDI3LUsXw+ByUf9AJDgEHv0TCOxbDjDYaaQw1tjSBNZMyYInNeoASwhA== dependencies: - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.13.0" + "@lerna/rimraf-dir" "3.13.3" p-map "^1.2.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" @@ -1233,24 +1233,32 @@ npmlog "^4.1.2" yargs "^12.0.1" -"@lerna/collect-updates@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.13.0.tgz#f0828d84ff959ff153d006765659ffc4d68cdefc" - integrity sha512-uR3u6uTzrS1p46tHQ/mlHog/nRJGBqskTHYYJbgirujxm6FqNh7Do+I1Q/7zSee407G4lzsNxZdm8IL927HemQ== +"@lerna/collect-uncommitted@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.14.0.tgz#7fb4f1eee205de4168aba5218ac81cfc9aeeff9c" + integrity sha512-ermeTGemXEBx1buBDjvQT7ghN32rgOm7nbdxq+TvwVOS52F/c1QVsvN3xu/ZJVMBFXug72cnbJeaHCddl0zhIw== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/describe-ref" "3.13.0" + "@lerna/child-process" "3.13.3" + chalk "^2.3.1" + +"@lerna/collect-updates@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.14.0.tgz#64d64ff1ec05ac53dfe6851be49d2ad261e6795e" + integrity sha512-siRHo2atAwj5KpKVOo6QTVIYDYbNs7dzTG6ow9VcFMLKX5shuaEyFA22Z3LmnxQ3sakVFdgvvVeediEz6cM3VA== + dependencies: + "@lerna/child-process" "3.13.3" + "@lerna/describe-ref" "3.13.3" minimatch "^3.0.4" npmlog "^4.1.2" slash "^1.0.0" -"@lerna/command@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.13.1.tgz#b60dda2c0d9ffbb6030d61ddf7cceedc1e8f7e6e" - integrity sha512-SYWezxX+iheWvzRoHCrbs8v5zHPaxAx3kWvZhqi70vuGsdOVAWmaG4IvHLn11ztS+Vpd5PM+ztBWSbnykpLFKQ== +"@lerna/command@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.14.0.tgz#5f5e68293c0ff1e85a20b4e96fa6bea33b7632df" + integrity sha512-PtFi5EtXB2VuSruoLsjfZdus56d7oKlZAI4iSRoaS/BBxE2Wyfn7//vW7Ow4hZCzuqb9tBcpDq+4u2pdXN1d2Q== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/package-graph" "3.13.0" + "@lerna/child-process" "3.13.3" + "@lerna/package-graph" "3.14.0" "@lerna/project" "3.13.1" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" @@ -1260,10 +1268,10 @@ lodash "^4.17.5" npmlog "^4.1.2" -"@lerna/conventional-commits@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.13.0.tgz#877aa225ca34cca61c31ea02a5a6296af74e1144" - integrity sha512-BeAgcNXuocmLhPxnmKU2Vy8YkPd/Uo+vu2i/p3JGsUldzrPC8iF3IDxH7fuXpEFN2Nfogu7KHachd4tchtOppA== +"@lerna/conventional-commits@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.14.0.tgz#24f643550dc29d4f1249cc26d0eb453d7a1c513d" + integrity sha512-hGZ2qQZ9uEGf2eeIiIpEodSs9Qkkf/2uYEtNT7QN1RYISPUh6/lKGBssc5dpbCF64aEuxmemWLdlDf1ogG6++w== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" @@ -1276,22 +1284,22 @@ pify "^3.0.0" semver "^5.5.0" -"@lerna/create-symlink@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.13.0.tgz#e01133082fe040779712c960683cb3a272b67809" - integrity sha512-PTvg3jAAJSAtLFoZDsuTMv1wTOC3XYIdtg54k7uxIHsP8Ztpt+vlilY/Cni0THAqEMHvfiToel76Xdta4TU21Q== +"@lerna/create-symlink@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.14.0.tgz#f40ae06e8cebe70c694368ebf9a4af5ab380fbea" + integrity sha512-Kw51HYOOi6UfCKncqkgEU1k/SYueSBXgkNL91FR8HAZH7EPSRTEtp9mnJo568g0+Hog5C+3cOaWySwhHpRG29A== dependencies: cmd-shim "^2.0.2" fs-extra "^7.0.0" npmlog "^4.1.2" -"@lerna/create@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.13.1.tgz#2c1284cfdc59f0d2b88286d78bc797f4ab330f79" - integrity sha512-pLENMXgTkQuvKxAopjKeoLOv9fVUCnpTUD7aLrY5d95/1xqSZlnsOcQfUYcpMf3GpOvHc8ILmI5OXkPqjAf54g== +"@lerna/create@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.14.0.tgz#ec7a0d4aa81e60c918ea2ba06f3c71ee2855a936" + integrity sha512-J4PeGnzVBOSV7Cih8Uhv9xIauljR9bGcfSDN9aMzFtJhSX0xFXNvmnpXRORp7xNHV2lbxk7mNxRQxzR9CQRMuw== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/command" "3.13.1" + "@lerna/child-process" "3.13.3" + "@lerna/command" "3.14.0" "@lerna/npm-conf" "3.13.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" @@ -1309,42 +1317,42 @@ validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.13.0.tgz#fb4c3863fd6bcccad67ce7b183887a5fc1942bb6" - integrity sha512-UJefF5mLxLae9I2Sbz5RLYGbqbikRuMqdgTam0MS5OhXnyuuKYBUpwBshCURNb1dPBXTQhSwc7+oUhORx8ojCg== +"@lerna/describe-ref@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.13.3.tgz#13318513613f6a407d37fc5dc025ec2cfb705606" + integrity sha512-5KcLTvjdS4gU5evW8ESbZ0BF44NM5HrP3dQNtWnOUSKJRgsES8Gj0lq9AlB2+YglZfjEftFT03uOYOxnKto4Uw== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" npmlog "^4.1.2" -"@lerna/diff@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.13.1.tgz#5c734321b0f6c46a3c87f55c99afef3b01d46520" - integrity sha512-cKqmpONO57mdvxtp8e+l5+tjtmF04+7E+O0QEcLcNUAjC6UR2OSM77nwRCXDukou/1h72JtWs0jjcdYLwAmApg== +"@lerna/diff@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.14.0.tgz#a4860c062faf990dd3c208dcf1c6fbde5a042bdb" + integrity sha512-H6FSj0jOiQ6unVCwOK6ReT5uZN6ZIn/j/cx4YwuOtU3SMcs3UfuQRIFNeKg/tKmOcQGd39Mn9zDhmt3TAYGROA== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/command" "3.13.1" + "@lerna/child-process" "3.13.3" + "@lerna/command" "3.14.0" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.13.1.tgz#4439e90fb0877ec38a6ef933c86580d43eeaf81b" - integrity sha512-I34wEP9lrAqqM7tTXLDxv/6454WFzrnXDWpNDbiKQiZs6SIrOOjmm6I4FiQsx+rU3o9d+HkC6tcUJRN5mlJUgA== +"@lerna/exec@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.14.0.tgz#da632dac4a86d59f7fe8c566af8648f8272241ff" + integrity sha512-cNFO8hWsBVLeqVQ7LsQ4rYKbbQ2eN+Ne+hWKTlUQoyRbYzgJ22TXhjKR6IMr68q0xtclcDlasfcNO+XEWESh0g== dependencies: - "@lerna/batch-packages" "3.13.0" - "@lerna/child-process" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" - "@lerna/run-parallel-batches" "3.13.0" + "@lerna/child-process" "3.13.3" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" + "@lerna/run-topologically" "3.14.0" "@lerna/validation-error" "3.13.0" + p-map "^1.2.0" -"@lerna/filter-options@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.13.0.tgz#976e3d8b9fcd47001ab981d276565c1e9f767868" - integrity sha512-SRp7DCo9zrf+7NkQxZMkeyO1GRN6GICoB9UcBAbXhLbWisT37Cx5/6+jh49gYB63d/0/WYHSEPMlheUrpv1Srw== +"@lerna/filter-options@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.14.0.tgz#6a2e60708633f54973bf31262b58e53efb537ef2" + integrity sha512-ZmNZK9m8evxHc+2ZnDyCm8XFIKVDKpIASG1wtizr3R14t49fuYE7nR+rm4t82u9oSSmER8gb8bGzh0SKZme/jg== dependencies: - "@lerna/collect-updates" "3.13.0" + "@lerna/collect-updates" "3.14.0" "@lerna/filter-packages" "3.13.0" dedent "^0.7.0" @@ -1373,12 +1381,12 @@ ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.13.1.tgz#cb9bf9f01685a0cee0fac63f287f6c3673e45aa3" - integrity sha512-iPLUp8FFoAKGURksYEYZzfuo9TRA+NepVlseRXFaWlmy36dCQN20AciINpoXiXGoHcEUHXUKHQvY3ARFdMlf3w== +"@lerna/github-client@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.13.3.tgz#bcf9b4ff40bdd104cb40cd257322f052b41bb9ce" + integrity sha512-fcJkjab4kX0zcLLSa/DCUNvU3v8wmy2c1lhdIbL7s7gABmDcV0QZq93LhnEee3VkC9UpnJ6GKG4EkD7eIifBnA== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" "@octokit/plugin-enterprise-rest" "^2.1.1" "@octokit/rest" "^16.16.0" git-url-parse "^11.1.2" @@ -1389,21 +1397,21 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.13.0.tgz#6e1f7e9336cce3e029066f0175f06dd9d51ad09f" - integrity sha512-Oqu7DGLnrMENPm+bPFGOHnqxK8lCnuYr6bk3g/CoNn8/U0qgFvHcq6Iv8/Z04TsvleX+3/RgauSD2kMfRmbypg== +"@lerna/has-npm-version@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.13.3.tgz#167e3f602a2fb58f84f93cf5df39705ca6432a2d" + integrity sha512-mQzoghRw4dBg0R9FFfHrj0TH0glvXyzdEZmYZ8Isvx5BSuEEwpsryoywuZSdppcvLu8o7NAdU5Tac8cJ/mT52w== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" semver "^5.5.0" -"@lerna/import@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.13.1.tgz#69d641341a38b79bd379129da1c717d51dd728c7" - integrity sha512-A1Vk1siYx1XkRl6w+zkaA0iptV5TIynVlHPR9S7NY0XAfhykjztYVvwtxarlh6+VcNrO9We6if0+FXCrfDEoIg== +"@lerna/import@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.14.0.tgz#de5727dc18d21c50af14b481e47b424c5bbe107c" + integrity sha512-j8z/m85FX1QYPgl5TzMNupdxsQF/NFZSmdCR19HQzqiVKC8ULGzF30WJEk66+KeZ94wYMSakINtYD+41s34pNQ== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/command" "3.13.1" + "@lerna/child-process" "3.13.3" + "@lerna/command" "3.14.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" @@ -1411,44 +1419,44 @@ fs-extra "^7.0.0" p-map-series "^1.0.0" -"@lerna/init@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.13.1.tgz#0392c822abb3d63a75be4916c5e761cfa7b34dda" - integrity sha512-M59WACqim8WkH5FQEGOCEZ89NDxCKBfFTx4ZD5ig3LkGyJ8RdcJq5KEfpW/aESuRE9JrZLzVr0IjKbZSxzwEMA== +"@lerna/init@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.14.0.tgz#f5b92f171f9ed4168bd3d9305fffe6a46460a1d2" + integrity sha512-X3PQkQZds5ozA1xiarmVzAK6LPLNK3bBu24Api0w2KJXO7Ccs9ob/VcGdevZuzqdJo1Xg2H6oBhEqIClU9Uqqw== dependencies: - "@lerna/child-process" "3.13.0" - "@lerna/command" "3.13.1" + "@lerna/child-process" "3.13.3" + "@lerna/command" "3.14.0" fs-extra "^7.0.0" p-map "^1.2.0" write-json-file "^2.3.0" -"@lerna/link@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.13.1.tgz#7d8ed4774bfa198d1780f790a14abb8722a3aad1" - integrity sha512-N3h3Fj1dcea+1RaAoAdy4g2m3fvU7m89HoUn5X/Zcw5n2kPoK8kTO+NfhNAatfRV8VtMXst8vbNrWQQtfm0FFw== +"@lerna/link@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.14.0.tgz#817243559b3d460a08bd65582e7632b1dbc6df69" + integrity sha512-xlwQhWTVOZrgAuoONY3/OIBWehDfZXmf5qFhnOy7lIxByRhEX5Vwx0ApaGxHTv3Flv7T+oI4s8UZVq5F6dT8Aw== dependencies: - "@lerna/command" "3.13.1" - "@lerna/package-graph" "3.13.0" - "@lerna/symlink-dependencies" "3.13.0" + "@lerna/command" "3.14.0" + "@lerna/package-graph" "3.14.0" + "@lerna/symlink-dependencies" "3.14.0" p-map "^1.2.0" slash "^1.0.0" -"@lerna/list@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.13.1.tgz#f9513ed143e52156c10ada4070f903c5847dcd10" - integrity sha512-635iRbdgd9gNvYLLIbYdQCQLr+HioM5FGJLFS0g3DPGygr6iDR8KS47hzCRGH91LU9NcM1mD1RoT/AChF+QbiA== +"@lerna/list@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.14.0.tgz#cfe826937c63a3652003639eb7fd36bf4b0a3660" + integrity sha512-Gp+9gaIkBfXBwc9Ng0Y74IEfAqpQpLiXwOP4IOpdINxOeDpllhMaYP6SzLaMvrfSyHRayM7Cq5/PRnHkXQ5uuQ== dependencies: - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" - "@lerna/listable" "3.13.0" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" + "@lerna/listable" "3.14.0" "@lerna/output" "3.13.0" -"@lerna/listable@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.13.0.tgz#babc18442c590b549cf0966d20d75fea066598d4" - integrity sha512-liYJ/WBUYP4N4MnSVZuLUgfa/jy3BZ02/1Om7xUY09xGVSuNVNEeB8uZUMSC+nHqFHIsMPZ8QK9HnmZb1E/eTA== +"@lerna/listable@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.14.0.tgz#08f4c78e0466568e8e8a57d4ad09537f2bb7bbb9" + integrity sha512-ZK44Mo8xf/N97eQZ236SPSq0ek6+gk4HqHIx05foEMZVV1iIDH4a/nblLsJNjGQVsIdMYFPaqNJ0z+ZQfiJazQ== dependencies: - "@lerna/batch-packages" "3.13.0" + "@lerna/query-graph" "3.14.0" chalk "^2.3.1" columnify "^1.5.4" @@ -1470,22 +1478,23 @@ config-chain "^1.1.11" pify "^3.0.0" -"@lerna/npm-dist-tag@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.13.0.tgz#49ecbe0e82cbe4ad4a8ea6de112982bf6c4e6cd4" - integrity sha512-mcuhw34JhSRFrbPn0vedbvgBTvveG52bR2lVE3M3tfE8gmR/cKS/EJFO4AUhfRKGCTFn9rjaSEzlFGYV87pemQ== +"@lerna/npm-dist-tag@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.14.0.tgz#69b1f99ce9d777782afe646522cb14293d986eb5" + integrity sha512-DEyYEdufTGIC6E4RTJUsYPgqlz1Bs/XPeEQ5fd+ojWnICevj7dRrr2DfHucPiUCADlm2jbAraAQc3QPU0dXRhw== dependencies: + "@lerna/otplease" "3.14.0" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npm-registry-fetch "^3.9.0" npmlog "^4.1.2" -"@lerna/npm-install@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.13.0.tgz#88f4cc39f4f737c8a8721256b915ea1bcc6a7227" - integrity sha512-qNyfts//isYQxore6fsPorNYJmPVKZ6tOThSH97tP0aV91zGMtrYRqlAoUnDwDdAjHPYEM16hNujg2wRmsqqIw== +"@lerna/npm-install@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.13.3.tgz#9b09852732e51c16d2e060ff2fd8bfbbb49cf7ba" + integrity sha512-7Jig9MLpwAfcsdQ5UeanAjndChUjiTjTp50zJ+UZz4CbIBIDhoBehvNMTCL2G6pOEC7sGEg6sAqJINAqred6Tg== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" "@lerna/get-npm-exec-opts" "3.13.0" fs-extra "^7.0.0" npm-package-arg "^6.1.0" @@ -1493,28 +1502,38 @@ signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.13.0.tgz#5c74808376e778865ffdc5885fe83935e15e60c3" - integrity sha512-y4WO0XTaf9gNRkI7as6P2ItVDOxmYHwYto357fjybcnfXgMqEA94c3GJ++jU41j0A9vnmYC6/XxpTd9sVmH9tA== +"@lerna/npm-publish@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.14.0.tgz#e3fc5613a2dd08cdd3323347ba87fad5dc5f11fb" + integrity sha512-ShG0qEnGkWxtjQvIRATgm/CzeoVaSyyoNRag5t8gDSR/r2u9ux72oROKQUEaE8OwcTS4rL2cyBECts8XMNmyYw== dependencies: - "@lerna/run-lifecycle" "3.13.0" + "@lerna/otplease" "3.14.0" + "@lerna/run-lifecycle" "3.14.0" figgy-pudding "^3.5.1" fs-extra "^7.0.0" libnpmpublish "^1.1.1" + npm-package-arg "^6.1.0" npmlog "^4.1.2" pify "^3.0.0" read-package-json "^2.0.13" -"@lerna/npm-run-script@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.13.0.tgz#e5997f045402b9948bdc066033ebb36bf94fc9e4" - integrity sha512-hiL3/VeVp+NFatBjkGN8mUdX24EfZx9rQlSie0CMgtjc7iZrtd0jCguLomSCRHYjJuvqgbp+LLYo7nHVykfkaQ== +"@lerna/npm-run-script@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.13.3.tgz#9bb6389ed70cd506905d6b05b6eab336b4266caf" + integrity sha512-qR4o9BFt5hI8Od5/DqLalOJydnKpiQFEeN0h9xZi7MwzuX1Ukwh3X22vqsX4YRbipIelSFtrDzleNVUm5jj0ow== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" +"@lerna/otplease@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.14.0.tgz#b539fd3e7a08452fc0db3b10010ca3cf0e4a73e7" + integrity sha512-rYAWzaYZ81bwnrmTkYWGgcc13bl/6DlG7pjWQWNGAJNLzO5zzj0xmXN5sMFJnNvDpSiS/ZS1sIuPvb4xnwLUkg== + dependencies: + "@lerna/prompt" "3.13.0" + figgy-pudding "^3.5.1" + "@lerna/output@3.13.0": version "3.13.0" resolved "https://registry.yarnpkg.com/@lerna/output/-/output-3.13.0.tgz#3ded7cc908b27a9872228a630d950aedae7a4989" @@ -1522,27 +1541,29 @@ dependencies: npmlog "^4.1.2" -"@lerna/pack-directory@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.13.1.tgz#5ad4d0945f86a648f565e24d53c1e01bb3a912d1" - integrity sha512-kXnyqrkQbCIZOf1054N88+8h0ItC7tUN5v9ca/aWpx298gsURpxUx/1TIKqijL5TOnHMyIkj0YJmnH/PyBVLKA== +"@lerna/pack-directory@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.14.0.tgz#229446c2e3f307a7932f2f779d7fb8b8ff7d93b0" + integrity sha512-E9PmC1oWYjYN8Z0Oeoj7X98NruMg/pcdDiRxnwJ5awnB0d/kyfoquHXCYwCQQFCnWUfto7m5lM4CSostcolEVQ== dependencies: "@lerna/get-packed" "3.13.0" "@lerna/package" "3.13.0" - "@lerna/run-lifecycle" "3.13.0" + "@lerna/run-lifecycle" "3.14.0" figgy-pudding "^3.5.1" npm-packlist "^1.4.1" npmlog "^4.1.2" tar "^4.4.8" temp-write "^3.4.0" -"@lerna/package-graph@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.13.0.tgz#607062f8d2ce22b15f8d4a0623f384736e67f760" - integrity sha512-3mRF1zuqFE1HEFmMMAIggXy+f+9cvHhW/jzaPEVyrPNLKsyfJQtpTNzeI04nfRvbAh+Gd2aNksvaW/w3xGJnnw== +"@lerna/package-graph@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.14.0.tgz#4ccdf446dccedfbbeb4efff3eb720cb6fcb109fc" + integrity sha512-dNpA/64STD5YXhaSlg4gT6Z474WPJVCHoX1ibsVIFu0fVgH609Y69bsdmbvTRdI7r6Dcu4ZfGxdR636RTrH+Eg== dependencies: + "@lerna/prerelease-id-from-version" "3.14.0" "@lerna/validation-error" "3.13.0" npm-package-arg "^6.1.0" + npmlog "^4.1.2" semver "^5.5.0" "@lerna/package@3.13.0": @@ -1554,6 +1575,13 @@ npm-package-arg "^6.1.0" write-pkg "^3.1.0" +"@lerna/prerelease-id-from-version@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.14.0.tgz#d5da9c26ac4a0d0ecde09018f06e41ca4dd444c2" + integrity sha512-Ap3Z/dNhqQuSrKmK+JmzYvQYI2vowxHvUVxZJiDVilW8dyNnxkCsYFmkuZytk5sxVz4VeGLNPS2RSsU5eeSS+Q== + dependencies: + semver "^5.5.0" + "@lerna/project@3.13.1": version "3.13.1" resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.13.1.tgz#bce890f60187bd950bcf36c04b5260642e295e79" @@ -1580,29 +1608,29 @@ inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.13.1.tgz#217e401dcb5824cdd6d36555a36303fb7520c514" - integrity sha512-KhCJ9UDx76HWCF03i5TD7z5lX+2yklHh5SyO8eDaLptgdLDQ0Z78lfGj3JhewHU2l46FztmqxL/ss0IkWHDL+g== - dependencies: - "@lerna/batch-packages" "3.13.0" - "@lerna/check-working-tree" "3.13.0" - "@lerna/child-process" "3.13.0" - "@lerna/collect-updates" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/describe-ref" "3.13.0" +"@lerna/publish@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.14.0.tgz#3473c6de9ad7d614cc2a734eaf4ea505e8fedc4f" + integrity sha512-nLL0eDF/rgijPoLGGdHkuKQ4ktLZZDmPpj5n4aIZHf56AZRUYL0NgzLVPqg3btYQ/Zze9Wst1CB08DnBwJOzTw== + dependencies: + "@lerna/check-working-tree" "3.14.0" + "@lerna/child-process" "3.13.3" + "@lerna/collect-updates" "3.14.0" + "@lerna/command" "3.14.0" + "@lerna/describe-ref" "3.13.3" "@lerna/log-packed" "3.13.0" "@lerna/npm-conf" "3.13.0" - "@lerna/npm-dist-tag" "3.13.0" - "@lerna/npm-publish" "3.13.0" + "@lerna/npm-dist-tag" "3.14.0" + "@lerna/npm-publish" "3.14.0" "@lerna/output" "3.13.0" - "@lerna/pack-directory" "3.13.1" + "@lerna/pack-directory" "3.14.0" + "@lerna/prerelease-id-from-version" "3.14.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/run-lifecycle" "3.13.0" - "@lerna/run-parallel-batches" "3.13.0" + "@lerna/run-lifecycle" "3.14.0" + "@lerna/run-topologically" "3.14.0" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.13.1" + "@lerna/version" "3.14.0" figgy-pudding "^3.5.1" fs-extra "^7.0.0" libnpmaccess "^3.0.1" @@ -1612,7 +1640,6 @@ p-finally "^1.0.0" p-map "^1.2.0" p-pipe "^1.2.0" - p-reduce "^1.0.0" pacote "^9.5.0" semver "^5.5.0" @@ -1623,6 +1650,14 @@ dependencies: npmlog "^4.1.2" +"@lerna/query-graph@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.14.0.tgz#2abb36f445bd924d0f85ac7aec1445e9ef1e2c6c" + integrity sha512-6YTh3vDMW2hUxHdKeRvx4bosc9lZClKaN+DzC1XKTkwDbWrsjmEzLcemKL6QnyyeuryN2f/eto7P9iSe3z3pQQ== + dependencies: + "@lerna/package-graph" "3.14.0" + figgy-pudding "^3.5.1" + "@lerna/resolve-symlink@3.13.0": version "3.13.0" resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" @@ -1632,24 +1667,24 @@ npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.13.0.tgz#bb1006104b4aabcb6985624273254648f872b278" - integrity sha512-kte+pMemulre8cmPqljxIYjCmdLByz8DgHBHXB49kz2EiPf8JJ+hJFt0PzEubEyJZ2YE2EVAx5Tv5+NfGNUQyQ== +"@lerna/rimraf-dir@3.13.3": + version "3.13.3" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.13.3.tgz#3a8e71317fde853893ef0262bc9bba6a180b7227" + integrity sha512-d0T1Hxwu3gpYVv73ytSL+/Oy8JitsmvOYUR5ouRSABsmqS7ZZCh5t6FgVDDGVXeuhbw82+vuny1Og6Q0k4ilqw== dependencies: - "@lerna/child-process" "3.13.0" + "@lerna/child-process" "3.13.3" npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.13.0.tgz#d8835ee83425edee40f687a55f81b502354d3261" - integrity sha512-oyiaL1biZdjpmjh6X/5C4w07wNFyiwXSSHH5GQB4Ay4BPwgq9oNhCcxRoi0UVZlZ1YwzSW8sTwLgj8emkIo3Yg== +"@lerna/run-lifecycle@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.14.0.tgz#0499eca0e7f393faf4e24e6c8737302a9059c22b" + integrity sha512-GUM3L9MzGRSW0WQ8wbLW1+SYStU1OFjW0GBzShhBnFrO4nGRrU7VchsLpcLu0hk2uCzyhsrDKzifEdOdUyMoEQ== dependencies: "@lerna/npm-conf" "3.13.0" figgy-pudding "^3.5.1" - npm-lifecycle "^2.1.0" + npm-lifecycle "^2.1.1" npmlog "^4.1.2" "@lerna/run-parallel-batches@3.13.0": @@ -1660,39 +1695,47 @@ p-map "^1.2.0" p-map-series "^1.0.0" -"@lerna/run@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.13.1.tgz#87e174c1d271894ddd29adc315c068fb7b1b0117" - integrity sha512-nv1oj7bsqppWm1M4ifN+/IIbVu9F4RixrbQD2okqDGYne4RQPAXyb5cEZuAzY/wyGTWWiVaZ1zpj5ogPWvH0bw== +"@lerna/run-topologically@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.14.0.tgz#2a560cb657f0ef1565c680b6001b4b01b872dc07" + integrity sha512-y+KBpC1YExFzGynovt9MY4O/bc3RrJaKeuXieiPfKGKxrdtmZe/r33oj/xePTXZq65jnw3SaU3H8S5CrrdkwDg== + dependencies: + "@lerna/query-graph" "3.14.0" + figgy-pudding "^3.5.1" + p-queue "^4.0.0" + +"@lerna/run@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.14.0.tgz#1a5d3330149fbf5092012707b775d5f57d9d0057" + integrity sha512-kGGFGLYPKozAN07CSJ7kOyLY6W3oLCQcxCathg1isSkBqQH29tWUg8qNduOlhIFLmnq/nf1JEJxxoXnF6IRLjQ== dependencies: - "@lerna/batch-packages" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/filter-options" "3.13.0" - "@lerna/npm-run-script" "3.13.0" + "@lerna/command" "3.14.0" + "@lerna/filter-options" "3.14.0" + "@lerna/npm-run-script" "3.13.3" "@lerna/output" "3.13.0" - "@lerna/run-parallel-batches" "3.13.0" + "@lerna/run-topologically" "3.14.0" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" p-map "^1.2.0" -"@lerna/symlink-binary@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.13.0.tgz#36a9415d468afcb8105750296902f6f000a9680d" - integrity sha512-obc4Y6jxywkdaCe+DB0uTxYqP0IQ8mFWvN+k/YMbwH4G2h7M7lCBWgPy8e7xw/50+1II9tT2sxgx+jMus1sTJg== +"@lerna/symlink-binary@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.14.0.tgz#db1c3204b83d91c4b43386302ee76cea4d20bc3f" + integrity sha512-AHFb4NlazxYmC+7guoamM3laIRbMSeKERMooKHJ7moe0ayGPBWsCGOH+ZFKZ+eXSDek+FnxdzayR3wf8B3LkTg== dependencies: - "@lerna/create-symlink" "3.13.0" + "@lerna/create-symlink" "3.14.0" "@lerna/package" "3.13.0" fs-extra "^7.0.0" p-map "^1.2.0" -"@lerna/symlink-dependencies@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.13.0.tgz#76c23ecabda7824db98a0561364f122b457509cf" - integrity sha512-7CyN5WYEPkbPLbqHBIQg/YiimBzb5cIGQB0E9IkLs3+racq2vmUNQZn38LOaazQacAA83seB+zWSxlI6H+eXSg== +"@lerna/symlink-dependencies@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.14.0.tgz#f17e5cd704a0f067636038dafeaf42b5d2f28802" + integrity sha512-kuSXxwAWiVZqFcXfUBKH4yLUH3lrnGyZmCYon7UnZitw3AK3LQY7HvV2LNNw/oatfjOAiKhPBxnYjYijKiV4oA== dependencies: - "@lerna/create-symlink" "3.13.0" + "@lerna/create-symlink" "3.14.0" "@lerna/resolve-symlink" "3.13.0" - "@lerna/symlink-binary" "3.13.0" + "@lerna/symlink-binary" "3.14.0" fs-extra "^7.0.0" p-finally "^1.0.0" p-map "^1.2.0" @@ -1710,21 +1753,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.13.1.tgz#5e919d13abb13a663dcc7922bb40931f12fb137b" - integrity sha512-WpfKc5jZBBOJ6bFS4atPJEbHSiywQ/Gcd+vrwaEGyQHWHQZnPTvhqLuq3q9fIb9sbuhH5pSY6eehhuBrKqTnjg== - dependencies: - "@lerna/batch-packages" "3.13.0" - "@lerna/check-working-tree" "3.13.0" - "@lerna/child-process" "3.13.0" - "@lerna/collect-updates" "3.13.0" - "@lerna/command" "3.13.1" - "@lerna/conventional-commits" "3.13.0" - "@lerna/github-client" "3.13.1" +"@lerna/version@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.14.0.tgz#3b3ed1da7241383e22f506198f35e4bb61c146c8" + integrity sha512-51ae6sriSLONV1NnPtDNuC81fGQhQBL1FhSKbw+5WuNdJxJwG8bgEdS1xvUdETZT4WrwMCX3nzzSpu4owlH2nQ== + dependencies: + "@lerna/batch-packages" "3.14.0" + "@lerna/check-working-tree" "3.14.0" + "@lerna/child-process" "3.13.3" + "@lerna/collect-updates" "3.14.0" + "@lerna/command" "3.14.0" + "@lerna/conventional-commits" "3.14.0" + "@lerna/github-client" "3.13.3" "@lerna/output" "3.13.0" + "@lerna/prerelease-id-from-version" "3.14.0" "@lerna/prompt" "3.13.0" - "@lerna/run-lifecycle" "3.13.0" + "@lerna/run-lifecycle" "3.14.0" + "@lerna/run-topologically" "3.14.0" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" @@ -2368,13 +2413,6 @@ binary@~0.3.0: buffers "~0.1.1" chainsaw "~0.1.0" -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= - dependencies: - inherits "~2.0.0" - bluebird@^3.5.1, bluebird@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" @@ -3722,6 +3760,11 @@ eventemitter3@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" +eventemitter3@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + exec-sh@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" @@ -4148,7 +4191,7 @@ fsevents@^1.2.7: nan "^2.9.2" node-pre-gyp "^0.10.0" -fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: +fstream@~1.0.10: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= @@ -5684,26 +5727,26 @@ left-pad@^1.3.0: resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -lerna@^3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.13.1.tgz#feaff562176f304bd82329ca29ce46ab6c033463" - integrity sha512-7kSz8LLozVsoUNTJzJzy+b8TnV9YdviR2Ee2PwGZSlVw3T1Rn7kOAPZjEi+3IWnOPC96zMPHVmjCmzQ4uubalw== +lerna@^3.14.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.14.0.tgz#b5485fa1614f6d25d8bf48926639f4ae9f5aa5b0" + integrity sha512-AJobp8D/ovN6CC+nmkaTQ2KgbFH4bU2bNRaGp+30iqVoK9q0DVyAtnB7/hcql4kAE22iL/jpbKd5aSDls8oH3w== dependencies: - "@lerna/add" "3.13.1" - "@lerna/bootstrap" "3.13.1" - "@lerna/changed" "3.13.1" - "@lerna/clean" "3.13.1" + "@lerna/add" "3.14.0" + "@lerna/bootstrap" "3.14.0" + "@lerna/changed" "3.14.0" + "@lerna/clean" "3.14.0" "@lerna/cli" "3.13.0" - "@lerna/create" "3.13.1" - "@lerna/diff" "3.13.1" - "@lerna/exec" "3.13.1" - "@lerna/import" "3.13.1" - "@lerna/init" "3.13.1" - "@lerna/link" "3.13.1" - "@lerna/list" "3.13.1" - "@lerna/publish" "3.13.1" - "@lerna/run" "3.13.1" - "@lerna/version" "3.13.1" + "@lerna/create" "3.14.0" + "@lerna/diff" "3.14.0" + "@lerna/exec" "3.14.0" + "@lerna/import" "3.14.0" + "@lerna/init" "3.14.0" + "@lerna/link" "3.14.0" + "@lerna/list" "3.14.0" + "@lerna/publish" "3.14.0" + "@lerna/run" "3.14.0" + "@lerna/version" "3.14.0" import-local "^1.0.0" npmlog "^4.1.2" @@ -6531,12 +6574,11 @@ node-fetch@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.1.tgz#1fe551e0ded6c45b3b3b937d0fb46f76df718d1e" -node-gyp@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" - integrity sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA== +node-gyp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" + integrity sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA== dependencies: - fstream "^1.0.0" glob "^7.0.3" graceful-fs "^4.1.2" mkdirp "^0.5.0" @@ -6546,7 +6588,7 @@ node-gyp@^3.8.0: request "^2.87.0" rimraf "2" semver "~5.3.0" - tar "^2.0.0" + tar "^4.4.8" which "1" node-int64@^0.4.0: @@ -6641,14 +6683,14 @@ npm-bundled@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" -npm-lifecycle@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.0.tgz#1eda2eedb82db929e3a0c50341ab0aad140ed569" - integrity sha512-QbBfLlGBKsktwBZLj6AviHC6Q9Y3R/AY4a2PYSIRhSKSS0/CxRyD/PfxEX6tPeOCXQgMSNdwGeECacstgptc+g== +npm-lifecycle@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.1.tgz#0027c09646f0fd346c5c93377bdaba59c6748fdf" + integrity sha512-+Vg6I60Z75V/09pdcH5iUo/99Q/vop35PaI99elvxk56azSVVsdsSsS/sXqKDNwbRRNN1qSxkcO45ZOu0yOWew== dependencies: byline "^5.0.0" - graceful-fs "^4.1.11" - node-gyp "^3.8.0" + graceful-fs "^4.1.15" + node-gyp "^4.0.0" resolve-from "^4.0.0" slide "^1.1.6" uid-number "0.0.6" @@ -6992,6 +7034,13 @@ p-pipe@^1.2.0: resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-1.2.0.tgz#4b1a11399a11520a67790ee5a0c1d5881d6befe9" integrity sha1-SxoROZoRUgpneQ7loMHViB1r7+k= +p-queue@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-4.0.0.tgz#ed0eee8798927ed6f2c2f5f5b77fdb2061a5d346" + integrity sha512-3cRXXn3/O0o3+eVmUroJPSj/esxoEFIm0ZOno/T+NzG/VZgPOqQ8WKmlNqubSEpZmCIngEy34unkHGg83ZIBmg== + dependencies: + eventemitter3 "^3.1.0" + p-reduce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" @@ -8492,15 +8541,6 @@ table@^5.0.2: slice-ansi "1.0.0" string-width "^2.1.1" -tar@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" - integrity sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE= - dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" - tar@^4: version "4.4.7" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.7.tgz#14df45023ffdcd0c233befa2fc01ebb76ee39e7c" From d3f3aca16f79d2f3c7c7bb6aca6db17760094b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 15 May 2019 17:21:57 +0200 Subject: [PATCH 144/234] v2.0.0-alpha.20 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index d0c7402e4..5bd0094b9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.19", + "version": "2.0.0-alpha.20", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index a33f8d8c9..258cdb597 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.19", + "version": "2.0.0-alpha.20", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-alpha.19", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.19", - "@react-native-community/cli-tools": "^2.0.0-alpha.19", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.20", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.20", + "@react-native-community/cli-tools": "^2.0.0-alpha.20", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index aef283f84..06b977ff5 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.19", + "version": "2.0.0-alpha.20", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.19", + "@react-native-community/cli-tools": "^2.0.0-alpha.20", "logkitty": "^0.4.0", "node-fetch": "^2.2.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 197d3397c..bd276169d 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.19", + "version": "2.0.0-alpha.20", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.19", + "@react-native-community/cli-tools": "^2.0.0-alpha.20", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index b68b7ade3..8bf2aace3 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.19", + "version": "2.0.0-alpha.20", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 8a796051c0e12fb469a8134d640d8fd944928c59 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 16 May 2019 13:25:34 +0100 Subject: [PATCH 145/234] chore: Update npm version badge link (#391) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa36c7094..ac5c93222 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Everything inside this repository is [MIT licensed](./LICENSE). [build-badge]: https://img.shields.io/circleci/project/github/react-native-community/cli/master.svg?style=flat-square [build]: https://circleci.com/gh/react-native-community/cli/tree/master [version-badge]: https://img.shields.io/npm/v/@react-native-community/cli.svg?style=flat-square -[package]: https://www.npmjs.com/package/@react-native-community/cli.svg +[package]: https://www.npmjs.com/package/@react-native-community/cli [license-badge]: https://img.shields.io/npm/l/@react-native-community/cli.svg?style=flat-square [license]: https://opensource.org/licenses/MIT [prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square From c2fb83fb641e5800e9ceb22935256d1240b8eba1 Mon Sep 17 00:00:00 2001 From: Lucas Bento Date: Fri, 17 May 2019 18:25:11 +0200 Subject: [PATCH 146/234] feat: support `init` with custom project directory (#365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change `packageName` to `projectName` & add `projectPath` argument * Add a way to specify a custom project path to init the app on * Force the `init` command to create the project path recursively * Add test for providing the project path on init * Throw error if custom project path doesn’t exist and can’t be created * Fix type error on `customProjectPath` * Create directory before running the test with custom project path * Use `mkdirp` to create project folder & Use `inquirer` to prompt for a directory replace * Specify `directory` as an option * Handle custom directory path after react logo * Check if `ios` folder exists before trying to open it * Update `init` tests * Add `directory` type * Remove unused `inquirer` from `init` test * Only remove the project folder if it didn’t exist before running `init` * Remove correct directory if it didn’t exist before `init` * simplify * make directory an argument instead of a flag * update descriptions * fix test * use --directory after all * address feedback; remove version handling from createFromTemplate * flip the default --- __e2e__/init.test.js | 58 +++++++----- docs/commands.md | 26 +++--- packages/cli/src/cliEntry.js | 6 +- packages/cli/src/commands/init/index.js | 16 ++-- packages/cli/src/commands/init/init.js | 114 +++++++++++++++++------- packages/cli/src/tools/installPods.js | 8 +- 6 files changed, 160 insertions(+), 68 deletions(-) diff --git a/__e2e__/init.test.js b/__e2e__/init.test.js index a7d1586ba..747166aa2 100644 --- a/__e2e__/init.test.js +++ b/__e2e__/init.test.js @@ -22,27 +22,27 @@ test('init --template fails without package name', () => { expect(stderr).toContain('missing required argument'); }); -test('init --template', () => { - const templateFiles = [ - '.buckconfig', - '.eslintrc.js', - '.flowconfig', - '.gitattributes', - // should be here, but it's not published yet - // '.gitignore', - '.watchmanconfig', - 'App.js', - '__tests__', - 'android', - 'babel.config.js', - 'index.js', - 'ios', - 'metro.config.js', - 'node_modules', - 'package.json', - 'yarn.lock', - ]; +const templateFiles = [ + '.buckconfig', + '.eslintrc.js', + '.flowconfig', + '.gitattributes', + // should be here, but it's not published yet + // '.gitignore', + '.watchmanconfig', + 'App.js', + '__tests__', + 'android', + 'babel.config.js', + 'index.js', + 'ios', + 'metro.config.js', + 'node_modules', + 'package.json', + 'yarn.lock', +]; +test('init --template', () => { const {stdout} = run(DIR, [ 'init', '--template', @@ -84,3 +84,21 @@ test('init --template file:/tmp/custom/template', () => { expect(stdout).toContain('Run instructions'); }); + +test('init --template with custom project path', () => { + const projectName = 'TestInit'; + const customPath = 'custom-path'; + + run(DIR, [ + 'init', + '--template', + 'react-native-new-template', + projectName, + '--directory', + 'custom-path', + ]); + + // make sure we don't leave garbage + expect(fs.readdirSync(DIR)).toEqual([customPath]); + expect(fs.readdirSync(path.join(DIR, customPath))).toEqual(templateFiles); +}); diff --git a/docs/commands.md b/docs/commands.md index d6ae064bd..228e6d8b1 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -114,13 +114,15 @@ Output project and dependencies configuration in JSON format to stdout. Used by > Available since 0.60.0 -Usage: +> **IMPORTANT**: Please note that this command is not available through `react-native-cli`, hence you need to either invoke it directly from `@react-native-community/cli` or `react-native` package which proxies binary to this CLI since 0.60.0, so it's possible to use it with e.g. `npx`. + +Usage (with `npx`): ```sh -react-native init [options] +npx react-native init [options] ``` -Initialize new React Native project. You can find out more use cases in [init docs](./init.md). +Initialize a new React Native project named in a directory of the same name. You can find out more use cases in [init docs](./init.md). #### Options @@ -128,6 +130,10 @@ Initialize new React Native project. You can find out more use cases in [init do Uses a valid semver version of React Native as a template. +#### `--directory [string]` + +Uses a custom directory instead of ``. + #### `--template [string]` Uses a custom template. Accepts following template sources: @@ -140,10 +146,10 @@ Uses a custom template. Accepts following template sources: Example: ```sh -react-native init MyApp --template react-native-custom-template -react-native init MyApp --template typescript -react-native init MyApp --template file:///Users/name/template-path -react-native init MyApp --template file:///Users/name/template-name-1.0.0.tgz +npx react-native init MyApp --template react-native-custom-template +npx react-native init MyApp --template typescript +npx react-native init MyApp --template file:///Users/name/template-path +npx react-native init MyApp --template file:///Users/name/template-name-1.0.0.tgz ``` A template is any directory or npm package that contains a `template.config.js` file in the root with following of the following type: @@ -164,9 +170,9 @@ Example `template.config.js`: ```js module.exports = { - placeholderName: "ProjectName", - templateDir: "./template", - postInitScript: "./script.js", + placeholderName: 'ProjectName', + templateDir: './template', + postInitScript: './script.js', }; ``` diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index f8a59ed6d..8f480c7b9 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -55,6 +55,10 @@ const handleError = err => { // one modified to suit our needs function printHelpInformation(examples, pkg) { let cmdName = this._name; + const argsList = this._args + .map(arg => (arg.required ? `<${arg.name}>` : `[${arg.name}]`)) + .join(' '); + if (this._alias) { cmdName = `${cmdName}|${this._alias}`; } @@ -64,7 +68,7 @@ function printHelpInformation(examples, pkg) { : []; let output = [ - chalk.bold(`react-native ${cmdName}`), + chalk.bold(`react-native ${cmdName} ${argsList}`), this._description ? `\n${this._description}\n` : '', ...sourceInformation, `${chalk.bold('Options:')}`, diff --git a/packages/cli/src/commands/init/index.js b/packages/cli/src/commands/init/index.js index 464d572a9..b80e4f0f5 100644 --- a/packages/cli/src/commands/init/index.js +++ b/packages/cli/src/commands/init/index.js @@ -3,20 +3,26 @@ import init from './init'; export default { func: init, - name: 'init ', - description: 'initialize new React Native project', + name: 'init ', + description: + 'Initialize a new React Native project named in a directory of the same name.', options: [ { name: '--version [string]', - description: 'Version of RN', + description: 'Uses a valid semver version of React Native as a template', }, { name: '--template [string]', - description: 'Custom template', + description: + 'Uses a custom template. Valid arguments are: npm package, absolute directory prefixed with `file://`, Git repository or a tarball', }, { name: '--npm', - description: 'Force use of npm during initialization', + description: 'Forces using npm for initialization', + }, + { + name: '--directory [string]', + description: 'Uses a custom directory instead of ``.', }, ], }; diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 288214046..61bcd1c83 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -5,6 +5,8 @@ import fs from 'fs-extra'; import Ora from 'ora'; import minimist from 'minimist'; import semver from 'semver'; +import inquirer from 'inquirer'; +import mkdirp from 'mkdirp'; import type {ConfigT} from 'types'; import {validateProjectName} from './validate'; import DirectoryAlreadyExistsError from './errors/DirectoryAlreadyExistsError'; @@ -22,12 +24,56 @@ import installPods from '../../tools/installPods'; import {processTemplateName} from './templateName'; import banner from './banner'; import {getLoader} from '../../tools/loader'; +import {CLIError} from '@react-native-community/cli-tools'; + +const DEFAULT_VERSION = 'latest'; type Options = {| template?: string, npm?: boolean, + directory?: string, |}; +function doesDirectoryExist(dir: string) { + return fs.existsSync(dir); +} + +function getProjectDirectory({projectName, directory}): string { + return path.relative(process.cwd(), directory || projectName); +} + +async function setProjectDirectory(directory) { + const directoryExists = doesDirectoryExist(directory); + if (directoryExists) { + const {shouldReplaceprojectDirectory} = await inquirer.prompt([ + { + type: 'confirm', + name: 'shouldReplaceprojectDirectory', + message: `Directory "${directory}" already exists, do you want to replace it?`, + default: false, + }, + ]); + + if (!shouldReplaceprojectDirectory) { + throw new DirectoryAlreadyExistsError(directory); + } + + await fs.emptyDir(directory); + } + + try { + mkdirp.sync(directory); + process.chdir(directory); + } catch (error) { + throw new CLIError( + `Error occurred while trying to ${ + directoryExists ? 'replace' : 'create' + } project directory.`, + error, + ); + } +} + function adjustNameIfUrl(name, cwd) { // We use package manager to infer the name of the template module for us. // That's why we get it from temporary package.json, where the name is the @@ -44,33 +90,28 @@ function adjustNameIfUrl(name, cwd) { async function createFromTemplate({ projectName, templateName, - version, npm, + directory, }: { projectName: string, templateName: string, - version?: string, npm?: boolean, + directory: string, }) { logger.debug('Initializing new project'); logger.log(banner); + + await setProjectDirectory(directory); + const Loader = getLoader(); const loader = new Loader({text: 'Downloading template'}); const templateSourceDir = fs.mkdtempSync( path.join(os.tmpdir(), 'rncli-init-template-'), ); - if (version && semver.valid(version) && !semver.gte(version, '0.60.0-rc.0')) { - throw new Error( - 'Cannot use React Native CLI to initialize project with version lower than 0.60.0.', - ); - } - try { loader.start(); - let {uri, name} = await processTemplateName( - version ? `${templateName}@${version}` : templateName, - ); + let {uri, name} = await processTemplateName(templateName); await installTemplatePackage(uri, templateSourceDir, npm); @@ -127,49 +168,62 @@ async function installDependencies({ loader.succeed(); } -function createProject(projectName: string, options: Options, version: string) { - fs.mkdirSync(projectName); - process.chdir(projectName); +async function createProject( + projectName: string, + directory: string, + version: string, + options: Options, +) { + const templateName = options.template || `react-native@${version}`; - if (options.template) { - return createFromTemplate({ - projectName, - templateName: options.template, - npm: options.npm, - }); + if ( + version !== DEFAULT_VERSION && + semver.valid(version) && + !semver.gte(version, '0.60.0-rc.0') + ) { + throw new Error( + 'Cannot use React Native CLI to initialize project with version lower than 0.60.0.', + ); } return createFromTemplate({ projectName, - templateName: 'react-native', - version, + templateName, npm: options.npm, + directory, }); } export default (async function initialize( [projectName]: Array, - _context: ConfigT, + context: ConfigT, options: Options, ) { + const rootFolder = context.root; + validateProjectName(projectName); /** * Commander is stripping `version` from options automatically. * We have to use `minimist` to take that directly from `process.argv` */ - const version: string = minimist(process.argv).version || 'latest'; + const version: string = minimist(process.argv).version || DEFAULT_VERSION; - if (fs.existsSync(projectName)) { - throw new DirectoryAlreadyExistsError(projectName); - } + const directoryName = getProjectDirectory({ + projectName, + directory: options.directory || projectName, + }); + const directoryExists = doesDirectoryExist(directoryName); try { - await createProject(projectName, options, version); + await createProject(projectName, directoryName, version, options); - printRunInstructions(process.cwd(), projectName); + printRunInstructions(rootFolder, projectName); } catch (e) { logger.error(e.message); - fs.removeSync(projectName); + // Only remove project if it didn't exist before running `init` + if (!directoryExists) { + fs.removeSync(path.resolve(rootFolder, directoryName)); + } } }); diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js index c5818d35b..44947238a 100644 --- a/packages/cli/src/tools/installPods.js +++ b/packages/cli/src/tools/installPods.js @@ -1,5 +1,5 @@ // @flow -import fs from 'fs-extra'; +import fs from 'fs'; import execa from 'execa'; import chalk from 'chalk'; import Ora from 'ora'; @@ -17,9 +17,13 @@ async function installPods({ loader?: typeof Ora, }) { try { + if (!fs.existsSync('ios')) { + return; + } + process.chdir('ios'); - const hasPods = await fs.pathExists('Podfile'); + const hasPods = fs.existsSync('Podfile'); if (!hasPods) { return; From b03f7413cc4740b05333ef49dfcf3e9a12fd5c44 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Fri, 17 May 2019 22:32:54 +0200 Subject: [PATCH 147/234] chore: migrate `tools` to TypeScript (#296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Migrate tools package to Typescript * Prebuild ts * Improve yarn build-clean * Remove unnecessary statements * Fix linting * Fix eslint * Update packages/tools/src/isPackagerRunning.ts Co-Authored-By: Michał Pierzchała * adjust package.json * add vscode helper settings * remove dead node-fetch references --- .eslintrc.js | 4 +- .gitignore | 1 + .vscode/extensions.json | 10 + .vscode/settings.json | 24 +++ babel.config.js | 11 +- jest.config.js | 2 +- package.json | 15 +- packages/cli/package.json | 1 - packages/platform-android/package.json | 1 - packages/tools/package.json | 8 +- .../src/__mocks__/{logger.js => logger.ts} | 1 - ...yType-test.js => groupFilesByType.test.ts} | 2 - packages/tools/src/{errors.js => errors.ts} | 3 +- ...rTerminal.js => getDefaultUserTerminal.ts} | 2 +- ...roupFilesByType.js => groupFilesByType.ts} | 13 +- packages/tools/src/{index.js => index.ts} | 3 - ...ackagerRunning.js => isPackagerRunning.ts} | 19 +- packages/tools/src/{logger.js => logger.ts} | 3 - packages/tools/tsconfig.json | 7 + scripts/build.js | 31 ++- scripts/buildTs.js | 47 +++++ scripts/helpers.js | 27 +++ tsconfig.json | 25 +++ yarn.lock | 177 +++++++++++++++++- 24 files changed, 367 insertions(+), 70 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json rename packages/tools/src/__mocks__/{logger.js => logger.ts} (96%) rename packages/tools/src/__tests__/{groupFilesByType-test.js => groupFilesByType.test.ts} (92%) rename packages/tools/src/{errors.js => errors.ts} (93%) rename packages/tools/src/{getDefaultUserTerminal.js => getDefaultUserTerminal.ts} (63%) rename packages/tools/src/{groupFilesByType.js => groupFilesByType.ts} (69%) rename packages/tools/src/{index.js => index.ts} (94%) rename packages/tools/src/{isPackagerRunning.js => isPackagerRunning.ts} (72%) rename packages/tools/src/{logger.js => logger.ts} (98%) create mode 100644 packages/tools/tsconfig.json create mode 100644 scripts/buildTs.js create mode 100644 tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 602287973..494825ac6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { 'prettier/prettier': [2, 'fb'], }, // @todo: remove once we cover whole codebase with types - plugins: ['eslint-plugin-import'], + plugins: ['import'], settings: { react: { version: 'latest', @@ -16,6 +16,8 @@ module.exports = { alias: { map: [['types', './types/index.js']], }, + // Use /tsconfig.json for typescript resolution + typescript: {}, }, }, overrides: [ diff --git a/.gitignore b/.gitignore index a0031dbb3..71440e6ef 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ package-lock.json build/ .eslintcache !packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules +*.tsbuildinfo diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..961c02482 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "dbaeumer.vscode-eslint", + "redhat.vscode-yaml", + "flowtype.flow-for-vscode", + "esbenp.prettier-vscode" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..029ba7597 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,24 @@ +{ + "editor.rulers": [80], + "files.exclude": { + "**/.git": true, + "**/node_modules": true, + "**/build": true + }, + "editor.formatOnSave": true, + "flow.useNPMPackagedFlow": true, + "javascript.validate.enable": false, + "prettier.eslintIntegration": true, + "eslint.validate": [ + "javascript", + "javascriptreact", + { + "language": "typescript", + "autoFix": true + }, + { + "language": "typescriptreact", + "autoFix": true + } + ] +} diff --git a/babel.config.js b/babel.config.js index bf19c198a..f7a77eb48 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,15 @@ module.exports = { babelrcRoots: ['packages/*'], + overrides: [ + { + presets: ['@babel/preset-flow'], + test: '**/*.js', + }, + { + presets: ['@babel/preset-typescript'], + test: '**/*.ts', + }, + ], presets: [ [ require.resolve('@babel/preset-env'), @@ -8,7 +18,6 @@ module.exports = { useBuiltIns: 'entry', }, ], - require.resolve('@babel/preset-flow'), ], plugins: [ require.resolve('@babel/plugin-transform-strict-mode'), diff --git a/jest.config.js b/jest.config.js index eb479491c..e98503396 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,7 +12,7 @@ module.exports = { ...common, displayName: 'unit', setupFiles: ['/jest/setupUnitTests.js'], - testMatch: ['/**/__tests__/*{.,-}test.js'], + testMatch: ['/**/__tests__/*{.,-}test.[jt]s'], }, ], }; diff --git a/package.json b/package.json index 4993f4365..b698bf2c2 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,16 @@ "packages/*" ], "scripts": { + "prebuild": "yarn build:ts", "build": "node ./scripts/build.js", - "build-clean": "rm -rf ./packages/*/build", + "build:ts": "node ./scripts/buildTs.js", + "build-clean": "rm -rf ./packages/*/build ./packages/*/tsconfig.tsbuildinfo", "watch": "node ./scripts/watch.js", "test": "jest", "test:ci:unit": "jest packages --ci --coverage", "test:ci:e2e": "jest e2e --ci -i", + "lint": "eslint --ext .js,.ts . --cache --report-unused-disable-directives", "test:ci:cocoapods": "ruby packages/platform-ios/native_modules.rb", - "lint": "eslint . --cache --report-unused-disable-directives", "flow-check": "flow check", "postinstall": "yarn build", "publish": "yarn build-clean && yarn build && lerna publish" @@ -22,12 +24,16 @@ "@babel/plugin-transform-strict-mode": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-flow": "^7.0.0", - "@react-native-community/eslint-config": "^0.0.3", + "@babel/preset-typescript": "^7.3.3", + "@react-native-community/eslint-config": "^0.0.5", + "@types/jest": "^24.0.11", + "@types/node": "^11.13.0", "babel-jest": "^24.6.0", "babel-plugin-module-resolver": "^3.2.0", "chalk": "^2.4.2", "eslint": "^5.10.0", "eslint-import-resolver-alias": "^1.1.2", + "eslint-import-resolver-typescript": "^1.1.1", "eslint-plugin-import": "^2.17.0", "execa": "^1.0.0", "flow-bin": "^0.97.0", @@ -38,6 +44,7 @@ "metro-memory-fs": "^0.53.1", "micromatch": "^3.1.10", "mkdirp": "^0.5.1", - "string-length": "^2.0.0" + "string-length": "^2.0.0", + "typescript": "^3.4.5" } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 258cdb597..21c27e401 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -49,7 +49,6 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "morgan": "^1.9.0", - "node-fetch": "^2.2.0", "node-notifier": "^5.2.1", "open": "^6.2.0", "ora": "^3.4.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 06b977ff5..038c318c2 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -5,7 +5,6 @@ "dependencies": { "@react-native-community/cli-tools": "^2.0.0-alpha.20", "logkitty": "^0.4.0", - "node-fetch": "^2.2.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 8bf2aace3..df57dd382 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -5,7 +5,13 @@ "dependencies": { "chalk": "^1.1.1", "lodash": "^4.17.5", - "mime": "^1.3.4" + "mime": "^2.4.1", + "node-fetch": "^2.5.0" + }, + "devDependencies": { + "@types/lodash": "^4.14.123", + "@types/mime": "^2.0.1", + "@types/node-fetch": "^2.3.3" }, "files": [ "build" diff --git a/packages/tools/src/__mocks__/logger.js b/packages/tools/src/__mocks__/logger.ts similarity index 96% rename from packages/tools/src/__mocks__/logger.js rename to packages/tools/src/__mocks__/logger.ts index 33dbe25a2..8cc725657 100644 --- a/packages/tools/src/__mocks__/logger.js +++ b/packages/tools/src/__mocks__/logger.ts @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format */ module.exports.out = () => jest.fn(); diff --git a/packages/tools/src/__tests__/groupFilesByType-test.js b/packages/tools/src/__tests__/groupFilesByType.test.ts similarity index 92% rename from packages/tools/src/__tests__/groupFilesByType-test.js rename to packages/tools/src/__tests__/groupFilesByType.test.ts index 17f02ed59..e15a985cc 100644 --- a/packages/tools/src/__tests__/groupFilesByType-test.js +++ b/packages/tools/src/__tests__/groupFilesByType.test.ts @@ -4,8 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format - * @emails oncall+javascript_foundation */ import groupFilesByType from '../groupFilesByType'; diff --git a/packages/tools/src/errors.js b/packages/tools/src/errors.ts similarity index 93% rename from packages/tools/src/errors.js rename to packages/tools/src/errors.ts index 6cb5de299..5c59f26b3 100644 --- a/packages/tools/src/errors.js +++ b/packages/tools/src/errors.ts @@ -16,7 +16,8 @@ export class CLIError extends Error { this.stack = typeof originError === 'string' ? originError - : originError.stack + : originError.stack || + '' .split('\n') .slice(0, 2) .join('\n'); diff --git a/packages/tools/src/getDefaultUserTerminal.js b/packages/tools/src/getDefaultUserTerminal.ts similarity index 63% rename from packages/tools/src/getDefaultUserTerminal.js rename to packages/tools/src/getDefaultUserTerminal.ts index 48550b61b..a5bf91914 100644 --- a/packages/tools/src/getDefaultUserTerminal.js +++ b/packages/tools/src/getDefaultUserTerminal.ts @@ -1,4 +1,4 @@ -const getDefaultUserTerminal = (): ?string => +const getDefaultUserTerminal = (): string | undefined => process.env.REACT_TERMINAL || process.env.TERM_PROGRAM; export default getDefaultUserTerminal; diff --git a/packages/tools/src/groupFilesByType.js b/packages/tools/src/groupFilesByType.ts similarity index 69% rename from packages/tools/src/groupFilesByType.js rename to packages/tools/src/groupFilesByType.ts index cc9a723e8..c42215252 100644 --- a/packages/tools/src/groupFilesByType.js +++ b/packages/tools/src/groupFilesByType.ts @@ -4,22 +4,11 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ import {groupBy} from 'lodash'; import mime from 'mime'; -/** - * Since there are no officially registered MIME types - * for ttf/otf yet http://www.iana.org/assignments/media-types/media-types.xhtml, - * we define two non-standard ones for the sake of parsing - */ -mime.define({ - 'font/opentype': ['otf'], - 'font/truetype': ['ttf'], -}); - /** * Given an array of files, it groups it by it's type. * Type of the file is inferred from it's mimetype based on the extension @@ -32,5 +21,5 @@ mime.define({ * the returned object will be: {font: ['fonts/a.ttf'], image: ['images/b.jpg']} */ export default function groupFilesByType(assets: Array) { - return groupBy(assets, type => mime.lookup(type).split('/')[0]); + return groupBy(assets, type => (mime.getType(type) || '').split('/')[0]); } diff --git a/packages/tools/src/index.js b/packages/tools/src/index.ts similarity index 94% rename from packages/tools/src/index.js rename to packages/tools/src/index.ts index 08c20616d..d99e20bf0 100644 --- a/packages/tools/src/index.js +++ b/packages/tools/src/index.ts @@ -1,6 +1,3 @@ -/** - * @flow - */ export {default as logger} from './logger'; export {default as groupFilesByType} from './groupFilesByType'; export {default as isPackagerRunning} from './isPackagerRunning'; diff --git a/packages/tools/src/isPackagerRunning.js b/packages/tools/src/isPackagerRunning.ts similarity index 72% rename from packages/tools/src/isPackagerRunning.js rename to packages/tools/src/isPackagerRunning.ts index 393fdf817..ff9273346 100644 --- a/packages/tools/src/isPackagerRunning.js +++ b/packages/tools/src/isPackagerRunning.ts @@ -16,18 +16,17 @@ import fetch from 'node-fetch'; * - `not_running`: the packager nor any process is running on the expected port. * - `unrecognized`: one other process is running on the port we expect the packager to be running. */ -function isPackagerRunning( +async function isPackagerRunning( packagerPort: string = process.env.RCT_METRO_PORT || '8081', ): Promise<'running' | 'not_running' | 'unrecognized'> { - return fetch(`http://localhost:${packagerPort}/status`).then( - res => - res - .text() - .then(body => - body === 'packager-status:running' ? 'running' : 'unrecognized', - ), - () => 'not_running', - ); + try { + const result = await fetch(`http://localhost:${packagerPort}/status`); + const body = await result.text(); + + return body === 'packager-status:running' ? 'running' : 'unrecognized'; + } catch (_error) { + return 'not_running'; + } } export default isPackagerRunning; diff --git a/packages/tools/src/logger.js b/packages/tools/src/logger.ts similarity index 98% rename from packages/tools/src/logger.js rename to packages/tools/src/logger.ts index 8bb9cbddd..77cc37138 100644 --- a/packages/tools/src/logger.js +++ b/packages/tools/src/logger.ts @@ -1,6 +1,3 @@ -/** - * @flow - */ import chalk from 'chalk'; const SEPARATOR = ', '; diff --git a/packages/tools/tsconfig.json b/packages/tools/tsconfig.json new file mode 100644 index 000000000..7bb06bce6 --- /dev/null +++ b/packages/tools/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build" + } +} diff --git a/scripts/build.js b/scripts/build.js index cceda31af..b0c10568d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -25,31 +25,21 @@ const mkdirp = require('mkdirp'); const babel = require('@babel/core'); const chalk = require('chalk'); const micromatch = require('micromatch'); -const stringLength = require('string-length'); -const {PACKAGES_DIR, getPackages} = require('./helpers'); +const { + PACKAGES_DIR, + getPackages, + OK, + adjustToTerminalWidth, +} = require('./helpers'); -const OK = chalk.reset.inverse.bold.green(' DONE '); const SRC_DIR = 'src'; const BUILD_DIR = 'build'; const JS_FILES_PATTERN = '**/*.js'; +const TS_FILE_PATTERN = '**/*.ts'; const IGNORE_PATTERN = '**/__{tests,mocks,fixtures}__/**'; const transformOptions = require('../babel.config.js'); -const adjustToTerminalWidth = str => { - const columns = process.stdout.columns || 80; - const WIDTH = columns - stringLength(OK) + 1; - const strs = str.match(new RegExp(`(.{1,${WIDTH}})`, 'g')); - let lastString = strs[strs.length - 1]; - if (lastString.length < WIDTH) { - lastString += Array(WIDTH - lastString.length).join(chalk.dim('.')); - } - return strs - .slice(0, -1) - .concat(lastString) - .join('\n'); -}; - function getPackageName(file) { return path.relative(PACKAGES_DIR, file).split(path.sep)[0]; } @@ -59,7 +49,7 @@ function getBuildPath(file, buildFolder) { const pkgSrcPath = path.resolve(PACKAGES_DIR, pkgName, SRC_DIR); const pkgBuildPath = path.resolve(PACKAGES_DIR, pkgName, buildFolder); const relativeToSrcPath = path.relative(pkgSrcPath, file); - return path.resolve(pkgBuildPath, relativeToSrcPath); + return path.resolve(pkgBuildPath, relativeToSrcPath).replace(/\.ts$/, '.js'); } function buildNodePackage(p) { @@ -89,7 +79,10 @@ function buildFile(file, silent) { mkdirp.sync(path.dirname(destPath), '777'); - if (!micromatch.isMatch(file, JS_FILES_PATTERN)) { + if ( + !micromatch.isMatch(file, JS_FILES_PATTERN) && + !micromatch.isMatch(file, TS_FILE_PATTERN) + ) { fs.createReadStream(file).pipe(fs.createWriteStream(destPath)); silent || process.stdout.write( diff --git a/scripts/buildTs.js b/scripts/buildTs.js new file mode 100644 index 000000000..5ab6c6c8f --- /dev/null +++ b/scripts/buildTs.js @@ -0,0 +1,47 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const chalk = require('chalk'); +const execa = require('execa'); +const {getPackages, adjustToTerminalWidth, OK} = require('./helpers'); + +const packages = getPackages(); + +const packagesWithTs = packages.filter(p => + fs.existsSync(path.resolve(p, 'tsconfig.json')), +); + +const args = [ + path.resolve( + require.resolve('typescript/package.json'), + '..', + require('typescript/package.json').bin.tsc, + ), + '-b', + ...packagesWithTs, + ...process.argv.slice(2), +]; + +console.log(chalk.inverse('Building TypeScript definition files')); +process.stdout.write(adjustToTerminalWidth('Building\n')); + +try { + execa.sync('node', args, {stdio: 'inherit'}); + process.stdout.write(`${OK}\n`); +} catch (e) { + process.stdout.write('\n'); + console.error( + chalk.inverse.red('Unable to build TypeScript definition files'), + ); + console.error(e.stack); + process.exitCode = 1; +} diff --git a/scripts/helpers.js b/scripts/helpers.js index 3dfdf7f3c..97c108ba1 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -1,8 +1,19 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + const fs = require('fs'); const path = require('path'); +const chalk = require('chalk'); +const stringLength = require('string-length'); const PACKAGES_DIR = path.resolve(__dirname, '../packages'); +const OK = chalk.reset.inverse.bold.green(' DONE '); + function getPackages() { return fs .readdirSync(PACKAGES_DIR) @@ -10,7 +21,23 @@ function getPackages() { .filter(f => fs.lstatSync(path.resolve(f)).isDirectory()); } +function adjustToTerminalWidth(str) { + const columns = process.stdout.columns || 80; + const WIDTH = columns - stringLength(OK) + 1; + const strs = str.match(new RegExp(`(.{1,${WIDTH}})`, 'g')); + let lastString = strs[strs.length - 1]; + if (lastString.length < WIDTH) { + lastString += Array(WIDTH - lastString.length).join(chalk.dim('.')); + } + return strs + .slice(0, -1) + .concat(lastString) + .join('\n'); +} + module.exports = { getPackages, PACKAGES_DIR, + adjustToTerminalWidth, + OK, }; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..bc0c60880 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "lib": ["es2017"], + "declaration": true, + "declarationMap": true, + "composite": true, + "emitDeclarationOnly": true, + + "strict": true, + + /* Additional Checks */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + + /* Module Resolution Options */ + "moduleResolution": "node", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "exclude": ["**/__tests__/**/*", "**/build/**/*"] +} diff --git a/yarn.lock b/yarn.lock index 42ac30ffd..a72c5c0fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -430,6 +430,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-typescript@^7.2.0": + version "7.3.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991" + integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-arrow-functions@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz#a6c14875848c68a3b4b3163a486535ef25c7e749" @@ -831,6 +838,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-typescript" "^7.0.0" +"@babel/plugin-transform-typescript@^7.3.2": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.0.tgz#0389ec53a34e80f99f708c4ca311181449a68eb1" + integrity sha512-U7/+zKnRZg04ggM/Bm+xmu2B/PrwyDQTT/V89FXWYWNMxBDwSx56u6jtk9SEbfLFbZaEI72L+5LPvQjeZgFCrQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.2.0" + "@babel/plugin-transform-unicode-regex@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0.tgz#c6780e5b1863a76fe792d90eded9fcd5b51d68fc" @@ -902,6 +917,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-flow-strip-types" "^7.0.0" +"@babel/preset-typescript@^7.3.3": + version "7.3.3" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a" + integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.3.2" + "@babel/register@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827" @@ -1863,11 +1886,13 @@ universal-user-agent "^2.0.0" url-template "^2.0.8" -"@react-native-community/eslint-config@^0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.3.tgz#bf9be8434caa18f85b570cf4e28366f2a7f1ea91" - integrity sha512-YmCiqoiqgSW8YpWYWLwG4WYwVIwvkhfH97COxbin71CuCr5muZPlmhHOFwo2gIQzUvt1ewFb1shtUi1X8TAVhA== +"@react-native-community/eslint-config@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.5.tgz#584f6493258202a57efc22e7be66966e43832795" + integrity sha512-jwO2tnKaTPTLX5XYXMHGEnFdf543SU7jz98/OF5mDH3b7lP+BOaCD+jVfqqHoDRkcqyPlYiR1CgwVGWpi0vMWg== dependencies: + "@typescript-eslint/eslint-plugin" "^1.5.0" + "@typescript-eslint/parser" "^1.5.0" babel-eslint "10.0.1" eslint-plugin-eslint-comments "^3.1.1" eslint-plugin-flowtype "2.50.3" @@ -1916,6 +1941,50 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.0.tgz#1eb8c033e98cf4e1a4cedcaf8bcafe8cb7591e85" integrity sha512-eAtOAFZefEnfJiRFQBGw1eYqa5GTLCZ1y86N0XSI/D6EB+E8z6VPV/UL7Gi5UEclFqoQk+6NRqEDsfmDLXn8sg== +"@types/jest-diff@*": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" + integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== + +"@types/jest@^24.0.11": + version "24.0.11" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.11.tgz#1f099bea332c228ea6505a88159bfa86a5858340" + integrity sha512-2kLuPC5FDnWIDvaJBzsGTBQaBbnDweznicvK7UGYzlIJP4RJR2a4A/ByLUXEyEgag6jz8eHdlWExGDtH3EYUXQ== + dependencies: + "@types/jest-diff" "*" + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/lodash@^4.14.123": + version "4.14.123" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.123.tgz#39be5d211478c8dd3bdae98ee75bb7efe4abfe4d" + integrity sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q== + +"@types/mime@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" + integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== + +"@types/node-fetch@^2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.3.tgz#eb9c2a0ce8e9424ebe0c0cbe6f1e8ea7576c1310" + integrity sha512-MIplfRxrDTsIbOLGyFqNWTmxho5Fs710Kul35tEcaqkx9He86mGbSCDvILL0LCMfmm+oJ8tDg51crE9+pJGgiQ== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.0.tgz#d11813b9c0ff8aaca29f04cbc12817f4c7d656e5" + integrity sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg== + +"@types/node@^11.13.0": + version "11.13.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.0.tgz#b0df8d6ef9b5001b2be3a94d909ce3c29a80f9e1" + integrity sha512-rx29MMkRdVmzunmiA4lzBYJNnXsW/PhG4kMBy2ATsYaDjGGR75dCFEVVROKpNwlVdcUX3xxlghKQOeDPBJobng== + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -1926,6 +1995,33 @@ resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== +"@typescript-eslint/eslint-plugin@^1.5.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.6.0.tgz#a5ff3128c692393fb16efa403ec7c8a5593dab0f" + integrity sha512-U224c29E2lo861TQZs6GSmyC0OYeRNg6bE9UVIiFBxN2MlA0nq2dCrgIVyyRbC05UOcrgf2Wk/CF2gGOPQKUSQ== + dependencies: + "@typescript-eslint/parser" "1.6.0" + "@typescript-eslint/typescript-estree" "1.6.0" + requireindex "^1.2.0" + tsutils "^3.7.0" + +"@typescript-eslint/parser@1.6.0", "@typescript-eslint/parser@^1.5.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.6.0.tgz#f01189c8b90848e3b8e45a6cdad27870529d1804" + integrity sha512-VB9xmSbfafI+/kI4gUK3PfrkGmrJQfh0N4EScT1gZXSZyUxpsBirPL99EWZg9MmPG0pzq/gMtgkk7/rAHj4aQw== + dependencies: + "@typescript-eslint/typescript-estree" "1.6.0" + eslint-scope "^4.0.0" + eslint-visitor-keys "^1.0.0" + +"@typescript-eslint/typescript-estree@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.6.0.tgz#6cf43a07fee08b8eb52e4513b428c8cdc9751ef0" + integrity sha512-A4CanUwfaG4oXobD5y7EXbsOHjCwn8tj1RDd820etpPAjH+Icjc2K9e/DQM1Hac5zH2BSy+u6bjvvF2wwREvYA== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -3250,6 +3346,11 @@ deepmerge@3.2.0, deepmerge@^3.2.0: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== +deepmerge@^2.0.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170" + integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA== + default-require-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-2.0.0.tgz#f5f8fbb18a7d6d50b21f641f649ebb522cfe24f7" @@ -3564,6 +3665,15 @@ eslint-import-resolver-node@^0.3.2: debug "^2.6.9" resolve "^1.5.0" +eslint-import-resolver-typescript@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-1.1.1.tgz#e6d42172b95144ef16610fe104ef38340edea591" + integrity sha512-jqSfumQ+H5y3FUJ6NjRkbOQSUOlbBucGTN3ELymOtcDBbPjVdm/luvJuCfCaIXGh8sEF26ma1qVdtDgl9ndhUg== + dependencies: + debug "^4.0.1" + resolve "^1.4.0" + tsconfig-paths "^3.6.0" + eslint-module-utils@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz#546178dab5e046c8b562bbb50705e2456d7bda49" @@ -5628,6 +5738,13 @@ json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + json5@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" @@ -5886,6 +6003,11 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -6351,9 +6473,10 @@ mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" -mime@^1.3.4: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" +mime@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.1.tgz#19eb7357bebbda37df585b14038347721558c715" + integrity sha512-VRUfmQO0rCd3hKwBymAn3kxYzBHr3I/wdVMywgG3HhXOwrCQgN84ZagpdTm2tZ4TNtwsSmyJWYO88mb5XvzGqQ== mimic-fn@^1.0.0: version "1.2.0" @@ -6574,6 +6697,11 @@ node-fetch@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.1.tgz#1fe551e0ded6c45b3b3b937d0fb46f76df718d1e" +node-fetch@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.5.0.tgz#8028c49fc1191bba56a07adc6e2a954644a48501" + integrity sha512-YuZKluhWGJwCcUu4RlZstdAxr8bFfOVHakc1mplwHkk8J+tqM1Y5yraYvIUpeX8aY7+crCwiELJq7Vl0o0LWXw== + node-gyp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" @@ -7819,6 +7947,11 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" +requireindex@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" + integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== + reselect@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147" @@ -8016,6 +8149,11 @@ sax@~1.1.1: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" +semver@5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" + integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -8718,10 +8856,28 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -tslib@^1.9.0: +tsconfig-paths@^3.6.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.8.0.tgz#4e34202d5b41958f269cf56b01ed95b853d59f72" + integrity sha512-zZEYFo4sjORK8W58ENkRn9s+HmQFkkwydDG7My5s/fnfr2YYCaiyXe/HBUcIgU8epEKOXwiahOO+KZYjiXlWyQ== + dependencies: + "@types/json5" "^0.0.29" + deepmerge "^2.0.1" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" +tsutils@^3.7.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.10.0.tgz#6f1c95c94606e098592b0dff06590cf9659227d6" + integrity sha512-q20XSMq7jutbGB8luhKKsQldRKWvyBO2BGqni3p4yq8Ys9bEP/xQw3KepKmMRt9gJ4lvQSScrihJrcKdKoSU7Q== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -8745,6 +8901,11 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +typescript@^3.4.5: + version "3.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" + integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== + ua-parser-js@^0.7.18: version "0.7.19" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" From 1d2f2546ca2bc4bca38601ce918ee2e4dc37c4b6 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 20 May 2019 14:50:41 +0200 Subject: [PATCH 148/234] chore: improve RNPM warnings (#395) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve RNPM warnings * Update packages/cli/src/tools/config/readConfigFromDisk.js Co-Authored-By: Michał Pierzchała * Fix lint error --- packages/cli/src/tools/config/index.js | 5 +---- .../cli/src/tools/config/readConfigFromDisk.js | 18 +++++++----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 9c402b84e..704f03bee 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -12,7 +12,6 @@ import makeHook from './makeHook'; import { readConfigFromDisk, readDependencyConfigFromDisk, - readLegacyDependencyConfigFromDisk, } from './readConfigFromDisk'; import {type ConfigT} from 'types'; @@ -39,9 +38,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { let config; try { root = resolveNodeModuleDir(projectRoot, dependencyName); - config = - readLegacyDependencyConfigFromDisk(root) || - readDependencyConfigFromDisk(root); + config = readDependencyConfigFromDisk(root); } catch (error) { logger.warn( inlineString(` diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index dc2688fa9..babfb3887 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -55,7 +55,9 @@ export function readDependencyConfigFromDisk( searchPlaces, }); - const {config} = explorer.searchSync(rootFolder) || {config: undefined}; + const {config} = explorer.searchSync(rootFolder) || { + config: readLegacyDependencyConfigFromDisk(rootFolder), + }; const result = Joi.validate(config, schema.dependencyConfig); @@ -90,7 +92,7 @@ const loadProjectCommands = ( /** * Reads a legacy configuration from a `package.json` "rnpm" key. */ -export function readLegacyDependencyConfigFromDisk( +function readLegacyDependencyConfigFromDisk( rootFolder: string, ): ?UserDependencyConfigT { const {rnpm: config, name} = require(path.join(rootFolder, 'package.json')); @@ -113,21 +115,15 @@ export function readLegacyDependencyConfigFromDisk( commands: loadProjectCommands(rootFolder, config.plugin), platforms: config.platform ? require(path.join(rootFolder, config.platform)) - : undefined, + : {}, }; // @todo: paste a link to documentation that explains the migration steps logger.warn( `Package ${chalk.bold( path.basename(name), - )} is using deprecated "rnpm" config that will stop working from next release. Consider upgrading to the new config format.`, + )} is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.`, ); - const result = Joi.validate(transformedConfig, schema.dependencyConfig); - - if (result.error) { - throw new JoiError(result.error); - } - - return result.value; + return transformedConfig; } From ba14149103a68bc2946bd8d40aa04667e8b3b195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 20 May 2019 14:53:47 +0200 Subject: [PATCH 149/234] v2.0.0-alpha.21 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 5bd0094b9..6766ee27e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.20", + "version": "2.0.0-alpha.21", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 21c27e401..dc634c3ec 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.20", + "version": "2.0.0-alpha.21", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-alpha.20", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.20", - "@react-native-community/cli-tools": "^2.0.0-alpha.20", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.21", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.21", + "@react-native-community/cli-tools": "^2.0.0-alpha.21", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 038c318c2..829f78f37 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.20", + "version": "2.0.0-alpha.21", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.20", + "@react-native-community/cli-tools": "^2.0.0-alpha.21", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index bd276169d..99e180c8c 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.20", + "version": "2.0.0-alpha.21", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.20", + "@react-native-community/cli-tools": "^2.0.0-alpha.21", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index df57dd382..275c8980d 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.20", + "version": "2.0.0-alpha.21", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From bb11ffd8c2f9ed570d28ee9b92a0ff62d63b4455 Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Mon, 20 May 2019 15:58:21 +0100 Subject: [PATCH 150/234] feat: allow `dependencyConfig` to override `podspec` name (#393) * [ios][docs] document podspec param * [ios] add podspec to dependencyConfig schema * [types] add podspec to config * [config] add podspec param override to config --- docs/dependencies.md | 5 +++++ packages/cli/src/tools/config/schema.js | 1 + packages/platform-ios/src/config/index.js | 2 +- types/index.js | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/dependencies.md b/docs/dependencies.md index bfd20cbdb..afdc4f198 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -56,6 +56,7 @@ The following settings are available on iOS and Android: ```ts type DependencyParamsIOST = { project?: string, + podspec?: string, sharedLibraries?: string[], }; @@ -71,6 +72,10 @@ type DependencyParamsAndroidT = { Custom path to `.xcodeproj` +#### platforms.ios.podspec + +Custom `podspec` name to use when auto-linking (without the file extension). Your `podspec` file must be located in the root of the dependency package. + #### platforms.ios.sharedLibraries An array of shared iOS libraries to link with the dependency. E.g. `libc++`. This is mostly a requirement of the native code that a dependency ships with. diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index f5575fce5..548a0f242 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -49,6 +49,7 @@ export const dependencyConfig = t ios: t .object({ project: t.string(), + podspec: t.string(), sharedLibraries: t.array().items(t.string()), libraryFolder: t.string(), }) diff --git a/packages/platform-ios/src/config/index.js b/packages/platform-ios/src/config/index.js index fd3e3a6b3..258d4afb1 100644 --- a/packages/platform-ios/src/config/index.js +++ b/packages/platform-ios/src/config/index.js @@ -53,7 +53,7 @@ export function projectConfig( folder, pbxprojPath: path.join(projectPath, 'project.pbxproj'), podfile: findPodfilePath(projectPath), - podspec: findPodspecName(folder), + podspec: userConfig.podspec || findPodspecName(folder), projectPath, projectName: path.basename(projectPath), libraryFolder: userConfig.libraryFolder || 'Libraries', diff --git a/types/index.js b/types/index.js index b0fa6d58f..313d0e5ed 100644 --- a/types/index.js +++ b/types/index.js @@ -66,6 +66,7 @@ type ProjectParamsAndroidT = { */ type ProjectParamsIOST = { project?: string, + podspec?: string, sharedLibraries?: string[], libraryFolder?: string, plist: any[], @@ -221,7 +222,7 @@ type ProjectConfigIOST = { folder: string, pbxprojPath: string, podfile: null, - podspec: null, + podspec: null | string, projectPath: string, projectName: string, libraryFolder: string, From 4053d0711021ee7ac104cd7d9d7acc390f2fbfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 21 May 2019 13:54:10 +0200 Subject: [PATCH 151/234] feat: remove manifest from config output (#398) * feat: remove manifest from config output * fix typo in the docs --- docs/configuration.md | 3 +- docs/dependencies.md | 44 +++---- docs/init.md | 8 +- docs/platforms.md | 121 +++++++++--------- docs/plugins.md | 23 ++-- docs/projects.md | 51 ++++---- packages/platform-android/src/config/index.js | 2 +- types/index.js | 14 -- 8 files changed, 128 insertions(+), 138 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 173f4df37..bca5ad350 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -4,9 +4,10 @@ React Native CLI has a configuration mechanism that allows changing its behavior > Note: Configuring CLI used to be possible via `rn-cli.config.js` (that has been renamed to `metro.config.js`) and never documented `rnpm` entry on the `package.json`. We have provided migration guides where possible. -React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on the type of a package, the set of valid properties is different. +React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on the type of a package, the set of valid properties is different. Check the documentation for + - [projects](./projects.md) - [dependencies](./dependencies.md) - [platforms](./platforms.md) diff --git a/docs/dependencies.md b/docs/dependencies.md index afdc4f198..128b20582 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -4,9 +4,9 @@ A dependency is a JavaScript package that is listed under dependencies present i For example, `lodash` is a dependency that doesn't have any native code to link. On the other hand, `react-native-vector-icons` is a dependency that contains not only native code, but also font assets that the CLI should link. -By default, CLI analyses the folder structure inside the dependency and looks for assets and native files to link. This simple heuristic works in most of the cases. +By default, CLI analyses the folder structure inside the dependency and looks for assets and native files to link. This simple heuristic works in most of the cases. -At the same time, a dependency can explicitly set its configuration in case CLI cannot infer it properly. A dependency can also define additional settings, such as a script to run after linking, in order to support some advanced use-cases. +At the same time, a dependency can explicitly set its configuration in case CLI cannot infer it properly. A dependency can also define additional settings, such as a script to run after linking, in order to support some advanced use-cases. ## How does it work? @@ -34,12 +34,12 @@ The following type describes the configuration of a dependency that can be set u ```ts type DependencyConfigT = { platforms: { - [key: string]: any, - }, - assets: string[], + [key: string]: any; + }; + assets: string[]; hooks: { - [key: string]: string, - } + [key: string]: string; + }; }; ``` @@ -47,7 +47,7 @@ type DependencyConfigT = { ### platforms -A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. +A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. In most cases, as a library author, you should not need to define any of these. @@ -55,16 +55,16 @@ The following settings are available on iOS and Android: ```ts type DependencyParamsIOST = { - project?: string, - podspec?: string, - sharedLibraries?: string[], + project?: string; + podspec?: string; + sharedLibraries?: string[]; }; type DependencyParamsAndroidT = { - sourceDir?: string, - manifestPath?: string, - packageImportPath?: string, - packageInstance?: string + sourceDir?: string; + manifestPath?: string; + packageImportPath?: string; + packageInstance?: string; }; ``` @@ -94,7 +94,7 @@ Custom package import. For example: `import com.acme.AwesomePackage;`. #### platforms.android.packageInstance -Custom syntax to instantiate a package. By default, it's a `new AwesomePackage()`. It can be useful when your package requires additional arguments while initializing. +Custom syntax to instantiate a package. By default, it's a `new AwesomePackage()`. It can be useful when your package requires additional arguments while initializing. For settings applicable on other platforms, please consult their respective documentation. @@ -104,7 +104,7 @@ An array of assets folders to glob for files to link. ### hooks -A map where key is the name of a hook and value is the path to a file to execute. +A map where key is the name of a hook and value is the path to a file to execute. For example, `link` command supports `prelink` and `postlink` hooks to run before and after linking is done. @@ -116,7 +116,7 @@ These are the only ones supported by CLI at the moment. Depending on the package The changes are mostly cosmetic so the migration should be pretty straight-forward. -> Note: We read `rnpm` configuration to remain backwards-compatible. Dependency maintainers should update their configuration in the nearest future. +> Note: We read `rnpm` configuration to remain backwards-compatible. Dependency maintainers should update their configuration in the nearest future. ### Changing the configuration @@ -129,7 +129,7 @@ Properties were renamed. Look at the following example for the differences. "android": {}, "assets": ["./path-to-assets"], "hooks": { - "prelink": "./path-to-a-postlink-hook" + "prelink": "./path-to-a-prelink-hook" } } } @@ -146,9 +146,9 @@ module.exports = { }, assets: ['./path-to-assets'], hooks: { - prelink: './path-to-a-postlink-hook' - } - } + prelink: './path-to-a-prelink-hook', + }, + }, }; ``` diff --git a/docs/init.md b/docs/init.md index 8bd4e5d3b..b222f2524 100644 --- a/docs/init.md +++ b/docs/init.md @@ -33,6 +33,7 @@ npx react-native@${VERSION} init ProjectName #### Initializing project with custom template. In following examples `TEMPLATE_NAME` can be either: + - Full package name, eg. `react-native-template-typescript`. - Shorthand name of template, eg. `typescript`. - Absolute path to directory containing template, eg. `file:///Users/username/project/some-template`. @@ -47,6 +48,7 @@ npx react-native@${VERSION} init ProjectName --template ${TEMPLATE_NAME} ``` You can force usage of `npm` if you have both `yarn` and `npm` installed on your machine: + ```sh npx react-native init ProjectName --npm ``` @@ -69,13 +71,13 @@ Every custom template needs to have configuration file called `template.config.j ```js module.exports = { // Placeholder name that will be replaced in package.json, index.json, android/, ios/ for a project name. - placeholderName: "ProjectName", + placeholderName: 'ProjectName', // Directory with the template which will be copied and processed by React Native CLI. Template directory should have package.json with all dependencies specified, including `react-native`. - templateDir: "./template", + templateDir: './template', // Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template. - postInitScript: "./script.js", + postInitScript: './script.js', }; ``` diff --git a/docs/platforms.md b/docs/platforms.md index 23f6c2d0b..fa2f66d8e 100644 --- a/docs/platforms.md +++ b/docs/platforms.md @@ -1,6 +1,6 @@ # Platforms -A platform is a React Native package that enables writing and shipping React Native applications to a new target. +A platform is a React Native package that enables writing and shipping React Native applications to a new target. For example, React Native Windows is a platform, because it allows to run React Native apps on Windows. At the same time, React Native itself is also a platform - it allows to run React Native apps on Android, iOS and tvOS. @@ -9,6 +9,7 @@ Each platform can have an additional configuration for the CLI to enable bundlin ## How does it work? A platform can define the following `react-native.config.js` at the root: + ```js const ios = require('@react-native-community/cli-platform-ios'); const android = require('@react-native-community/cli-platform-android'); @@ -18,19 +19,20 @@ module.exports = { ios: { linkConfig: ios.linkConfig, projectConfig: ios.projectConfig, - dependencyConfig: ios.dependencyConfig + dependencyConfig: ios.dependencyConfig, }, android: { linkConfig: android.linkConfig, projectConfig: android.projectConfig, - dependencyConfig: android.dependencyConfig - } - } -} + dependencyConfig: android.dependencyConfig, + }, + }, +}; ``` -> The above config adds support for linking Android and iOS dependencies by the CLI as well as bundling code for these platforms. This config can be found in [React Native repository](https://github.com/facebook/react-native/blob/0.60-stable/react-native.config.js) from 0.60 version on. -At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. +> The above config adds support for linking Android and iOS dependencies by the CLI as well as bundling code for these platforms. This config can be found in [React Native repository](https://github.com/facebook/react-native/blob/0.60-stable/react-native.config.js) from 0.60 version on. + +At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. At the end, a map of available platforms is passed to the bundler (Metro) to make it aware of the platforms available. This allows APIs such as `Platform.select` and requiring files with platform extensions to work properly. @@ -59,15 +61,16 @@ type PlatformConfig = { Returns a project configuration for a given platform or `null`, when no project found. This is later used inside `linkConfig` to perform linking and unlinking. -First argument is a root folder where the project is located. +First argument is a root folder where the project is located. Second argument is everything that users defined under: + ```js module.exports = { project: { - [yourPlatformKey]: {} - } -} + [yourPlatformKey]: {}, + }, +}; ``` > Note: You may find this useful in order to alter the default behavior of your function. For example, on iOS, we find an `.xcodeproj` by globbing the project files and taking the first match. There's a possibility we pick the wrong one in case the project has multiple `.xcodeproj` files. In order to support this use-case, we have allowed users to define an exact path to an iOS project in order to overwrite our `glob` mechanism. @@ -76,29 +79,29 @@ On Android and iOS, this function returns: ```ts type ProjectConfigIOST = { - sourceDir: string, - folder: string, - pbxprojPath: string, - podfile: null, - podspec: null, - projectPath: string, - projectName: string, - libraryFolder: string, - sharedLibraries: Array, - plist: Array, + sourceDir: string; + folder: string; + pbxprojPath: string; + podfile: null; + podspec: null; + projectPath: string; + projectName: string; + libraryFolder: string; + sharedLibraries: Array; + plist: Array; }; type ProjectConfigAndroidT = { - sourceDir: string, - isFlat: boolean, - folder: string, - stringsPath: string, - manifestPath: string, - buildGradlePath: string, - settingsGradlePath: string, - assetsPath: string, - mainFilePath: string, - packageName: string, + sourceDir: string; + isFlat: boolean; + folder: string; + stringsPath: string; + manifestPath: string; + buildGradlePath: string; + settingsGradlePath: string; + assetsPath: string; + mainFilePath: string; + packageName: string; }; ``` @@ -106,17 +109,18 @@ We suggest performing all side-effects inside this function (such as resolving p ### dependencyConfig -Similar to [`projectConfig`](#projectconfig) above, but for a dependency of a project. +Similar to [`projectConfig`](#projectconfig) above, but for a dependency of a project. First argument is a path to a root folder of a dependency. Second argument is everything that dependency authors defined under: + ```js module.exports = { dependency: { - [yourPlatformKey]: {} - } -} + [yourPlatformKey]: {}, + }, +}; ``` On Android and iOS, this function returns: @@ -125,17 +129,16 @@ On Android and iOS, this function returns: type DependencyConfigIOST = ProjectConfigIOST; type DependencyConfigAndroidT = { - sourceDir: string, - folder: string, - manifest: Manifest, - packageImportPath: string, - packageInstance: string, + sourceDir: string; + folder: string; + packageImportPath: string; + packageInstance: string; }; ``` ### linkConfig -Returns an object with utilities that are run by the CLI while linking. +Returns an object with utilities that are run by the CLI while linking. > Note: The following is deprecated and will stop working in the future. Consider providing a [`autolinking`](./autolinking.md) support. @@ -161,7 +164,7 @@ Performs platform-specific steps in order to unlink assets of a library from a p ## Migrating from `rnpm` configuration -The changes are mostly cosmetic so the migration should be pretty straight-forward. +The changes are mostly cosmetic so the migration should be pretty straight-forward. ### Changing the configuration for a platform @@ -173,12 +176,8 @@ For example: { "rnpm": { "haste": { - "platforms": [ - "windows" - ], - "providesModuleNodeModules": [ - "react-native-windows" - ] + "platforms": ["windows"], + "providesModuleNodeModules": ["react-native-windows"] }, "platform": "./local-cli/platform.js" } @@ -191,7 +190,7 @@ to `react-native.config.js` module.exports = { platforms: { windows: require('./local-cli/platform.js').windows, - } + }, }; ``` @@ -199,7 +198,7 @@ module.exports = { ### Changing platform configuration for a [`dependency`](./dependencies.md) -Platform keys are now under `dependency.platforms`. +Platform keys are now under `dependency.platforms`. For example: @@ -220,18 +219,18 @@ module.exports = { dependency: { platforms: { ios: { - project: 'PathToCustomProject.xcodeproj' - } - } - } -} + project: 'PathToCustomProject.xcodeproj', + }, + }, + }, +}; ``` > The above is a configuration of a dependency that explicitly sets a path to `.xcodeproj`. ### Changing platform configuration for a [`project`](./projects.md) -Platform keys are now under `project.platforms`. +Platform keys are now under `project.platforms`. For example: @@ -251,10 +250,10 @@ to `react-native.config.js` module.exports = { project: { ios: { - project: 'PathToCustomProject.xcodeproj' - } - } -} + project: 'PathToCustomProject.xcodeproj', + }, + }, +}; ``` > The above is a configuration of a project that explicitly sets its main `.xcodeproj` project. diff --git a/docs/plugins.md b/docs/plugins.md index b5f0dc1d4..82d988b59 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,16 +15,15 @@ module.exports = { commands: [ { name: 'foo-command', - func: () => console.log('It worked') - } - ] + func: () => console.log('It worked'), + }, + ], }; ``` -> Above is an example of a plugin that exports a command named `foo-command` that can be executed with `react-native foo-command` and logs "It worked" and exits. +> Above is an example of a plugin that exports a command named `foo-command` that can be executed with `react-native foo-command` and logs "It worked" and exits. - -At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. +At the startup, React Native CLI reads configuration from all dependencies listed in `package.json` and reduces them into a single configuration. At the end, an array of commands concatenated from all plugins is passed on to the CLI to be loaded after built-in commands. @@ -56,7 +55,7 @@ type Command = { #### `name` -A name that will be used in order to run the command. +A name that will be used in order to run the command. Note: If you want your command to accept additional arguments, make sure to include them in the name. @@ -110,26 +109,30 @@ A command with arguments and options (if applicable) that can be run in order to ## Migrating from `rnpm` configuration -The changes are mostly cosmetic so the migration should be pretty straight-forward. +The changes are mostly cosmetic so the migration should be pretty straight-forward. ### Changing the configuration A `plugin` property should be renamed to `commands`. For example, the following `rnpm` configuration inside `package.json`: + ```json { "rnpm": { - "plugin": "./path-to-commands.js", + "plugin": "./path-to-commands.js" } } ``` + should be moved to a `react-native.config.js`: + ```js module.exports = { - commands: require('./path-to-commands.js') + commands: require('./path-to-commands.js'), }; ``` + provided that `./path-to-commands.js` returns an array of commands. ### Renaming command options diff --git a/docs/projects.md b/docs/projects.md index 1a2a681ff..1d8cb92dc 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -14,10 +14,10 @@ For example, below configuration informs CLI of the additional assets to link an module.exports = { project: { ios: { - project: './CustomProject.xcodeproj' - } + project: './CustomProject.xcodeproj', + }, }, - assets: ['./assets'] + assets: ['./assets'], }; ``` @@ -59,7 +59,7 @@ React Native from a (custom) source. ### project -A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. +A map of specific settings that can be set per platform. The exact shape is always defined by the package that provides given platform. In most cases, as a React Native developer, you should not need to define any of these. @@ -67,23 +67,23 @@ The following settings are available on iOS and Android: ```ts type ProjectParamsAndroidT = { - sourceDir?: string, - manifestPath?: string, - packageName?: string, - packageFolder?: string, - mainFilePath?: string, - stringsPath?: string, - settingsGradlePath?: string, - assetsPath?: string, - buildGradlePath?: string, - packageName?: string, + sourceDir?: string; + manifestPath?: string; + packageName?: string; + packageFolder?: string; + mainFilePath?: string; + stringsPath?: string; + settingsGradlePath?: string; + assetsPath?: string; + buildGradlePath?: string; + packageName?: string; }; type ProjectParamsIOST = { - project?: string, - sharedLibraries?: string[], - libraryFolder?: string, - plist: any[], + project?: string; + sharedLibraries?: string[]; + libraryFolder?: string; + plist: any[]; }; ``` @@ -104,17 +104,19 @@ An array of commands defined inside a project. You can check the format and opti Dependencies is a map where key is the name of the dependency and value is an object that can override any of the resolved settings for a particular package. For example, you could set: + ```js module.exports = { dependencies: { ['react-native-webview']: { platforms: { - ios: null - } - } - } -} + ios: null, + }, + }, + }, +}; ``` + in order to disable linking of React Native WebView on iOS. The object provided here is deep merged with the dependency config. Check [`projectConfig`](platforms.md#projectconfig) and [`dependencyConfig`](platforms.md#dependencyConfig) return values for a full list of properties that you can override. @@ -150,6 +152,3 @@ module.exports = { assets: ['./path-to-assets'], }; ``` - - - diff --git a/packages/platform-android/src/config/index.js b/packages/platform-android/src/config/index.js index e6cbf5155..78ab2f682 100644 --- a/packages/platform-android/src/config/index.js +++ b/packages/platform-android/src/config/index.js @@ -126,5 +126,5 @@ export function dependencyConfig(folder, userConfig = {}) { const packageInstance = userConfig.packageInstance || `new ${packageClassName}()`; - return {sourceDir, folder, manifest, packageImportPath, packageInstance}; + return {sourceDir, folder, packageImportPath, packageInstance}; } diff --git a/types/index.js b/types/index.js index 313d0e5ed..a17e6f305 100644 --- a/types/index.js +++ b/types/index.js @@ -245,20 +245,6 @@ type ProjectConfigAndroidT = { type DependencyConfigAndroidT = { sourceDir: string, folder: string, - manifest: Manifest, packageImportPath: string, packageInstance: string, }; - -type Manifest = { - name: string, - attr: { - [key: string]: string, - package: string, - }, - val: string, - isValCdata: boolean, - children: Array, - firstChild: Manifest, - lastChild: Manifest, -}; From 24babd6c5d8caefef660615974d8f41ebc9e1feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 21 May 2019 14:04:29 +0200 Subject: [PATCH 152/234] v2.0.0-alpha.22 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 6766ee27e..92ef6ebb4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index dc634c3ec..c506eb61c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-alpha.21", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.21", - "@react-native-community/cli-tools": "^2.0.0-alpha.21", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.22", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.22", + "@react-native-community/cli-tools": "^2.0.0-alpha.22", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 829f78f37..294411e1b 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.21", + "@react-native-community/cli-tools": "^2.0.0-alpha.22", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 99e180c8c..3127ffad2 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.21", + "@react-native-community/cli-tools": "^2.0.0-alpha.22", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 275c8980d..a19b667d4 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 644380f769ec1c9b53259c0b45c66f3c36270d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 21 May 2019 15:27:16 +0200 Subject: [PATCH 153/234] feat: log error stacktrace by default (#396) --- packages/cli/src/cliEntry.js | 4 ++- .../platform-ios/src/commands/runIOS/index.js | 6 ++-- .../src/link-pods/registerNativeModule.js | 28 +++++++++---------- packages/tools/src/errors.ts | 26 ++++++++--------- packages/tools/src/isPackagerRunning.ts | 1 - 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 8f480c7b9..c22bc0573 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -47,7 +47,9 @@ const handleError = err => { )}`, ); } - logger.debug(chalk.dim(err.stack)); + if (err.stack) { + logger.log(chalk.dim(err.stack)); + } process.exit(1); }; diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index b5f5a760c..3d3b395bf 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -114,13 +114,13 @@ async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { {encoding: 'utf8'}, ), ); - } catch (e) { - throw new CLIError('Could not parse the simulator list output'); + } catch (error) { + throw new CLIError('Could not parse the simulator list output', error); } const selectedSimulator = findMatchingSimulator(simulators, args.simulator); if (!selectedSimulator) { - throw new CLIError(`Could not find ${args.simulator} simulator`); + throw new CLIError(`Could not find "${args.simulator}" simulator`); } /** diff --git a/packages/platform-ios/src/link-pods/registerNativeModule.js b/packages/platform-ios/src/link-pods/registerNativeModule.js index a3363e0a4..7a4bcd130 100644 --- a/packages/platform-ios/src/link-pods/registerNativeModule.js +++ b/packages/platform-ios/src/link-pods/registerNativeModule.js @@ -7,7 +7,7 @@ * @format */ import chalk from 'chalk'; -import {CLIError, inlineString} from '@react-native-community/cli-tools'; +import {CLIError} from '@react-native-community/cli-tools'; import readPodfile from './readPodfile'; import findPodTargetLine from './findPodTargetLine'; @@ -36,20 +36,18 @@ function getLinesToAddEntry(podLines, {projectName}) { } const firstTargetLined = findPodTargetLine(podLines, projectName); if (firstTargetLined === null) { - throw new CLIError( - inlineString(` - We couldn't find a target to add a CocoaPods dependency. - - Make sure that you have a "${chalk.dim( - `target '${projectName.replace('.xcodeproj', '')}' do`, - )}" line in your Podfile. - - Alternatively, include "${chalk.dim( - MARKER_TEXT, - )}" in a Podfile where we should add - linked dependencies. - `), - ); + throw new CLIError(` + We couldn't find a target to add a CocoaPods dependency. + + Make sure that you have a "${chalk.dim( + `target '${projectName.replace('.xcodeproj', '')}' do`, + )}" line in your Podfile. + + Alternatively, include "${chalk.dim( + MARKER_TEXT, + )}" in a Podfile where we should add + linked dependencies. + `); } return findLineToAddPod(podLines, firstTargetLined); } diff --git a/packages/tools/src/errors.ts b/packages/tools/src/errors.ts index 5c59f26b3..17339a171 100644 --- a/packages/tools/src/errors.ts +++ b/packages/tools/src/errors.ts @@ -1,28 +1,24 @@ /** - * @flow - */ - -/** - * CLIError - * - * Features: - * - uses original stack trace when error object is passed - * - makes an inline string to match current styling inside CLI + * A custom Error that creates a single-lined message to match current styling inside CLI. + * Uses original stack trace when `originalError` is passed or erase the stack if it's not defined. */ export class CLIError extends Error { - constructor(msg: string, originError?: Error | string) { + constructor(msg: string, originalError?: Error | string) { super(inlineString(msg)); - if (originError) { + if (originalError) { this.stack = - typeof originError === 'string' - ? originError - : originError.stack || + typeof originalError === 'string' + ? originalError + : originalError.stack || '' .split('\n') .slice(0, 2) .join('\n'); } else { - Error.captureStackTrace(this, CLIError); + // When the "originalError" is not passed, it means that we know exactly + // what went wrong and provide means to fix it. In such cases showing the + // stack is an unnecessary clutter to the CLI output, hence removing it. + delete this.stack; } } } diff --git a/packages/tools/src/isPackagerRunning.ts b/packages/tools/src/isPackagerRunning.ts index ff9273346..11b276368 100644 --- a/packages/tools/src/isPackagerRunning.ts +++ b/packages/tools/src/isPackagerRunning.ts @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ import fetch from 'node-fetch'; From bceb068b0637993c86108cf9c700634a00521bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= <165856+hramos@users.noreply.github.com> Date: Mon, 27 May 2019 05:00:23 -0700 Subject: [PATCH 154/234] [CI] Migrate to Circle 2.1, add Node LTS tests (#402) --- .circleci/config.yml | 86 +++++++++++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 80d4a907b..7eb3dd4d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,24 @@ -version: 2 +version: 2.1 defaults: &defaults - docker: - - image: circleci/node:8 working_directory: ~/react-native-cli -jobs: - install-dependencies: +executors: + node8: + <<: *defaults + docker: + - image: circleci/node:8 + nodelts: + <<: *defaults + docker: + - image: circleci/node:lts + noderuby: <<: *defaults + docker: + - image: circleci/ruby:2.4-node + +commands: + install-dependencies: steps: - checkout - attach_workspace: @@ -25,28 +36,22 @@ jobs: root: . paths: - . - lint: - <<: *defaults + run-lint: steps: - attach_workspace: at: ~/react-native-cli - run: yarn lint - typecheck: - <<: *defaults + run-typecheck: steps: - attach_workspace: at: ~/react-native-cli - run: yarn flow-check - cocoa-pods: - <<: *defaults - docker: - - image: circleci/ruby:2.4-node + run-cocoa-pods-tests: steps: - attach_workspace: at: ~/react-native-cli - run: yarn test:ci:cocoapods - unit-tests: - <<: *defaults + run-unit-tests: steps: - attach_workspace: at: ~/react-native-cli @@ -54,30 +59,63 @@ jobs: - store_artifacts: path: coverage destination: coverage - e2e-tests: - <<: *defaults + run-e2e-tests: steps: - attach_workspace: at: ~/react-native-cli - run: yarn test:ci:e2e +jobs: + setup: + executor: node8 + steps: + - install-dependencies + lint: + executor: node8 + steps: + - run-lint + typecheck: + executor: node8 + steps: + - run-typecheck + cocoa-pods: + executor: noderuby + steps: + - run-cocoa-pods-tests + unit-tests: + executor: node8 + steps: + - run-unit-tests + e2e-tests: + executor: node8 + steps: + - run-e2e-tests + lts-tests: + executor: nodelts + steps: + - install-dependencies + - run-lint + - run-typecheck + - run-unit-tests + - run-e2e-tests + workflows: - version: 2 build-and-test: jobs: - - install-dependencies + - setup - lint: requires: - - install-dependencies + - setup - typecheck: requires: - - install-dependencies + - setup - unit-tests: requires: - - install-dependencies + - setup - e2e-tests: requires: - - install-dependencies + - setup - cocoa-pods: requires: - - install-dependencies + - setup + - lts-tests From 4be4c2571891a42ff8be15c83f8e8a87bdc87685 Mon Sep 17 00:00:00 2001 From: James Ide Date: Mon, 27 May 2019 05:36:27 -0700 Subject: [PATCH 155/234] fix: Ensure that bundle URL origin matches debugger page origin (#403) This structurally sets up the Chrome debugger not to have CORS issues if the bundle URL domain differs from the Chrome debugger page domain. This bug was initially fixed in https://github.com/facebook/react-native/pull/17720 and regressed in https://github.com/react-native-community/cli/pull/194. This commit fixes the original bug without changing the behavior introduced in #194. This commit makes the debugger page use its own URL origin when loading the bundle URL. This addresses the case where the native client may have a bundle URL with a domain like xip.io. Fundamentally, unless the development server allows cross-origin requests, the bundle URL's domain must match the domain used by the Chrome debugger page, which is what this commit achieves. --- .../cli/src/commands/server/debugger-ui/index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/debugger-ui/index.html b/packages/cli/src/commands/server/debugger-ui/index.html index 320b48289..a0ebbbd69 100644 --- a/packages/cli/src/commands/server/debugger-ui/index.html +++ b/packages/cli/src/commands/server/debugger-ui/index.html @@ -219,7 +219,15 @@ connectToDebuggerProxy(); async function getBlobUrl(url) { - return await window.deltaUrlToBlobUrl(url.replace('.bundle', '.delta')); + // Ensure that the bundle URL has the same origin as this webpage so that + // the same-origin policy lets us fetch it + const urlObject = new URL(url, location); + const relativeUrl = urlObject.pathname.replace('.bundle', '.delta') + + urlObject.search + + urlObject.hash; + const localUrl = new URL(relativeUrl, location).toString(); + + return await window.deltaUrlToBlobUrl(localUrl); } })(); From f0ca2c35c65128d0c8baa2fedbc6662246091484 Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Wed, 29 May 2019 14:05:59 +0100 Subject: [PATCH 156/234] [android] Fixed a crash when adding non-autolinked custom `ReactPackages` (#407) --- packages/platform-android/native_modules.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index e7e00e20a..3f6bdea37 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -12,7 +12,7 @@ import android.content.res.Resources; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; -import java.util.List; +import java.util.ArrayList; {{ packageImports }} @@ -38,10 +38,10 @@ public class PackageList { return this.getApplication().getApplicationContext(); } - public List getPackages() { - return Arrays.asList( + public ArrayList getPackages() { + return new ArrayList<>(Arrays.asList( new MainReactPackage(){{ packageClassInstances }} - ); + )); } } """ From 7c487fea1e9ba1c11df5e2fac88130066c5af4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 29 May 2019 15:06:53 +0200 Subject: [PATCH 157/234] v2.0.0-alpha.23 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 92ef6ebb4..0d9540139 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.22", + "version": "2.0.0-alpha.23", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index c506eb61c..42b12dddd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.22", + "version": "2.0.0-alpha.23", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-alpha.22", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.22", - "@react-native-community/cli-tools": "^2.0.0-alpha.22", + "@react-native-community/cli-platform-android": "^2.0.0-alpha.23", + "@react-native-community/cli-platform-ios": "^2.0.0-alpha.23", + "@react-native-community/cli-tools": "^2.0.0-alpha.23", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 294411e1b..c8070fef3 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.22", + "version": "2.0.0-alpha.23", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.22", + "@react-native-community/cli-tools": "^2.0.0-alpha.23", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 3127ffad2..412c2259d 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.22", + "version": "2.0.0-alpha.23", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.22", + "@react-native-community/cli-tools": "^2.0.0-alpha.23", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index a19b667d4..a9c576e61 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.22", + "version": "2.0.0-alpha.23", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 190dc9f6f1869d9eda22278b50409dfa8cb9031f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 30 May 2019 15:05:03 +0200 Subject: [PATCH 158/234] chore: add CODEOWNERS file (#404) --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..9f2d69ff5 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @grabbou @thymikee @esemesek From 3770603a0bf994b346c8a017560e23367f7856db Mon Sep 17 00:00:00 2001 From: Anna Doubkova Date: Fri, 31 May 2019 11:39:22 +0100 Subject: [PATCH 159/234] chore(docs): update CONTRIBUTING.md (#409) --- CONTRIBUTING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd506a249..fdb38e7f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,6 +61,25 @@ react-native init --version ${RN_VERSION} npm config set registry https://registry.npmjs.org/ ``` +## Running `start` command + +In order for symlinks to work correctly when running `start` locally, set REACT_NATIVE_APP_ROOT as the root folder of your cli project: + +``` +REACT_NATIVE_APP_ROOT=path/to/cli node path/to/cli/packages/cli/build/index.js start +``` + +## Running CLI with React Native from the source + +First make sure you have RN repo checked out and CLI repo checked out and built. Then you can start a new RN project with local version of CLI and RN without publishing or proxy: + +1. Check out `react-native` repo. Then update template in local `react-native/template/package.json`, replacing dependency version of `react-native` with the absolute path of the react native repo, for example: "react-native": "file:///Users/username/react-native" (you can find the absolute path using `pwd` command) + +1. Go back up and create a new RN project: `node ./cli/packages/cli/build/index.js init --template=file:///path/to/local/react-native RNTestProject` + +1. To work with android, update gradle config in the newly created project following the second part of [Christoph's instructions](https://gist.github.com/cpojer/38a91f90614f35769e88410e3a387b48) + +1. Run start (as described above) and compile your app eg `node ../cli/packages/cli/build/index.js run-android` (make sure you definitely have NDK r17c installed before building android) ## Typechecking, linting and testing From 2b19fc84b7a97beda977b71577a321fac9db6054 Mon Sep 17 00:00:00 2001 From: Yuri Kulikov Date: Fri, 31 May 2019 16:07:56 +0300 Subject: [PATCH 160/234] fix: no active iOS device case in `logIOS` (#410) --- packages/platform-ios/src/commands/logIOS/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-ios/src/commands/logIOS/index.js b/packages/platform-ios/src/commands/logIOS/index.js index 0a0cf0d2b..9e4e5524d 100644 --- a/packages/platform-ios/src/commands/logIOS/index.js +++ b/packages/platform-ios/src/commands/logIOS/index.js @@ -36,7 +36,7 @@ async function logIOS() { const {devices} = JSON.parse(rawDevices); const device = findAvailableDevice(devices); - if (device === undefined) { + if (device === null) { logger.error('No active iOS device found'); return; } From 2f24a8c09daf9422461949ef0a8d69fbd7eeace0 Mon Sep 17 00:00:00 2001 From: Matthew Salmon <138464+invig@users.noreply.github.com> Date: Wed, 5 Jun 2019 14:59:16 +1000 Subject: [PATCH 161/234] fix: Add a simulator.isAvailable check for true value (#414) * Add a simulator.isAvailable check for true Installing the Xcode 11 beta changes the result of isAvailable to `true` and `false`. * Fix lint error --- .../platform-ios/src/commands/runIOS/findMatchingSimulator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js b/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js index c46a25c75..5a114eed3 100644 --- a/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js +++ b/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js @@ -61,7 +61,8 @@ function findMatchingSimulator(simulators, simulatorString) { // Skipping non-available simulator if ( simulator.availability !== '(available)' && - simulator.isAvailable !== 'YES' + simulator.isAvailable !== 'YES' && + simulator.isAvailable !== true ) { continue; } From 8b71f883cdadcaa6d85701e1fc24a5317c7b300d Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Wed, 5 Jun 2019 16:53:17 +0100 Subject: [PATCH 162/234] feat: Only pass `hasteImplModulePath` if the `hasteImpl` file is available in RN (#417) --- packages/cli/src/tools/loadMetroConfig.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 08497faa0..041586d41 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -5,6 +5,7 @@ import path from 'path'; import {createBlacklist} from 'metro'; import {loadConfig} from 'metro-config'; +import {existsSync} from 'fs'; import {type ConfigT} from 'types'; import findSymlinkedModules from './findSymlinkedModules'; @@ -31,13 +32,16 @@ const getBlacklistRE = () => createBlacklist([/.*\/__fixtures__\/.*/]); * Otherwise, a.native.js will not load on Windows or other platforms */ export const getDefaultConfig = (ctx: ConfigT) => { + const hasteImplPath = path.join(ctx.reactNativePath, 'jest/hasteImpl'); return { resolver: { resolverMainFields: ['react-native', 'browser', 'main'], blacklistRE: getBlacklistRE(), platforms: [...ctx.haste.platforms, 'native'], providesModuleNodeModules: ctx.haste.providesModuleNodeModules, - hasteImplModulePath: path.join(ctx.reactNativePath, 'jest/hasteImpl'), + hasteImplModulePath: existsSync(hasteImplPath) + ? hasteImplPath + : undefined, }, serializer: { getModulesRunBeforeMainModule: () => [ From c3dbf3a592a3abe016fcbb6c300670b5a8ece95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 5 Jun 2019 18:20:07 +0200 Subject: [PATCH 163/234] chore: remove deprecated entries in DevTools middleware (#415) --- .../middleware/getDevToolsMiddleware.js | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js index 93bb78076..aacd32b22 100644 --- a/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getDevToolsMiddleware.js @@ -35,33 +35,17 @@ function launchDevTools({port, watchFolders}, isChromeConnected) { function startCustomDebugger({watchFolders, customDebugger}) { const folders = watchFolders.map(escapePath).join(' '); const command = `${customDebugger} ${folders}`; - console.log('Starting custom debugger by executing:', command); + logger.info('Starting custom debugger by executing:', command); exec(command, function(error, stdout, stderr) { if (error !== null) { - console.log('Error while starting custom debugger:', error); + logger.error('Error while starting custom debugger:', error); } }); } export default function getDevToolsMiddleware(options, isChromeConnected) { return function devToolsMiddleware(req, res, next) { - if (req.url === '/launch-safari-devtools') { - // TODO: remove `logger.info` and dev tools binary - logger.info( - 'We removed support for Safari dev-tools. ' + - 'If you still need this, please let us know.', - ); - } else if (req.url === '/launch-chrome-devtools') { - // TODO: Remove this case in the future - logger.info( - 'The method /launch-chrome-devtools is deprecated. You are ' + - ' probably using an application created with an older CLI with the ' + - ' packager of a newer CLI. Please upgrade your application: ' + - 'https://facebook.github.io/react-native/docs/upgrading.html', - ); - launchDevTools(options, isChromeConnected); - res.end('OK'); - } else if (req.url === '/launch-js-devtools') { + if (req.url === '/launch-js-devtools') { launchDevTools(options, isChromeConnected); res.end('OK'); } else { From 7dec6541a88ba3496d43a20a832b3150166522aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 6 Jun 2019 11:39:13 +0200 Subject: [PATCH 164/234] feat(breaking): link only assets by default; add `--all` flag (#416) Change the default behavior of `link` to only link assets. Since autolinking, manual linking of packages is quickly becoming obsolete, however there's no easy way to autolink assets (can be automated with CocoaPods podspecs, but not sure about Gradle cc @Salakar. EDIT: should be doable, @Salakar is on it). That's why I think it makes sense to default `link` to process assets only, unless the `--all` flag is passed explicitly. Additional changes that accumulated while testing: - fix linking hooks failing to execute - fix handling assets from legacy "rnpm" config - overhaul linking logs and error messages - disable flaky e2e tests in lts-tests phase --- .circleci/config.yml | 4 +- docs/commands.md | 6 +- .../src/commands/link/__tests__/link-test.js | 2 +- packages/cli/src/commands/link/link.js | 20 +++-- packages/cli/src/commands/link/linkAll.js | 73 ++++++++++++------- packages/cli/src/commands/link/linkAssets.js | 2 +- .../cli/src/commands/link/linkDependency.js | 16 ++-- .../__snapshots__/index-test.js.snap | 18 +++++ .../src/tools/config/__tests__/index-test.js | 17 +++++ .../tools/config/__tests__/makeHook-test.js | 38 +++------- packages/cli/src/tools/config/makeHook.js | 25 +------ .../src/tools/config/readConfigFromDisk.js | 59 +++++++++++++-- packages/platform-ios/src/link/copyAssets.js | 10 ++- types/index.js | 2 +- 14 files changed, 187 insertions(+), 105 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7eb3dd4d8..54793168f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,7 +97,9 @@ jobs: - run-lint - run-typecheck - run-unit-tests - - run-e2e-tests + # TODO: figure out why e2e tests fail even though not interfering with + # other tests + # - run-e2e-tests workflows: build-and-test: diff --git a/docs/commands.md b/docs/commands.md index 228e6d8b1..b01ed8a06 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -210,10 +210,14 @@ Usage: react-native link [packageName] ``` -Link native dependency or all native dependencies if no `packageName` passed. +Links assets and optionally native modules. #### Options +#### `--all` + +Link all native modules and assets. + #### `--platforms [list]` Pass comma-separated list of platforms to scope `link` to. diff --git a/packages/cli/src/commands/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js index 6f93f1180..a9c173f3c 100644 --- a/packages/cli/src/commands/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -1,7 +1,7 @@ import {func as link} from '../link'; import loadConfig from '../../../tools/config'; -jest.mock('chalk', () => ({grey: str => str})); +jest.mock('chalk', () => ({grey: str => str, bold: str => str})); jest.mock('../../../tools/config'); jest.mock('../../../tools/logger'); diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 5fe49362b..94627c22b 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -7,6 +7,7 @@ * @flow */ +import chalk from 'chalk'; import {pick} from 'lodash'; import {logger, CLIError} from '@react-native-community/cli-tools'; import {type ConfigT} from 'types'; @@ -17,6 +18,7 @@ import linkAll from './linkAll'; type FlagsType = { platforms?: Array, + all?: boolean, }; /** @@ -46,10 +48,8 @@ async function link( ); if (rawPackageName === undefined) { - logger.debug( - 'No package name provided, will attempt to link all possible packages.', - ); - return linkAll(ctx); + logger.debug('No package name provided, will linking all possible assets.'); + return linkAll(ctx, {linkDeps: opts.all, linkAssets: true}); } // Trim the version / tag out of the package name (eg. package@latest) @@ -77,7 +77,7 @@ async function link( await linkAssets(platforms, project, dependency.assets); } catch (error) { throw new CLIError( - `Something went wrong while linking. Reason: ${error.message}`, + `Linking "${chalk.bold(dependency.name)}" failed.`, error, ); } @@ -87,13 +87,17 @@ export const func = link; export default { func: link, - description: 'scope link command to certain platforms (comma-separated)', + description: 'links assets and optionally native modules', name: 'link [packageName]', options: [ { name: '--platforms [list]', - description: - 'If you want to link dependencies only for specific platforms', + description: 'Scope linking to specified platforms', + parse: (val: string) => val.toLowerCase().split(','), + }, + { + name: '--all [boolean]', + description: 'Link all native modules and assets', parse: (val: string) => val.toLowerCase().split(','), }, ], diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 478346b36..50878141f 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -4,44 +4,65 @@ import {uniqBy} from 'lodash'; import path from 'path'; - +import chalk from 'chalk'; +import {CLIError, logger} from '@react-native-community/cli-tools'; import type {ConfigT} from 'types'; - import linkAssets from './linkAssets'; import linkDependency from './linkDependency'; -import {CLIError} from '@react-native-community/cli-tools'; - const dedupeAssets = (assets: Array): Array => uniqBy(assets, asset => path.basename(asset)); -async function linkAll(config: ConfigT) { - const projectAssets = config.assets; +type Options = { + linkDeps?: boolean, + linkAssets?: boolean, +}; - const assets = dedupeAssets( - Object.keys(config.dependencies).reduce( - (acc, dependency) => acc.concat(config.dependencies[dependency].assets), - projectAssets, - ), - ); +async function linkAll(config: ConfigT, options: Options) { + if (options.linkDeps) { + logger.debug('Linking all dependencies'); + logger.info( + `Linking dependencies using "${chalk.bold( + 'link', + )}" command is now legacy and likely unnecessary. We encourage you to try ${chalk.bold( + 'autolinking', + )} that comes with React Native v0.60 default template. Autolinking happens at build time – during CocoaPods install or Gradle install phase. More information: ${chalk.dim.underline( + 'https://github.com/react-native-community/cli/blob/master/docs/autolinking.md', + )}`, + ); - try { - Object.keys(config.dependencies).forEach(async key => { + for (let key in config.dependencies) { const dependency = config.dependencies[key]; - if (dependency.hooks.prelink) { - await dependency.hooks.prelink(); - } - await linkDependency(config.platforms, config.project, dependency); - if (dependency.hooks.postlink) { - await dependency.hooks.postlink(); + try { + if (dependency.hooks.prelink) { + await dependency.hooks.prelink(); + } + await linkDependency(config.platforms, config.project, dependency); + if (dependency.hooks.postlink) { + await dependency.hooks.postlink(); + } + } catch (error) { + throw new CLIError( + `Linking "${chalk.bold(dependency.name)}" failed.`, + error, + ); } - }); - await linkAssets(config.platforms, config.project, assets); - } catch (error) { - throw new CLIError( - `Something went wrong while linking. Reason: ${error.message}`, - error, + } + } + if (options.linkAssets) { + logger.debug('Linking all assets'); + const projectAssets = config.assets; + const assets = dedupeAssets( + Object.keys(config.dependencies).reduce( + (acc, dependency) => acc.concat(config.dependencies[dependency].assets), + projectAssets, + ), ); + try { + await linkAssets(config.platforms, config.project, assets); + } catch (error) { + throw new CLIError('Linking assets failed.', error); + } } } diff --git a/packages/cli/src/commands/link/linkAssets.js b/packages/cli/src/commands/link/linkAssets.js index c74148333..700893724 100644 --- a/packages/cli/src/commands/link/linkAssets.js +++ b/packages/cli/src/commands/link/linkAssets.js @@ -29,7 +29,7 @@ const linkAssets = ( linkConfig.copyAssets(assets, project[platform]); }); - logger.info('Assets have been successfully linked to your project'); + logger.success('Assets have been successfully linked to your project'); }; export default linkAssets; diff --git a/packages/cli/src/commands/link/linkDependency.js b/packages/cli/src/commands/link/linkDependency.js index 80187b94a..a893076a8 100644 --- a/packages/cli/src/commands/link/linkDependency.js +++ b/packages/cli/src/commands/link/linkDependency.js @@ -1,5 +1,5 @@ // @flow - +import chalk from 'chalk'; import type {DependencyConfigT, ProjectConfigT, PlatformsT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import pollParams from './pollParams'; @@ -39,19 +39,23 @@ const linkDependency = async ( if (isInstalled) { logger.info( - `${getPlatformName(platform)} module "${name}" is already linked`, + `${getPlatformName(platform)} module "${chalk.bold( + name, + )}" is already linked`, ); return; } - logger.info(`Linking "${name}" ${getPlatformName(platform)} dependency`); + logger.info( + `Linking "${chalk.bold(name)}" ${getPlatformName(platform)} dependency`, + ); // $FlowFixMe linkConfig.register(name, dependencyConfig, params, projectConfig); logger.info( - `${getPlatformName(platform)} module "${ - dependency.name - }" has been successfully linked`, + `${getPlatformName(platform)} module "${chalk.bold( + dependency.name, + )}" has been successfully linked`, ); }); }; diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index 75ec236d6..dfc4d401c 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -12,6 +12,24 @@ Object { } `; +exports[`should handle deprecated "rnpm" in project root: returns valid config 1`] = ` +Object { + "assets": Array [ + "<>/fonts/SampleFont.ttf", + ], + "commands": Array [], + "dependencies": Object {}, + "haste": Object { + "platforms": Array [], + "providesModuleNodeModules": Array [], + }, + "platforms": Object {}, + "project": Object {}, + "reactNativePath": "<>/node_modules/react-native", + "root": "<>", +} +`; + exports[`should have a valid structure by default 1`] = ` Object { "assets": Array [], diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index 5a1953b3a..bb19f1787 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -40,6 +40,23 @@ test('should have a valid structure by default', () => { expect(removeString(config, DIR)).toMatchSnapshot(); }); +test('should handle deprecated "rnpm" in project root', () => { + writeFiles(DIR, { + 'package.json': `{ + "rnpm": { + "assets": ["./fonts"] + } + }`, + 'fonts/SampleFont.ttf': '', + }); + const config = loadConfig(DIR); + + expect(removeString(config, DIR)).toMatchSnapshot('returns valid config'); + expect(logger.warn).toBeCalledWith( + expect.stringMatching(/Your project is using deprecated/), + ); +}); + test('should return dependencies from package.json', () => { writeFiles(DIR, { 'node_modules/react-native/package.json': '{}', diff --git a/packages/cli/src/tools/config/__tests__/makeHook-test.js b/packages/cli/src/tools/config/__tests__/makeHook-test.js index d16953c4a..6114c1b71 100644 --- a/packages/cli/src/tools/config/__tests__/makeHook-test.js +++ b/packages/cli/src/tools/config/__tests__/makeHook-test.js @@ -3,40 +3,22 @@ */ import makeHook from '../makeHook'; -let spawnError = false; - -jest.setMock('child_process', { - spawn: () => ({ - on: (event, cb) => cb(spawnError), - }), -}); - afterAll(() => { jest.restoreAllMocks(); }); describe('makeHook', () => { - const hook = makeHook('echo'); - - it('generates a function around shell command', () => { - expect(typeof hook).toBe('function'); - }); - - it('throws an error if there is no callback provided', () => { - expect(hook).toThrow(); - }); - - it('invokes a callback after command execution', () => { - const spy = jest.fn(); - hook(spy); - expect(spy.mock.calls).toHaveLength(1); + it('invokes the command', async () => { + const hook = makeHook('echo'); + // $FlowFixMe - execa weird Promise-like return value + const result = await hook(); + expect(result.cmd).toBe('echo'); }); - it('throws an error if spawn ended up with error', () => { - spawnError = true; - const cb = jest.fn(); - expect(() => { - hook(cb); - }).toThrow(); + it('invokes the command with multiple arguments', async () => { + const hook = makeHook('node -p "1;"'); + // $FlowFixMe - execa weird Promise-like return value + const result = await hook(); + expect(result.cmd).toBe('node -p "1;"'); }); }); diff --git a/packages/cli/src/tools/config/makeHook.js b/packages/cli/src/tools/config/makeHook.js index 2eaad64db..29b23489c 100644 --- a/packages/cli/src/tools/config/makeHook.js +++ b/packages/cli/src/tools/config/makeHook.js @@ -2,30 +2,13 @@ * @flow */ -import {spawn} from 'child_process'; - -export default function makeCommand(command: string) { - return (cb: Function) => { - if (!cb) { - throw new Error( - `You missed a callback function for the ${command} command`, - ); - } +import execa from 'execa'; +export default function makeHook(command: string) { + return () => { const args = command.split(' '); const cmd = args.shift(); - const commandProcess = spawn(cmd, args, { - stdio: 'inherit', - stdin: 'inherit', - }); - - commandProcess.on('close', code => { - if (code) { - throw new Error(`Error occurred during executing "${command}" command`); - } - - cb(); - }); + return execa(cmd, args, {stdio: 'inherit'}); }; } diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index babfb3887..7225f44d4 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -7,24 +7,66 @@ import Joi from '@hapi/joi'; import cosmiconfig from 'cosmiconfig'; import path from 'path'; import chalk from 'chalk'; - import { type UserDependencyConfigT, type UserConfigT, type CommandT, } from 'types'; - import {JoiError} from './errors'; - import * as schema from './schema'; - import {logger} from '@react-native-community/cli-tools'; +import resolveReactNativePath from './resolveReactNativePath'; + +const MIGRATION_GUIDE = `Migration guide: ${chalk.dim.underline( + 'https://github.com/react-native-community/cli/blob/master/docs/configuration.md', +)}`; /** * Places to look for the new configuration */ const searchPlaces = ['react-native.config.js']; +function readLegacyConfigFromDisk(rootFolder: string): UserConfigT | void { + let config; + + try { + config = require(path.join(rootFolder, 'package.json')).rnpm; + } catch (error) { + // when `init` is running, there's no package.json yet + return undefined; + } + + if (!config) { + return undefined; + } + + const transformedConfig = { + project: { + ios: config.ios, + android: config.android, + }, + assets: config.assets, + commands: [], + dependencies: {}, + platforms: {}, + get reactNativePath() { + return config.reactNativePath + ? path.resolve(rootFolder, config.reactNativePath) + : resolveReactNativePath(rootFolder); + }, + }; + + logger.warn( + `Your project is using deprecated "${chalk.bold( + 'rnpm', + )}" config that will stop working from next release. Please use a "${chalk.bold( + 'react-native.config.js', + )}" file to configure the React Native CLI. ${MIGRATION_GUIDE}`, + ); + + return transformedConfig; +} + /** * Reads a project configuration as defined by the user in the current * workspace. @@ -32,7 +74,9 @@ const searchPlaces = ['react-native.config.js']; export function readConfigFromDisk(rootFolder: string): UserConfigT { const explorer = cosmiconfig('react-native', {searchPlaces}); - const {config} = explorer.searchSync(rootFolder) || {config: undefined}; + const {config} = explorer.searchSync(rootFolder) || { + config: readLegacyConfigFromDisk(rootFolder), + }; const result = Joi.validate(config, schema.projectConfig); @@ -118,11 +162,10 @@ function readLegacyDependencyConfigFromDisk( : {}, }; - // @todo: paste a link to documentation that explains the migration steps logger.warn( - `Package ${chalk.bold( + `Package "${chalk.bold( path.basename(name), - )} is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.`, + )}" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.`, ); return transformedConfig; diff --git a/packages/platform-ios/src/link/copyAssets.js b/packages/platform-ios/src/link/copyAssets.js index f4d65170a..862aa3ed2 100644 --- a/packages/platform-ios/src/link/copyAssets.js +++ b/packages/platform-ios/src/link/copyAssets.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import fs from 'fs'; @@ -14,12 +14,16 @@ import createGroupWithMessage from './createGroupWithMessage'; import getPlist from './getPlist'; import writePlist from './writePlist'; import {logger, groupFilesByType} from '@react-native-community/cli-tools'; +import type {ProjectConfigIOST} from '../../../../types'; /** * This function works in a similar manner to its Android version, * except it does not copy fonts but creates Xcode Group references */ -export default function linkAssetsIOS(files, projectConfig) { +export default function linkAssetsIOS( + files: Array, + projectConfig: ProjectConfigIOST, +) { const project = xcode.project(projectConfig.pbxprojPath).parseSync(); const assets = groupFilesByType(files); const plist = getPlist(project, projectConfig.sourceDir); @@ -35,7 +39,7 @@ export default function linkAssetsIOS(files, projectConfig) { {target: project.getFirstTarget().uuid}, ); }) - .filter(file => file) // xcode returns false if file is already there + .filter(Boolean) // xcode returns false if file is already there .map(file => file.basename); } diff --git a/types/index.js b/types/index.js index a17e6f305..0c435a0e0 100644 --- a/types/index.js +++ b/types/index.js @@ -217,7 +217,7 @@ export type UserConfigT = { // The following types are used in untyped-parts of the codebase, so I am leaving them // until we actually need them. -type ProjectConfigIOST = { +export type ProjectConfigIOST = { sourceDir: string, folder: string, pbxprojPath: string, From 77944a85f25188003d443f3c3324b92ea837e4e8 Mon Sep 17 00:00:00 2001 From: Matei Radu Date: Thu, 6 Jun 2019 14:45:32 +0200 Subject: [PATCH 165/234] feat: notify of new major RN version at most once a week (#268) Summary: --------- This PR addresses the first part of #189: notifying the user when a newer version of React Native is available to upgrade to when using the CLI. **Behaviour** * The remote release check mechanism uses the [GitHub API](https://developer.github.com/v3/repos/releases/#get-the-latest-release). * The mechanism is triggered for any CLI command. * Nothing will be displayed if the project is already up-to-date. * The release data returned from the API call is cached per-project. Caching is necessary to not hit the GitHub API rate limit. * For the time being, there is no way to "mute" this behaviour if a project is intentionally using an older RN version because we have not discussed yet how the UX for that will be. **Caveats** The GitHub API we are using is specific to [Releases](https://help.github.com/en/articles/creating-releases), so we need to make sure that each new version of React Native has one. For example, 0.59.1 has been cut and published on NPM on March 14th but the release has been made only on the 25th. During that interval, the CLI would have not notified users of the newer version. Test Plan: ---------- * Clone this branch * Install dependencies with `yarn install` * Test the behaviour in newer and older projects by calling `cli.js` directly from the cloned repository as described in `CONTRIBUTING.md`. Screenshots: --------- Linking a module in an older project: ![Screenshot from 2019-03-25 19-22-14](https://user-images.githubusercontent.com/1713151/54944577-1a523680-4f34-11e9-8d28-5c4b3e00b8f9.png) Output when a project is up-to-date (showing debug messages as normally there would be no output): ![Screenshot from 2019-03-25 19-35-42](https://user-images.githubusercontent.com/1713151/54945093-55a13500-4f35-11e9-879e-69780ae7a59c.png) --- packages/cli/src/cliEntry.js | 42 +++++- .../tools/releaseChecker/getLatestRelease.js | 140 ++++++++++++++++++ .../tools/releaseChecker/printNewRelease.js | 26 ++++ .../releaseChecker/releaseCacheManager.js | 69 +++++++++ packages/cli/src/tools/walk.js | 4 +- 5 files changed, 272 insertions(+), 9 deletions(-) create mode 100644 packages/cli/src/tools/releaseChecker/getLatestRelease.js create mode 100644 packages/cli/src/tools/releaseChecker/printNewRelease.js create mode 100644 packages/cli/src/tools/releaseChecker/releaseCacheManager.js diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index c22bc0573..1798f391e 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -19,6 +19,9 @@ import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import {logger} from '@react-native-community/cli-tools'; import {setProjectDir} from './tools/packageManager'; +import resolveNodeModuleDir from './tools/config/resolveNodeModuleDir'; +import getLatestRelease from './tools/releaseChecker/getLatestRelease'; +import printNewRelease from './tools/releaseChecker/printNewRelease'; import pkgJson from '../package.json'; import loadConfig from './tools/config'; @@ -107,16 +110,18 @@ const addCommand = (command: CommandT, ctx: ConfigT) => { const cmd = commander .command(command.name) .description(command.description) - .action(function handleAction(...args) { + .action(async function handleAction(...args) { const passedOptions = this.opts(); const argv: Array = Array.from(args).slice(0, -1); - Promise.resolve() - .then(() => { - assertRequiredOptions(options, passedOptions); - return command.func(argv, ctx, passedOptions); - }) - .catch(handleError); + try { + assertRequiredOptions(options, passedOptions); + await command.func(argv, ctx, passedOptions); + } catch (error) { + handleError(error); + } finally { + checkForNewRelease(ctx.root); + } }); cmd.helpInformation = printHelpInformation.bind( @@ -186,6 +191,29 @@ async function setupAndRun() { logger.setVerbose(commander.verbose); } +async function checkForNewRelease(root: string) { + try { + const {version: currentVersion} = require(path.join( + resolveNodeModuleDir(root, 'react-native'), + 'package.json', + )); + const {name} = require(path.join(root, 'package.json')); + const latestRelease = await getLatestRelease(name, currentVersion); + + if (latestRelease) { + printNewRelease(name, latestRelease, currentVersion); + } + } catch (e) { + // We let the flow continue as this component is not vital for the rest of + // the CLI. + logger.debug( + 'Cannot detect current version of React Native, ' + + 'skipping check for a newer release', + ); + logger.debug(e); + } +} + export default { run, init, diff --git a/packages/cli/src/tools/releaseChecker/getLatestRelease.js b/packages/cli/src/tools/releaseChecker/getLatestRelease.js new file mode 100644 index 000000000..debf37f0e --- /dev/null +++ b/packages/cli/src/tools/releaseChecker/getLatestRelease.js @@ -0,0 +1,140 @@ +/** + * @flow + */ +import https from 'https'; +import semver from 'semver'; +import logger from '../logger'; +import cacheManager from './releaseCacheManager'; + +export type Release = { + version: string, + changelogUrl: string, +}; + +/** + * Checks via GitHub API if there is a newer stable React Native release and, + * if it exists, returns the release data. + * + * If the latest release is not newer or if it's a prerelease, the function + * will return undefined. + */ +export default async function getLatestRelease( + name: string, + currentVersion: string, +) { + logger.debug('Checking for a newer version of React Native'); + try { + logger.debug(`Current version: ${currentVersion}`); + + const cachedLatest = cacheManager.get(name, 'latestVersion'); + + if (cachedLatest) { + logger.debug(`Cached release version: ${cachedLatest}`); + } + + const aWeek = 7 * 24 * 60 * 60 * 1000; + const lastChecked = cacheManager.get(name, 'lastChecked'); + const now = new Date(); + if (lastChecked && now - new Date(lastChecked) < aWeek) { + logger.debug('Cached release is still recent, skipping remote check'); + return; + } + + logger.debug('Checking for newer releases on GitHub'); + const eTag = cacheManager.get(name, 'eTag'); + const latestVersion = await getLatestRnDiffPurgeVersion(name, eTag); + logger.debug(`Latest release: ${latestVersion}`); + + if ( + semver.compare(latestVersion, currentVersion) === 1 && + !semver.prerelease(latestVersion) + ) { + return { + version: latestVersion, + changelogUrl: buildChangelogUrl(latestVersion), + }; + } + } catch (e) { + logger.debug( + 'Something went wrong with remote version checking, moving on', + ); + logger.debug(e); + } +} + +function buildChangelogUrl(version: string) { + return `https://github.com/facebook/react-native/releases/tag/v${version}`; +} + +/** + * Returns the most recent React Native version available to upgrade to. + */ +async function getLatestRnDiffPurgeVersion(name: string, eTag: ?string) { + const options = { + hostname: 'api.github.com', + path: '/repos/react-native-community/rn-diff-purge/tags', + // https://developer.github.com/v3/#user-agent-required + headers: ({'User-Agent': 'React-Native-CLI'}: Headers), + }; + + if (eTag) { + options.headers['If-None-Match'] = eTag; + } + + const response = await httpsGet(options); + + // Remote is newer. + if (response.statusCode === 200) { + const latestVersion = JSON.parse(response.body)[0].name.substring(8); + + // Update cache only if newer release is stable. + if (!semver.prerelease(latestVersion)) { + logger.debug(`Saving ${response.eTag} to cache`); + cacheManager.set(name, 'eTag', response.eTag); + cacheManager.set(name, 'latestVersion', latestVersion); + } + + return latestVersion; + } + + // Cache is still valid. + if (response.statusCode === 304) { + const latestVersion = cacheManager.get(name, 'latestVersion'); + if (latestVersion) { + return latestVersion; + } + } + + // Should be returned only if something went wrong. + return '0.0.0'; +} + +type Headers = { + 'User-Agent': string, + [header: string]: string, +}; + +function httpsGet(options: any) { + return new Promise((resolve, reject) => { + https + .get(options, result => { + let body = ''; + + result.setEncoding('utf8'); + result.on('data', data => { + body += data; + }); + + result.on('end', () => { + resolve({ + body, + eTag: result.headers.etag, + statusCode: result.statusCode, + }); + }); + + result.on('error', error => reject(error)); + }) + .on('error', error => reject(error)); + }); +} diff --git a/packages/cli/src/tools/releaseChecker/printNewRelease.js b/packages/cli/src/tools/releaseChecker/printNewRelease.js new file mode 100644 index 000000000..cfababab7 --- /dev/null +++ b/packages/cli/src/tools/releaseChecker/printNewRelease.js @@ -0,0 +1,26 @@ +/** + * @flow + */ +import chalk from 'chalk'; +import logger from '../logger'; +import type {Release} from './getLatestRelease'; +import cacheManager from './releaseCacheManager'; + +/** + * Notifies the user that a newer version of React Native is available. + */ +export default function printNewRelease( + name: string, + latestRelease: Release, + currentVersion: string, +) { + logger.info( + `React Native v${ + latestRelease.version + } is now available (your project is running on v${currentVersion}).`, + ); + logger.info(`Changelog: ${chalk.dim.underline(latestRelease.changelogUrl)}.`); + logger.info(`To upgrade, run "${chalk.bold('react-native upgrade')}".`); + + cacheManager.set(name, 'lastChecked', new Date().toISOString()); +} diff --git a/packages/cli/src/tools/releaseChecker/releaseCacheManager.js b/packages/cli/src/tools/releaseChecker/releaseCacheManager.js new file mode 100644 index 000000000..193af6c33 --- /dev/null +++ b/packages/cli/src/tools/releaseChecker/releaseCacheManager.js @@ -0,0 +1,69 @@ +/** + * @flow + */ +import path from 'path'; +import fs from 'fs'; +import os from 'os'; +import mkdirp from 'mkdirp'; +import logger from '../logger'; + +type ReleaseCacheKey = 'eTag' | 'lastChecked' | 'latestVersion'; +type Cache = {[key: ReleaseCacheKey]: string}; + +function loadCache(name: string): ?Cache { + try { + const cacheRaw = fs.readFileSync( + path.resolve(getCacheRootPath(), name), + 'utf8', + ); + const cache = JSON.parse(cacheRaw); + return cache; + } catch (e) { + if (e.code === 'ENOENT') { + // Create cache file since it doesn't exist. + saveCache(name, {}); + } + logger.debug('No release cache found'); + } +} + +function saveCache(name: string, cache: Cache) { + fs.writeFileSync( + path.resolve(getCacheRootPath(), name), + JSON.stringify(cache, null, 2), + ); +} + +/** + * Returns the path string of `$HOME/.react-native-cli`. + * + * In case it doesn't exist, it will be created. + */ +function getCacheRootPath() { + const cachePath = path.resolve(os.homedir(), '.react-native-cli', 'cache'); + if (!fs.existsSync(cachePath)) { + mkdirp(cachePath); + } + + return cachePath; +} + +function get(name: string, key: ReleaseCacheKey): ?string { + const cache = loadCache(name); + if (cache) { + return cache[key]; + } +} + +function set(name: string, key: ReleaseCacheKey, value: string) { + const cache = loadCache(name); + if (cache) { + cache[key] = value; + saveCache(name, cache); + } +} + +export default { + get, + set, +}; diff --git a/packages/cli/src/tools/walk.js b/packages/cli/src/tools/walk.js index 5fdc88848..fb0a81eba 100644 --- a/packages/cli/src/tools/walk.js +++ b/packages/cli/src/tools/walk.js @@ -4,13 +4,13 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import fs from 'fs'; import path from 'path'; -function walk(current) { +function walk(current: string) { if (!fs.lstatSync(current).isDirectory()) { return [current]; } From 3fcd4bc4dcb7102d171604b70b40fa1b2ee33d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 6 Jun 2019 14:59:00 +0200 Subject: [PATCH 166/234] v2.0.0-rc.0 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 0d9540139..66f57c4dd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-alpha.23", + "version": "2.0.0-rc.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 42b12dddd..e28df8696 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-alpha.23", + "version": "2.0.0-rc.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-alpha.23", - "@react-native-community/cli-platform-ios": "^2.0.0-alpha.23", - "@react-native-community/cli-tools": "^2.0.0-alpha.23", + "@react-native-community/cli-platform-android": "^2.0.0-rc.0", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.0", + "@react-native-community/cli-tools": "^2.0.0-rc.0", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index c8070fef3..9ea23a0e2 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-alpha.23", + "version": "2.0.0-rc.0", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.23", + "@react-native-community/cli-tools": "^2.0.0-rc.0", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 412c2259d..05acafadf 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-alpha.23", + "version": "2.0.0-rc.0", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-alpha.23", + "@react-native-community/cli-tools": "^2.0.0-rc.0", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index a9c576e61..662a584e3 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-alpha.23", + "version": "2.0.0-rc.0", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 56f41f6cc8bdb6f68138534c7c8e370b0ed4d3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 7 Jun 2019 18:09:39 +0200 Subject: [PATCH 167/234] chore: bump Metro to 0.54.1 (#420) * chore: bump Metro to 0.54.1 * fix hasteImpl path resolving --- packages/cli/package.json | 8 +- packages/cli/src/tools/loadMetroConfig.js | 2 +- yarn.lock | 256 +++++++--------------- 3 files changed, 85 insertions(+), 181 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index e28df8696..ad92a7f20 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -42,10 +42,10 @@ "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", "lodash": "^4.17.5", - "metro": "^0.53.1", - "metro-config": "^0.53.1", - "metro-core": "^0.53.1", - "metro-react-native-babel-transformer": "^0.53.1", + "metro": "^0.54.1", + "metro-config": "^0.54.1", + "metro-core": "^0.54.1", + "metro-react-native-babel-transformer": "^0.54.1", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "morgan": "^1.9.0", diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 041586d41..683ac9d6f 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -32,7 +32,7 @@ const getBlacklistRE = () => createBlacklist([/.*\/__fixtures__\/.*/]); * Otherwise, a.native.js will not load on Windows or other platforms */ export const getDefaultConfig = (ctx: ConfigT) => { - const hasteImplPath = path.join(ctx.reactNativePath, 'jest/hasteImpl'); + const hasteImplPath = path.join(ctx.reactNativePath, 'jest/hasteImpl.js'); return { resolver: { resolverMainFields: ['react-native', 'browser', 'main'], diff --git a/yarn.lock b/yarn.lock index a72c5c0fb..42dc8e53a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2750,12 +2750,6 @@ caniuse-lite@^1.0.30000929: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000929.tgz#7b391b781a9c3097ecc39ea053301aea8ea16317" integrity sha512-n2w1gPQSsYyorSVYqPMqbSaz1w7o9ZC8VhOEGI9T5MfGDzp7sbopQxG6GaQmYsaq13Xfx/mkxJUWC1Dz3oZfzw== -capture-exit@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" - dependencies: - rsvp "^3.3.3" - capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -3875,12 +3869,6 @@ eventemitter3@^3.1.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== -exec-sh@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" - dependencies: - merge "^1.2.0" - exec-sh@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" @@ -4286,13 +4274,6 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^1.2.3: - version "1.2.4" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - fsevents@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.7.tgz#4851b664a3783e52003b3c66eb0eee1074933aa4" @@ -5350,20 +5331,6 @@ jest-get-type@^24.3.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.3.0.tgz#582cfd1a4f91b5cdad1d43d2932f816d543c65da" integrity sha512-HYF6pry72YUlVcvUx3sEpMRwXEWGEPlJ0bSPVnB3b3n++j4phUEoSPcS6GC0pPJ9rpyPSe4cb5muFo6D39cXow== -jest-haste-map@24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0.tgz#e9ef51b2c9257384b4d6beb83bd48c65b37b5e6e" - integrity sha512-CcViJyUo41IQqttLxXVdI41YErkzBKbE6cS6dRAploCeutePYfUimWd3C9rQEWhX0YBOQzvNsC0O9nYxK2nnxQ== - dependencies: - fb-watchman "^2.0.0" - graceful-fs "^4.1.15" - invariant "^2.2.4" - jest-serializer "^24.0.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" - micromatch "^3.1.10" - sane "^3.0.0" - jest-haste-map@^24.7.1: version "24.7.1" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.7.1.tgz#772e215cd84080d4bbcb759cfb668ad649a21471" @@ -5422,7 +5389,7 @@ jest-matcher-utils@^24.7.0: jest-get-type "^24.3.0" pretty-format "^24.7.0" -jest-message-util@^24.0.0, jest-message-util@^24.7.1: +jest-message-util@^24.7.1: version "24.7.1" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.7.1.tgz#f1dc3a6c195647096a99d0f1dadbc447ae547018" integrity sha512-dk0gqVtyqezCHbcbk60CdIf+8UHgD+lmRHifeH3JRcnAqh4nEyPytSc9/L1+cQyxC+ceaeP696N4ATe7L+omcg== @@ -5527,11 +5494,6 @@ jest-runtime@^24.7.1: strip-bom "^3.0.0" yargs "^12.0.2" -jest-serializer@24.0.0, jest-serializer@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0.tgz#522c44a332cdd194d8c0531eb06a1ee5afb4256b" - integrity sha512-9FKxQyrFgHtx3ozU+1a8v938ILBE7S8Ko3uiAVjT8Yfi2o91j/fj81jacCQZ/Ihjiff/VsUCXVgQ+iF1XdImOw== - jest-serializer@^24.4.0: version "24.4.0" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" @@ -5555,20 +5517,6 @@ jest-snapshot@^24.0.0, jest-snapshot@^24.7.1: pretty-format "^24.7.0" semver "^5.5.0" -jest-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.0.0.tgz#fd38fcafd6dedbd0af2944d7a227c0d91b68f7d6" - integrity sha512-QxsALc4wguYS7cfjdQSOr5HTkmjzkHgmZvIDkcmPfl1ib8PNV8QUWLwbKefCudWS0PRKioV+VbQ0oCUPC691fQ== - dependencies: - callsites "^3.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.15" - is-ci "^2.0.0" - jest-message-util "^24.0.0" - mkdirp "^0.5.1" - slash "^2.0.0" - source-map "^0.6.0" - jest-util@^24.7.1: version "24.7.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.7.1.tgz#b4043df57b32a23be27c75a2763d8faf242038ff" @@ -5612,14 +5560,6 @@ jest-watcher@^24.7.1: jest-util "^24.7.1" string-length "^2.0.0" -jest-worker@24.0.0, jest-worker@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0.tgz#3d3483b077bf04f412f47654a27bba7e947f8b6d" - integrity sha512-s64/OThpfQvoCeHG963MiEZOAAxu8kHsaL/rCMF7lpdzo7vgF0CtPml9hfguOMgykgH/eOm4jFP4ibfHLruytg== - dependencies: - merge-stream "^1.0.1" - supports-color "^6.1.0" - jest-worker@^24.6.0: version "24.6.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" @@ -6204,14 +6144,10 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -merge@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" - -metro-babel-register@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.53.1.tgz#41c73313ff882d28d8f7df072d2c7a6b7b314ac8" - integrity sha512-kDu7mktGCVdpa2islDzmNXZ0sGQjUvIEcQkmO9pt4b4d8QVecEHyHSZB9jvWnE2w9lADzvnERmZLHS2iDDYOyw== +metro-babel-register@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.54.1.tgz#7d2bfe444b1ccef8de99aedc7d9330891d806076" + integrity sha512-j3VydgncUG8HP6AZala6GTIt3V01nptodnnOke3JMYLqgk8EJ1LOVOdotK9pXi80o7EmmNKFs/LyyH8z+uAJzQ== dependencies: "@babel/core" "^7.0.0" "@babel/plugin-proposal-class-properties" "^7.0.0" @@ -6226,58 +6162,59 @@ metro-babel-register@0.53.1: core-js "^2.2.2" escape-string-regexp "^1.0.5" -metro-babel-transformer@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.53.1.tgz#a076fd77a9a7aef8004706edf537dcd1fec4a79e" - integrity sha512-cgZj9KK/SLxsO/rAmrlnZpaBlLhxuWxGrQkkiWxV/OjfbW8nvodozfZ3Euxvh4Ytf0e8qgTFG3JpQf8EGSDp7w== +metro-babel-transformer@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.54.1.tgz#371ffa2d1118b22cc9e40b3c3ea6738c49dae9dc" + integrity sha512-2aiAnuYBdcLV1VINb8ENAA4keIaJIepHgR9+iRvIde+9GSjKnexqx4nNmJN392285gRDp1fVZ7uY0uQawK/A5g== dependencies: "@babel/core" "^7.0.0" -metro-babel7-plugin-react-transform@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.53.1.tgz#9ad31e5c84f5003333a6a3cf79f2d093cd3b2ddc" - integrity sha512-98lEpTu7mox/7QurxVuLnbjrGDdayjpS2Z1T4vkLcP+mBxzloKJuTRnmtyWC8cNlx9qjimHGDlqtNY78rQ8rsA== +metro-babel7-plugin-react-transform@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.54.1.tgz#5335b810284789724886dc483d5bde9c149a1996" + integrity sha512-jWm5myuMoZAOhoPsa8ItfDxdTcOzKhTTzzhFlbZnRamE7i9qybeMdrZt8KHQpF7i2p/mKzE9Yhf4ouOz5K/jHg== dependencies: "@babel/helper-module-imports" "^7.0.0" -metro-cache@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.53.1.tgz#38d73c441771bdd2437a55d50943e346e1897108" - integrity sha512-27Cbo32nabef/P+y5s3cpaIUWa7Hpql2xD0HqQD8AbCfSG4xraEoBOLCmvB6wusvDAnQAcuglLq9AUbTvcSebA== +metro-cache@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.54.1.tgz#2e9017cbd11106837b8c385c9eb8c8175469a8c1" + integrity sha512-RxCFoNcANHXZYi4MIQNnqh68gUnC3bMpzCFJY5pBoqqdrkkn8ibYglBweA0/DW7hx1OZTJWelwS1Dp8xxmE2CA== dependencies: - jest-serializer "24.0.0" - metro-core "0.53.1" + jest-serializer "^24.4.0" + metro-core "0.54.1" mkdirp "^0.5.1" rimraf "^2.5.4" -metro-config@0.53.1, metro-config@^0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.53.1.tgz#a522beec446187b010c0e68273015818d1c6dfb9" - integrity sha512-3hRweWmrGs8NOjQXLsg/FHAEWqCnfNKLXM4BcI8RXQFvrQQRqhoXCuhcTfM9lSfNkefJiRp+4wW6cHXgo/TP6w== +metro-config@0.54.1, metro-config@^0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.54.1.tgz#808b4e17625d9f4e9afa34232778fdf8e63cc8dd" + integrity sha512-FpxrA+63rGkPGvGI653dvuSreJzU+eOTILItVnnhmqwn2SAK5V00N/qGTOIJe2YIuWEFXwCzw9lXmANrXbwuGg== dependencies: cosmiconfig "^5.0.5" - metro "0.53.1" - metro-cache "0.53.1" - metro-core "0.53.1" - pretty-format "24.0.0-alpha.6" + jest-validate "^24.7.0" + metro "0.54.1" + metro-cache "0.54.1" + metro-core "0.54.1" + pretty-format "^24.7.0" -metro-core@0.53.1, metro-core@^0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.53.1.tgz#350211c6327ccf307270199bb1c04012ec2d7d96" - integrity sha512-bBK0GMZWsZrdBGi+jh/87g0VvItT2jez6aj+vRw8AcBataT81SZ5WsSAw3CtbivBXXR7x3oK49T6ZZ+D79VZAw== +metro-core@0.54.1, metro-core@^0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.54.1.tgz#17f6ecc167918da8819d4af5726349e55714954b" + integrity sha512-8oz3Ck7QFBzW9dG9tKFhrXHKPu2Ajx3R7eatf61Gl6Jf/tF7PNouv3wHxPsJW3oXDFiwKLszd89+OgleTGkB5g== dependencies: - jest-haste-map "24.0.0" + jest-haste-map "^24.7.1" lodash.throttle "^4.1.1" - metro-resolver "0.53.1" + metro-resolver "0.54.1" wordwrap "^1.0.0" -metro-inspector-proxy@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-inspector-proxy/-/metro-inspector-proxy-0.53.1.tgz#cff4b9fa8b9e5598c034469bd30ef07093f75b28" - integrity sha512-4q5WIFFmpjtKbY2vze3tNI3hPUFrvv1iwTrpz3DMdQ+NYZO6aEwCxtgZAt8N4HC3xZMdECL+DDKKAJu+4jsiEA== +metro-inspector-proxy@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-inspector-proxy/-/metro-inspector-proxy-0.54.1.tgz#0ef48ee3feb11c6da47aa100151a9bf2a7c358ee" + integrity sha512-sf6kNu7PgFW6U+hU7YGZfbAUKAPVvCJhY8YVu/A1RMKH9nNULrCo+jlWh0gWgmFfWRQiAPCElevROg+5somk8A== dependencies: - chalk "^2.4.1" connect "^3.6.5" + debug "^2.2.0" rxjs "^5.4.3" ws "^1.1.5" yargs "^9.0.0" @@ -6287,17 +6224,17 @@ metro-memory-fs@^0.53.1: resolved "https://registry.yarnpkg.com/metro-memory-fs/-/metro-memory-fs-0.53.1.tgz#d8975317122b8a9a90f649337d58da85e4ae2559" integrity sha512-Xb6/TnMOjquTIRyKpaGx/jYM01+ajtQEjGpGS/N1TtnQeW0P7HMZnD+e/FpMgXmdqsf2IiQMK7l8WONU2L3Evw== -metro-minify-uglify@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.53.1.tgz#145b6e37c09e3ff8fb1bbd3221e5a3fded044904" - integrity sha512-uTdsoACy0WP51qDNrKcLILcpZOMLGyi2B9j3pu9zVRts7hlfVQGxBg4v3uDZ+L7zJ7TKR15p4iMXFmTAkRBpdA== +metro-minify-uglify@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.54.1.tgz#54ed1cb349245ce82dba8cc662bbf69fbca142c3" + integrity sha512-z+pOPna/8IxD4OhjW6Xo1mV2EszgqqQHqBm1FdmtdF6IpWkQp33qpDBNEi9NGZTOr7pp2bvcxZnvNJdC2lrK9Q== dependencies: uglify-es "^3.1.9" -metro-react-native-babel-preset@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.53.1.tgz#6cd9e41a1b9a6e210e71ef2adf114219b4eaf2ec" - integrity sha512-Uf8EGL8kIPhDkoSdAAysNPxPQclUS2R1QC4cwnc8bkk2f6yqGn+1CorfiY9AaqlLEth5mKQqdtRYFDTFfB9QyA== +metro-react-native-babel-preset@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.54.1.tgz#b8f03865c381841d7f8912e7ba46804ea3a928b8" + integrity sha512-Hfr32+u5yYl3qhYQJU8NQ26g4kQlc3yFMg7keVR/3H8rwBIbFqXgsKt8oe0dOrv7WvrMqBHhDtVdU9ls3sSq8g== dependencies: "@babel/plugin-proposal-class-properties" "^7.0.0" "@babel/plugin-proposal-export-default-from" "^7.0.0" @@ -6333,37 +6270,39 @@ metro-react-native-babel-preset@0.53.1: "@babel/plugin-transform-typescript" "^7.0.0" "@babel/plugin-transform-unicode-regex" "^7.0.0" "@babel/template" "^7.0.0" - metro-babel7-plugin-react-transform "0.53.1" + metro-babel7-plugin-react-transform "0.54.1" react-transform-hmr "^1.0.4" -metro-react-native-babel-transformer@^0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.53.1.tgz#addf31b3a9b5fc512b9ff6967d923dcfcda56394" - integrity sha512-UB64jN/akuTdDmoQlw+yLBifJhQzJr7QPP3cwitwM5XD4d9M+12pZreeFn66oMakTy4pNx4jkaYEJ5rLyh/b0Q== +metro-react-native-babel-transformer@^0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.54.1.tgz#45b56db004421134e10e739f69e8de50775fef17" + integrity sha512-ECw7xG91t8dk/PHdiyoC5SP1s9OQzfmJzG5m0YOZaKtHMe534qTDbncxaKfTI3CP99yti2maXFBRVj+xyvph/g== dependencies: "@babel/core" "^7.0.0" babel-preset-fbjs "^3.1.2" - metro-babel-transformer "0.53.1" - metro-react-native-babel-preset "0.53.1" + metro-babel-transformer "0.54.1" + metro-react-native-babel-preset "0.54.1" -metro-resolver@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.53.1.tgz#e21df30c0b9913c7cbeeda9c28d8ffe0ae58cd53" - integrity sha512-UOL2AY3HF3kyuwO+SXceA7MvVbxGZTwRmWOcRl2mYMZ66osSygFgR0WoYFAlxoW83c1ZDYXMIg78ob8bs0lSAg== +metro-resolver@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.54.1.tgz#0295b38624b678b88b16bf11d47288845132b087" + integrity sha512-Byv1LIawYAASy9CFRwzrncYnqaFGLe8vpw178EtzStqP05Hu6hXSqkNTrfoXa+3V9bPFGCrVzFx2NY3gFp2btg== dependencies: absolute-path "^0.0.0" -metro-source-map@0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.53.1.tgz#61d915720eb90722d55252f3bd014ba0ce8fabfd" - integrity sha512-mZ8NJMq5lKE9+0gfhpYFVqK3z4wng6xCzOMXoROjkOsO/exbHGK4oSfOzEnVl6oCRBTGMfaeB32ZeECwZ9O0jw== +metro-source-map@0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.54.1.tgz#e17bad53c11978197d3c05c9168d799c2e04dcc5" + integrity sha512-E9iSYMSUSq5qYi1R2hTQtxH4Mxjzfgr/jaSmQIWi7h3fG2P1qOZNNSzeaeUeTK+s2N/ksVlkcL5kMikol8CDrQ== dependencies: + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" source-map "^0.5.6" -metro@0.53.1, metro@^0.53.1: - version "0.53.1" - resolved "https://registry.yarnpkg.com/metro/-/metro-0.53.1.tgz#23fb558eb22e8de8d84fa3f456adfdedec435021" - integrity sha512-Q2iVHfUu5NO2o0dZukBkWrW5s2LiResQuK5KalomNsOHLguOYI5r1nR5QdznZ05GI96iR0fgNvFWfPMyIhtKvw== +metro@0.54.1, metro@^0.54.1: + version "0.54.1" + resolved "https://registry.yarnpkg.com/metro/-/metro-0.54.1.tgz#a629be00abee5a450a25a8f71c24745f70cc9b44" + integrity sha512-6ODPT4mEo4FCpbExRNnQAcZmf1VeNvYOTMj2Na03FjGqhNODHhI2U/wF/Ul5gqTyJ2dVdkXeyvKW3gl/LrnJRg== dependencies: "@babel/core" "^7.0.0" "@babel/generator" "^7.0.0" @@ -6387,21 +6326,21 @@ metro@0.53.1, metro@^0.53.1: graceful-fs "^4.1.3" image-size "^0.6.0" invariant "^2.2.4" - jest-haste-map "24.0.0" - jest-worker "24.0.0" + jest-haste-map "^24.7.1" + jest-worker "^24.6.0" json-stable-stringify "^1.0.1" lodash.throttle "^4.1.1" merge-stream "^1.0.1" - metro-babel-register "0.53.1" - metro-babel-transformer "0.53.1" - metro-cache "0.53.1" - metro-config "0.53.1" - metro-core "0.53.1" - metro-inspector-proxy "0.53.1" - metro-minify-uglify "0.53.1" - metro-react-native-babel-preset "0.53.1" - metro-resolver "0.53.1" - metro-source-map "0.53.1" + metro-babel-register "0.54.1" + metro-babel-transformer "0.54.1" + metro-cache "0.54.1" + metro-config "0.54.1" + metro-core "0.54.1" + metro-inspector-proxy "0.54.1" + metro-minify-uglify "0.54.1" + metro-react-native-babel-preset "0.54.1" + metro-resolver "0.54.1" + metro-source-map "0.54.1" mime-types "2.1.11" mkdirp "^0.5.1" node-fetch "^2.2.0" @@ -7448,14 +7387,6 @@ prettier@1.16.4: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== -pretty-format@24.0.0-alpha.6: - version "24.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.0.0-alpha.6.tgz#25ad2fa46b342d6278bf241c5d2114d4376fbac1" - integrity sha512-zG2m6YJeuzwBFqb5EIdmwYVf30sap+iMRuYNPytOccEXZMAJbPIFGKVJ/U0WjQegmnQbRo9CI7j6j3HtDaifiA== - dependencies: - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - pretty-format@^24.0.0, pretty-format@^24.7.0: version "24.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.7.0.tgz#d23106bc2edcd776079c2daa5da02bcb12ed0c10" @@ -8039,10 +7970,6 @@ rimraf@~2.2.6: version "2.2.8" resolved "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" -rsvp@^3.3.3: - version "3.6.2" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" - rsvp@^4.8.4: version "4.8.4" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" @@ -8100,22 +8027,6 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sane@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-3.1.0.tgz#995193b7dc1445ef1fe41ddfca2faf9f111854c6" - dependencies: - anymatch "^2.0.0" - capture-exit "^1.2.0" - exec-sh "^0.2.0" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - watch "~0.18.0" - optionalDependencies: - fsevents "^1.2.3" - sane@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" @@ -9127,13 +9038,6 @@ walker@^1.0.7, walker@~1.0.5: dependencies: makeerror "1.0.x" -watch@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" - dependencies: - exec-sh "^0.2.0" - minimist "^1.2.0" - wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" From 7ed0a0ff3e9ce68f0b9deb54be039edd1a05aaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 7 Jun 2019 18:11:00 +0200 Subject: [PATCH 168/234] v2.0.0-rc.1 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 66f57c4dd..edb9d5f8d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.0", + "version": "2.0.0-rc.1", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index ad92a7f20..865c00b88 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.0", + "version": "2.0.0-rc.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.0", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.0", - "@react-native-community/cli-tools": "^2.0.0-rc.0", + "@react-native-community/cli-platform-android": "^2.0.0-rc.1", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.1", + "@react-native-community/cli-tools": "^2.0.0-rc.1", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 9ea23a0e2..ac4c2de32 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.0", + "version": "2.0.0-rc.1", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.0", + "@react-native-community/cli-tools": "^2.0.0-rc.1", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 05acafadf..4000f755b 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.0", + "version": "2.0.0-rc.1", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.0", + "@react-native-community/cli-tools": "^2.0.0-rc.1", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 662a584e3..a0b632a91 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.0", + "version": "2.0.0-rc.1", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From fe2c7619075bb1ca7ab644e285414d9dab7606d8 Mon Sep 17 00:00:00 2001 From: Nathan Hunzaker Date: Sun, 9 Jun 2019 04:10:31 -0700 Subject: [PATCH 169/234] feat: Pass along CLI port configuration for Android (#421) This commit operates in conjunction with a change to React Native Android to allow the overriding of the development server port. --- .../src/commands/runAndroid/runOnAllDevices.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js b/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js index a4e9b2fff..164296f64 100644 --- a/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js +++ b/packages/platform-android/src/commands/runAndroid/runOnAllDevices.js @@ -39,6 +39,10 @@ function runOnAllDevices( const tasks = args.tasks || ['install' + toPascalCase(args.variant)]; const gradleArgs = getTaskNames(args.appFolder, tasks); + if (args.port != null) { + gradleArgs.push('-PreactNativeDevServerPort=' + args.port); + } + logger.info('Installing the app...'); logger.debug( `Running command "cd android && ${cmd} ${gradleArgs.join(' ')}"`, From 973e76890e4cf09621292835893070013ed77672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 12 Jun 2019 21:22:31 +0200 Subject: [PATCH 170/234] fix: make sure the port passed to Metro is a number (#424) --- packages/cli/src/tools/loadMetroConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 683ac9d6f..c9e5fb7f4 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -53,7 +53,7 @@ export const getDefaultConfig = (ctx: ConfigT) => { require(path.join(ctx.reactNativePath, 'rn-get-polyfills'))(), }, server: { - port: process.env.RCT_METRO_PORT || 8081, + port: Number(process.env.RCT_METRO_PORT) || 8081, }, transformer: { babelTransformerPath: require.resolve( From caaacb36ffdc29de8236afd46cf72b9428b391ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 12 Jun 2019 21:23:30 +0200 Subject: [PATCH 171/234] v2.0.0-rc.2 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index edb9d5f8d..c3cad9a09 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 865c00b88..3d631f7fa 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.1", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.1", - "@react-native-community/cli-tools": "^2.0.0-rc.1", + "@react-native-community/cli-platform-android": "^2.0.0-rc.2", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.2", + "@react-native-community/cli-tools": "^2.0.0-rc.2", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index ac4c2de32..22ce663c9 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.1", + "@react-native-community/cli-tools": "^2.0.0-rc.2", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 4000f755b..ddfa3c523 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.1", + "@react-native-community/cli-tools": "^2.0.0-rc.2", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index a0b632a91..4c53a9859 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From f316f9269bdd71d492efd8b73104f38c568c9e52 Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Thu, 13 Jun 2019 16:13:47 +0100 Subject: [PATCH 172/234] Log `console` invocations to the terminal. (#426) --- .../server/middleware/MiddlewareManager.js | 2 + .../middleware/logToConsoleMiddleware.js | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/cli/src/commands/server/middleware/logToConsoleMiddleware.js diff --git a/packages/cli/src/commands/server/middleware/MiddlewareManager.js b/packages/cli/src/commands/server/middleware/MiddlewareManager.js index 735554de7..d3c222a97 100644 --- a/packages/cli/src/commands/server/middleware/MiddlewareManager.js +++ b/packages/cli/src/commands/server/middleware/MiddlewareManager.js @@ -21,6 +21,7 @@ import getSecurityHeadersMiddleware from './getSecurityHeadersMiddleware'; import loadRawBodyMiddleware from './loadRawBodyMiddleware'; import openStackFrameInEditorMiddleware from './openStackFrameInEditorMiddleware'; import openURLMiddleware from './openURLMiddleware'; +import logToConsoleMiddleware from './logToConsoleMiddleware'; import statusPageMiddleware from './statusPageMiddleware'; import systraceProfileMiddleware from './systraceProfileMiddleware'; import getDevToolsMiddleware from './getDevToolsMiddleware'; @@ -53,6 +54,7 @@ export default class MiddlewareManager { .use('/debugger-ui', serveStatic(debuggerUIFolder)) .use(openStackFrameInEditorMiddleware(this.options)) .use(openURLMiddleware) + .use(logToConsoleMiddleware) .use(copyToClipBoardMiddleware) .use(statusPageMiddleware) .use(systraceProfileMiddleware) diff --git a/packages/cli/src/commands/server/middleware/logToConsoleMiddleware.js b/packages/cli/src/commands/server/middleware/logToConsoleMiddleware.js new file mode 100644 index 000000000..e1e245b15 --- /dev/null +++ b/packages/cli/src/commands/server/middleware/logToConsoleMiddleware.js @@ -0,0 +1,37 @@ +'use strict'; + +import chalk from 'chalk'; + +let cache = []; +let timer; + +const log = ({level, data, id}) => { + const logFunction = level !== 'trace' && console[level] ? level : 'log'; + const color = + level === 'error' ? 'red' : level === 'warn' ? 'yellow' : 'white'; + + console[logFunction].apply(console, [ + chalk.inverse[color].bold(` ${level.toUpperCase()} `), + ...data, + ]); +}; + +// Hold messages and flush them to reduce the amount of out-of-order logs +const flush = () => { + timer = null; + cache.sort((a, b) => a.id - b.id).forEach(log); + cache = []; +}; + +export default (req, res, next) => { + if (req.url === '/log-to-console') { + cache.push(JSON.parse(req.rawBody)); + if (!timer) { + timer = setTimeout(flush, 200); + } + + res.end('OK'); + } else { + next(); + } +}; From 2d237b3cd803dafd91446945e310494060e9006f Mon Sep 17 00:00:00 2001 From: Wu Zhong Date: Fri, 14 Jun 2019 14:45:55 +0800 Subject: [PATCH 173/234] fix: Add fallback path check when not found app file for iOS (#428) --- packages/platform-ios/src/commands/runIOS/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 3d3b395bf..239334d07 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -329,7 +329,13 @@ function getBuildPath(configuration, appName, isDevice, scheme) { device = 'iphonesimulator'; } - return `build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app`; + let buildPath = `build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app`; + // Check wether app file exist, sometimes `-derivedDataPath` option of `xcodebuild` not works as expected. + if (!fs.existsSync(path.join(buildPath))) { + return `DerivedData/Build/Products/${configuration}-${device}/${appName}.app`; + } + + return buildPath; } function getProductName(buildOutput) { From 982a18a4ffe8e37036861eb6085b4de45d3a7f81 Mon Sep 17 00:00:00 2001 From: Emin Khateeb Date: Fri, 14 Jun 2019 09:03:57 +0200 Subject: [PATCH 174/234] chore: update init docs to be more descriptive (#427) * updated docs to match the current implementation * added note about the shebang * re-added the .js extension as it works with it as well --- docs/init.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/init.md b/docs/init.md index b222f2524..166473ff6 100644 --- a/docs/init.md +++ b/docs/init.md @@ -76,7 +76,7 @@ module.exports = { // Directory with the template which will be copied and processed by React Native CLI. Template directory should have package.json with all dependencies specified, including `react-native`. templateDir: './template', - // Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template. + // Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template. This script runs as a shell script but you can change that (e.g. to Node) by using a shebang (see example custom template). postInitScript: './script.js', }; ``` From 116281fb53f972d6960526be8ed2bcc5bb09ab4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 17 Jun 2019 16:07:30 +0200 Subject: [PATCH 175/234] fix: allow upgrading with binary files in the diff (#432) * feat: allow upgrading with binary files in the diff * fix tests --- jest/setupUnitTests.js | 14 +------------- .../src/commands/upgrade/__tests__/upgrade.test.js | 7 ++++--- packages/cli/src/commands/upgrade/upgrade.js | 8 ++++++-- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/jest/setupUnitTests.js b/jest/setupUnitTests.js index 4c31f817a..cff360d25 100644 --- a/jest/setupUnitTests.js +++ b/jest/setupUnitTests.js @@ -2,18 +2,6 @@ * @flow */ -jest.mock('@react-native-community/cli-tools', () => ({ - ...jest.requireActual('@react-native-community/cli-tools'), - logger: { - success: jest.fn(), - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - debug: jest.fn(), - log: jest.fn(), - setVerbose: jest.fn(), - isVerbose: jest.fn(), - }, -})); +jest.mock('@react-native-community/cli-tools'); jest.setTimeout(20000); diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index f64b4c47e..a35b0def8 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -47,6 +47,7 @@ jest.mock('../../../tools/fetch', () => ({ fetch: jest.fn(() => Promise.resolve('patch')), })); jest.mock('@react-native-community/cli-tools', () => ({ + ...jest.requireActual('@react-native-community/cli-tools'), logger: { info: jest.fn((...args) => mockPushLog('info', args)), error: jest.fn((...args) => mockPushLog('error', args)), @@ -187,7 +188,7 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch $ execa git rev-parse --show-prefix - $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= + $ execa git apply --binary --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= info Applying diff... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= [fs] unlink tmp-upgrade-rn.patch @@ -219,7 +220,7 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch $ execa git rev-parse --show-prefix - $ execa git apply --check tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ + $ execa git apply --binary --check tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ info Applying diff... $ execa git apply tmp-upgrade-rn.patch --exclude=NestedApp/package.json -p2 --3way --directory=NestedApp/ [fs] unlink tmp-upgrade-rn.patch @@ -266,7 +267,7 @@ test('cleans up if patching fails,', async () => { "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch $ execa git rev-parse --show-prefix - $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= + $ execa git apply --binary --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way --directory= error: .flowconfig: does not exist in index diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 8f48537b8..ba6875bd5 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -5,7 +5,7 @@ import chalk from 'chalk'; import semver from 'semver'; import execa from 'execa'; import type {ConfigT} from 'types'; -import {logger} from '@react-native-community/cli-tools'; +import {logger, CLIError} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; import {fetch} from '../../tools/fetch'; import legacyUpgrade from './legacyUpgrade'; @@ -179,6 +179,10 @@ const applyPatch = async ( ); await execa('git', [ 'apply', + // According to git documentation, `--binary` flag is turned on by + // default. However it's necessary when running `git apply --check` to + // actually accept binary files, maybe a bug in git? + '--binary', '--check', tmpPatchFile, ...excludes, @@ -307,7 +311,7 @@ async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { `${rnDiffPurgeRawDiffsUrl}/${currentVersion}..${newVersion}.diff`, )}`); - throw new Error( + throw new CLIError( 'Upgrade failed. Please see the messages above for details', ); } From f482f234b58b7270d45ce62961826bb2d228ed8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 17 Jun 2019 16:07:47 +0200 Subject: [PATCH 176/234] chore: bump Flow to 0.101 (#431) --- package.json | 2 +- .../cli/src/commands/upgrade/__tests__/upgrade.test.js | 4 ++-- packages/cli/src/tools/releaseChecker/getLatestRelease.js | 6 +++--- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index b698bf2c2..11aa5ef77 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "eslint-import-resolver-typescript": "^1.1.1", "eslint-plugin-import": "^2.17.0", "execa": "^1.0.0", - "flow-bin": "^0.97.0", + "flow-bin": "^0.101.0", "flow-typed": "^2.5.1", "glob": "^7.1.3", "jest": "^24.6.0", diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index a35b0def8..81a271ec6 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -204,7 +204,7 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" `); expect( - snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { + snapshotDiff(samplePatch, (fs.writeFileSync: any).mock.calls[0][1], { contextLines: 1, }), ).toMatchSnapshot( @@ -294,7 +294,7 @@ test('works with --name-ios and --name-android', async () => { opts, ); expect( - snapshotDiff(samplePatch, fs.writeFileSync.mock.calls[0][1], { + snapshotDiff(samplePatch, (fs.writeFileSync: any).mock.calls[0][1], { contextLines: 1, }), ).toMatchSnapshot( diff --git a/packages/cli/src/tools/releaseChecker/getLatestRelease.js b/packages/cli/src/tools/releaseChecker/getLatestRelease.js index debf37f0e..7f41a2304 100644 --- a/packages/cli/src/tools/releaseChecker/getLatestRelease.js +++ b/packages/cli/src/tools/releaseChecker/getLatestRelease.js @@ -110,11 +110,11 @@ async function getLatestRnDiffPurgeVersion(name: string, eTag: ?string) { } type Headers = { - 'User-Agent': string, - [header: string]: string, + 'User-Agent': mixed, + [header: string]: mixed, }; -function httpsGet(options: any) { +function httpsGet(options) { return new Promise((resolve, reject) => { https .get(options, result => { diff --git a/yarn.lock b/yarn.lock index 42dc8e53a..52747b228 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4155,10 +4155,10 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.97.0: - version "0.97.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.97.0.tgz#036ffcfc27503367a9d906ec9d843a0aa6f6bb83" - integrity sha512-jXjD05gkatLuC4+e28frH1hZoRwr1iASP6oJr61Q64+kR4kmzaS+AdFBhYgoYS5kpoe4UzwDebWK8ETQFNh00w== +flow-bin@^0.101.0: + version "0.101.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.101.0.tgz#c56fa0afb9c151eeba7954136e9066d408691063" + integrity sha512-2xriPEOSrGQklAArNw1ixoIUiLTWhIquYV26WqnxEu7IcXWgoZUcfJXufG9kIvrNbdwCNd5RBjTwbB0p6L6XaA== flow-typed@^2.5.1: version "2.5.1" From 5e2d7a04f43abe599ac66909a8b885394cfeb08c Mon Sep 17 00:00:00 2001 From: Robert Ying Date: Thu, 20 Jun 2019 19:55:42 +0800 Subject: [PATCH 177/234] fix: Add import for `applicationId.R` class in generated `PackageList.java` (#435) * Add import for `applicationId.R` class * Remove redundant semicolon --- packages/platform-android/native_modules.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 3f6bdea37..1d4f54018 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -145,10 +145,10 @@ class ReactNativeModules { String packageClassInstances = "" if (packages.size() > 0) { - packageImports = "import ${applicationId}.BuildConfig;\n\n" + packageImports = "import ${applicationId}.BuildConfig;\nimport ${applicationId}.R;\n\n" packageImports = packageImports + packages.collect { "// ${it.name}\n${it.packageImportPath}" - }.join(';\n') + }.join('\n') packageClassInstances = ",\n " + packages.collect { it.packageInstance }.join(',') } From be699f7d5440ef91855adada1dc55c832b2d0877 Mon Sep 17 00:00:00 2001 From: James George Date: Fri, 21 Jun 2019 23:49:50 +0530 Subject: [PATCH 178/234] chore: refactor packageManager.js for less redundancy (#433) --- package.json | 1 + .../tools/__tests__/packageManager-test.js | 10 ++-- packages/cli/src/tools/packageManager.js | 50 +++++++++++-------- yarn.lock | 7 +++ 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 11aa5ef77..d731ffe7b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@react-native-community/eslint-config": "^0.0.5", "@types/jest": "^24.0.11", "@types/node": "^11.13.0", + "@types/node-fetch": "^2.3.7", "babel-jest": "^24.6.0", "babel-plugin-module-resolver": "^3.2.0", "chalk": "^2.4.2", diff --git a/packages/cli/src/tools/__tests__/packageManager-test.js b/packages/cli/src/tools/__tests__/packageManager-test.js index 1e53b185f..4527091b5 100644 --- a/packages/cli/src/tools/__tests__/packageManager-test.js +++ b/packages/cli/src/tools/__tests__/packageManager-test.js @@ -55,7 +55,7 @@ describe('npm', () => { expect(execa).toHaveBeenCalledWith( 'npm', - ['install', ...PACKAGES, '--save', '--save-exact'], + ['install', '--save', '--save-exact', ...PACKAGES], EXEC_OPTS, ); }); @@ -65,7 +65,7 @@ describe('npm', () => { expect(execa).toHaveBeenCalledWith( 'npm', - ['install', ...PACKAGES, '--save-dev', '--save-exact'], + ['install', '--save-dev', '--save-exact', ...PACKAGES], EXEC_OPTS, ); }); @@ -75,7 +75,7 @@ describe('npm', () => { expect(execa).toHaveBeenCalledWith( 'npm', - ['uninstall', ...PACKAGES, '--save'], + ['uninstall', '--save', ...PACKAGES], EXEC_OPTS, ); }); @@ -87,7 +87,7 @@ it('should use npm if yarn is not available', () => { expect(execa).toHaveBeenCalledWith( 'npm', - ['install', ...PACKAGES, '--save', '--save-exact'], + ['install', '--save', '--save-exact', ...PACKAGES], EXEC_OPTS, ); }); @@ -100,7 +100,7 @@ it('should use npm if project is not using yarn', () => { expect(execa).toHaveBeenCalledWith( 'npm', - ['install', ...PACKAGES, '--save', '--save-exact'], + ['install', '--save', '--save-exact', ...PACKAGES], EXEC_OPTS, ); expect(yarn.isProjectUsingYarn).toHaveBeenCalledWith(PROJECT_ROOT); diff --git a/packages/cli/src/tools/packageManager.js b/packages/cli/src/tools/packageManager.js index b42519b68..b85e8c293 100644 --- a/packages/cli/src/tools/packageManager.js +++ b/packages/cli/src/tools/packageManager.js @@ -11,6 +11,32 @@ type Options = {| let projectDir; +const packageManagers = { + yarn: { + install: ['add'], + installDev: ['add', '-D'], + uninstall: ['remove'], + installAll: ['install'], + }, + npm: { + install: ['install', '--save', '--save-exact'], + installDev: ['install', '--save-dev', '--save-exact'], + uninstall: ['uninstall', '--save'], + installAll: ['install'], + }, +}; + +function configurePackageManager( + packageNames: Array, + options?: Options, + action: 'install' | 'installDev' | 'installAll' | 'uninstall', +) { + const pm = shouldUseYarn(options) ? 'yarn' : 'npm'; + const [executable, ...flags] = packageManagers[pm][action]; + const args = [executable, ...flags, ...packageNames]; + return executeCommand(pm, args, options); +} + function executeCommand( command: string, args: Array, @@ -36,33 +62,17 @@ export function setProjectDir(dir: string) { } export function install(packageNames: Array, options?: Options) { - return shouldUseYarn(options) - ? executeCommand('yarn', ['add', ...packageNames], options) - : executeCommand( - 'npm', - ['install', ...packageNames, '--save', '--save-exact'], - options, - ); + return configurePackageManager(packageNames, options, 'install'); } export function installDev(packageNames: Array, options?: Options) { - return shouldUseYarn(options) - ? executeCommand('yarn', ['add', '-D', ...packageNames], options) - : executeCommand( - 'npm', - ['install', ...packageNames, '--save-dev', '--save-exact'], - options, - ); + return configurePackageManager(packageNames, options, 'installDev'); } export function uninstall(packageNames: Array, options?: Options) { - return shouldUseYarn(options) - ? executeCommand('yarn', ['remove', ...packageNames], options) - : executeCommand('npm', ['uninstall', ...packageNames, '--save'], options); + return configurePackageManager(packageNames, options, 'uninstall'); } export function installAll(options?: Options) { - return shouldUseYarn(options) - ? executeCommand('yarn', ['install'], options) - : executeCommand('npm', ['install'], options); + return configurePackageManager([], options, 'installAll'); } diff --git a/yarn.lock b/yarn.lock index 52747b228..9bdd5834c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1975,6 +1975,13 @@ dependencies: "@types/node" "*" +"@types/node-fetch@^2.3.7": + version "2.3.7" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.7.tgz#b7212e895100f8642dbdab698472bab5f3c1d2f1" + integrity sha512-+bKtuxhj/TYSSP1r4CZhfmyA0vm/aDRQNo7vbAgf6/cZajn0SAniGGST07yvI4Q+q169WTa2/x9gEHfJrkcALw== + dependencies: + "@types/node" "*" + "@types/node@*": version "12.0.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.0.tgz#d11813b9c0ff8aaca29f04cbc12817f4c7d656e5" From 0fcf6d3ddf320e309bca905eea562cebc944b144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 24 Jun 2019 16:00:54 +0200 Subject: [PATCH 179/234] feat: filter out non-native deps from config output; fix missing hooks (#436) --- jest/setupUnitTests.js | 16 +- packages/cli/src/commands/config/config.js | 23 ++- .../src/commands/link/__tests__/link-test.js | 28 ++-- .../link}/__tests__/makeHook-test.js | 0 packages/cli/src/commands/link/link.js | 5 +- packages/cli/src/commands/link/linkAll.js | 5 +- .../config => commands/link}/makeHook.js | 0 packages/cli/src/commands/link/unlink.js | 5 +- packages/cli/src/tools/config/index.js | 145 ++++++++++-------- .../__tests__/findLineToAddPod-test.js | 2 +- types/index.js | 6 +- 11 files changed, 140 insertions(+), 95 deletions(-) rename packages/cli/src/{tools/config => commands/link}/__tests__/makeHook-test.js (100%) rename packages/cli/src/{tools/config => commands/link}/makeHook.js (100%) diff --git a/jest/setupUnitTests.js b/jest/setupUnitTests.js index cff360d25..a6ea7c372 100644 --- a/jest/setupUnitTests.js +++ b/jest/setupUnitTests.js @@ -2,6 +2,20 @@ * @flow */ -jest.mock('@react-native-community/cli-tools'); +jest.mock('@react-native-community/cli-tools', () => { + return { + ...jest.requireActual('@react-native-community/cli-tools'), + logger: { + success: jest.fn(), + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + debug: jest.fn(), + log: jest.fn(), + setVerbose: jest.fn(), + isVerbose: jest.fn(), + }, + }; +}); jest.setTimeout(20000); diff --git a/packages/cli/src/commands/config/config.js b/packages/cli/src/commands/config/config.js index 36b0c7130..37705d0d3 100644 --- a/packages/cli/src/commands/config/config.js +++ b/packages/cli/src/commands/config/config.js @@ -2,10 +2,31 @@ * @flow */ import {type ConfigT} from 'types'; + +function isValidRNDependency(config) { + return ( + Object.keys(config.platforms).filter(key => Boolean(config.platforms[key])) + .length !== 0 || + Object.keys(config.hooks).length !== 0 || + config.assets.length !== 0 || + config.params.length !== 0 + ); +} + +function filterConfig(config) { + const filtered = {...config}; + Object.keys(filtered.dependencies).forEach(item => { + if (!isValidRNDependency(filtered.dependencies[item])) { + delete filtered.dependencies[item]; + } + }); + return filtered; +} + export default { name: 'config', description: 'Print CLI configuration', func: async (argv: string[], ctx: ConfigT) => { - console.log(JSON.stringify(ctx, null, 2)); + console.log(JSON.stringify(filterConfig(ctx), null, 2)); }, }; diff --git a/packages/cli/src/commands/link/__tests__/link-test.js b/packages/cli/src/commands/link/__tests__/link-test.js index a9c173f3c..02c537344 100644 --- a/packages/cli/src/commands/link/__tests__/link-test.js +++ b/packages/cli/src/commands/link/__tests__/link-test.js @@ -1,9 +1,15 @@ import {func as link} from '../link'; import loadConfig from '../../../tools/config'; +import makeHook from '../makeHook'; jest.mock('chalk', () => ({grey: str => str, bold: str => str})); jest.mock('../../../tools/config'); jest.mock('../../../tools/logger'); +jest.mock('../makeHook', () => { + return jest.fn(() => { + return jest.fn(() => Promise.resolve()); + }); +}); const baseConfig = loadConfig(); @@ -54,9 +60,9 @@ describe('link', () => { expect(spy).toHaveBeenCalled(); }); - it('should register native module when android/ios projects are present', done => { - const prelink = jest.fn(); - const postlink = jest.fn(); + it('should register native module when android/ios projects are present', async () => { + const prelink = 'node prelink.js'; + const postlink = 'node postlink.js'; const registerNativeModule = jest.fn(); const config = { @@ -87,19 +93,9 @@ describe('link', () => { }, }; - link(['react-native-blur'], config, {}).then(() => { - expect(registerNativeModule.mock.calls).toHaveLength(2); - - expect(prelink.mock.invocationCallOrder[0]).toBeLessThan( - registerNativeModule.mock.invocationCallOrder[0], - ); - - expect(postlink.mock.invocationCallOrder[0]).toBeGreaterThan( - registerNativeModule.mock.invocationCallOrder[0], - ); - - done(); - }); + await link(['react-native-blur'], config, {}); + expect(registerNativeModule.mock.calls).toHaveLength(2); + expect(makeHook.mock.calls).toEqual([[prelink], [postlink]]); }); it('should copy assets only from the specific dependency that we are linking', done => { diff --git a/packages/cli/src/tools/config/__tests__/makeHook-test.js b/packages/cli/src/commands/link/__tests__/makeHook-test.js similarity index 100% rename from packages/cli/src/tools/config/__tests__/makeHook-test.js rename to packages/cli/src/commands/link/__tests__/makeHook-test.js diff --git a/packages/cli/src/commands/link/link.js b/packages/cli/src/commands/link/link.js index 94627c22b..d7e458e82 100644 --- a/packages/cli/src/commands/link/link.js +++ b/packages/cli/src/commands/link/link.js @@ -15,6 +15,7 @@ import getPlatformName from './getPlatformName'; import linkDependency from './linkDependency'; import linkAssets from './linkAssets'; import linkAll from './linkAll'; +import makeHook from './makeHook'; type FlagsType = { platforms?: Array, @@ -68,11 +69,11 @@ async function link( try { if (dependency.hooks.prelink) { - await dependency.hooks.prelink(); + await makeHook(dependency.hooks.prelink)(); } await linkDependency(platforms, project, dependency); if (dependency.hooks.postlink) { - await dependency.hooks.postlink(); + await makeHook(dependency.hooks.postlink)(); } await linkAssets(platforms, project, dependency.assets); } catch (error) { diff --git a/packages/cli/src/commands/link/linkAll.js b/packages/cli/src/commands/link/linkAll.js index 50878141f..97ce27ade 100644 --- a/packages/cli/src/commands/link/linkAll.js +++ b/packages/cli/src/commands/link/linkAll.js @@ -9,6 +9,7 @@ import {CLIError, logger} from '@react-native-community/cli-tools'; import type {ConfigT} from 'types'; import linkAssets from './linkAssets'; import linkDependency from './linkDependency'; +import makeHook from './makeHook'; const dedupeAssets = (assets: Array): Array => uniqBy(assets, asset => path.basename(asset)); @@ -35,11 +36,11 @@ async function linkAll(config: ConfigT, options: Options) { const dependency = config.dependencies[key]; try { if (dependency.hooks.prelink) { - await dependency.hooks.prelink(); + await makeHook(dependency.hooks.prelink)(); } await linkDependency(config.platforms, config.project, dependency); if (dependency.hooks.postlink) { - await dependency.hooks.postlink(); + await makeHook(dependency.hooks.postlink)(); } } catch (error) { throw new CLIError( diff --git a/packages/cli/src/tools/config/makeHook.js b/packages/cli/src/commands/link/makeHook.js similarity index 100% rename from packages/cli/src/tools/config/makeHook.js rename to packages/cli/src/commands/link/makeHook.js diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 411b6d70b..5b91768b1 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -11,6 +11,7 @@ import {flatMap, values, difference} from 'lodash'; import {logger, CLIError} from '@react-native-community/cli-tools'; import type {ConfigT} from 'types'; import getPlatformName from './getPlatformName'; +import makeHook from './makeHook'; const unlinkDependency = ( platforms, @@ -91,7 +92,7 @@ async function unlink(args: Array, ctx: ConfigT) { const dependencies = values(otherDependencies); try { if (dependency.hooks.preulink) { - await dependency.hooks.preulink(); + await makeHook(dependency.hooks.preulink)(); } unlinkDependency( ctx.platforms, @@ -101,7 +102,7 @@ async function unlink(args: Array, ctx: ConfigT) { dependencies, ); if (dependency.hooks.postunlink) { - await dependency.hooks.postunlink(); + await makeHook(dependency.hooks.postunlink)(); } } catch (error) { throw new CLIError( diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 704f03bee..a78f9f99c 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -2,29 +2,54 @@ * @flow */ import path from 'path'; -import {mapValues} from 'lodash'; import chalk from 'chalk'; - +import {logger, inlineString} from '@react-native-community/cli-tools'; +import * as ios from '@react-native-community/cli-platform-ios'; +import * as android from '@react-native-community/cli-platform-android'; import findDependencies from './findDependencies'; import resolveReactNativePath from './resolveReactNativePath'; import findAssets from './findAssets'; -import makeHook from './makeHook'; import { readConfigFromDisk, readDependencyConfigFromDisk, } from './readConfigFromDisk'; - import {type ConfigT} from 'types'; - import assign from '../assign'; import merge from '../merge'; import resolveNodeModuleDir from './resolveNodeModuleDir'; -/** - * Built-in platforms - */ -import * as ios from '@react-native-community/cli-platform-ios'; -import * as android from '@react-native-community/cli-platform-android'; -import {logger, inlineString} from '@react-native-community/cli-tools'; + +function getDependencyConfig( + root, + dependencyName, + finalConfig, + config, + userConfig, + isPlatform, +) { + return merge( + { + root, + name: dependencyName, + platforms: Object.keys(finalConfig.platforms).reduce( + (dependency, platform) => { + // Linking platforms is not supported + dependency[platform] = isPlatform + ? null + : finalConfig.platforms[platform].dependencyConfig( + root, + config.dependency.platforms[platform] || {}, + ); + return dependency; + }, + {}, + ), + assets: findAssets(root, config.dependency.assets), + hooks: config.dependency.hooks, + params: config.dependency.params, + }, + userConfig.dependencies[dependencyName] || {}, + ); +} /** * Loads CLI configuration @@ -32,6 +57,35 @@ import {logger, inlineString} from '@react-native-community/cli-tools'; function loadConfig(projectRoot: string = process.cwd()): ConfigT { const userConfig = readConfigFromDisk(projectRoot); + const initialConfig: ConfigT = { + root: projectRoot, + get reactNativePath() { + return userConfig.reactNativePath + ? path.resolve(projectRoot, userConfig.reactNativePath) + : resolveReactNativePath(projectRoot); + }, + dependencies: {}, + commands: userConfig.commands, + get assets() { + return findAssets(projectRoot, userConfig.assets); + }, + platforms: userConfig.platforms, + haste: { + providesModuleNodeModules: [], + platforms: Object.keys(userConfig.platforms), + }, + get project() { + const project = {}; + for (const platform in finalConfig.platforms) { + project[platform] = finalConfig.platforms[platform].projectConfig( + projectRoot, + userConfig.project[platform] || {}, + ); + } + return project; + }, + }; + const finalConfig = findDependencies(projectRoot).reduce( (acc: ConfigT, dependencyName) => { let root; @@ -53,9 +107,8 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { } /** - * This workaround is necessary for development only before - * first 0.60.0-rc.0 gets released and we can switch to it - * while testing. + * @todo: remove this code once `react-native` is published with + * `platforms` and `commands` inside `react-native.config.js`. */ if (dependencyName === 'react-native') { if (Object.keys(config.platforms).length === 0) { @@ -72,39 +125,24 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { * Legacy `rnpm` config required `haste` to be defined. With new config, * we do it automatically. * - * Remove this once `rnpm` config is deprecated. + * @todo: Remove this once `rnpm` config is deprecated and all major RN libs are converted. */ const haste = config.haste || { providesModuleNodeModules: isPlatform ? [dependencyName] : [], platforms: Object.keys(config.platforms), }; - return assign({}, acc, { + return (assign({}, acc, { dependencies: assign({}, acc.dependencies, { // $FlowExpectedError: Dynamic getters are not supported get [dependencyName]() { - return merge( - { - root, - name: dependencyName, - platforms: Object.keys(finalConfig.platforms).reduce( - (dependency, platform) => { - // Linking platforms is not supported - dependency[platform] = isPlatform - ? null - : finalConfig.platforms[platform].dependencyConfig( - root, - config.dependency.platforms[platform] || {}, - ); - return dependency; - }, - {}, - ), - assets: findAssets(root, config.dependency.assets), - hooks: mapValues(config.dependency.hooks, makeHook), - params: config.dependency.params, - }, - userConfig.dependencies[dependencyName] || {}, + return getDependencyConfig( + root, + dependencyName, + finalConfig, + config, + userConfig, + isPlatform, ); }, }), @@ -120,36 +158,9 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { ], platforms: [...acc.haste.platforms, ...haste.platforms], }, - }); + }): ConfigT); }, - ({ - root: projectRoot, - get reactNativePath() { - return userConfig.reactNativePath - ? path.resolve(projectRoot, userConfig.reactNativePath) - : resolveReactNativePath(projectRoot); - }, - dependencies: {}, - commands: userConfig.commands, - get assets() { - return findAssets(projectRoot, userConfig.assets); - }, - platforms: userConfig.platforms, - haste: { - providesModuleNodeModules: [], - platforms: Object.keys(userConfig.platforms), - }, - get project() { - const project = {}; - for (const platform in finalConfig.platforms) { - project[platform] = finalConfig.platforms[platform].projectConfig( - projectRoot, - userConfig.project[platform] || {}, - ); - } - return project; - }, - }: ConfigT), + initialConfig, ); return finalConfig; diff --git a/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js b/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js index 245190d01..a3d4e4e46 100644 --- a/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/findLineToAddPod-test.js @@ -15,7 +15,7 @@ const path = require('path'); const PODFILES_PATH = path.join(__dirname, '../__fixtures__/'); const LINE_AFTER_TARGET_IN_TEST_PODFILE = 4; -console.log(PODFILES_PATH); + describe('pods::findLineToAddPod', () => { it('returns null if file is not Podfile', () => { const podfile = readPodfile(path.join(PODFILES_PATH, 'Info.plist')); diff --git a/types/index.js b/types/index.js index 0c435a0e0..c2c6d6523 100644 --- a/types/index.js +++ b/types/index.js @@ -121,9 +121,9 @@ export type ConfigT = {| }, assets: string[], hooks: { - [key: string]: () => void, - prelink?: () => void, - postlink?: () => void, + [key: string]: string, + prelink?: string, + postlink?: string, }, params: InquirerPromptT[], }, From 9a63f8604f900ea42f2ffb4d23aab3316898aa60 Mon Sep 17 00:00:00 2001 From: Robert Ying Date: Mon, 24 Jun 2019 22:15:32 +0800 Subject: [PATCH 180/234] fix: use `packageName` instead of `applicationId` in gradle script (#439) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use `packageName` instead of `applicationId` * Use pre-parsed config for `packageName` * Remove param `packageName` Co-Authored-By: Michał Pierzchała --- packages/platform-android/native_modules.gradle | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 1d4f54018..75700d790 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -49,6 +49,7 @@ public class PackageList { class ReactNativeModules { private Logger logger private Project project + private String packageName private DefaultSettings defaultSettings private ExtraPropertiesExtension extension private ArrayList> reactNativeModules @@ -136,16 +137,16 @@ class ReactNativeModules { * @param outputDir * @param generatedFileName * @param generatedFileContentsTemplate - * @param applicationId */ - void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate, String applicationId) { + void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate) { ArrayList>[] packages = this.reactNativeModules + String packageName = this.packageName String packageImports = "" String packageClassInstances = "" if (packages.size() > 0) { - packageImports = "import ${applicationId}.BuildConfig;\nimport ${applicationId}.R;\n\n" + packageImports = "import ${packageName}.BuildConfig;\nimport ${packageName}.R;\n\n" packageImports = packageImports + packages.collect { "// ${it.name}\n${it.packageImportPath}" }.join('\n') @@ -193,6 +194,7 @@ class ReactNativeModules { def reactNativeConfigOutput = cmdProcess.in.text def json = new JsonSlurper().parseText(reactNativeConfigOutput) + this.packageName = json["project"]["android"]["packageName"] def dependencies = json["dependencies"] dependencies.each { name, value -> @@ -233,17 +235,11 @@ ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings -> ext.applyNativeModulesAppBuildGradle = { Project project -> autoModules.applyBuildGradle(project, ext) - def applicationId def generatedSrcDir = new File(buildDir, "generated/rncli/src/main/java/com/facebook/react") - // TODO(salakar): not sure if this is the best way of getting the package name (used to import BuildConfig) - project.android.applicationVariants.all { variant -> - applicationId = [variant.mergedFlavor.applicationId, variant.buildType.applicationIdSuffix].findAll().join() - } - task generatePackageList { doLast { - autoModules.generatePackagesFile(generatedSrcDir, generatedFileName, generatedFileContentsTemplate, applicationId) + autoModules.generatePackagesFile(generatedSrcDir, generatedFileName, generatedFileContentsTemplate) } } From c6ad37da59eddb69ffa5af1ee8b7fb2f328a414e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 24 Jun 2019 21:34:23 +0200 Subject: [PATCH 181/234] feat(breaking): use 'podspecPath' instead of 'podspec', make it smarter (#442) --- docs/dependencies.md | 8 ++--- docs/platforms.md | 2 +- docs/projects.md | 1 + .../__snapshots__/index-test.js.snap | 8 ++--- packages/cli/src/tools/config/schema.js | 4 +-- packages/platform-ios/native_modules.rb | 12 +++---- ...odspecName-test.js => findPodspec-test.js} | 21 +++++++----- .../platform-ios/src/config/findPodspec.js | 21 ++++++++++++ .../src/config/findPodspecName.js | 34 ------------------- .../platform-ios/src/config/getPodspecName.js | 13 +++++++ packages/platform-ios/src/config/index.js | 12 +++++-- .../link-pods/__tests__/isInstalled-test.js | 8 ++--- .../platform-ios/src/link-pods/addPodEntry.js | 16 +++++---- .../src/link-pods/findMarkedLinesInPodfile.js | 4 +-- .../platform-ios/src/link-pods/isInstalled.js | 3 +- .../src/link-pods/registerNativeModule.js | 12 +++---- .../src/link-pods/removePodEntry.js | 4 ++- .../src/link-pods/unregisterNativeModule.js | 2 +- .../src/link/common/registerNativeModule.js | 15 ++++---- .../src/link/registerNativeModule.js | 8 ++--- types/index.js | 6 ++-- 21 files changed, 117 insertions(+), 97 deletions(-) rename packages/platform-ios/src/config/__tests__/{findPodspecName-test.js => findPodspec-test.js} (70%) create mode 100644 packages/platform-ios/src/config/findPodspec.js delete mode 100644 packages/platform-ios/src/config/findPodspecName.js create mode 100644 packages/platform-ios/src/config/getPodspecName.js diff --git a/docs/dependencies.md b/docs/dependencies.md index 128b20582..6ce468e7d 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -56,7 +56,7 @@ The following settings are available on iOS and Android: ```ts type DependencyParamsIOST = { project?: string; - podspec?: string; + podspecPath?: string; sharedLibraries?: string[]; }; @@ -70,11 +70,11 @@ type DependencyParamsAndroidT = { #### platforms.ios.project -Custom path to `.xcodeproj` +Custom path to `.xcodeproj`. -#### platforms.ios.podspec +#### platforms.ios.podspecPath -Custom `podspec` name to use when auto-linking (without the file extension). Your `podspec` file must be located in the root of the dependency package. +Custom path to `.podspec` file to use when auto-linking. Example: `node_modules/react-native-module/ios/module.podspec`. #### platforms.ios.sharedLibraries diff --git a/docs/platforms.md b/docs/platforms.md index fa2f66d8e..8f85fbbd9 100644 --- a/docs/platforms.md +++ b/docs/platforms.md @@ -83,7 +83,7 @@ type ProjectConfigIOST = { folder: string; pbxprojPath: string; podfile: null; - podspec: null; + podspecPath: null; projectPath: string; projectName: string; libraryFolder: string; diff --git a/docs/projects.md b/docs/projects.md index 1d8cb92dc..caee753ba 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -81,6 +81,7 @@ type ProjectParamsAndroidT = { type ProjectParamsIOST = { project?: string; + podspecPath?: string; sharedLibraries?: string[]; libraryFolder?: string; plist: any[]; diff --git a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap index dfc4d401c..36eb20609 100644 --- a/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap +++ b/packages/cli/src/tools/config/__tests__/__snapshots__/index-test.js.snap @@ -91,7 +91,7 @@ Object { "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", "plist": Array [], "podfile": null, - "podspec": null, + "podspecPath": null, "projectName": "HelloWorld.xcodeproj", "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", "sharedLibraries": Array [], @@ -125,7 +125,7 @@ Object { "pbxprojPath": "<>/node_modules/react-native-foo/customLocation/customProject.xcodeproj/project.pbxproj", "plist": Array [], "podfile": null, - "podspec": null, + "podspecPath": null, "projectName": "customProject.xcodeproj", "projectPath": "<>/node_modules/react-native-foo/customLocation/customProject.xcodeproj", "sharedLibraries": Array [], @@ -164,7 +164,7 @@ Object { "pbxprojPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj/project.pbxproj", "plist": Array [], "podfile": null, - "podspec": "ReactNativeTest", + "podspecPath": "<>/node_modules/react-native-test/ReactNativeTest.podspec", "projectName": "customProject.xcodeproj", "projectPath": "<>/node_modules/react-native-test/customLocation/customProject.xcodeproj", "sharedLibraries": Array [], @@ -201,7 +201,7 @@ Object { "pbxprojPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj/project.pbxproj", "plist": Array [], "podfile": null, - "podspec": null, + "podspecPath": null, "projectName": "HelloWorld.xcodeproj", "projectPath": "<>/node_modules/react-native-test/ios/HelloWorld.xcodeproj", "sharedLibraries": Array [], diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index 548a0f242..a6ee6d4a4 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -49,7 +49,7 @@ export const dependencyConfig = t ios: t .object({ project: t.string(), - podspec: t.string(), + podspecPath: t.string(), sharedLibraries: t.array().items(t.string()), libraryFolder: t.string(), }) @@ -113,7 +113,7 @@ export const projectConfig = t folder: t.string(), pbxprojPath: t.string(), podfile: t.string(), - podspec: t.string(), + podspecPath: t.string(), projectPath: t.string(), projectName: t.string(), libraryFolder: t.string(), diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index 0df725e74..2eb120953 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -41,7 +41,7 @@ def use_native_modules!(root = "..", packages = nil) packages.each do |package_name, package| next unless package_config = package["platforms"]["ios"] - podspec_path = File.join(package["root"], "#{package_config["podspec"]}.podspec") + podspec_path = package_config["podspecPath"] spec = Pod::Specification.from_file(podspec_path) # We want to do a look up inside the current CocoaPods target @@ -57,7 +57,7 @@ def use_native_modules!(root = "..", packages = nil) existing_dep.name.split('/').first == spec.name end - pod spec.name, :path => package["root"] + pod spec.name, :path => File.dirname(podspec_path) if package_config["scriptPhases"] # Can be either an object, or an array of objects @@ -126,16 +126,16 @@ def pluralize(count) } @ios_package = ios_package = { - "root" => "/Users/grabbou/Repositories/WebViewDemoApp/node_modules/react", + "root" => "/root/app/node_modules/react", "platforms" => { "ios" => { - "podspec" => "React", + "podspecPath" => "/root/app/node_modules/react/React.podspec", }, "android" => nil, }, } @android_package = { - "root" => "/Users/grabbou/Repositories/WebViewDemoApp/node_modules/react-native-google-play-game-services", + "root" => "/root/app/node_modules/react-native-google-play-game-services", "platforms" => { "ios" => nil, "android" => { @@ -160,7 +160,7 @@ def pluralize(count) end Pod::Specification.singleton_class.send(:define_method, :from_file) do |podspec_path| - podspec_path.must_equal File.join(ios_package["root"], "#{ios_package["platforms"]["ios"]["podspec"]}.podspec") + podspec_path.must_equal ios_package["platforms"]["ios"]["podspecPath"] spec end diff --git a/packages/platform-ios/src/config/__tests__/findPodspecName-test.js b/packages/platform-ios/src/config/__tests__/findPodspec-test.js similarity index 70% rename from packages/platform-ios/src/config/__tests__/findPodspecName-test.js rename to packages/platform-ios/src/config/__tests__/findPodspec-test.js index 7a1c1600d..16b05b714 100644 --- a/packages/platform-ios/src/config/__tests__/findPodspecName-test.js +++ b/packages/platform-ios/src/config/__tests__/findPodspec-test.js @@ -4,11 +4,10 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format - * @emails oncall+javascript_foundation + * @flow */ -import findPodspecName from '../findPodspecName'; +import findPodspec from '../findPodspec'; import * as projects from '../__fixtures__/projects'; jest.mock('path'); @@ -16,18 +15,21 @@ jest.mock('fs'); const fs = require('fs'); -describe('ios::findPodspecName', () => { +describe('ios::findPodspec', () => { it('returns null if there is not podspec file', () => { + // $FlowFixMe fs.__setMockFilesystem(projects.flat); - expect(findPodspecName('')).toBeNull(); + expect(findPodspec('')).toBeNull(); }); it('returns podspec name if only one exists', () => { + // $FlowFixMe fs.__setMockFilesystem(projects.withPods.ios); - expect(findPodspecName('/')).toBe('TestPod'); + expect(findPodspec('/')).toBe('/TestPod.podspec'); }); it('returns podspec name that match packet directory', () => { + // $FlowFixMe fs.__setMockFilesystem({ user: { PacketName: { @@ -36,10 +38,13 @@ describe('ios::findPodspecName', () => { }, }, }); - expect(findPodspecName('/user/PacketName')).toBe('PacketName'); + expect(findPodspec('/user/PacketName')).toBe( + '/user/PacketName/PacketName.podspec', + ); }); it('returns first podspec name if not match in directory', () => { + // $FlowFixMe fs.__setMockFilesystem({ user: { packet: { @@ -48,6 +53,6 @@ describe('ios::findPodspecName', () => { }, }, }); - expect(findPodspecName('/user/packet')).toBe('Another'); + expect(findPodspec('/user/packet')).toBe('/user/packet/Another.podspec'); }); }); diff --git a/packages/platform-ios/src/config/findPodspec.js b/packages/platform-ios/src/config/findPodspec.js new file mode 100644 index 000000000..30ab98d00 --- /dev/null +++ b/packages/platform-ios/src/config/findPodspec.js @@ -0,0 +1,21 @@ +/** + * @flow + */ + +import glob from 'glob'; +import path from 'path'; + +export default function findPodspec(folder: string): string | null { + const podspecs = glob.sync('*.podspec', {cwd: folder}); + + if (podspecs.length === 0) { + return null; + } + + const packagePodspec = path.basename(folder) + '.podspec'; + const podspecFile = podspecs.includes(packagePodspec) + ? packagePodspec + : podspecs[0]; + + return path.join(folder, podspecFile); +} diff --git a/packages/platform-ios/src/config/findPodspecName.js b/packages/platform-ios/src/config/findPodspecName.js deleted file mode 100644 index eb14ba8b5..000000000 --- a/packages/platform-ios/src/config/findPodspecName.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -import glob from 'glob'; -import path from 'path'; - -export default function findPodspecName(folder: string): string | null { - const podspecs = glob.sync('*.podspec', {cwd: folder}); - let podspecFile = null; - if (podspecs.length === 0) { - return null; - } - if (podspecs.length === 1) { - podspecFile = podspecs[0]; - } else { - const folderParts = folder.split(path.sep); - const currentFolder = folderParts[folderParts.length - 1]; - const toSelect = podspecs.indexOf(`${currentFolder}.podspec`); - if (toSelect === -1) { - podspecFile = podspecs[0]; - } else { - podspecFile = podspecs[toSelect]; - } - } - - return podspecFile.replace('.podspec', ''); -} diff --git a/packages/platform-ios/src/config/getPodspecName.js b/packages/platform-ios/src/config/getPodspecName.js new file mode 100644 index 000000000..19fc35fc9 --- /dev/null +++ b/packages/platform-ios/src/config/getPodspecName.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ +import path from 'path'; + +export default function getPodspecName(podspecFile: string) { + return path.basename(podspecFile).replace(/\.podspec$/, ''); +} diff --git a/packages/platform-ios/src/config/index.js b/packages/platform-ios/src/config/index.js index 258d4afb1..a6f7b4855 100644 --- a/packages/platform-ios/src/config/index.js +++ b/packages/platform-ios/src/config/index.js @@ -11,7 +11,7 @@ import path from 'path'; import findProject from './findProject'; import findPodfilePath from './findPodfilePath'; -import findPodspecName from './findPodspecName'; +import findPodspec from './findPodspec'; import type {UserConfigT} from 'types'; /** @@ -47,13 +47,19 @@ export function projectConfig( } const projectPath = path.join(folder, project); + const sourceDir = path.dirname(projectPath); return { - sourceDir: path.dirname(projectPath), + sourceDir, folder, pbxprojPath: path.join(projectPath, 'project.pbxproj'), podfile: findPodfilePath(projectPath), - podspec: userConfig.podspec || findPodspecName(folder), + podspecPath: + userConfig.podspecPath || + // podspecs are usually placed in the root dir of the library or in the + // iOS project path + findPodspec(folder) || + findPodspec(sourceDir), projectPath, projectName: path.basename(projectPath), libraryFolder: userConfig.libraryFolder || 'Libraries', diff --git a/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js b/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js index 0f66648f6..2b606b104 100644 --- a/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js +++ b/packages/platform-ios/src/link-pods/__tests__/isInstalled-test.js @@ -17,19 +17,19 @@ const PODFILES_PATH = path.join(__dirname, '../__fixtures__/'); describe('pods::isInstalled', () => { it('returns false if pod is missing', () => { const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; - const podspecName = {podspec: 'NotExisting'}; + const podspecName = {podspecPath: '/path/NotExisting'}; expect(isInstalled(project, podspecName)).toBe(false); }); it('returns true for existing pod with version number', () => { const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')}; - const podspecName = {podspec: 'TestPod'}; + const podspecName = {podspecPath: '/path/TestPod.podspec'}; expect(isInstalled(project, podspecName)).toBe(true); }); it('returns true for existing pod with path', () => { const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithTarget')}; - const podspecName = {podspec: 'Yoga'}; + const podspecName = {podspecPath: '/path/Yoga.podspec'}; expect(isInstalled(project, podspecName)).toBe(true); }); @@ -37,7 +37,7 @@ describe('pods::isInstalled', () => { const project = { podfile: path.join(PODFILES_PATH, 'PodfileWithFunction'), }; - const podspecName = {podspec: 'React'}; + const podspecName = {podspecPath: '/path/React.podspec'}; expect(isInstalled(project, podspecName)).toBe(true); }); }); diff --git a/packages/platform-ios/src/link-pods/addPodEntry.js b/packages/platform-ios/src/link-pods/addPodEntry.js index d22d088ba..86d327feb 100644 --- a/packages/platform-ios/src/link-pods/addPodEntry.js +++ b/packages/platform-ios/src/link-pods/addPodEntry.js @@ -4,18 +4,22 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import {logger} from '@react-native-community/cli-tools'; +import getPodspecName from '../config/getPodspecName'; export default function addPodEntry( - podLines, - linesToAddEntry, - podName, - nodePath, + podLines: Array, + linesToAddEntry?: + | Array<{line: number, indentation: number}> + | {line: number, indentation: number}, + podspecPath: string, + nodeModulePath: string, ) { - const newEntry = `pod '${podName}', :path => '../node_modules/${nodePath}'\n`; + const podName = getPodspecName(podspecPath); + const newEntry = `pod '${podName}', :path => '../node_modules/${nodeModulePath}'\n`; if (!linesToAddEntry) { return; diff --git a/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js b/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js index 05033817a..13cae2c14 100644 --- a/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js +++ b/packages/platform-ios/src/link-pods/findMarkedLinesInPodfile.js @@ -4,12 +4,12 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ export const MARKER_TEXT = '# Add new pods below this line'; -export default function findMarkedLinesInPodfile(podLines) { +export default function findMarkedLinesInPodfile(podLines: Array) { const result = []; for (let i = 0, len = podLines.length; i < len; i++) { if (podLines[i].includes(MARKER_TEXT)) { diff --git a/packages/platform-ios/src/link-pods/isInstalled.js b/packages/platform-ios/src/link-pods/isInstalled.js index e68059616..d925a5592 100644 --- a/packages/platform-ios/src/link-pods/isInstalled.js +++ b/packages/platform-ios/src/link-pods/isInstalled.js @@ -8,6 +8,7 @@ */ import readPodfile from './readPodfile'; +import getPodspecName from '../config/getPodspecName'; export default function isInstalled(iOSProject, dependencyConfig) { if (!iOSProject.podfile) { @@ -15,7 +16,7 @@ export default function isInstalled(iOSProject, dependencyConfig) { } // match line with pod declaration: pod 'dependencyPodName' (other possible parameters of pod are ignored) const dependencyRegExp = new RegExp( - `pod\\s+('|")${dependencyConfig.podspec}('|")`, + `pod\\s+('|")${getPodspecName(dependencyConfig.podspecPath)}('|")`, 'g', ); const podLines = readPodfile(iOSProject.podfile); diff --git a/packages/platform-ios/src/link-pods/registerNativeModule.js b/packages/platform-ios/src/link-pods/registerNativeModule.js index 7a4bcd130..4cbb21ba6 100644 --- a/packages/platform-ios/src/link-pods/registerNativeModule.js +++ b/packages/platform-ios/src/link-pods/registerNativeModule.js @@ -4,11 +4,11 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import chalk from 'chalk'; import {CLIError} from '@react-native-community/cli-tools'; - +import type {ProjectConfigIOST} from 'types'; import readPodfile from './readPodfile'; import findPodTargetLine from './findPodTargetLine'; import findLineToAddPod from './findLineToAddPod'; @@ -19,13 +19,13 @@ import addPodEntry from './addPodEntry'; import savePodFile from './savePodFile'; export default function registerNativeModulePods( - name, - dependencyConfig, - iOSProject, + name: string, + podspecPath: string, + iOSProject: ProjectConfigIOST, ) { const podLines = readPodfile(iOSProject.podfile); const linesToAddEntry = getLinesToAddEntry(podLines, iOSProject); - addPodEntry(podLines, linesToAddEntry, dependencyConfig.podspec, name); + addPodEntry(podLines, linesToAddEntry, podspecPath, name); savePodFile(iOSProject.podfile, podLines); } diff --git a/packages/platform-ios/src/link-pods/removePodEntry.js b/packages/platform-ios/src/link-pods/removePodEntry.js index 75849636d..7ee8f9eea 100644 --- a/packages/platform-ios/src/link-pods/removePodEntry.js +++ b/packages/platform-ios/src/link-pods/removePodEntry.js @@ -8,8 +8,10 @@ */ import {logger} from '@react-native-community/cli-tools'; +import getPodspecName from '../config/getPodspecName'; -export default function removePodEntry(podfileContent, podName) { +export default function removePodEntry(podfileContent, podspecPath) { + const podName = getPodspecName(podspecPath); // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1'] const podRegex = new RegExp( `\\n( |\\t)*pod\\s+("|')${podName}("|')(,\\s*(:[a-z]+\\s*=>)?\\s*(("|').*?("|')|\\[[\\s\\S]*?\\]))*\\n`, diff --git a/packages/platform-ios/src/link-pods/unregisterNativeModule.js b/packages/platform-ios/src/link-pods/unregisterNativeModule.js index fc485fc93..6ac7ca71d 100644 --- a/packages/platform-ios/src/link-pods/unregisterNativeModule.js +++ b/packages/platform-ios/src/link-pods/unregisterNativeModule.js @@ -16,7 +16,7 @@ import {logger} from '@react-native-community/cli-tools'; */ export default function unregisterNativeModule(dependencyConfig, iOSProject) { const podContent = fs.readFileSync(iOSProject.podfile, 'utf8'); - const removed = removePodEntry(podContent, dependencyConfig.podspec); + const removed = removePodEntry(podContent, dependencyConfig.podspecPath); logger.debug(`Writing changes to ${iOSProject.podfile}`); fs.writeFileSync(iOSProject.podfile, removed); } diff --git a/packages/platform-ios/src/link/common/registerNativeModule.js b/packages/platform-ios/src/link/common/registerNativeModule.js index cefca1dfa..041e60cb8 100644 --- a/packages/platform-ios/src/link/common/registerNativeModule.js +++ b/packages/platform-ios/src/link/common/registerNativeModule.js @@ -4,20 +4,21 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ +import type {DependencyConfigIOST, ProjectConfigIOST} from 'types'; import registerDependencyIOS from '../registerNativeModule'; import registerDependencyPods from '../../link-pods/registerNativeModule'; export default function registerNativeModule( - name, - dependencyConfig, - params, - projectConfig, + name: string, + dependencyConfig: DependencyConfigIOST, + params?: any, + projectConfig: ProjectConfigIOST, ) { - if (projectConfig.podfile && dependencyConfig.podspec) { - registerDependencyPods(name, dependencyConfig, projectConfig); + if (projectConfig.podfile && dependencyConfig.podspecPath) { + registerDependencyPods(name, dependencyConfig.podspecPath, projectConfig); } else { registerDependencyIOS(dependencyConfig, projectConfig); } diff --git a/packages/platform-ios/src/link/registerNativeModule.js b/packages/platform-ios/src/link/registerNativeModule.js index 2583d60fb..698f89139 100644 --- a/packages/platform-ios/src/link/registerNativeModule.js +++ b/packages/platform-ios/src/link/registerNativeModule.js @@ -4,14 +4,14 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import xcode from 'xcode'; import fs from 'fs'; import path from 'path'; import {isEmpty} from 'lodash'; - +import type {DependencyConfigIOST, ProjectConfigIOST} from 'types'; import addToHeaderSearchPaths from './addToHeaderSearchPaths'; import getHeadersInFolder from './getHeadersInFolder'; import getHeaderSearchPath from './getHeaderSearchPath'; @@ -30,8 +30,8 @@ import {logger} from '@react-native-community/cli-tools'; * If library is already linked, this action is a no-op. */ export default function registerNativeModuleIOS( - dependencyConfig, - projectConfig, + dependencyConfig: DependencyConfigIOST, + projectConfig: ProjectConfigIOST, ) { logger.debug(`Reading ${projectConfig.pbxprojPath}`); const project = xcode.project(projectConfig.pbxprojPath).parseSync(); diff --git a/types/index.js b/types/index.js index c2c6d6523..cfd7a2940 100644 --- a/types/index.js +++ b/types/index.js @@ -66,7 +66,7 @@ type ProjectParamsAndroidT = { */ type ProjectParamsIOST = { project?: string, - podspec?: string, + podspecPath?: string, sharedLibraries?: string[], libraryFolder?: string, plist: any[], @@ -222,14 +222,14 @@ export type ProjectConfigIOST = { folder: string, pbxprojPath: string, podfile: null, - podspec: null | string, + podspecPath: null | string, projectPath: string, projectName: string, libraryFolder: string, sharedLibraries: Array, plist: Array, }; -type DependencyConfigIOST = ProjectConfigIOST; +export type DependencyConfigIOST = ProjectConfigIOST; type ProjectConfigAndroidT = { sourceDir: string, isFlat: boolean, From 40242b918cb2cf342d3c31530e80c77a65e6de43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 27 Jun 2019 16:23:19 +0200 Subject: [PATCH 182/234] =?UTF-8?q?docs:=20document=20how=20to=20disable?= =?UTF-8?q?=20autolinking=20for=20unsupported=20packag=E2=80=A6=20(#444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/autolinking.md | 16 ++++++++ packages/cli/src/tools/config/index.js | 39 ++++++++++++------- .../platform-android/native_modules.gradle | 2 +- types/index.js | 15 +++++-- 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index c052d8232..9b07f28b4 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -48,3 +48,19 @@ On the iOS side, you will need to ensure you have a Podspec to the root of your ## How can I customize how autolinking works for my package? A library can add a `react-native.config.js` configuration file, which will customize the defaults. + +## How do I disable autolinking for unsupported package? + +It happens, that during transition period or due to convoluted setup some packages don't support autolinking on certain platforms. To disable autolinking from running for a certain package, update your `react-native.config.js`'s `dependencies` entry to look like this: + +```js +module.exports = { + dependencies: { + 'some-unsupported-package': { + platforms: { + android: null, // disable Android platform, other platforms will still autolink if provided + }, + }, + }, +}; +``` diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index a78f9f99c..b92c73224 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -13,32 +13,41 @@ import { readConfigFromDisk, readDependencyConfigFromDisk, } from './readConfigFromDisk'; -import {type ConfigT} from 'types'; +import type { + ConfigT, + UserDependencyConfigT, + UserConfigT, + DependencyConfigT, +} from 'types'; import assign from '../assign'; import merge from '../merge'; import resolveNodeModuleDir from './resolveNodeModuleDir'; function getDependencyConfig( - root, - dependencyName, - finalConfig, - config, - userConfig, - isPlatform, -) { + root: string, + dependencyName: string, + finalConfig: ConfigT, + config: UserDependencyConfigT, + userConfig: UserConfigT, + isPlatform: boolean, +): DependencyConfigT { return merge( { root, name: dependencyName, platforms: Object.keys(finalConfig.platforms).reduce( (dependency, platform) => { - // Linking platforms is not supported - dependency[platform] = isPlatform - ? null - : finalConfig.platforms[platform].dependencyConfig( - root, - config.dependency.platforms[platform] || {}, - ); + const platformConfig = finalConfig.platforms[platform]; + dependency[platform] = + // Linking platforms is not supported + isPlatform || !platformConfig + ? null + : platformConfig.dependencyConfig( + root, + /* $FlowFixMe - can't figure out which platform's dependency + config to choose */ + config.dependency.platforms[platform], + ); return dependency; }, {}, diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 75700d790..2e829e7f0 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -150,7 +150,7 @@ class ReactNativeModules { packageImports = packageImports + packages.collect { "// ${it.name}\n${it.packageImportPath}" }.join('\n') - packageClassInstances = ",\n " + packages.collect { it.packageInstance }.join(',') + packageClassInstances = ",\n " + packages.collect { it.packageInstance }.join(",\n ") } String generatedFileContents = generatedFileContentsTemplate diff --git a/types/index.js b/types/index.js index cfd7a2940..6d9015f36 100644 --- a/types/index.js +++ b/types/index.js @@ -72,9 +72,14 @@ type ProjectParamsIOST = { plist: any[], }; -type PlatformConfig = { - projectConfig: (string, ProjectParams) => ?ProjectConfig, - dependencyConfig: (string, ProjectParams) => ?DependencyConfig, +type PlatformConfig< + ProjectParams, + DependencyParams, + ProjectConfig, + DependencyConfig, +> = { + projectConfig: (string, ?ProjectParams) => ?ProjectConfig, + dependencyConfig: (string, ?DependencyParams) => ?DependencyConfig, linkConfig: () => { isInstalled: (ProjectConfig, string, DependencyConfig) => boolean, register: (string, DependencyConfig, Object, ProjectConfig) => void, @@ -131,14 +136,16 @@ export type ConfigT = {| // Map of available platforms (built-ins and dynamically loaded) platforms: { - [name: string]: PlatformConfig, + [name: string]: PlatformConfig, ios?: PlatformConfig< ProjectParamsIOST, + ProjectParamsIOST, // DependencyParams are the same as ProjectParams on iOS ProjectConfigIOST, DependencyConfigIOST, >, android?: PlatformConfig< ProjectParamsAndroidT, + DependencyParamsAndroidT, ProjectConfigAndroidT, DependencyConfigAndroidT, >, From de936f6caa933ab46991b231cd294f727be53589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 27 Jun 2019 23:42:25 +0200 Subject: [PATCH 183/234] v2.0.0-rc.3 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index c3cad9a09..cf9d7e653 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.2", + "version": "2.0.0-rc.3", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 3d631f7fa..616c4ddd7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.2", + "version": "2.0.0-rc.3", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.2", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.2", - "@react-native-community/cli-tools": "^2.0.0-rc.2", + "@react-native-community/cli-platform-android": "^2.0.0-rc.3", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.3", + "@react-native-community/cli-tools": "^2.0.0-rc.3", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 22ce663c9..af24e28d7 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.2", + "version": "2.0.0-rc.3", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.2", + "@react-native-community/cli-tools": "^2.0.0-rc.3", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index ddfa3c523..c3d32b9e6 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.2", + "version": "2.0.0-rc.3", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.2", + "@react-native-community/cli-tools": "^2.0.0-rc.3", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 4c53a9859..f0b48223b 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.2", + "version": "2.0.0-rc.3", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 023360b5750845d44a21cceceaa91ac67275cbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 30 Jun 2019 10:39:05 +0200 Subject: [PATCH 184/234] fix: don't use yarn for spawning 'config' command (#449) --- packages/platform-android/native_modules.gradle | 12 ++---------- packages/platform-ios/native_modules.rb | 8 -------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 2e829e7f0..0b09f47d9 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -55,8 +55,6 @@ class ReactNativeModules { private ArrayList> reactNativeModules private static String LOG_PREFIX = ":ReactNative:" - private static String REACT_NATIVE_CONFIG_CMD = "yarn run --silent react-native config" - private static String REACT_NATIVE_CONFIG_CMD_FALLBACK = "node ./node_modules/.bin/react-native config" ReactNativeModules(Logger logger) { this.logger = logger @@ -175,20 +173,14 @@ class ReactNativeModules { def cmdProcess def root = getReactNativeProjectRoot() - def command = REACT_NATIVE_CONFIG_CMD_FALLBACK + def command = "node ./node_modules/.bin/react-native config" try { - try { - // Check if project uses Yarn - def isYarnProject = Runtime.getRuntime().exec("node -e console.log(require.resolve('./yarn.lock'))", null, root) - isYarnProject.waitFor() - command = REACT_NATIVE_CONFIG_CMD - } catch(Exception exception) {} cmdProcess = Runtime.getRuntime().exec(command, null, root) cmdProcess.waitFor() } catch (Exception exception) { this.logger.warn("${LOG_PREFIX}${exception.message}") - this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed. (UNKNOWN)") + this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.") return reactNativeModules } diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index 2eb120953..e2b6965fc 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -7,14 +7,6 @@ def use_native_modules!(root = "..", packages = nil) if (!packages) command = "node" args = ["./node_modules/.bin/react-native", "config"] - begin - # Check if project uses Yarn - Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('#{root}/yarn.lock'))"], true) - command = "yarn" - args = ["run", "--silent", "react-native", "config"] - rescue - end - output = "" # Make sure `react-native config` is ran from your project root Dir.chdir(root) do From f6b546e83a3b51711f48fe320e1ea5d454019c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 30 Jun 2019 10:45:15 +0200 Subject: [PATCH 185/234] =?UTF-8?q?feat:=20add=20warnings=20for=20`run-ios?= =?UTF-8?q?`=20and=20`run-android`=20when=20manually=E2=80=A6=20(#447)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * wip * add warnings for run-ios and run-android * memoize in place * cleanup --- .../src/commands/runAndroid/index.js | 3 ++ .../src/link/warnAboutManuallyLinkedLibs.js | 51 +++++++++++++++++++ .../platform-ios/src/commands/runIOS/index.js | 4 +- packages/platform-ios/src/config/index.js | 5 +- .../platform-ios/src/link-pods/isInstalled.js | 10 ++-- .../src/link/common/isInstalled.js | 9 +++- packages/platform-ios/src/link/index.js | 2 +- packages/platform-ios/src/link/isInstalled.js | 20 ++++++-- .../src/link/warnAboutManuallyLinkedLibs.js | 51 +++++++++++++++++++ 9 files changed, 144 insertions(+), 11 deletions(-) create mode 100644 packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js create mode 100644 packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index 096da3991..a687ff69b 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -24,6 +24,7 @@ import { getDefaultUserTerminal, CLIError, } from '@react-native-community/cli-tools'; +import warnAboutManuallyLinkedLibs from '../../link/warnAboutManuallyLinkedLibs'; // Verifies this is an Android project function checkAndroid(root) { @@ -55,6 +56,8 @@ function runAndroid(argv: Array, config: ConfigT, args: FlagsT) { return; } + warnAboutManuallyLinkedLibs(config); + if (!args.packager) { return buildAndRun(args); } diff --git a/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js b/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js new file mode 100644 index 000000000..78ceb9a29 --- /dev/null +++ b/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js @@ -0,0 +1,51 @@ +// @flow + +import chalk from 'chalk'; +import {logger} from '@react-native-community/cli-tools'; +import type {ConfigT} from 'types'; +import getLinkConfig from './index'; + +// TODO: move to cli-tools once platform-ios and platform-android are migrated +// to TS and unify with iOS implementation +export default function warnAboutManuallyLinkedLibs( + config: ConfigT, + platform: string = 'android', + linkConfig: $Call = getLinkConfig(), +) { + let deps = []; + + for (let key in config.dependencies) { + const dependency = config.dependencies[key]; + try { + const projectConfig = config.project[platform]; + const dependencyConfig = dependency.platforms[platform]; + if (projectConfig && dependencyConfig) { + const x = linkConfig.isInstalled( + projectConfig, + dependency.name, + dependencyConfig, + ); + deps = deps.concat(x ? dependency.name : []); + } + } catch (error) { + logger.debug('Checking manually linked modules failed.', error); + } + } + + const installedModules = [...new Set(deps)]; + + if (installedModules.length) { + logger.error( + `React Native CLI uses autolinking for native dependencies, but following modules are linked manually: \n${installedModules + .map( + x => + ` - ${chalk.bold(x)} ${chalk.dim( + `(to unlink run: "react-native unlink ${x}")`, + )}`, + ) + .join( + '\n', + )}\nThis is likely to happen when upgrading React Native from version lower than 0.60 to 0.60 or later. Please unlink them as they are likely to cause build failures. You can do so with "react-native unlink" command as shown above. If a library is not compatible with autolinking yet, please ignore this warning and notify the library maintainers.`, + ); + } +} diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 239334d07..1726d2ea4 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. * * @flow - * @format */ import child_process from 'child_process'; @@ -16,6 +15,7 @@ import type {ConfigT} from 'types'; import findXcodeProject from './findXcodeProject'; import parseIOSDevicesList from './parseIOSDevicesList'; import findMatchingSimulator from './findMatchingSimulator'; +import warnAboutManuallyLinkedLibs from '../../link/warnAboutManuallyLinkedLibs'; import { logger, CLIError, @@ -42,6 +42,8 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { ); } + warnAboutManuallyLinkedLibs(ctx); + process.chdir(args.projectPath); const xcodeProject = findXcodeProject(fs.readdirSync('.')); diff --git a/packages/platform-ios/src/config/index.js b/packages/platform-ios/src/config/index.js index a6f7b4855..5bf40f7b8 100644 --- a/packages/platform-ios/src/config/index.js +++ b/packages/platform-ios/src/config/index.js @@ -9,11 +9,14 @@ */ import path from 'path'; +import {memoize} from 'lodash'; import findProject from './findProject'; import findPodfilePath from './findPodfilePath'; import findPodspec from './findPodspec'; import type {UserConfigT} from 'types'; +const memoizedFindProject = memoize(findProject); + /** * For libraries specified without an extension, add '.tbd' for those that * start with 'lib' and '.framework' to the rest. @@ -37,7 +40,7 @@ export function projectConfig( if (!userConfig) { return; } - const project = userConfig.project || findProject(folder); + const project = userConfig.project || memoizedFindProject(folder); /** * No iOS config found here diff --git a/packages/platform-ios/src/link-pods/isInstalled.js b/packages/platform-ios/src/link-pods/isInstalled.js index d925a5592..caf97eb71 100644 --- a/packages/platform-ios/src/link-pods/isInstalled.js +++ b/packages/platform-ios/src/link-pods/isInstalled.js @@ -4,14 +4,18 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import readPodfile from './readPodfile'; import getPodspecName from '../config/getPodspecName'; +import type {ProjectConfigIOST, DependencyConfigIOST} from 'types'; -export default function isInstalled(iOSProject, dependencyConfig) { - if (!iOSProject.podfile) { +export default function isInstalled( + iOSProject: ProjectConfigIOST, + dependencyConfig: DependencyConfigIOST, +) { + if (!iOSProject.podfile || !dependencyConfig.podspecPath) { return false; } // match line with pod declaration: pod 'dependencyPodName' (other possible parameters of pod are ignored) diff --git a/packages/platform-ios/src/link/common/isInstalled.js b/packages/platform-ios/src/link/common/isInstalled.js index acbe38838..fcb5fab00 100644 --- a/packages/platform-ios/src/link/common/isInstalled.js +++ b/packages/platform-ios/src/link/common/isInstalled.js @@ -4,13 +4,18 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import isInstalledIOS from '../isInstalled'; import isInstalledPods from '../../link-pods/isInstalled'; +import type {ProjectConfigIOST, DependencyConfigIOST} from 'types'; -export default function isInstalled(projectConfig, name, dependencyConfig) { +export default function isInstalled( + projectConfig: ProjectConfigIOST, + name?: string, + dependencyConfig: DependencyConfigIOST, +) { return ( isInstalledIOS(projectConfig, dependencyConfig) || isInstalledPods(projectConfig, dependencyConfig) diff --git a/packages/platform-ios/src/link/index.js b/packages/platform-ios/src/link/index.js index cb7d49142..687e922f4 100644 --- a/packages/platform-ios/src/link/index.js +++ b/packages/platform-ios/src/link/index.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import isInstalled from './common/isInstalled'; diff --git a/packages/platform-ios/src/link/isInstalled.js b/packages/platform-ios/src/link/isInstalled.js index cf88883bc..13c74cdc1 100644 --- a/packages/platform-ios/src/link/isInstalled.js +++ b/packages/platform-ios/src/link/isInstalled.js @@ -4,19 +4,33 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @flow */ import xcode from 'xcode'; import getGroup from './getGroup'; import hasLibraryImported from './hasLibraryImported'; +import type {ProjectConfigIOST, DependencyConfigIOST} from 'types'; + +const memo = new Map(); /** * Returns true if `xcodeproj` specified by dependencyConfig is present * in a top level `libraryFolder` */ -export default function isInstalled(projectConfig, dependencyConfig) { - const project = xcode.project(projectConfig.pbxprojPath).parseSync(); +export default function isInstalled( + projectConfig: ProjectConfigIOST, + dependencyConfig: DependencyConfigIOST, +) { + let project; + + if (memo.has(projectConfig.pbxprojPath)) { + project = memo.get(projectConfig.pbxprojPath); + } else { + project = xcode.project(projectConfig.pbxprojPath).parseSync(); + memo.set(projectConfig.pbxprojPath, project); + } + const libraries = getGroup(project, projectConfig.libraryFolder); if (!libraries) { diff --git a/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js b/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js new file mode 100644 index 000000000..fc5a67d6b --- /dev/null +++ b/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js @@ -0,0 +1,51 @@ +// @flow + +import chalk from 'chalk'; +import {logger} from '@react-native-community/cli-tools'; +import type {ConfigT} from 'types'; +import getLinkConfig from './index'; + +// TODO: move to cli-tools once platform-ios and platform-android are migrated +// to TS and unify with Android implementation +export default function warnAboutManuallyLinkedLibs( + config: ConfigT, + platform?: string = 'ios', + linkConfig: $Call = getLinkConfig(), +) { + let deps = []; + + for (let key in config.dependencies) { + const dependency = config.dependencies[key]; + try { + const projectConfig = config.project[platform]; + const dependencyConfig = dependency.platforms[platform]; + if (projectConfig && dependencyConfig) { + const x = linkConfig.isInstalled( + projectConfig, + dependency.name, + dependencyConfig, + ); + deps = deps.concat(x ? dependency.name : []); + } + } catch (error) { + logger.debug('Checking manually linked modules failed.', error); + } + } + + const installedModules = [...new Set(deps)]; + + if (installedModules.length) { + logger.error( + `React Native CLI uses autolinking for native dependencies, but following modules are linked manually: \n${installedModules + .map( + x => + ` - ${chalk.bold(x)} ${chalk.dim( + `(to unlink run: "react-native unlink ${x}")`, + )}`, + ) + .join( + '\n', + )}\nThis is likely to happen when upgrading React Native from version lower than 0.60 to 0.60 or later. Please unlink them as they are likely to cause build failures. You can do so with "react-native unlink" command as shown above. If a library is not compatible with autolinking yet, please ignore this warning and notify the library maintainers.`, + ); + } +} From 5199d6af1aa6dc5d8dfb4a98e675987272d68998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Jul 2019 20:50:20 +0200 Subject: [PATCH 186/234] chore: group deprecated rnpm warnings, add migration guide (#450) * chore: group deprecated rnpm warnings, add migration guide * Update packages/cli/src/tools/config/index.js Co-Authored-By: Satyajit Sahoo * remove parens from links --- README.md | 3 +- docs/configuration.md | 104 ++++++++++++++++++ packages/cli/src/tools/config/index.js | 27 ++++- .../src/tools/config/readConfigFromDisk.js | 15 +-- 4 files changed, 137 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ac5c93222..c4f4d548b 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,11 @@ This CLI is intended to be used with a certain version of React Native. You'll f ## Documentation +- [configuration](./docs/configuration.md) - [commands](./docs/commands.md) +- [plugins](./docs/plugins.md) - [init](./docs/init.md) - [autolinking](./docs/autolinking.md) -- [plugins](./docs/plugins.md) ## About diff --git a/docs/configuration.md b/docs/configuration.md index bca5ad350..24aeb533e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -14,3 +14,107 @@ Check the documentation for - [plugins](./plugins.md) to learn more about different types of configuration and features available. + +## Migration guide + +`"rnpm"` is deprecated and support for it will be removed in next major version of the CLI. + +> **Important**: Proceed further only if your project uses `"rnpm"` in `package.json`. + +There are different kinds of React Native projects, including apps, libraries and platforms. For each we prepared a brief "before & after" of the configuration shape with legacy `"rnpm"` and current `react-native.config.js`. Please mind that all configuration entries are optional. + +### Apps + +`package.json` entry: + +```json +{ + "rnpm": { + "ios": {}, + "android": {}, + "assets": ["./path-to-assets"], + "plugin": "./path-to-commands.js" + } +} +``` + +becomes `react-native.config.js` + +```js +module.exports = { + project: { + ios: {}, + android: {}, // grouped into "project" + }, + assets: ['./path-to-assets'], // stays the same + commands: require('./path-to-commands.js'), // formerly "plugin", returns an array of commands +}; +``` + +### Libraries + +`package.json` entry: + +```json +{ + "rnpm": { + "ios": {}, + "android": {}, + "assets": ["./path-to-assets"], + "hooks": { + "prelink": "./path-to-a-prelink-hook" + } + } +} +``` + +becomes `react-native.config.js`: + +```js +module.exports = { + // config for a library is scoped under "dependency" key + dependency: { + platforms: { + ios: {}, + android: {}, // projects are grouped into "platforms" + }, + assets: ['./path-to-assets'], // stays the same + // hooks are considered anti-pattern, please avoid them + hooks: { + prelink: './path-to-a-prelink-hook', + }, + }, +}; +``` + +You'll find more details in [dependencies](./dependencies.md) docs. + +### Out-of-tree platforms + +`package.json` entry: + +```json +{ + "rnpm": { + "haste": { + "platforms": ["windows"], + "providesModuleNodeModules": ["react-native-windows"] + }, + "platform": "./local-cli/platform.js" + } +} +``` + +becomes `react-native.config.js` + +```js +module.exports = { + platforms: { + // grouped under "platforms" entry + windows: require('./local-cli/platform.js').windows, + }, + // "haste" is no longer needed +}; +``` + +You'll find more details in [platforms](./platforms.md) docs. diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index b92c73224..c6e5a088f 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -95,13 +95,23 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { }, }; + let depsWithWarnings = []; + const finalConfig = findDependencies(projectRoot).reduce( (acc: ConfigT, dependencyName) => { let root; let config; try { root = resolveNodeModuleDir(projectRoot, dependencyName); - config = readDependencyConfigFromDisk(root); + const output = readDependencyConfigFromDisk(root); + config = output.config; + + if (output.legacy) { + const pkg = require(path.join(root, 'package.json')); + const link = + pkg.homepage || `https://npmjs.com/package/${dependencyName}`; + depsWithWarnings.push([dependencyName, link]); + } } catch (error) { logger.warn( inlineString(` @@ -172,6 +182,21 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { initialConfig, ); + if (depsWithWarnings.length) { + logger.warn( + `The following packages use deprecated "rnpm" config that will stop working from next release:\n${depsWithWarnings + .map( + ([name, link]) => + ` - ${chalk.bold(name)}: ${chalk.dim(chalk.underline(link))}`, + ) + .join( + '\n', + )}\nPlease notify their maintainers about it. You can find more details at ${chalk.dim.underline( + 'https://react-native-community/cli/docs/configuration.md#migration-guide', + )}.`, + ); + } + return finalConfig; } diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 7225f44d4..76a9c7e38 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -93,14 +93,15 @@ export function readConfigFromDisk(rootFolder: string): UserConfigT { */ export function readDependencyConfigFromDisk( rootFolder: string, -): UserDependencyConfigT { +): {config: UserDependencyConfigT, legacy?: boolean} { const explorer = cosmiconfig('react-native', { stopDir: rootFolder, searchPlaces, }); - const {config} = explorer.searchSync(rootFolder) || { + const {config, legacy} = explorer.searchSync(rootFolder) || { config: readLegacyDependencyConfigFromDisk(rootFolder), + legacy: true, }; const result = Joi.validate(config, schema.dependencyConfig); @@ -109,7 +110,7 @@ export function readDependencyConfigFromDisk( throw new JoiError(result.error); } - return result.value; + return {config: result.value, legacy: legacy && config !== undefined}; } /** @@ -139,7 +140,7 @@ const loadProjectCommands = ( function readLegacyDependencyConfigFromDisk( rootFolder: string, ): ?UserDependencyConfigT { - const {rnpm: config, name} = require(path.join(rootFolder, 'package.json')); + const {rnpm: config} = require(path.join(rootFolder, 'package.json')); if (!config) { return undefined; @@ -162,11 +163,5 @@ function readLegacyDependencyConfigFromDisk( : {}, }; - logger.warn( - `Package "${chalk.bold( - path.basename(name), - )}" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.`, - ); - return transformedConfig; } From 616eaf26de78705056aa29c87f33d0eeb15de68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Jul 2019 21:00:26 +0200 Subject: [PATCH 187/234] chore: fix grammar in warning (#453) * chore: fix grammar in warning * adjust wording --- .../src/link/warnAboutManuallyLinkedLibs.js | 6 ++++-- .../platform-ios/src/link/warnAboutManuallyLinkedLibs.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js b/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js index 78ceb9a29..1e28485be 100644 --- a/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js +++ b/packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js @@ -36,7 +36,7 @@ export default function warnAboutManuallyLinkedLibs( if (installedModules.length) { logger.error( - `React Native CLI uses autolinking for native dependencies, but following modules are linked manually: \n${installedModules + `React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: \n${installedModules .map( x => ` - ${chalk.bold(x)} ${chalk.dim( @@ -45,7 +45,9 @@ export default function warnAboutManuallyLinkedLibs( ) .join( '\n', - )}\nThis is likely to happen when upgrading React Native from version lower than 0.60 to 0.60 or later. Please unlink them as they are likely to cause build failures. You can do so with "react-native unlink" command as shown above. If a library is not compatible with autolinking yet, please ignore this warning and notify the library maintainers.`, + )}\nThis is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink " and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.\nRead more about autolinking: ${chalk.dim.underline( + 'https://github.com/react-native-community/cli/blob/master/docs/autolinking.md', + )}`, ); } } diff --git a/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js b/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js index fc5a67d6b..78023df9c 100644 --- a/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js +++ b/packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js @@ -36,7 +36,7 @@ export default function warnAboutManuallyLinkedLibs( if (installedModules.length) { logger.error( - `React Native CLI uses autolinking for native dependencies, but following modules are linked manually: \n${installedModules + `React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: \n${installedModules .map( x => ` - ${chalk.bold(x)} ${chalk.dim( @@ -45,7 +45,9 @@ export default function warnAboutManuallyLinkedLibs( ) .join( '\n', - )}\nThis is likely to happen when upgrading React Native from version lower than 0.60 to 0.60 or later. Please unlink them as they are likely to cause build failures. You can do so with "react-native unlink" command as shown above. If a library is not compatible with autolinking yet, please ignore this warning and notify the library maintainers.`, + )}\nThis is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink " and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.\nRead more about autolinking: ${chalk.dim.underline( + 'https://github.com/react-native-community/cli/blob/master/docs/autolinking.md', + )}`, ); } } From 00b930877c2a133196dee8231552a53669aff61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 13:54:38 +0200 Subject: [PATCH 188/234] fix: incorrect condition for upgrade newer version check (#455) --- packages/cli/src/commands/upgrade/__tests__/upgrade.test.js | 4 ++++ packages/cli/src/commands/upgrade/upgrade.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 81a271ec6..01766beea 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -147,6 +147,10 @@ test('errors when older version passed', async () => { expect(logger.error).toBeCalledWith( `Trying to upgrade from newer version "${currentVersion}" to older "${olderVersion}"`, ); + await upgrade.func(['0.57.10'], ctx, opts); + expect(logger.error).not.toBeCalledWith( + `Trying to upgrade from newer version "${currentVersion}" to older "0.57.10"`, + ); }, 60000); test('warns when dependency upgrade version is in semver range', async () => { diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index ba6875bd5..43e5749d3 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -110,13 +110,13 @@ const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => { return null; } - if (currentVersion > newVersion) { + if (semver.gt(currentVersion, newVersion)) { logger.error( `Trying to upgrade from newer version "${currentVersion}" to older "${newVersion}"`, ); return null; } - if (currentVersion === newVersion) { + if (semver.eq(currentVersion, newVersion)) { const { dependencies: {'react-native': version}, } = require(path.join(projectDir, 'package.json')); From 32e6339763d19d6e0f1d56c38b0612c0de9a3005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 16:41:25 +0200 Subject: [PATCH 189/234] chore(docs): simplify autolinking (#454) * chore(docs): simplify autolinking * address feedback --- docs/autolinking.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index 9b07f28b4..b62c6957e 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -1,20 +1,25 @@ # Autolinking -Autolinking is a mechanism built into CLI that allows adding a dependency with native components for React Native to be as simple as: +React Native libraries often come with platform-specific (native) code. Autolinking is a mechanism that allows your project to discover and use this code. + +Add a library using your favorite package manager and run the build: ```sh +# install yarn add react-native-webview +cd ios && pod install && cd .. # CocoaPods on iOS needs this extra step +# run +yarn react-native run-ios +yarn react-native run-android ``` -> Autolinking is a replacement for [`react-native link`](./linking.md) that brings new features (such as ability to easily integrate native dependencies on iOS) and fixes some of the long-standing issues. - -## How does it work +That's it. No more editing build config files to use native code. -React Native CLI provides a [`config`](./commands.md#config) command which grabs all of the configuration for React Native packages installed in the project (by scanning dependencies in `package.json`) and outputs it in JSON format. +> Autolinking is a replacement for [`react-native link`](./linking.md). If you have been using React Native before version 0.60, please `unlink` native dependencies if you have any from a previous install. -This information is then used by the projects advertised as platforms (with `react-native` being a default project supporting both iOS and Android platforms) that implement their autolinking behavior. +## How does it work -This design ensures consistent settings for any platform and allows `react-native config` to update the implementation of how to source this information (be it specified filenames, entries in the module’s package.json, etc). +Each platform defines its own [`platforms`](./platforms.md) configuration. It instructs the CLI on how to find information about native dependencies. This information is exposed through the [`config`](./commands.md#config) command in a JSON format. It's then used by the scripts run by the platform's build tools. Each script applies the logic to link native dependencies specific to its platform. ## Platform iOS @@ -25,19 +30,20 @@ The `Podfile` gets the package metadata from `react-native config` and: This means that all libraries need to ship a Podspec in the root of their folder to work seamlessly. This references the native code that your library depends on, and notes any of its other native dependencies. -The implementation ensures that a library is imported only once, so if you need to have a custom `pod` directive then including it above the function `use_native_modules!`. +The implementation ensures that a library is imported only once. If you need to have a custom `pod` directive then include it above the `use_native_modules!` function. -See implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). +See the implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). -_Notes_: Auto-linking assumes your Podfile is in a sub-folder from your `package.json` - if this is not the case, use the first parameter to tell the linker where to find the `package.json` e.g. `use_native_modules!("../../")`. +> Autolinking assumes your Podfile is in a sub-folder from your `package.json`. If this is not the case, use the first parameter to tell the linker where to find the `package.json` e.g. `use_native_modules!("../../")`. ## Platform Android -1. At build time, before the build script is run, a first gradle plugin (`settings.gradle`) is ran that takes the package metadata from `react-native config` to dynamically include Android library projects into the build. -1. A second plugin then adds those dependencies to the app project and generates a manifest of React Native packages to include in the fully generated file `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java`. -1. Finally, at runtime (on startup) the list of React Native packages, generated in step 2, is used to instruct the React Native runtime of what native modules are available. +1. At build time, before the build script is run: + 1. A first Gradle plugin (in `settings.gradle`) runs. It uses the package metadata from `react-native config` to add Android projects. + 1. A second Gradle plugin (in `build.gradle`) runs. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file. +1. At runtime, the list of React Native packages, generated in step 1.2, is passed to React Native host. -See implementation of [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle). +See the implementation of [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle). ## What do I need to have in my package to make it work? @@ -51,7 +57,7 @@ A library can add a `react-native.config.js` configuration file, which will cust ## How do I disable autolinking for unsupported package? -It happens, that during transition period or due to convoluted setup some packages don't support autolinking on certain platforms. To disable autolinking from running for a certain package, update your `react-native.config.js`'s `dependencies` entry to look like this: +During the transition period some packages may not support autolinking on certain platforms. To disable autolinking for a package, update your `react-native.config.js`'s `dependencies` entry to look like this: ```js module.exports = { From e50aa8da4b3a2b8fafafa6c1e124115fce222e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 22:16:21 +0200 Subject: [PATCH 190/234] feat: simplify passing root to gradle autolinking (#457) * feat: simplify passing root to gradle autolinking * improve docs --- docs/autolinking.md | 45 +++++++++++++++++-- .../platform-android/native_modules.gradle | 30 +++++-------- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index b62c6957e..f01ab2474 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -34,17 +34,56 @@ The implementation ensures that a library is imported only once. If you need to See the implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). -> Autolinking assumes your Podfile is in a sub-folder from your `package.json`. If this is not the case, use the first parameter to tell the linker where to find the `package.json` e.g. `use_native_modules!("../../")`. +### Custom root (monorepos) + +The project root is where `node_modules` with `react-native` is. Autolinking script assume your project root to be `".."`, relative to `ios` directory. If you're in a project with custom structure, like this: + +``` +root/ + node_modules + example/ + ios/ +``` + +you'll need to set a custom root. Pass it as an argument to `use_native_modules!`: + +```rb +# example/ios/Podfile +use_native_modules!("../..") +``` ## Platform Android 1. At build time, before the build script is run: - 1. A first Gradle plugin (in `settings.gradle`) runs. It uses the package metadata from `react-native config` to add Android projects. - 1. A second Gradle plugin (in `build.gradle`) runs. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file. + 1. A first Gradle plugin (in `settings.gradle`) runs `applyNativeModulesSettingsGradle` method. It uses the package metadata from `react-native config` to add Android projects. + 1. A second Gradle plugin (in `app/build.gradle`) runs `applyNativeModulesAppBuildGradle` method. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file. 1. At runtime, the list of React Native packages, generated in step 1.2, is passed to React Native host. See the implementation of [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle). +### Custom root (monorepos) + +The project root is where `node_modules` with `react-native` is. Autolinking scripts assume your project root to be `".."`, relative to `android` directory. If you're in a project with custom structure, like this: + +``` +root/ + node_modules + example/ + android/ +``` + +you'll need to set a custom root. Pass it as a second argument to `applyNativeModulesSettingsGradle` and `applyNativeModulesAppBuildGradle` methods: + +```groovy +// example/android/settings.gradle +applyNativeModulesSettingsGradle(settings, "../..") +``` + +```groovy +// example/android/app/build.gradle +applyNativeModulesAppBuildGradle(project, "../..") +``` + ## What do I need to have in my package to make it work? You’re already using Gradle, so Android support will work by default. diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 0b09f47d9..c70a57b14 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -51,7 +51,7 @@ class ReactNativeModules { private Project project private String packageName private DefaultSettings defaultSettings - private ExtraPropertiesExtension extension + private String root private ArrayList> reactNativeModules private static String LOG_PREFIX = ":ReactNative:" @@ -60,17 +60,17 @@ class ReactNativeModules { this.logger = logger } - void applySettingsGradle(DefaultSettings defaultSettings, ExtraPropertiesExtension extraPropertiesExtension) { + void applySettingsGradle(DefaultSettings defaultSettings, String root) { this.defaultSettings = defaultSettings - this.extension = extraPropertiesExtension + this.root = root this.reactNativeModules = this.getReactNativeConfig() addReactNativeModuleProjects() } - void applyBuildGradle(Project project, ExtraPropertiesExtension extraPropertiesExtension) { + void applyBuildGradle(Project project, String root) { this.project = project - this.extension = extraPropertiesExtension + this.root = root this.reactNativeModules = this.getReactNativeConfig() addReactNativeModuleDependencies() @@ -110,13 +110,6 @@ class ReactNativeModules { * @return */ File getReactNativeProjectRoot() { - if (this.extension.has("reactNativeProjectRoot")) { - File rnRoot = File(this.extension.get("reactNativeProjectRoot")) - // allow custom React Native project roots for non-standard directory structures - this.logger.debug("${LOG_PREFIX}Using custom React Native project root path '${rnRoot.toString()}'") - return rnRoot - } - File androidRoot if (this.project) { @@ -125,8 +118,9 @@ class ReactNativeModules { androidRoot = this.defaultSettings.rootProject.projectDir } - this.logger.debug("${LOG_PREFIX}Using default React Native project root path '${androidRoot.parentFile.toString()}'") - return androidRoot.parentFile + File rnRoot = new File(androidRoot, this.root) + this.logger.debug("${LOG_PREFIX}Using React Native project root path '${rnRoot.toString()}'") + return rnRoot } /** @@ -220,12 +214,12 @@ class ReactNativeModules { def autoModules = new ReactNativeModules(logger) -ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings -> - autoModules.applySettingsGradle(defaultSettings, ext) +ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings, String root = ".." -> + autoModules.applySettingsGradle(defaultSettings, root) } -ext.applyNativeModulesAppBuildGradle = { Project project -> - autoModules.applyBuildGradle(project, ext) +ext.applyNativeModulesAppBuildGradle = { Project project, String root = ".." -> + autoModules.applyBuildGradle(project, root) def generatedSrcDir = new File(buildDir, "generated/rncli/src/main/java/com/facebook/react") From 024a43231690f39944a584b97cd57885ef722fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 22:17:16 +0200 Subject: [PATCH 191/234] v2.0.0-rc.4 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index cf9d7e653..649c86df2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 616c4ddd7..130061a7a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.3", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.3", - "@react-native-community/cli-tools": "^2.0.0-rc.3", + "@react-native-community/cli-platform-android": "^2.0.0-rc.4", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.4", + "@react-native-community/cli-tools": "^2.0.0-rc.4", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index af24e28d7..ac84f68e1 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.3", + "@react-native-community/cli-tools": "^2.0.0-rc.4", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index c3d32b9e6..662cafbd8 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.3", + "@react-native-community/cli-tools": "^2.0.0-rc.4", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index f0b48223b..06a83ce99 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From ae7b78d3b96e1f76bf3826f45450984fa8078e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 22:36:25 +0200 Subject: [PATCH 192/234] feat: support local RN libraries in autolinking (#451) * feat: support local RN libraries in autolinking * simplify local deps config * address feedback --- docs/autolinking.md | 18 +- docs/projects.md | 14 +- .../src/tools/config/__tests__/index-test.js | 52 +++++- packages/cli/src/tools/config/index.js | 158 +++++++++--------- .../src/tools/config/readConfigFromDisk.js | 19 ++- packages/cli/src/tools/config/schema.js | 1 + types/index.js | 4 +- 7 files changed, 182 insertions(+), 84 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index f01ab2474..09f272959 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -94,11 +94,12 @@ On the iOS side, you will need to ensure you have a Podspec to the root of your A library can add a `react-native.config.js` configuration file, which will customize the defaults. -## How do I disable autolinking for unsupported package? +## How can I disable autolinking for unsupported library? During the transition period some packages may not support autolinking on certain platforms. To disable autolinking for a package, update your `react-native.config.js`'s `dependencies` entry to look like this: ```js +// react-native.config.js module.exports = { dependencies: { 'some-unsupported-package': { @@ -109,3 +110,18 @@ module.exports = { }, }; ``` + +## How can I autolink a local library? + +We can leverage CLI configuration to make it "see" React Native libraries that are not part of our 3rd party dependencies. To do so, update your `react-native.config.js`'s `dependencies` entry to look like this: + +```js +// react-native.config.js +module.exports = { + dependencies: { + 'local-rn-library': { + root: '/root/libraries', + }, + }, +}; +``` diff --git a/docs/projects.md b/docs/projects.md index caee753ba..abc704497 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -109,7 +109,7 @@ For example, you could set: ```js module.exports = { dependencies: { - ['react-native-webview']: { + 'react-native-webview': { platforms: { ios: null, }, @@ -120,6 +120,18 @@ module.exports = { in order to disable linking of React Native WebView on iOS. +Another use-case would be supporting local libraries that are not discoverable for autolinking, since they're not part of your `dependencies` or `devDependencies`: + +```js +module.exports = { + dependencies: { + 'local-rn-library': { + root: '/root/libraries', + }, + }, +}; +``` + The object provided here is deep merged with the dependency config. Check [`projectConfig`](platforms.md#projectconfig) and [`dependencyConfig`](platforms.md#dependencyConfig) return values for a full list of properties that you can override. > Note: This is an advanced feature and you should not need to use it mos of the time. diff --git a/packages/cli/src/tools/config/__tests__/index-test.js b/packages/cli/src/tools/config/__tests__/index-test.js index bb19f1787..c65f138e2 100644 --- a/packages/cli/src/tools/config/__tests__/index-test.js +++ b/packages/cli/src/tools/config/__tests__/index-test.js @@ -285,8 +285,6 @@ test.skip('should skip packages that have invalid configuration', () => { }); test('does not use restricted "react-native" key to resolve config from package.json', () => { - jest.resetModules(); - writeFiles(DIR, { 'node_modules/react-native-netinfo/package.json': `{ "react-native": "src/index.js" @@ -302,3 +300,53 @@ test('does not use restricted "react-native" key to resolve config from package. expect(dependencies).toHaveProperty('react-native-netinfo'); expect(spy).not.toHaveBeenCalled(); }); + +test('supports dependencies from user configuration with custom root and properties', () => { + writeFiles(DIR, { + 'node_modules/react-native/package.json': '{}', + 'native-libs/local-lib/ios/LocalRNLibrary.xcodeproj/project.pbxproj': '', + 'react-native.config.js': `module.exports = { + dependencies: { + 'local-lib': { + root: "${DIR}/native-libs/local-lib", + platforms: { + ios: { + podspecPath: "custom-path" + } + } + }, + } + }`, + 'package.json': `{ + "dependencies": { + "react-native": "0.0.1" + } + }`, + }); + + const {dependencies} = loadConfig(DIR); + expect(removeString(dependencies['local-lib'], DIR)).toMatchInlineSnapshot(` + Object { + "assets": Array [], + "hooks": Object {}, + "name": "local-lib", + "params": Array [], + "platforms": Object { + "android": null, + "ios": Object { + "folder": "<>/native-libs/local-lib", + "libraryFolder": "Libraries", + "pbxprojPath": "<>/native-libs/local-lib/ios/LocalRNLibrary.xcodeproj/project.pbxproj", + "plist": Array [], + "podfile": null, + "podspecPath": "custom-path", + "projectName": "LocalRNLibrary.xcodeproj", + "projectPath": "<>/native-libs/local-lib/ios/LocalRNLibrary.xcodeproj", + "sharedLibraries": Array [], + "sourceDir": "<>/native-libs/local-lib/ios", + }, + }, + "root": "<>/native-libs/local-lib", + } + `); +}); diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index c6e5a088f..a9924aa95 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -73,7 +73,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { ? path.resolve(projectRoot, userConfig.reactNativePath) : resolveReactNativePath(projectRoot); }, - dependencies: {}, + dependencies: userConfig.dependencies, commands: userConfig.commands, get assets() { return findAssets(projectRoot, userConfig.assets); @@ -97,90 +97,94 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { let depsWithWarnings = []; - const finalConfig = findDependencies(projectRoot).reduce( - (acc: ConfigT, dependencyName) => { - let root; - let config; - try { - root = resolveNodeModuleDir(projectRoot, dependencyName); - const output = readDependencyConfigFromDisk(root); - config = output.config; + const finalConfig = [ + ...Object.keys(userConfig.dependencies), + ...findDependencies(projectRoot), + ].reduce((acc: ConfigT, dependencyName) => { + const localDependencyRoot = + userConfig.dependencies[dependencyName] && + userConfig.dependencies[dependencyName].root; + let root; + let config; + try { + root = + localDependencyRoot || + resolveNodeModuleDir(projectRoot, dependencyName); + const output = readDependencyConfigFromDisk(root); + config = output.config; - if (output.legacy) { - const pkg = require(path.join(root, 'package.json')); - const link = - pkg.homepage || `https://npmjs.com/package/${dependencyName}`; - depsWithWarnings.push([dependencyName, link]); - } - } catch (error) { - logger.warn( - inlineString(` - Package ${chalk.bold( - dependencyName, - )} has been ignored because it contains invalid configuration. - - Reason: ${chalk.dim(error.message)} - `), - ); - return acc; + if (output.legacy && !localDependencyRoot) { + const pkg = require(path.join(root, 'package.json')); + const link = + pkg.homepage || `https://npmjs.com/package/${dependencyName}`; + depsWithWarnings.push([dependencyName, link]); } + } catch (error) { + logger.warn( + inlineString(` + Package ${chalk.bold( + dependencyName, + )} has been ignored because it contains invalid configuration. - /** - * @todo: remove this code once `react-native` is published with - * `platforms` and `commands` inside `react-native.config.js`. - */ - if (dependencyName === 'react-native') { - if (Object.keys(config.platforms).length === 0) { - config.platforms = {ios, android}; - } - if (config.commands.length === 0) { - config.commands = [...ios.commands, ...android.commands]; - } + Reason: ${chalk.dim(error.message)}`), + ); + return acc; + } + + /** + * @todo: remove this code once `react-native` is published with + * `platforms` and `commands` inside `react-native.config.js`. + */ + if (dependencyName === 'react-native') { + if (Object.keys(config.platforms).length === 0) { + config.platforms = {ios, android}; + } + if (config.commands.length === 0) { + config.commands = [...ios.commands, ...android.commands]; } + } - const isPlatform = Object.keys(config.platforms).length > 0; + const isPlatform = Object.keys(config.platforms).length > 0; - /** - * Legacy `rnpm` config required `haste` to be defined. With new config, - * we do it automatically. - * - * @todo: Remove this once `rnpm` config is deprecated and all major RN libs are converted. - */ - const haste = config.haste || { - providesModuleNodeModules: isPlatform ? [dependencyName] : [], - platforms: Object.keys(config.platforms), - }; + /** + * Legacy `rnpm` config required `haste` to be defined. With new config, + * we do it automatically. + * + * @todo: Remove this once `rnpm` config is deprecated and all major RN libs are converted. + */ + const haste = config.haste || { + providesModuleNodeModules: isPlatform ? [dependencyName] : [], + platforms: Object.keys(config.platforms), + }; - return (assign({}, acc, { - dependencies: assign({}, acc.dependencies, { - // $FlowExpectedError: Dynamic getters are not supported - get [dependencyName]() { - return getDependencyConfig( - root, - dependencyName, - finalConfig, - config, - userConfig, - isPlatform, - ); - }, - }), - commands: [...acc.commands, ...config.commands], - platforms: { - ...acc.platforms, - ...config.platforms, + return (assign({}, acc, { + dependencies: assign({}, acc.dependencies, { + // $FlowExpectedError: Dynamic getters are not supported + get [dependencyName]() { + return getDependencyConfig( + root, + dependencyName, + finalConfig, + config, + userConfig, + isPlatform, + ); }, - haste: { - providesModuleNodeModules: [ - ...acc.haste.providesModuleNodeModules, - ...haste.providesModuleNodeModules, - ], - platforms: [...acc.haste.platforms, ...haste.platforms], - }, - }): ConfigT); - }, - initialConfig, - ); + }), + commands: [...acc.commands, ...config.commands], + platforms: { + ...acc.platforms, + ...config.platforms, + }, + haste: { + providesModuleNodeModules: [ + ...acc.haste.providesModuleNodeModules, + ...haste.providesModuleNodeModules, + ], + platforms: [...acc.haste.platforms, ...haste.platforms], + }, + }): ConfigT); + }, initialConfig); if (depsWithWarnings.length) { logger.warn( diff --git a/packages/cli/src/tools/config/readConfigFromDisk.js b/packages/cli/src/tools/config/readConfigFromDisk.js index 76a9c7e38..197ed237b 100644 --- a/packages/cli/src/tools/config/readConfigFromDisk.js +++ b/packages/cli/src/tools/config/readConfigFromDisk.js @@ -140,7 +140,24 @@ const loadProjectCommands = ( function readLegacyDependencyConfigFromDisk( rootFolder: string, ): ?UserDependencyConfigT { - const {rnpm: config} = require(path.join(rootFolder, 'package.json')); + let config = {}; + + try { + config = require(path.join(rootFolder, 'package.json')).rnpm; + } catch (error) { + // package.json is usually missing in local libraries that are not in + // project "dependencies", so we just return a bare config + return { + dependency: { + platforms: {}, + assets: [], + hooks: {}, + params: [], + }, + commands: [], + platforms: {}, + }; + } if (!config) { return undefined; diff --git a/packages/cli/src/tools/config/schema.js b/packages/cli/src/tools/config/schema.js index a6ee6d4a4..8bb0174c7 100644 --- a/packages/cli/src/tools/config/schema.js +++ b/packages/cli/src/tools/config/schema.js @@ -106,6 +106,7 @@ export const projectConfig = t t.string(), t .object({ + root: t.string(), platforms: map(t.string(), t.any()).keys({ ios: t .object({ diff --git a/types/index.js b/types/index.js index 6d9015f36..32ba63ef2 100644 --- a/types/index.js +++ b/types/index.js @@ -179,8 +179,8 @@ export type UserDependencyConfigT = { // Additional dependency settings dependency: { platforms: { - android: DependencyParamsAndroidT, - ios: ProjectParamsIOST, + android?: DependencyParamsAndroidT, + ios?: ProjectParamsIOST, [key: string]: any, }, assets: string[], From 8cb7f8831f41b1b8556ed7b044f3cb93b2230e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Jul 2019 22:37:35 +0200 Subject: [PATCH 193/234] v2.0.0-rc.5 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 649c86df2..13b21c422 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 130061a7a..2af67a2ad 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.4", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.4", - "@react-native-community/cli-tools": "^2.0.0-rc.4", + "@react-native-community/cli-platform-android": "^2.0.0-rc.5", + "@react-native-community/cli-platform-ios": "^2.0.0-rc.5", + "@react-native-community/cli-tools": "^2.0.0-rc.5", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index ac84f68e1..e7cd29113 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.4", + "@react-native-community/cli-tools": "^2.0.0-rc.5", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 662cafbd8..eac0bcb09 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.4", + "@react-native-community/cli-tools": "^2.0.0-rc.5", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 06a83ce99..3be872666 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 870a4e2ae07f5859deb08d4ca468536f4bb6e787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 3 Jul 2019 11:40:27 +0200 Subject: [PATCH 194/234] feat: improve `upgrade` when patches fail to apply (#461) --- .../upgrade/__tests__/upgrade.test.js | 20 ++++-- packages/cli/src/commands/upgrade/upgrade.js | 68 +++++++++++++------ 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 01766beea..9f5e11826 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -53,6 +53,7 @@ jest.mock('@react-native-community/cli-tools', () => ({ error: jest.fn((...args) => mockPushLog('error', args)), warn: jest.fn((...args) => mockPushLog('warn', args)), success: jest.fn((...args) => mockPushLog('success', args)), + debug: jest.fn((...args) => mockPushLog('debug', args)), log: jest.fn((...args) => mockPushLog(args)), }, })); @@ -252,7 +253,8 @@ test('cleans up if patching fails,', async () => { if (command === 'git' && args[0] === 'apply') { return Promise.reject({ code: 1, - stderr: 'error: .flowconfig: does not exist in index\n', + stderr: + 'error: .flowconfig: does not exist in index\nerror: ios/MyApp.xcodeproj/project.pbxproj: patch does not apply', }); } if (command === 'git' && args[0] === 'rev-parse') { @@ -272,16 +274,24 @@ test('cleans up if patching fails,', async () => { [fs] write tmp-upgrade-rn.patch $ execa git rev-parse --show-prefix $ execa git apply --binary --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way --directory= - info Applying diff (excluding: package.json, .flowconfig)... - $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way --directory= + info Applying diff... + warn Excluding files that exist in the template, but not in your project: + - .flowconfig + error Excluding files that failed to apply the diff: + - ios/MyApp.xcodeproj/project.pbxproj + Please make sure to check the actual changes after the upgrade command is finished. + You can find them in our Upgrade Helper web app: https://react-native-community.github.io/upgrade-helper/?from=0.57.8&to=0.58.4 + $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig --exclude=ios/MyApp.xcodeproj/project.pbxproj -p2 --3way --directory= + debug \\"git apply\\" failed. Error output: error: .flowconfig: does not exist in index - error Automatically applying diff failed + error: ios/MyApp.xcodeproj/project.pbxproj: patch does not apply + error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible [fs] unlink tmp-upgrade-rn.patch $ execa git status -s error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading info You may find these resources helpful: • Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 - • Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/release/0.57.8..release/0.58.4 + • Manual Upgrade Helper: https://react-native-community.github.io/upgrade-helper/?from=0.57.8&to=0.58.4 • Git diff: https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.57.8..0.58.4.diff" `); }, 60000); diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index 43e5749d3..d3cbb5085 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -14,9 +14,9 @@ type FlagsT = { legacy: boolean | void, }; -const rnDiffPurgeUrl = - 'https://github.com/react-native-community/rn-diff-purge'; -const rnDiffPurgeRawDiffsUrl = +// https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0-rc.3 +const webDiffUrl = 'https://react-native-community.github.io/upgrade-helper'; +const rawDiffUrl = 'https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs'; const getLatestRNVersion = async (): Promise => { @@ -46,9 +46,7 @@ const getPatch = async (currentVersion, newVersion, config) => { logger.info(`Fetching diff between v${currentVersion} and v${newVersion}...`); try { - patch = await fetch( - `${rnDiffPurgeRawDiffsUrl}/${currentVersion}..${newVersion}.diff`, - ); + patch = await fetch(`${rawDiffUrl}/${currentVersion}..${newVersion}.diff`); } catch (error) { logger.error( `Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?`, @@ -166,7 +164,9 @@ const applyPatch = async ( newVersion: string, tmpPatchFile: string, ) => { - let filesToExclude = ['package.json']; + const defaultExcludes = ['package.json']; + let filesThatDontExist = []; + let filesThatFailedToApply = []; // $FlowFixMe ThenableChildProcess is incompatible with Promise const {stdout: relativePathFromRoot} = await execa('git', [ 'rev-parse', @@ -174,7 +174,7 @@ const applyPatch = async ( ]); try { try { - const excludes = filesToExclude.map( + const excludes = defaultExcludes.map( e => `--exclude=${path.join(relativePathFromRoot, e)}`, ); await execa('git', [ @@ -192,19 +192,41 @@ const applyPatch = async ( ]); logger.info('Applying diff...'); } catch (error) { - filesToExclude = [ - ...filesToExclude, - ...error.stderr - .split('\n') + const errorLines = error.stderr.split('\n'); + filesThatDontExist = [ + ...errorLines .filter(x => x.includes('does not exist in index')) .map(x => x.replace(/^error: (.*): does not exist in index$/, '$1')), ].filter(Boolean); - logger.info(`Applying diff (excluding: ${filesToExclude.join(', ')})...`); - } finally { - const excludes = filesToExclude.map( - e => `--exclude=${path.join(relativePathFromRoot, e)}`, + filesThatFailedToApply = errorLines + .filter(x => x.includes('patch does not apply')) + .map(x => x.replace(/^error: (.*): patch does not apply$/, '$1')) + .filter(Boolean); + + logger.info('Applying diff...'); + logger.warn( + `Excluding files that exist in the template, but not in your project:\n${filesThatDontExist + .map(file => ` - ${chalk.bold(file)}`) + .join('\n')}`, ); + if (filesThatFailedToApply.length) { + logger.error( + `Excluding files that failed to apply the diff:\n${filesThatFailedToApply + .map(file => ` - ${chalk.bold(file)}`) + .join( + '\n', + )}\nPlease make sure to check the actual changes after the upgrade command is finished.\nYou can find them in our Upgrade Helper web app: ${chalk.underline.dim( + `${webDiffUrl}/?from=${currentVersion}&to=${newVersion}`, + )}`, + ); + } + } finally { + const excludes = [ + ...defaultExcludes, + ...filesThatDontExist, + ...filesThatFailedToApply, + ].map(e => `--exclude=${path.join(relativePathFromRoot, e)}`); await execa('git', [ 'apply', tmpPatchFile, @@ -216,9 +238,11 @@ const applyPatch = async ( } } catch (error) { if (error.stderr) { - logger.log(`${chalk.dim(error.stderr.trim())}`); + logger.debug(`"git apply" failed. Error output:\n${error.stderr}`); } - logger.error('Automatically applying diff failed'); + logger.error( + 'Automatically applying diff failed. We did our best to automatically upgrade as many files as possible', + ); return false; } return true; @@ -279,7 +303,7 @@ async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { if (!patchSuccess) { if (stdout) { logger.warn( - 'Continuing after failure. Most of the files are upgraded but you will need to deal with some conflicts manually', + 'Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually', ); await installDeps(newVersion, projectDir); logger.info('Running "git status" to check what changed...'); @@ -304,11 +328,11 @@ async function upgrade(argv: Array, ctx: ConfigT, args: FlagsT) { • Release notes: ${chalk.underline.dim( `https://github.com/facebook/react-native/releases/tag/v${newVersion}`, )} -• Comparison between versions: ${chalk.underline.dim( - `${rnDiffPurgeUrl}/compare/release/${currentVersion}..release/${newVersion}`, +• Manual Upgrade Helper: ${chalk.underline.dim( + `${webDiffUrl}/?from=${currentVersion}&to=${newVersion}`, )} • Git diff: ${chalk.underline.dim( - `${rnDiffPurgeRawDiffsUrl}/${currentVersion}..${newVersion}.diff`, + `${rawDiffUrl}/${currentVersion}..${newVersion}.diff`, )}`); throw new CLIError( From 2cd6c7fd6083f2101989dbfbb7b4f31a8ecc9aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 3 Jul 2019 13:05:11 +0200 Subject: [PATCH 195/234] v2.0.1 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 13b21c422..96f9d7090 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.0-rc.5", + "version": "2.0.1", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 2af67a2ad..bdfd2a036 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.0-rc.5", + "version": "2.0.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.0-rc.5", - "@react-native-community/cli-platform-ios": "^2.0.0-rc.5", - "@react-native-community/cli-tools": "^2.0.0-rc.5", + "@react-native-community/cli-platform-android": "^2.0.1", + "@react-native-community/cli-platform-ios": "^2.0.1", + "@react-native-community/cli-tools": "^2.0.1", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index e7cd29113..0ba6e1804 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.0-rc.5", + "version": "2.0.1", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.5", + "@react-native-community/cli-tools": "^2.0.1", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index eac0bcb09..aacadec85 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.0-rc.5", + "version": "2.0.1", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.0-rc.5", + "@react-native-community/cli-tools": "^2.0.1", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 3be872666..d046b8ea3 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.0-rc.5", + "version": "2.0.1", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From 3f116721eb30071b04a2957f8bd02a81954699de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 3 Jul 2019 17:44:55 +0200 Subject: [PATCH 196/234] =?UTF-8?q?fix:=20config=20on=20Windows=20&=20warn?= =?UTF-8?q?ings=20breaking=20config=20JSON=20output=20on=E2=80=A6=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: warnings breaking config JSON output * fix legacy test --- __e2e__/legacyInit.test.js | 3 +- packages/cli/src/cliEntry.js | 8 +++++ .../platform-android/native_modules.gradle | 2 +- packages/platform-ios/native_modules.rb | 13 ++------ packages/tools/src/logger.ts | 33 +++++++++++++++---- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/__e2e__/legacyInit.test.js b/__e2e__/legacyInit.test.js index dee3170a7..4e7df6228 100644 --- a/__e2e__/legacyInit.test.js +++ b/__e2e__/legacyInit.test.js @@ -17,6 +17,7 @@ afterEach(() => { test('legacy init through react-native-cli', () => { const templateFiles = [ '.buckconfig', + '.eslintrc.js', '.flowconfig', '.gitattributes', '.gitignore', @@ -64,7 +65,7 @@ test('legacy init through react-native-cli', () => { name: 'TestApp', private: true, scripts: { - start: 'node node_modules/react-native/local-cli/cli.js start', + start: 'react-native start', test: 'jest', }, }); diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 1798f391e..38ed86516 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -169,8 +169,16 @@ async function setupAndRun() { } } + // when we run `config`, we don't want to output anything to the console. We + // expect it to return valid JSON + if (process.argv.includes('config')) { + logger.disable(); + } + const ctx = loadConfig(); + logger.enable(); + setProjectDir(ctx.root); [...commands, ...ctx.commands].forEach(command => addCommand(command, ctx)); diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index c70a57b14..4bd826f76 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -167,7 +167,7 @@ class ReactNativeModules { def cmdProcess def root = getReactNativeProjectRoot() - def command = "node ./node_modules/.bin/react-native config" + def command = "./node_modules/.bin/react-native config" try { cmdProcess = Runtime.getRuntime().exec(command, null, root) diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index e2b6965fc..d0c91b60d 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -5,8 +5,8 @@ # def use_native_modules!(root = "..", packages = nil) if (!packages) - command = "node" - args = ["./node_modules/.bin/react-native", "config"] + command = "./node_modules/.bin/react-native" + args = ["config"] output = "" # Make sure `react-native config` is ran from your project root Dir.chdir(root) do @@ -15,14 +15,7 @@ def use_native_modules!(root = "..", packages = nil) json = [] output.each_line do |line| - case line - when /^warn\s(.+)/ - Pod::UI.warn($1) - when /^(success|info|error|debug)\s(.+)/ - Pod::UI.message($1) - else - json << line - end + json << line end config = JSON.parse(json.join("\n")) packages = config["dependencies"] diff --git a/packages/tools/src/logger.ts b/packages/tools/src/logger.ts index 77cc37138..6ad30997f 100644 --- a/packages/tools/src/logger.ts +++ b/packages/tools/src/logger.ts @@ -3,34 +3,45 @@ import chalk from 'chalk'; const SEPARATOR = ', '; let verbose = false; +let disabled = false; const formatMessages = (messages: Array) => chalk.reset(messages.join(SEPARATOR)); const success = (...messages: Array) => { - console.log(`${chalk.green.bold('success')} ${formatMessages(messages)}`); + if (!disabled) { + console.log(`${chalk.green.bold('success')} ${formatMessages(messages)}`); + } }; const info = (...messages: Array) => { - console.log(`${chalk.cyan.bold('info')} ${formatMessages(messages)}`); + if (!disabled) { + console.log(`${chalk.cyan.bold('info')} ${formatMessages(messages)}`); + } }; const warn = (...messages: Array) => { - console.warn(`${chalk.yellow.bold('warn')} ${formatMessages(messages)}`); + if (!disabled) { + console.warn(`${chalk.yellow.bold('warn')} ${formatMessages(messages)}`); + } }; const error = (...messages: Array) => { - console.error(`${chalk.red.bold('error')} ${formatMessages(messages)}`); + if (!disabled) { + console.error(`${chalk.red.bold('error')} ${formatMessages(messages)}`); + } }; const debug = (...messages: Array) => { - if (verbose) { + if (verbose && !disabled) { console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`); } }; const log = (...messages: Array) => { - console.log(`${formatMessages(messages)}`); + if (!disabled) { + console.log(`${formatMessages(messages)}`); + } }; const setVerbose = (level: boolean) => { @@ -39,6 +50,14 @@ const setVerbose = (level: boolean) => { const isVerbose = () => verbose; +const disable = () => { + disabled = true; +}; + +const enable = () => { + disabled = false; +}; + export default { success, info, @@ -48,4 +67,6 @@ export default { log, setVerbose, isVerbose, + disable, + enable, }; From 0758bd49a042b71552be71523af3215cd4024e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 3 Jul 2019 17:50:40 +0200 Subject: [PATCH 197/234] v2.0.2 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index 96f9d7090..777c7d364 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.1", + "version": "2.0.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index bdfd2a036..b9d6ac47b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.1", + "version": "2.0.2", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.1", - "@react-native-community/cli-platform-ios": "^2.0.1", - "@react-native-community/cli-tools": "^2.0.1", + "@react-native-community/cli-platform-android": "^2.0.2", + "@react-native-community/cli-platform-ios": "^2.0.2", + "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", "command-exists": "^1.2.8", "commander": "^2.19.0", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 0ba6e1804..701c86532 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.1", + "version": "2.0.2", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.1", + "@react-native-community/cli-tools": "^2.0.2", "logkitty": "^0.4.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index aacadec85..3b12f5245 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,9 +1,9 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.1", + "version": "2.0.2", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.1", + "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index d046b8ea3..2510d106c 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.1", + "version": "2.0.2", "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", From dabc2f56be2b2577c68551822d4b969ab0ba3c1a Mon Sep 17 00:00:00 2001 From: Rohan Talip Date: Wed, 3 Jul 2019 22:08:57 -0700 Subject: [PATCH 198/234] fix: Changed the URL to be valid for configuration.md (#466) * Changed the URL to be valid for configuration.md * Update packages/cli/src/tools/config/index.js Co-Authored-By: Kacper Wiszczuk --- packages/cli/src/tools/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index a9924aa95..25426eddb 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -196,7 +196,7 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { .join( '\n', )}\nPlease notify their maintainers about it. You can find more details at ${chalk.dim.underline( - 'https://react-native-community/cli/docs/configuration.md#migration-guide', + 'https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide', )}.`, ); } From 7220d3ef19e9344e6e3d10863a9090ac9ac729ef Mon Sep 17 00:00:00 2001 From: CallMeLaNN Date: Thu, 4 Jul 2019 16:02:26 +0800 Subject: [PATCH 199/234] fix: log-android not working. update logkitty. (#469) * fix: log-android not working. update logkitty. * fix registry --- packages/platform-android/package.json | 2 +- .../platform-android/src/commands/logAndroid/index.js | 4 ++-- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 701c86532..4e2ccdd19 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -4,7 +4,7 @@ "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", - "logkitty": "^0.4.0", + "logkitty": "^0.5.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" }, diff --git a/packages/platform-android/src/commands/logAndroid/index.js b/packages/platform-android/src/commands/logAndroid/index.js index bdeff9190..6ae7c9914 100644 --- a/packages/platform-android/src/commands/logAndroid/index.js +++ b/packages/platform-android/src/commands/logAndroid/index.js @@ -10,7 +10,7 @@ import { makeTagsFilter, formatEntry, formatError, - Priority, + AndroidPriority, } from 'logkitty'; import {logger} from '@react-native-community/cli-tools'; @@ -19,7 +19,7 @@ async function logAndroid() { const emitter = logkitty({ platform: 'android', - minPriority: Priority.VERBOSE, + minPriority: AndroidPriority.VERBOSE, filter: makeTagsFilter('ReactNative', 'ReactNativeJS'), }); diff --git a/yarn.lock b/yarn.lock index 9bdd5834c..b6ccd26b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5971,10 +5971,10 @@ log-symbols@^2.2.0: dependencies: chalk "^2.0.1" -logkitty@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/logkitty/-/logkitty-0.4.0.tgz#4a534bb4fb2b27f0120ed7b9fc62b8aa3ba6bb43" - integrity sha512-IKuHwaXYDpbEzC9EfsrmvwdS80b4Lv+W4n7g6GG0gBHt5kXzQEvew46E0omrSD3ycEpTOtAX7BXGWnOUFEksYA== +logkitty@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/logkitty/-/logkitty-0.5.0.tgz#5a348c2049551aa02da69543c3b5c44e28c7c24f" + integrity sha512-UA06TmPaSPiHxMBlo5uxL3ZvjJ2Gx/rEECrqowHsIsNoAoSB8aBSP553Fr2FJhOp3it2ulLsd520DZWS1IaYOw== dependencies: ansi-fragments "^0.2.1" yargs "^12.0.5" From df0e6b7189182a0fd8280bd7fbc49e021a0fffbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 5 Jul 2019 13:57:46 +0200 Subject: [PATCH 200/234] fix: run release checker only after `start` and `info` command (#479) * fix: run release checker only after `start` command * fix test --- packages/cli/src/cliEntry.js | 28 ------------------ .../src/commands/info/__tests__/info.test.js | 8 ----- packages/cli/src/commands/info/info.js | 3 ++ packages/cli/src/commands/server/runServer.js | 3 ++ .../cli/src/tools/releaseChecker/index.js | 29 +++++++++++++++++++ 5 files changed, 35 insertions(+), 36 deletions(-) create mode 100644 packages/cli/src/tools/releaseChecker/index.js diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 38ed86516..b2342de34 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -19,9 +19,6 @@ import init from './commands/init/initCompat'; import assertRequiredOptions from './tools/assertRequiredOptions'; import {logger} from '@react-native-community/cli-tools'; import {setProjectDir} from './tools/packageManager'; -import resolveNodeModuleDir from './tools/config/resolveNodeModuleDir'; -import getLatestRelease from './tools/releaseChecker/getLatestRelease'; -import printNewRelease from './tools/releaseChecker/printNewRelease'; import pkgJson from '../package.json'; import loadConfig from './tools/config'; @@ -119,8 +116,6 @@ const addCommand = (command: CommandT, ctx: ConfigT) => { await command.func(argv, ctx, passedOptions); } catch (error) { handleError(error); - } finally { - checkForNewRelease(ctx.root); } }); @@ -199,29 +194,6 @@ async function setupAndRun() { logger.setVerbose(commander.verbose); } -async function checkForNewRelease(root: string) { - try { - const {version: currentVersion} = require(path.join( - resolveNodeModuleDir(root, 'react-native'), - 'package.json', - )); - const {name} = require(path.join(root, 'package.json')); - const latestRelease = await getLatestRelease(name, currentVersion); - - if (latestRelease) { - printNewRelease(name, latestRelease, currentVersion); - } - } catch (e) { - // We let the flow continue as this component is not vital for the rest of - // the CLI. - logger.debug( - 'Cannot detect current version of React Native, ' + - 'skipping check for a newer release', - ); - logger.debug(e); - } -} - export default { run, init, diff --git a/packages/cli/src/commands/info/__tests__/info.test.js b/packages/cli/src/commands/info/__tests__/info.test.js index 5887a6a63..bea3af2c9 100644 --- a/packages/cli/src/commands/info/__tests__/info.test.js +++ b/packages/cli/src/commands/info/__tests__/info.test.js @@ -3,14 +3,6 @@ import info from '../info'; import {logger} from '@react-native-community/cli-tools'; import loadConfig from '../../../tools/config'; -jest.mock('@react-native-community/cli-tools', () => ({ - logger: { - info: jest.fn(), - error: jest.fn(), - log: jest.fn(), - }, -})); - jest.mock('../../../tools/config'); beforeEach(() => { diff --git a/packages/cli/src/commands/info/info.js b/packages/cli/src/commands/info/info.js index 4c5492763..149f87459 100644 --- a/packages/cli/src/commands/info/info.js +++ b/packages/cli/src/commands/info/info.js @@ -10,6 +10,7 @@ import envinfo from 'envinfo'; import {logger} from '@react-native-community/cli-tools'; import type {ConfigT} from 'types'; +import releaseChecker from '../../tools/releaseChecker'; const info = async function getInfo( argv: Array, @@ -29,6 +30,8 @@ const info = async function getInfo( logger.log(output.trim()); } catch (err) { logger.error(`Unable to print environment info.\n${err}`); + } finally { + await releaseChecker(ctx.root); } }; diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 535955ef5..75c1a04c8 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -17,6 +17,7 @@ import messageSocket from './messageSocket'; import webSocketProxy from './webSocketProxy'; import MiddlewareManager from './middleware/MiddlewareManager'; import loadMetroConfig from '../../tools/loadMetroConfig'; +import releaseChecker from '../../tools/releaseChecker'; export type Args = {| assetPlugins?: string[], @@ -107,6 +108,8 @@ async function runServer(argv: Array, ctx: ConfigT, args: Args) { // For more info: https://github.com/nodejs/node/issues/13391 // serverInstance.keepAliveTimeout = 30000; + + await releaseChecker(ctx.root); } function getReporterImpl(customLogReporterPath: ?string) { diff --git a/packages/cli/src/tools/releaseChecker/index.js b/packages/cli/src/tools/releaseChecker/index.js new file mode 100644 index 000000000..1d0dd15ce --- /dev/null +++ b/packages/cli/src/tools/releaseChecker/index.js @@ -0,0 +1,29 @@ +// @flow +import path from 'path'; +import {logger} from '@react-native-community/cli-tools'; +import resolveNodeModuleDir from '../config/resolveNodeModuleDir'; +import getLatestRelease from './getLatestRelease'; +import printNewRelease from './printNewRelease'; + +export default async function releaseChecker(root: string) { + try { + const {version: currentVersion} = require(path.join( + resolveNodeModuleDir(root, 'react-native'), + 'package.json', + )); + const {name} = require(path.join(root, 'package.json')); + const latestRelease = await getLatestRelease(name, currentVersion); + + if (latestRelease) { + printNewRelease(name, latestRelease, currentVersion); + } + } catch (e) { + // We let the flow continue as this component is not vital for the rest of + // the CLI. + logger.debug( + 'Cannot detect current version of React Native, ' + + 'skipping check for a newer release', + ); + logger.debug(e); + } +} From f6560dddbafa4447d0b2de2b02be7c5204b620f7 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 5 Jul 2019 17:50:17 +0500 Subject: [PATCH 201/234] fix: autolinking bug on Windows when reading config (#480) --- packages/platform-android/native_modules.gradle | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 4bd826f76..fcfaa7893 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -167,18 +167,23 @@ class ReactNativeModules { def cmdProcess def root = getReactNativeProjectRoot() - def command = "./node_modules/.bin/react-native config" - + def command = "node ./node_modules/react-native/cli.js config" + def reactNativeConfigOutput = "" + try { cmdProcess = Runtime.getRuntime().exec(command, null, root) - cmdProcess.waitFor() + def inputStreamReader = new InputStreamReader(cmdProcess.getInputStream()) + def bufferedReader = new BufferedReader(inputStreamReader) + def line = null + while ((line = bufferedReader.readLine()) != null){ + reactNativeConfigOutput += line + } } catch (Exception exception) { this.logger.warn("${LOG_PREFIX}${exception.message}") this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.") return reactNativeModules } - def reactNativeConfigOutput = cmdProcess.in.text def json = new JsonSlurper().parseText(reactNativeConfigOutput) this.packageName = json["project"]["android"]["packageName"] def dependencies = json["dependencies"] From 653db769b937016d89da7cb7e90db180ade8e33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 5 Jul 2019 14:59:50 +0200 Subject: [PATCH 202/234] fix: duplicate entires in rnpm warning (#481) --- packages/cli/src/tools/config/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index 25426eddb..c7aa9a691 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -97,10 +97,12 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { let depsWithWarnings = []; - const finalConfig = [ - ...Object.keys(userConfig.dependencies), - ...findDependencies(projectRoot), - ].reduce((acc: ConfigT, dependencyName) => { + const finalConfig = Array.from( + new Set([ + ...Object.keys(userConfig.dependencies), + ...findDependencies(projectRoot), + ]), + ).reduce((acc: ConfigT, dependencyName) => { const localDependencyRoot = userConfig.dependencies[dependencyName] && userConfig.dependencies[dependencyName].root; From dfbb1934e8e236552db52d10e78e4b9782ac7611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 5 Jul 2019 15:04:16 +0200 Subject: [PATCH 203/234] feat: make run-ios output leaner (#472) * feat: make run-ios output leaner * --ammend --- .../platform-ios/src/commands/runIOS/index.js | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 1726d2ea4..4b36b6da2 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -60,9 +60,9 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { const scheme = args.scheme || inferredSchemeName; logger.info( - `Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${ - xcodeProject.name - }`, + `Found Xcode ${ + xcodeProject.isWorkspace ? 'workspace' : 'project' + } "${chalk.bold(xcodeProject.name)}"`, ); const {device, udid} = args; @@ -161,14 +161,12 @@ async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { const appPath = getBuildPath(args.configuration, appName, false, scheme); - logger.info(`Installing ${appPath}`); + logger.info(`Installing "${chalk.bold(appPath)}"`); child_process.spawnSync( 'xcrun', ['simctl', 'install', selectedSimulator.udid, appPath], - { - stdio: 'inherit', - }, + {stdio: 'inherit'}, ); const bundleID = child_process @@ -180,15 +178,20 @@ async function runOnSimulator(xcodeProject, scheme, args: FlagsT) { // $FlowExpectedError https://github.com/facebook/flow/issues/5675 .trim(); - logger.info(`Launching ${bundleID}`); + logger.info(`Launching "${chalk.bold(bundleID)}"`); - child_process.spawnSync( - 'xcrun', - ['simctl', 'launch', selectedSimulator.udid, bundleID], - { - stdio: 'inherit', - }, - ); + const result = child_process.spawnSync('xcrun', [ + 'simctl', + 'launch', + selectedSimulator.udid, + bundleID, + ]); + + if (result.status === 0) { + logger.success('Successfully launched the app on the simulator'); + } else { + logger.error('Failed to launch the app on simulator', result.stderr); + } } async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) { @@ -221,7 +224,7 @@ async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) { '--justlaunch', ]; - logger.info(`Installing and launching your app on ${selectedDevice.name}...`); + logger.info(`Installing and launching your app on ${selectedDevice.name}`); const iosDeployOutput = child_process.spawnSync( 'ios-deploy', @@ -254,7 +257,11 @@ function buildProject(xcodeProject, udid, scheme, args: FlagsT) { '-derivedDataPath', `build/${scheme}`, ]; - logger.info(`Building using "xcodebuild ${xcodebuildArgs.join(' ')}"`); + logger.info( + `Building ${chalk.dim( + `(using "xcodebuild ${xcodebuildArgs.join(' ')}")`, + )}`, + ); let xcpretty; if (!args.verbose) { xcpretty = @@ -271,11 +278,16 @@ function buildProject(xcodeProject, udid, scheme, args: FlagsT) { let buildOutput = ''; let errorOutput = ''; buildProcess.stdout.on('data', data => { - buildOutput += data.toString(); + const stringData = data.toString(); + buildOutput += stringData; if (xcpretty) { xcpretty.stdin.write(data); } else { - logger.info(data.toString()); + if (logger.isVerbose()) { + logger.debug(stringData); + } else { + process.stdout.write('.'); + } } }); buildProcess.stderr.on('data', data => { @@ -284,6 +296,8 @@ function buildProject(xcodeProject, udid, scheme, args: FlagsT) { buildProcess.on('close', code => { if (xcpretty) { xcpretty.stdin.end(); + } else { + process.stdout.write('\n'); } if (code !== 0) { reject( @@ -295,7 +309,7 @@ function buildProject(xcodeProject, udid, scheme, args: FlagsT) { logs further, consider building your app with Xcode.app, by opening ${xcodeProject.name}. `, - errorOutput, + buildOutput + '\n' + errorOutput, ), ); return; @@ -307,7 +321,7 @@ function buildProject(xcodeProject, udid, scheme, args: FlagsT) { function bootSimulator(selectedSimulator) { const simulatorFullName = formattedDeviceName(selectedSimulator); - logger.info(`Launching ${simulatorFullName}...`); + logger.info(`Launching ${simulatorFullName}`); try { child_process.spawnSync('xcrun', [ 'instruments', From a760af98863dab54cf449a99db01dba94f0b9ee1 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 5 Jul 2019 18:11:29 +0500 Subject: [PATCH 204/234] chore: use StringBuffer when getting config (#482) --- packages/platform-android/native_modules.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index fcfaa7893..abef44b47 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -172,12 +172,13 @@ class ReactNativeModules { try { cmdProcess = Runtime.getRuntime().exec(command, null, root) - def inputStreamReader = new InputStreamReader(cmdProcess.getInputStream()) - def bufferedReader = new BufferedReader(inputStreamReader) - def line = null - while ((line = bufferedReader.readLine()) != null){ - reactNativeConfigOutput += line + def bufferedReader = new BufferedReader(new InputStreamReader(cmdProcess.getInputStream())) + def buff = "" + def readBuffer = new StringBuffer() + while ((buff = bufferedReader.readLine()) != null){ + readBuffer.append(buff) } + reactNativeConfigOutput = readBuffer.toString() } catch (Exception exception) { this.logger.warn("${LOG_PREFIX}${exception.message}") this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.") From 34d6f70408505d22877ae721949f614ce077d544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 5 Jul 2019 15:15:50 +0200 Subject: [PATCH 205/234] v2.1.0 --- lerna.json | 2 +- packages/cli/package.json | 6 +++--- packages/platform-android/package.json | 2 +- packages/platform-ios/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index 777c7d364..a8426ab2a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.0.2", + "version": "2.1.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index b9d6ac47b..7b664ac0b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.0.2", + "version": "2.1.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,8 +24,8 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.0.2", - "@react-native-community/cli-platform-ios": "^2.0.2", + "@react-native-community/cli-platform-android": "^2.1.0", + "@react-native-community/cli-platform-ios": "^2.1.0", "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", "command-exists": "^1.2.8", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 4e2ccdd19..fa8674e7c 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.0.2", + "version": "2.1.0", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 3b12f5245..5fecbe32a 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.0.2", + "version": "2.1.0", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", From 0fd831e6c496babc67ff1f9596043e8bafe2e073 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Sat, 6 Jul 2019 18:10:54 +0500 Subject: [PATCH 206/234] chore: revamp README for readability, about and updating info (#490) * chore: add updating guide & improve about * update readme * fix typo --- README.md | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c4f4d548b..87470fcb0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # React Native CLI -Command line tools to interact with React Native projects. +Command line tools that ship with [`react-native`](https://github.com/facebook/react-native) in form of the `@react-native-community/cli` package. + +> It exposes `react-native` binary, so your can call `yarn react-native` or `npx react-native` directly from your project. [![Build Status][build-badge]][build] [![Version][version-badge]][package] [![MIT License][license-badge]][license] [![PRs Welcome][prs-welcome-badge]][prs-welcome] @@ -8,12 +10,12 @@ _Note: CLI has been extracted from core `react-native` as a part of "[Lean Core] ## Compatibility -This CLI is intended to be used with a certain version of React Native. You'll find the support table with compatible versions below. +Our release cycle is independent of `react-native`. We follow semver and here is the compatibility table: -| CLI | React Native | -| ------ | ------------ | -| ^2.0.0 | ^0.60.0 | -| ^1.0.0 | ^0.59.0 | +| `@react-native-community/cli` | `react-native` | +| ----------------------------- | -------------- | +| ^2.0.0 | ^0.60.0 | +| [^1.0.0](tree/1.x) | ^0.59.0 | ## Documentation @@ -25,18 +27,22 @@ This CLI is intended to be used with a certain version of React Native. You'll f ## About -This repository contains tools and helpers for React Native projects in form of a CLI. We want to make a couple of things clear for you first: +This repository contains tools and helpers for React Native projects in form of a command line tool. There's been quite some confusion around that since the extraction from React Native core. Let's clear them up: -- this is a monorepo; -- there are currently two CLIs: the actual one called [`@react-native-community/cli`](./packages/cli) that does all the job and global [`react-native-cli`](./packages/global-cli) which is used as its proxy and installation helper; +- There are currently two CLIs: + - [`@react-native-community/cli`](./packages/cli) – **the one used directly by `react-native`**. That makes it a transitive dependency of your project. + - [`react-native-cli`](./packages/global-cli) – an optional global convenience package, which is a proxy to [`@react-native-community/cli`](./packages/cli) and global installation helper. **Please consider it legacy, because it's not necessary anymore**. +- When we say "the CLI" we mean `@react-native-community/cli`. +- We update the CLI independently of React Native itself. Please see [how to use the latest version](#updating-the-cli). +- This is a monorepo to keep stuff organized. -We know it's confusing, but we're actively working to make this indirection gone. +We're actively working to make any indirections gone. ## Creating a new React Native project There are two ways to start a React Native project. -### Using `npx` +### Using `npx` (_recommended_) > Available since `react-native@0.60` @@ -46,7 +52,7 @@ This method is preferred if you don't want to install global packages. npx react-native init MyApp ``` -### Using global CLI +### Using global CLI (_legacy_) You'll need to install a global module [`react-native-cli`](./packages/global-cli) and follow instructions there. @@ -62,7 +68,9 @@ Example running `start` command in terminal: ```sh yarn react-native start -# or if you don't use Yarn: +# or: +npx react-native start +# or node ./node_modules/.bin/react-native start ``` @@ -76,6 +84,16 @@ You can also add npm scripts to call it with whichever package manager you use: } ``` +## Updating the CLI + +Because we release independently of `react-native`, it happens that you may be locked on a version without fixes for bugs that affect you. Here's how to get it sorted: + +1. If you use lock files (`yarn.lock` or `package-lock.json`) - find the `@react-native-community/cli` entry, remove it, run `yarn install` / `npm install` once again. +2. If you don't use lock files – remove `node_modules` and run `yarn install` / `npm install` again. +3. Run `yarn list @react-native-community/cli` or `npm list @react-native-community/cli` and verify you're on the latest version. + +After performing these steps you should be on the latest CLI version. Feel free to do it once in a while, because we release often. + ## Maintainers - Michał Pierzchała ([**@thymikee**](https://github.com/thymikee)) - [Callstack](https://callstack.com) From 4732edc3b73e875a868f65515bb766ae8bb4d915 Mon Sep 17 00:00:00 2001 From: James George Date: Sat, 6 Jul 2019 21:42:15 +0530 Subject: [PATCH 207/234] docs: add table of contents (#491) --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 87470fcb0..50b1aa434 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,19 @@ Command line tools that ship with [`react-native`](https://github.com/facebook/r _Note: CLI has been extracted from core `react-native` as a part of "[Lean Core](https://github.com/facebook/react-native/issues/23313)" effort. Please read [this blog post](https://blog.callstack.io/the-react-native-cli-has-a-new-home-79b63838f0e6) for more details._ +## Contents + +- [Compatibility](#compatibility) +- [Documentation](#documentation) +- [About](#about) +- [Creating a new React Native project](#creating-a-new-react-native-project) + - [Using `npx` (_recommended_)](#using-npx-recommended) + - [Using global CLI (_legacy_)](#using-global-cli-legacy) +- [Usage in an existing React Native project](#usage-in-an-existing-react-native-project) +- [Updating the CLI](#updating-the-cli) +- [Maintainers](#maintainers) +- [License](#license) + ## Compatibility Our release cycle is independent of `react-native`. We follow semver and here is the compatibility table: From 32bce3147e38fbba31bcb1873fc699f72c4f5cbd Mon Sep 17 00:00:00 2001 From: Mike Diarmid Date: Sun, 7 Jul 2019 09:14:19 +0100 Subject: [PATCH 208/234] fix: support an Application instance in PackageList for Android (#493) --- packages/platform-android/native_modules.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index abef44b47..e31154865 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -17,10 +17,16 @@ import java.util.ArrayList; {{ packageImports }} public class PackageList { + private Application application; private ReactNativeHost reactNativeHost; public PackageList(ReactNativeHost reactNativeHost) { this.reactNativeHost = reactNativeHost; } + + public PackageList(Application application) { + this.reactNativeHost = null; + this.application = application; + } private ReactNativeHost getReactNativeHost() { return this.reactNativeHost; @@ -31,6 +37,7 @@ public class PackageList { } private Application getApplication() { + if (this.reactNativeHost == null) return this.application; return this.reactNativeHost.getApplication(); } From 617a014549c43c58b56b2a18afadcce768c0e3aa Mon Sep 17 00:00:00 2001 From: thecodrr Date: Sun, 7 Jul 2019 13:24:33 +0500 Subject: [PATCH 209/234] fix: Metro Bundler crashing on `run-android` on Windows (#489) --- .../src/commands/runAndroid/index.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/platform-android/src/commands/runAndroid/index.js b/packages/platform-android/src/commands/runAndroid/index.js index a687ff69b..887fda6a1 100644 --- a/packages/platform-android/src/commands/runAndroid/index.js +++ b/packages/platform-android/src/commands/runAndroid/index.js @@ -250,6 +250,24 @@ function startServerInNewWindow(port, terminal, reactNativePath) { ? `set RCT_METRO_PORT=${port}` : `export RCT_METRO_PORT=${port}`; + /** + * Quick & temporary fix for packager crashing on Windows due to using removed --projectRoot flag + * in script. So we just replace the contents of the script with the fixed version. This should be + * removed when PR #25517 on RN Repo gets approved and a new RN version is released. + */ + const launchPackagerScriptContent = `:: 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. + + @echo off + title Metro Bundler + call .packager.bat + cd ../../../ + node "%~dp0..\\cli.js" start + pause + exit`; + /** * Set up the `.packager.(env|bat)` file to ensure the packager starts on the right port. */ @@ -296,6 +314,11 @@ function startServerInNewWindow(port, terminal, reactNativePath) { if (/^win/.test(process.platform)) { procConfig.detached = true; procConfig.stdio = 'ignore'; + //Temporary fix for #484. See comment on line 254 + fs.writeFileSync(launchPackagerScript, launchPackagerScriptContent, { + encoding: 'utf8', + flag: 'w', + }); return spawn('cmd.exe', ['/C', launchPackagerScript], procConfig); } logger.error( From debaa07dd363c13d021ec5f6b1affa3e766b89ae Mon Sep 17 00:00:00 2001 From: iKoala Date: Sun, 7 Jul 2019 16:29:39 +0800 Subject: [PATCH 210/234] fix: passing iOS simulator name with brackets in latest Xcode (#460) * Fixed cli --simulator not working with latest Xcode simulator name with brackets * Updated test case * Fixed findMatchingSimulator unit test --- .../__tests__/findMatchingSimulator-test.js | 220 ++++++++++++++++++ .../commands/runIOS/findMatchingSimulator.js | 3 +- 2 files changed, 222 insertions(+), 1 deletion(-) diff --git a/packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js b/packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js index 95d0551a1..6a181328f 100644 --- a/packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js +++ b/packages/platform-ios/src/commands/runIOS/__tests__/findMatchingSimulator-test.js @@ -676,6 +676,226 @@ describe('findMatchingSimulator', () => { ).toEqual(null); }); + it('should return iPad(name with brackets) simulator if simulator name is in the list', () => { + expect( + findMatchingSimulator( + { + devices: { + 'iOS 12.0': [ + { + state: 'Shutdown', + availability: '(unavailable, runtime profile not found)', + name: 'iPhone 4s', + udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 5', + udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6s', + udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPad Pro (9.7-inch)', + udid: 'B2141C1E-86B7-4A10-82A7-4956799526DF', + }, + ], + 'iOS 12.2': [ + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', + }, + { + state: 'Booted', + availability: '(available)', + name: 'iPhone 7', + udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', + }, + ], + }, + }, + 'iPad Pro (9.7-inch)', + ), + ).toEqual({ + udid: 'B2141C1E-86B7-4A10-82A7-4956799526DF', + name: 'iPad Pro (9.7-inch)', + booted: false, + version: 'iOS 12.0', + }); + }); + + it('should return iPad(name with brackets) simulator if simulator name and specified iOS version is in the list', () => { + expect( + findMatchingSimulator( + { + devices: { + 'iOS 12.0': [ + { + state: 'Shutdown', + availability: '(unavailable, runtime profile not found)', + name: 'iPhone 4s', + udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 5', + udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6s', + udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', + }, + ], + 'iOS 12.2': [ + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', + }, + { + state: 'Booted', + availability: '(available)', + name: 'iPhone 7', + udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPad Pro (9.7-inch)', + udid: 'B2141C1E-86B7-4A10-82A7-4956799526DF', + }, + ], + }, + }, + 'iPad Pro (9.7-inch) (12.2)', + ), + ).toEqual({ + udid: 'B2141C1E-86B7-4A10-82A7-4956799526DF', + name: 'iPad Pro (9.7-inch)', + booted: false, + version: 'iOS 12.2', + }); + }); + + it('should return null if the version is specified and no iPad device with the exact version exists', () => { + expect( + findMatchingSimulator( + { + devices: { + 'iOS 12.0': [ + { + state: 'Shutdown', + availability: '(unavailable, runtime profile not found)', + name: 'iPhone 4s', + udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 5', + udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6s', + udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508', + }, + ], + 'iOS 12.2': [ + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6', + udid: '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPhone 6 (Plus)', + udid: '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC', + }, + { + state: 'Booted', + availability: '(available)', + name: 'iPhone 7', + udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'iPad Pro (9.7-inch)', + udid: 'B2141C1E-86B7-4A10-82A7-4956799526DF', + }, + ], + }, + }, + 'iPad Pro (9.7-inch) (12.0)', + ), + ).toEqual(null); + }); + it('should return AppleTV devices if in the list', () => { expect( findMatchingSimulator( diff --git a/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js b/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js index 5a114eed3..b26e08e61 100644 --- a/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js +++ b/packages/platform-ios/src/commands/runIOS/findMatchingSimulator.js @@ -27,8 +27,9 @@ function findMatchingSimulator(simulators, simulatorString) { const devices = simulators.devices; const parsedSimulatorName = simulatorString - ? simulatorString.match(/(.*)? (?:\((.*)?\))?/) + ? simulatorString.match(/(.*)? (?:\((\d+\.\d+)?\))$/) : []; + if (parsedSimulatorName && parsedSimulatorName[2] !== undefined) { var simulatorVersion = parsedSimulatorName[2]; var simulatorName = parsedSimulatorName[1]; From 9e3134b2c33521229ed377899ea96ec3b92d74b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 7 Jul 2019 10:53:44 +0200 Subject: [PATCH 211/234] v2.1.1 --- lerna.json | 2 +- packages/cli/package.json | 6 +++--- packages/platform-android/package.json | 2 +- packages/platform-ios/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index a8426ab2a..bbca3755f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.1.0", + "version": "2.1.1", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 7b664ac0b..855b47f82 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.1.0", + "version": "2.1.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,8 +24,8 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.1.0", - "@react-native-community/cli-platform-ios": "^2.1.0", + "@react-native-community/cli-platform-android": "^2.1.1", + "@react-native-community/cli-platform-ios": "^2.1.1", "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", "command-exists": "^1.2.8", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index fa8674e7c..0504518c2 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.1.0", + "version": "2.1.1", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 5fecbe32a..08355d222 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.1.0", + "version": "2.1.1", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", From 09e77d80fd21798ab74e1b7bec0707ce3edda074 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 7 Jul 2019 11:33:06 -0400 Subject: [PATCH 212/234] fix: `init` command with scoped templates without version (#497) --- packages/cli/src/commands/init/__tests__/templateName.test.js | 1 + packages/cli/src/commands/init/templateName.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/__tests__/templateName.test.js b/packages/cli/src/commands/init/__tests__/templateName.test.js index db972581b..3cb120a6c 100644 --- a/packages/cli/src/commands/init/__tests__/templateName.test.js +++ b/packages/cli/src/commands/init/__tests__/templateName.test.js @@ -54,6 +54,7 @@ test.each` templateName | uri | name ${'react-native@0.58.0'} | ${'react-native@0.58.0'} | ${'react-native'} ${'some-name@latest'} | ${'some-name@latest'} | ${'some-name'} + ${'@scoped/name'} | ${'@scoped/name'} | ${'@scoped/name'} ${'@scoped/name@0.58.0'} | ${'@scoped/name@0.58.0'} | ${'@scoped/name'} ${'@scoped/name@tag'} | ${'@scoped/name@tag'} | ${'@scoped/name'} `( diff --git a/packages/cli/src/commands/init/templateName.js b/packages/cli/src/commands/init/templateName.js index d2b8b7e98..9fdef32ac 100644 --- a/packages/cli/src/commands/init/templateName.js +++ b/packages/cli/src/commands/init/templateName.js @@ -7,7 +7,7 @@ const FILE_PROTOCOL = /file:/; const HTTP_PROTOCOL = /https?:/; const TARBALL = /\.tgz$/; const VERSION_POSTFIX = /(.*)(-\d+\.\d+\.\d+)/; -const VERSIONED_PACKAGE = /(@?.*)(@)(.*)/; +const VERSIONED_PACKAGE = /(@?.+)(@)(.+)/; function handleFileProtocol(filePath: string) { const uri = new URL(filePath).pathname; From 212587fa2a8e2cfb9cfce07ef042cbb411671004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 7 Jul 2019 21:40:48 +0200 Subject: [PATCH 213/234] fix: don't set `projetRoot` for Metro (#496) --- packages/cli/src/commands/server/runServer.js | 1 - packages/cli/src/tools/loadMetroConfig.js | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 75c1a04c8..24e9821a1 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -48,7 +48,6 @@ async function runServer(argv: Array, ctx: ConfigT, args: Args) { port: args.port, resetCache: args.resetCache, watchFolders: args.watchFolders, - projectRoot: ctx.root, sourceExts: args.sourceExts, reporter, }); diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index c9e5fb7f4..a59f28751 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -71,7 +71,6 @@ export const getDefaultConfig = (ctx: ConfigT) => { export type ConfigOptionsT = {| maxWorkers?: number, port?: number, - projectRoot?: string, resetCache?: boolean, watchFolders?: string[], sourceExts?: string[], From 46aff3ccd57293365068b7916bb734a277603256 Mon Sep 17 00:00:00 2001 From: mciechanowicz Date: Mon, 8 Jul 2019 12:06:10 +0200 Subject: [PATCH 214/234] chore: fix typo in contribution guide (#501) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fdb38e7f9..8b701f3bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ verdaccio ```sh npm set registry http://localhost:4873/ ``` -* Clone `react-native` and `@react-native-commiunity/cli` +* Clone `react-native` and `@react-native-community/cli` * Release new version of `@react-native-community/cli` to local npm proxy. If you have any issues, head over to [verdaccio](https://github.com/verdaccio/verdaccio) and check out the docs. ``` cd /path/to/cli/packages/cli && npm publish From 6df50eb42cb22d5992d0d7c79923b7f989719d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 8 Jul 2019 14:41:49 +0200 Subject: [PATCH 215/234] v2.1.2 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index bbca3755f..ebfc52505 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.1.1", + "version": "2.1.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 855b47f82..eb90b25e5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.1.1", + "version": "2.1.2", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 56ad88712b77e9c50f74a27c05f658262b932bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 8 Jul 2019 19:18:02 +0200 Subject: [PATCH 216/234] chore: add more information to autolinking guide (#505) --- docs/autolinking.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/autolinking.md b/docs/autolinking.md index 09f272959..67520b337 100644 --- a/docs/autolinking.md +++ b/docs/autolinking.md @@ -23,16 +23,18 @@ Each platform defines its own [`platforms`](./platforms.md) configuration. It in ## Platform iOS -The `Podfile` gets the package metadata from `react-native config` and: +The [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb) script required by `Podfile` gets the package metadata from `react-native config` during install phase and: 1. Adds dependencies via CocoaPods dev pods (using files from a local path). 1. Adds build phase scripts to the App project’s build phase. (see examples below) -This means that all libraries need to ship a Podspec in the root of their folder to work seamlessly. This references the native code that your library depends on, and notes any of its other native dependencies. +This means that all libraries need to ship a Podspec either in the root of their folder or where the Xcode project is. Podspec references the native code that your library depends on. The implementation ensures that a library is imported only once. If you need to have a custom `pod` directive then include it above the `use_native_modules!` function. -See the implementation of [native_modules.rb](https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb). +### Example + +See example usage in React Native template's [Podfile](https://github.com/facebook/react-native/blob/0.60-stable/template/ios/Podfile). ### Custom root (monorepos) @@ -45,21 +47,31 @@ root/ ios/ ``` -you'll need to set a custom root. Pass it as an argument to `use_native_modules!`: +you'll need to set a custom root. Pass it as an argument to `use_native_modules!` and adjust the `native_modules` path accordingly: ```rb # example/ios/Podfile +require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules' +# ... use_native_modules!("../..") ``` ## Platform Android +The [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle) script is included in your project's `settings.gradle` and `app/build.gradle` files and: + 1. At build time, before the build script is run: 1. A first Gradle plugin (in `settings.gradle`) runs `applyNativeModulesSettingsGradle` method. It uses the package metadata from `react-native config` to add Android projects. 1. A second Gradle plugin (in `app/build.gradle`) runs `applyNativeModulesAppBuildGradle` method. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file. -1. At runtime, the list of React Native packages, generated in step 1.2, is passed to React Native host. +1. At runtime, the list of React Native packages generated in step 1.2 is registered by `getPackages` method of `ReactNativeHost` in `MainApplication.java`. + +### Example + +See example usage in React Native template: -See the implementation of [native_modules.gradle](https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle). +- [settings.gradle](https://github.com/facebook/react-native/blob/0.60-stable/template/android/settings.gradle) +- [app/build.gradle](https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle#L185) +- [MainApplication.java](https://github.com/facebook/react-native/blob/769e35ba5f4c31ef913035a5cc8bc0e88546ca55/template/android/app/src/main/java/com/helloworld/MainApplication.java#L22-L28) ### Custom root (monorepos) @@ -72,15 +84,17 @@ root/ android/ ``` -you'll need to set a custom root. Pass it as a second argument to `applyNativeModulesSettingsGradle` and `applyNativeModulesAppBuildGradle` methods: +you'll need to set a custom root. Pass it as a second argument to `applyNativeModulesSettingsGradle` and `applyNativeModulesAppBuildGradle` methods and adjust the `native_modules.gradle` path accordingly: ```groovy // example/android/settings.gradle +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings, "../..") ``` ```groovy // example/android/app/build.gradle +apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project, "../..") ``` From c9aec255627c80dc6bab853ad9433ef7e864cde9 Mon Sep 17 00:00:00 2001 From: Maciej Simka Date: Tue, 9 Jul 2019 09:05:27 +0200 Subject: [PATCH 217/234] feat: use relative paths for Podfile.lock (#502) --- packages/platform-ios/native_modules.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index d0c91b60d..e5243c211 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -42,7 +42,11 @@ def use_native_modules!(root = "..", packages = nil) existing_dep.name.split('/').first == spec.name end - pod spec.name, :path => File.dirname(podspec_path) + # Use relative path + absolute_podspec_path = File.dirname(podspec_path) + relative_podspec_path = File.join(root, absolute_podspec_path.partition('node_modules').last(2).join()) + + pod spec.name, :path => relative_podspec_path if package_config["scriptPhases"] # Can be either an object, or an array of objects @@ -174,7 +178,7 @@ def pluralize(count) @podfile.use_native_modules('..', @config) @activated_pods.must_equal [{ name: "ios-dep", - options: { path: @ios_package["root"] } + options: { path: "../node_modules/react" } }] end From cbb9828bc6ff947e4abf0d245eac022b9debf042 Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Tue, 9 Jul 2019 02:11:47 -0500 Subject: [PATCH 218/234] fix: use_native_modules! warns and skips dependencies without a podspec (#507) --- packages/platform-ios/native_modules.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index e5243c211..205386754 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -27,6 +27,18 @@ def use_native_modules!(root = "..", packages = nil) next unless package_config = package["platforms"]["ios"] podspec_path = package_config["podspecPath"] + + # Add a warning to the queue and continue to the next dependency if the podspec_path is nil/empty + if podspec_path.nil? || podspec_path.empty? + Pod::UI.warn("use_native_modules! skipped the react-native dependency '#{package["name"]}'. No podspec file was found.", + [ + "Check to see if there is an updated version that contains the necessary podspec file", + "Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec", + "If necessary, you can disable autolinking for the dependency and link it manually. See https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library" + ]) + end + next if podspec_path.nil? || podspec_path.empty? + spec = Pod::Specification.from_file(podspec_path) # We want to do a look up inside the current CocoaPods target From 82ac1c73e6ba3da45b42c7900c524ead224aa8f0 Mon Sep 17 00:00:00 2001 From: Taym Haddadi Date: Tue, 9 Jul 2019 09:40:55 +0200 Subject: [PATCH 219/234] fix: correct project directory in run instructions after `init` (#504) * fix: fix project directory name in run instructions * fix: pass the right project directory to printRunInstructions --- packages/cli/src/commands/init/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index 61bcd1c83..b55557fe8 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -218,7 +218,8 @@ export default (async function initialize( try { await createProject(projectName, directoryName, version, options); - printRunInstructions(rootFolder, projectName); + const projectFolder = path.join(rootFolder, projectName); + printRunInstructions(projectFolder, projectName); } catch (e) { logger.error(e.message); // Only remove project if it didn't exist before running `init` From 9e2be6ce0f7d85b66392fe930ff717cab02b43f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Jul 2019 09:43:48 +0200 Subject: [PATCH 220/234] v2.2.0 --- lerna.json | 2 +- packages/cli/package.json | 4 ++-- packages/platform-ios/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lerna.json b/lerna.json index ebfc52505..07e3f408e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.1.2", + "version": "2.2.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index eb90b25e5..629d42b76 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.1.2", + "version": "2.2.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -25,7 +25,7 @@ "dependencies": { "@hapi/joi": "^15.0.3", "@react-native-community/cli-platform-android": "^2.1.1", - "@react-native-community/cli-platform-ios": "^2.1.1", + "@react-native-community/cli-platform-ios": "^2.2.0", "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", "command-exists": "^1.2.8", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 08355d222..811988d47 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.1.1", + "version": "2.2.0", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", From a3d468e54dd3de51c2a0c788c1c8962d1c6abfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Jul 2019 10:32:30 +0200 Subject: [PATCH 221/234] chore: remove unstable `init --template` shorthand support (#495) --- docs/commands.md | 1 - docs/init.md | 1 - .../init/__tests__/templateName.test.js | 22 ------------- .../cli/src/commands/init/templateName.js | 31 ++----------------- 4 files changed, 2 insertions(+), 53 deletions(-) diff --git a/docs/commands.md b/docs/commands.md index b01ed8a06..4e29ed00d 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -139,7 +139,6 @@ Uses a custom directory instead of ``. Uses a custom template. Accepts following template sources: - an npm package name -- a shorthand name for packages prefixed with `react-native-template-` - an absolute path to a local directory - an absolute path to a tarball created using `npm pack` diff --git a/docs/init.md b/docs/init.md index 166473ff6..74971ac58 100644 --- a/docs/init.md +++ b/docs/init.md @@ -35,7 +35,6 @@ npx react-native@${VERSION} init ProjectName In following examples `TEMPLATE_NAME` can be either: - Full package name, eg. `react-native-template-typescript`. -- Shorthand name of template, eg. `typescript`. - Absolute path to directory containing template, eg. `file:///Users/username/project/some-template`. - Absolute path to a tarball created using `npm pack`. diff --git a/packages/cli/src/commands/init/__tests__/templateName.test.js b/packages/cli/src/commands/init/__tests__/templateName.test.js index 3cb120a6c..27fc9c44d 100644 --- a/packages/cli/src/commands/init/__tests__/templateName.test.js +++ b/packages/cli/src/commands/init/__tests__/templateName.test.js @@ -21,28 +21,6 @@ test('supports file protocol with absolute path', async () => { }); }); -test('supports shorthand templates', async () => { - const templateName = 'typescript'; - (fetch: any).mockImplementationOnce(() => { - return Promise.resolve(`{"name": "react-native-template-${templateName}"}`); - }); - expect(await processTemplateName(templateName)).toEqual({ - uri: `react-native-template-${templateName}`, - name: `react-native-template-${templateName}`, - }); -}); - -test('supports not-found shorthand templates', async () => { - const templateName = 'typescriptz'; - (fetch: any).mockImplementationOnce(() => { - return Promise.resolve('Not found'); - }); - expect(await processTemplateName(templateName)).toEqual({ - uri: templateName, - name: templateName, - }); -}); - test('supports npm packages as template names', async () => { expect(await processTemplateName(RN_NPM_PACKAGE)).toEqual({ uri: RN_NPM_PACKAGE, diff --git a/packages/cli/src/commands/init/templateName.js b/packages/cli/src/commands/init/templateName.js index 9fdef32ac..42ff684a9 100644 --- a/packages/cli/src/commands/init/templateName.js +++ b/packages/cli/src/commands/init/templateName.js @@ -57,35 +57,8 @@ export async function processTemplateName(templateName: string) { return handleVersionedPackage(templateName); } - const name = await tryTemplateShorthand(templateName); - return { - uri: name, - name, + uri: templateName, + name: templateName, }; } - -/** - * `init` may be invoked with a shorthand like `--template typescript` - * which should resolve to `react-native-template-typescript` package. - * To support that, we query npm registry if a package like this exists, if not - * we return the original name without a change. - */ -async function tryTemplateShorthand(templateName: string) { - if (templateName.match(FILE_PROTOCOL) || templateName.match(HTTP_PROTOCOL)) { - return templateName; - } - try { - const reactNativeTemplatePackage = `react-native-template-${templateName}`; - const response = await fetch( - `https://registry.yarnpkg.com/${reactNativeTemplatePackage}/latest`, - ); - - if (JSON.parse(response).name) { - return reactNativeTemplatePackage; - } - } catch (e) { - // we expect this to fail when `file://` protocol or regular module is passed - } - return templateName; -} From f5d64fb83383301843f8cb73ff1e080185c0c579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Jul 2019 13:46:54 +0200 Subject: [PATCH 222/234] feat: support `unlink --platforms` (#511) --- .../cli/src/commands/install/uninstall.js | 4 +- packages/cli/src/commands/link/unlink.js | 37 +++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/commands/install/uninstall.js b/packages/cli/src/commands/install/uninstall.js index 7c51a0a41..be22269c9 100644 --- a/packages/cli/src/commands/install/uninstall.js +++ b/packages/cli/src/commands/install/uninstall.js @@ -10,13 +10,13 @@ import type {ConfigT} from 'types'; import {logger} from '@react-native-community/cli-tools'; import * as PackageManager from '../../tools/packageManager'; -import link from '../link/unlink'; +import unlink from '../link/unlink'; async function uninstall(args: Array, ctx: ConfigT) { const name = args[0]; logger.info(`Unlinking "${name}"...`); - await link.func([name], ctx); + await unlink.func([name], ctx, {}); logger.info(`Uninstalling "${name}"...`); await PackageManager.uninstall([name]); diff --git a/packages/cli/src/commands/link/unlink.js b/packages/cli/src/commands/link/unlink.js index 5b91768b1..d19d5321a 100644 --- a/packages/cli/src/commands/link/unlink.js +++ b/packages/cli/src/commands/link/unlink.js @@ -7,12 +7,16 @@ * @flow */ -import {flatMap, values, difference} from 'lodash'; +import {flatMap, values, difference, pick} from 'lodash'; import {logger, CLIError} from '@react-native-community/cli-tools'; import type {ConfigT} from 'types'; import getPlatformName from './getPlatformName'; import makeHook from './makeHook'; +type Flags = { + platforms?: Array, +}; + const unlinkDependency = ( platforms, project, @@ -78,8 +82,20 @@ const unlinkDependency = ( * If optional argument [packageName] is provided, it's the only one * that's checked */ -async function unlink(args: Array, ctx: ConfigT) { +async function unlink(args: Array, ctx: ConfigT, opts: Flags) { const packageName = args[0]; + let platforms = ctx.platforms; + + if (opts.platforms) { + platforms = pick(platforms, opts.platforms); + logger.debug('Skipping selected platforms'); + } + + logger.debug( + `Available platforms: ${Object.keys(platforms) + .map(getPlatformName) + .join(', ')}`, + ); const {[packageName]: dependency, ...otherDependencies} = ctx.dependencies; @@ -95,7 +111,7 @@ async function unlink(args: Array, ctx: ConfigT) { await makeHook(dependency.hooks.preulink)(); } unlinkDependency( - ctx.platforms, + platforms, ctx.project, dependency, packageName, @@ -122,12 +138,12 @@ async function unlink(args: Array, ctx: ConfigT) { return; } - Object.keys(ctx.platforms || {}).forEach(platform => { + Object.keys(platforms || {}).forEach(platform => { const projectConfig = ctx.project[platform]; const linkConfig = - ctx.platforms[platform] && - ctx.platforms[platform].linkConfig && - ctx.platforms[platform].linkConfig(); + platforms[platform] && + platforms[platform].linkConfig && + platforms[platform].linkConfig(); if (!linkConfig || !linkConfig.unlinkAssets || !projectConfig) { return; } @@ -146,4 +162,11 @@ export default { func: unlink, description: 'unlink native dependency', name: 'unlink ', + options: [ + { + name: '--platforms [list]', + description: 'Scope unlinking to specified platforms', + parse: (val: string) => val.toLowerCase().split(','), + }, + ], }; From 8d088e961232032a6ae3afed068ac85126224db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Jul 2019 13:47:47 +0200 Subject: [PATCH 223/234] v2.3.0 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 07e3f408e..1f93c59e6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.2.0", + "version": "2.3.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 629d42b76..d33618da4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.2.0", + "version": "2.3.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From c57f41e841194f73779bc23a03d509fb1e1a57a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 9 Jul 2019 13:58:30 +0200 Subject: [PATCH 224/234] docs: add docs for `unlink --platforms` --- docs/commands.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/commands.md b/docs/commands.md index 4e29ed00d..b7b751965 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -475,11 +475,17 @@ Unlinks single package native dependencies and then uninstalls it from `package. Usage: ``` -react-native unlink +react-native unlink [options] ``` Unlink native dependency linked with the `link` command. +#### Options + +#### `--platforms [list]` + +Scope unlinking to specified platforms + ### `upgrade` Usage: From 558fad24f7e05b42014c550bef675b480e0d3c2e Mon Sep 17 00:00:00 2001 From: Taym Haddadi Date: Wed, 10 Jul 2019 12:24:58 +0200 Subject: [PATCH 225/234] feat: add `xed -b ios` for opening Xcode to init instructions (#514) --- packages/cli/src/commands/init/printRunInstructions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/printRunInstructions.js b/packages/cli/src/commands/init/printRunInstructions.js index 43258c85a..8d4b72446 100644 --- a/packages/cli/src/commands/init/printRunInstructions.js +++ b/packages/cli/src/commands/init/printRunInstructions.js @@ -31,7 +31,7 @@ function printRunInstructions(projectDir: string, projectName: string) { ${chalk.cyan(`Run instructions for ${chalk.bold('iOS')}`)}: • cd ${absoluteProjectDir} && react-native run-ios - or - - • Open ${relativeXcodeProjectPath} in Xcode + • Open ${relativeXcodeProjectPath} in Xcode or run "xed -b ios" • Hit the Run button ${chalk.green(`Run instructions for ${chalk.bold('Android')}`)}: From c8c036243be85b98b7bf5af428de30a83af6991c Mon Sep 17 00:00:00 2001 From: Maciej Simka Date: Wed, 10 Jul 2019 14:18:29 +0200 Subject: [PATCH 226/234] fix: run `pod repo update` after installing CocoaPods (#513) * fix: run `pod repo update` after installing CocoaPods (#487) Added `pod repo update` command call after CocoaPods installation to avoid issues with pod command being unable to find specification for dependency. Added loader to CocoaPods installation step for consistency with other steps of init and better DX, removed logger info after 30s timeout because of redundancy with loader. Changed loader method before prompt for CocoaPods installation from `stop` to `info` for better prompt visibility. * always show installing pods step * add notice back * minor loader refactor * fix false positive for pod command being available * use pod --version for smaller output --- packages/cli/package.json | 1 - packages/cli/src/commands/init/init.js | 2 +- packages/cli/src/tools/installPods.js | 62 +++++++++++++++++--------- packages/cli/src/tools/loader.js | 11 ++--- yarn.lock | 5 --- 5 files changed, 48 insertions(+), 33 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index d33618da4..563ec7596 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,7 +28,6 @@ "@react-native-community/cli-platform-ios": "^2.2.0", "@react-native-community/cli-tools": "^2.0.2", "chalk": "^1.1.1", - "command-exists": "^1.2.8", "commander": "^2.19.0", "compression": "^1.7.1", "connect": "^3.6.5", diff --git a/packages/cli/src/commands/init/init.js b/packages/cli/src/commands/init/init.js index b55557fe8..35099c883 100644 --- a/packages/cli/src/commands/init/init.js +++ b/packages/cli/src/commands/init/init.js @@ -154,7 +154,7 @@ async function installDependencies({ npm?: boolean, loader: typeof Ora, }) { - loader.start('Installing all required dependencies'); + loader.start('Installing dependencies'); await PackageManager.installAll({ preferYarn: !npm, diff --git a/packages/cli/src/tools/installPods.js b/packages/cli/src/tools/installPods.js index 44947238a..04d6e9e5a 100644 --- a/packages/cli/src/tools/installPods.js +++ b/packages/cli/src/tools/installPods.js @@ -4,10 +4,8 @@ import execa from 'execa'; import chalk from 'chalk'; import Ora from 'ora'; import inquirer from 'inquirer'; -import commandExists from 'command-exists'; import {logger} from '@react-native-community/cli-tools'; - -const COCOAPODS_INSTALLATION_TIMEOUT = 30000; +import {NoopLoader} from './loader'; async function installPods({ projectName, @@ -16,6 +14,7 @@ async function installPods({ projectName: string, loader?: typeof Ora, }) { + loader = loader || new NoopLoader(); try { if (!fs.existsSync('ios')) { return; @@ -30,11 +29,12 @@ async function installPods({ } try { - await commandExists('pod'); + // Check if "pod" is available and usable. It happens that there are + // multiple versions of "pod" command and even though it's there, it exits + // with a failure + await execa('pod', ['--version']); } catch (e) { - if (loader) { - loader.stop(); - } + loader.info(); const {shouldInstallCocoaPods} = await inquirer.prompt([ { @@ -49,20 +49,23 @@ async function installPods({ ]); if (shouldInstallCocoaPods) { - // Show a helpful notice when installation takes more than usually - const cocoaPodsInstallationTimeMessage = setTimeout( - () => - logger.info('Installing CocoaPods, this may take a few minutes'), - COCOAPODS_INSTALLATION_TIMEOUT, - ); + loader.start('Installing CocoaPods'); + try { // First attempt to install `cocoapods` - await execa('gem', ['install', 'cocoapods']); + await execa('gem', ['install', 'cocoapods', '--no-document']); + loader.succeed(); } catch (_error) { try { // If that doesn't work then try with sudo - await execa('sudo', ['gem', 'install', 'cocoapods']); + await execa('sudo', [ + 'gem', + 'install', + 'cocoapods', + '--no-document', + ]); } catch (error) { + loader.fail(); logger.log(error.stderr); throw new Error( @@ -71,19 +74,36 @@ async function installPods({ )}`, ); } - } finally { - clearTimeout(cocoaPodsInstallationTimeMessage); } - // This only shows when `CocoaPods` is automatically installed, - // if it's already installed then we just show the `Installing dependencies` step - if (loader) { - loader.start('Installing CocoaPods dependencies'); + try { + loader.start( + `Updating CocoaPods repositories ${chalk.dim( + '(this make take a few minutes)', + )}`, + ); + await execa('pod', ['repo', 'update']); + } catch (error) { + // "pod" command outputs errors to stdout (at least some of them) + logger.log(error.stderr || error.stdout); + loader.fail(); + + throw new Error( + `Failed to update CocoaPods repositories for iOS project.\nPlease try again manually: "pod repo update".\nCocoaPods documentation: ${chalk.dim.underline( + 'https://cocoapods.org/', + )}`, + ); } } } try { + loader.succeed(); + loader.start( + `Installing CocoaPods dependencies ${chalk.dim( + '(this make take a few minutes)', + )}`, + ); await execa('pod', ['install']); } catch (error) { // "pod" command outputs errors to stdout (at least some of them) diff --git a/packages/cli/src/tools/loader.js b/packages/cli/src/tools/loader.js index 525cc5c9d..b0c480975 100644 --- a/packages/cli/src/tools/loader.js +++ b/packages/cli/src/tools/loader.js @@ -2,14 +2,15 @@ import Ora from 'ora'; import logger from './logger'; -class OraMock { +class OraNoop { succeed() {} fail() {} - start() {} + start(message?: string) {} + info(message?: string) {} } -function getLoader(): typeof Ora { - return logger.isVerbose() ? OraMock : Ora; +export function getLoader(): typeof Ora { + return logger.isVerbose() ? OraNoop : Ora; } -export {getLoader}; +export const NoopLoader = OraNoop; diff --git a/yarn.lock b/yarn.lock index b6ccd26b8..a7f24014f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2948,11 +2948,6 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -command-exists@^1.2.8: - version "1.2.8" - resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291" - integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw== - commander@^2.19.0, commander@~2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" From a82902d268d0bd7427f564d2e64180a7ca15264b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 10 Jul 2019 14:35:34 +0200 Subject: [PATCH 227/234] v2.4.0 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 1f93c59e6..c7fab95c1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.3.0", + "version": "2.4.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 563ec7596..c686c359e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.3.0", + "version": "2.4.0", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 681318f418b355a93c0aafcdbac9220292729836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 10 Jul 2019 22:10:07 +0200 Subject: [PATCH 228/234] fix: add chalk as dependency of cli-platform-android (#517) --- packages/cli/package.json | 2 +- packages/platform-android/package.json | 2 ++ packages/platform-ios/package.json | 3 ++- packages/platform-ios/src/commands/runIOS/index.js | 2 +- packages/tools/package.json | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index c686c359e..abc098fa6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -27,7 +27,7 @@ "@react-native-community/cli-platform-android": "^2.1.1", "@react-native-community/cli-platform-ios": "^2.2.0", "@react-native-community/cli-tools": "^2.0.2", - "chalk": "^1.1.1", + "chalk": "^2.4.2", "commander": "^2.19.0", "compression": "^1.7.1", "connect": "^3.6.5", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 0504518c2..287b8ece3 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,9 +1,11 @@ { "name": "@react-native-community/cli-platform-android", "version": "2.1.1", + "license": "MIT", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", + "chalk": "^2.4.2", "logkitty": "^0.5.0", "slash": "^2.0.0", "xmldoc": "^0.4.0" diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 811988d47..4bfb46e84 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,10 +1,11 @@ { "name": "@react-native-community/cli-platform-ios", "version": "2.2.0", + "license": "MIT", "main": "build/index.js", "dependencies": { "@react-native-community/cli-tools": "^2.0.2", - "chalk": "^1.1.1", + "chalk": "^2.4.2", "xcode": "^2.0.0" }, "files": [ diff --git a/packages/platform-ios/src/commands/runIOS/index.js b/packages/platform-ios/src/commands/runIOS/index.js index 4b36b6da2..5b7b3f5ae 100644 --- a/packages/platform-ios/src/commands/runIOS/index.js +++ b/packages/platform-ios/src/commands/runIOS/index.js @@ -91,7 +91,7 @@ function runIOS(_: Array, ctx: ConfigT, args: FlagsT) { if (device) { return logger.error( `Could not find a device named: "${chalk.bold( - device, + String(device), )}". ${printFoundDevices(devices)}`, ); } diff --git a/packages/tools/package.json b/packages/tools/package.json index 2510d106c..47641b49e 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,9 +1,10 @@ { "name": "@react-native-community/cli-tools", "version": "2.0.2", + "license": "MIT", "main": "build/index.js", "dependencies": { - "chalk": "^1.1.1", + "chalk": "^2.4.2", "lodash": "^4.17.5", "mime": "^2.4.1", "node-fetch": "^2.5.0" From 3a17d449d89766e3332419bbe75d715ce5de3c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 10 Jul 2019 22:11:07 +0200 Subject: [PATCH 229/234] v2.4.1 --- lerna.json | 2 +- packages/cli/package.json | 8 ++++---- packages/platform-android/package.json | 4 ++-- packages/platform-ios/package.json | 4 ++-- packages/tools/package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lerna.json b/lerna.json index c7fab95c1..ce1148eb2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.4.0", + "version": "2.4.1", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index abc098fa6..b102182ef 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.4.0", + "version": "2.4.1", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", @@ -24,9 +24,9 @@ }, "dependencies": { "@hapi/joi": "^15.0.3", - "@react-native-community/cli-platform-android": "^2.1.1", - "@react-native-community/cli-platform-ios": "^2.2.0", - "@react-native-community/cli-tools": "^2.0.2", + "@react-native-community/cli-platform-android": "^2.4.1", + "@react-native-community/cli-platform-ios": "^2.4.1", + "@react-native-community/cli-tools": "^2.4.1", "chalk": "^2.4.2", "commander": "^2.19.0", "compression": "^1.7.1", diff --git a/packages/platform-android/package.json b/packages/platform-android/package.json index 287b8ece3..6e3fad8b8 100644 --- a/packages/platform-android/package.json +++ b/packages/platform-android/package.json @@ -1,10 +1,10 @@ { "name": "@react-native-community/cli-platform-android", - "version": "2.1.1", + "version": "2.4.1", "license": "MIT", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.2", + "@react-native-community/cli-tools": "^2.4.1", "chalk": "^2.4.2", "logkitty": "^0.5.0", "slash": "^2.0.0", diff --git a/packages/platform-ios/package.json b/packages/platform-ios/package.json index 4bfb46e84..5cfd4a292 100644 --- a/packages/platform-ios/package.json +++ b/packages/platform-ios/package.json @@ -1,10 +1,10 @@ { "name": "@react-native-community/cli-platform-ios", - "version": "2.2.0", + "version": "2.4.1", "license": "MIT", "main": "build/index.js", "dependencies": { - "@react-native-community/cli-tools": "^2.0.2", + "@react-native-community/cli-tools": "^2.4.1", "chalk": "^2.4.2", "xcode": "^2.0.0" }, diff --git a/packages/tools/package.json b/packages/tools/package.json index 47641b49e..3ef5b4ac6 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli-tools", - "version": "2.0.2", + "version": "2.4.1", "license": "MIT", "main": "build/index.js", "dependencies": { From c58f3c116fd5505acd19800376e102161ca622b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 11 Jul 2019 10:34:34 +0200 Subject: [PATCH 230/234] fix: don't copy node_modules in templates (#519) --- .../commands/init/__tests__/template.test.js | 4 +- packages/cli/src/commands/init/template.js | 4 +- .../__tests__/__fixtures__/binary.keystore | Bin 0 -> 2257 bytes .../__tests__/__fixtures__/extraDir/file3 | 0 .../src/tools/__tests__/__fixtures__/file1.js | 1 + .../tools/__tests__/__fixtures__/file2.txt | 1 + .../cli/src/tools/__tests__/copyFiles.test.js | 61 ++++++++++++++++++ packages/cli/src/tools/copyFiles.js | 14 +++- 8 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 packages/cli/src/tools/__tests__/__fixtures__/binary.keystore create mode 100644 packages/cli/src/tools/__tests__/__fixtures__/extraDir/file3 create mode 100644 packages/cli/src/tools/__tests__/__fixtures__/file1.js create mode 100644 packages/cli/src/tools/__tests__/__fixtures__/file2.txt create mode 100644 packages/cli/src/tools/__tests__/copyFiles.test.js diff --git a/packages/cli/src/commands/init/__tests__/template.test.js b/packages/cli/src/commands/init/__tests__/template.test.js index 3af48b748..fc41fdce0 100644 --- a/packages/cli/src/commands/init/__tests__/template.test.js +++ b/packages/cli/src/commands/init/__tests__/template.test.js @@ -72,7 +72,9 @@ test('copyTemplate', async () => { TEMPLATE_NAME, TEMPLATE_DIR, ); - expect(copyFiles.default).toHaveBeenCalledWith(expect.any(String), CWD); + expect(copyFiles.default).toHaveBeenCalledWith(expect.any(String), CWD, { + exclude: [expect.any(RegExp)], + }); }); test('executePostInitScript', async () => { diff --git a/packages/cli/src/commands/init/template.js b/packages/cli/src/commands/init/template.js index 8e2f9dede..918a40be6 100644 --- a/packages/cli/src/commands/init/template.js +++ b/packages/cli/src/commands/init/template.js @@ -54,7 +54,9 @@ export async function copyTemplate( logger.debug(`Copying template from ${templatePath}`); - await copyFiles(templatePath, process.cwd()); + await copyFiles(templatePath, process.cwd(), { + exclude: [new RegExp(path.resolve(templatePath, 'node_modules'))], + }); } export function executePostInitScript( diff --git a/packages/cli/src/tools/__tests__/__fixtures__/binary.keystore b/packages/cli/src/tools/__tests__/__fixtures__/binary.keystore new file mode 100644 index 0000000000000000000000000000000000000000..364e105ed39fbfd62001429a68140672b06ec0de GIT binary patch literal 2257 zcmchYXEfYt8;7T1^dLH$VOTZ%2NOdOH5j5LYLtZ0q7x-V8_6gU5)#7dkq{HTmsfNq zB3ZqcAxeY^G10@?efK?Q&)M(qInVv!xjx+IKEL}p*K@LYvIzo#AZG>st5|P)KF1_Z;y){W{<7K{nl!CPuE z_^(!C(Ol0n8 zK13*rzAtW>(wULKPRYLd7G18F8#1P`V*9`(Poj26eOXYyBVZPno~Cvvhx7vPjAuZo zF?VD!zB~QG(!zbw#qsxT8%BSpqMZ4f70ZPn-3y$L8{EVbbN9$H`B&Z1quk9tgp5FM zuxp3pJ0b8u|3+#5bkJ4SRnCF2l7#DyLYXYY8*?OuAwK4E6J{0N=O3QNVzQ$L#FKkR zi-c@&!nDvezOV$i$Lr}iF$XEcwnybQ6WZrMKuw8gCL^U#D;q3t&HpTbqyD%vG=TeDlzCT~MXUPC|Leb-Uk+ z=vnMd(|>ld?Fh>V8poP;q;;nc@en$|rnP0ytzD&fFkCeUE^kG9Kx4wUh!!rpjwKDP zyw_e|a^x_w3E zP}}@$g>*LLJ4i0`Gx)qltL}@;mDv}D*xR^oeWcWdPkW@Uu)B^X&4W1$p6}ze!zudJ zyiLg@uggoMIArBr*27EZV7djDg@W1MaL+rcZ-lrANJQ%%>u8)ZMWU@R2qtnmG(acP z0d_^!t>}5W zpT`*2NR+0+SpTHb+6Js4b;%LJB;B_-ChhnU5py}iJtku*hm5F0!iql8Hrpcy1aYbT z1*dKC5ua6pMX@@iONI?Hpr%h;&YaXp9n!ND7-=a%BD7v&g zOO41M6EbE24mJ#S$Ui0-brR5ML%@|ndz^)YLMMV1atna{Fw<;TF@>d&F|!Z>8eg>>hkFrV)W+uv=`^F9^e zzzM2*oOjT9%gLoub%(R57p-`TXFe#oh1_{&N-YN z<}artH|m=d8TQuKSWE)Z%puU|g|^^NFwC#N=@dPhasyYjoy(fdEVfKR@cXKHZV-`06HsP`|Ftx;8(YD$fFXumLWbGnu$GMqRncXYY9mwz9$ap zQtfZB^_BeNYITh^hA7+(XNFox5WMeG_LtJ%*Q}$8VKDI_p8^pqX)}NMb`0e|wgF7D zuQACY_Ua<1ri{;Jwt@_1sW9zzdgnyh_O#8y+C;LcZq6=4e^cs6KvmK@$vVpKFGbQ= z$)Eux5C|Fx;Gtmv9^#Y-g@7Rt7*eLp5n!gJmn7&B_L$G?NCN`AP>cXQEz}%F%K;vUs{+l4Q{}eWW;ATe2 zqvXzxoIDy(u;F2q1JH7Sf;{jy_j})F+cKlIOmNfjBGHoG^CN zM|Ho&&X|L-36f}Q-obEACz`sI%2f&k>z5c$2TyTSj~vmO)BW~+N^kt`Jt@R|s!){H ze1_eCrlNaPkJQhL$WG&iRvF*YG=gXd1IyYQ9ew|iYn7r~g!wOnw;@n42>enAxBv*A zEmV*N#sxdicyNM=A4|yaOC5MByts}s_Hpfj|y<6G=o=!3S@eIFKDdpR7|FY>L&Wat&oW&cm&X~ z5Bt>Fcq(fgnvlvLSYg&o6>&fY`ODg4`V^lWWD=%oJ#Kbad2u~! zLECFS*??>|vDsNR&pH=Ze0Eo`sC_G`OjoEKVHY|wmwlX&(XBE<@sx3Hd^gtd-fNwUHsylg06p`U2y_={u}Bc { + cleanup(DIR); + fs.mkdirSync(DIR); +}); + +afterEach(() => { + cleanup(DIR); +}); + +test('copies text and binary files from source to destination', async () => { + const src = path.resolve(__dirname, './__fixtures__'); + await copyFiles(src, DIR); + + expect(fs.readdirSync(DIR)).toMatchInlineSnapshot(` + Array [ + "binary.keystore", + "extraDir", + "file1.js", + "file2.txt", + ] + `); + + ['binary.keystore', 'file1.js', 'file2.txt'].forEach(file => { + expect(fs.readFileSync(path.join(src, file))).toEqual( + fs.readFileSync(path.join(DIR, file)), + ); + }); + + expect(fs.readdirSync(path.join(DIR, 'extraDir'))).toMatchInlineSnapshot(` + Array [ + "file3", + ] + `); + + expect(fs.readFileSync(path.join(src, 'extraDir', 'file3'))).toEqual( + fs.readFileSync(path.join(DIR, 'extraDir', 'file3')), + ); +}); + +test('copies files from source to destination excluding directory', async () => { + const src = path.resolve(__dirname, './__fixtures__'); + await copyFiles(src, DIR, { + exclude: [new RegExp(path.join(src, 'extraDir'))], + }); + + expect(fs.readdirSync(DIR)).toMatchInlineSnapshot(` + Array [ + "binary.keystore", + "file1.js", + "file2.txt", + ] + `); +}); diff --git a/packages/cli/src/tools/copyFiles.js b/packages/cli/src/tools/copyFiles.js index 6f8206a05..e2e5fad66 100644 --- a/packages/cli/src/tools/copyFiles.js +++ b/packages/cli/src/tools/copyFiles.js @@ -11,12 +11,24 @@ import fs from 'fs'; import path from 'path'; import walk from './walk'; +type Options = { + exclude?: Array, +}; + /** * Copy files (binary included) recursively. */ -async function copyFiles(srcPath: string, destPath: string) { +async function copyFiles( + srcPath: string, + destPath: string, + options?: Options = {}, +) { return Promise.all( walk(srcPath).map(async absoluteSrcFilePath => { + const exclude = options.exclude; + if (exclude && exclude.some(p => p.test(absoluteSrcFilePath))) { + return; + } const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); await copyFile( absoluteSrcFilePath, From f81f53b01d3b86bb97b594e6e01197d94f94350e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 11 Jul 2019 10:37:53 +0200 Subject: [PATCH 231/234] v2.4.2 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index ce1148eb2..c5418a0d0 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.4.1", + "version": "2.4.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index b102182ef..521ba1b8b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.4.1", + "version": "2.4.2", "description": "React Native CLI", "license": "MIT", "main": "build/index.js", From 061454852ad23f36b8385a9fdf1a1ad19ec146dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 11 Jul 2019 12:48:34 +0200 Subject: [PATCH 232/234] fix: cache lazy project getter for perf when accessed repeatedly (#520) --- packages/cli/src/tools/config/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/tools/config/index.js b/packages/cli/src/tools/config/index.js index c7aa9a691..08afb4e72 100644 --- a/packages/cli/src/tools/config/index.js +++ b/packages/cli/src/tools/config/index.js @@ -64,6 +64,7 @@ function getDependencyConfig( * Loads CLI configuration */ function loadConfig(projectRoot: string = process.cwd()): ConfigT { + let lazyProject; const userConfig = readConfigFromDisk(projectRoot); const initialConfig: ConfigT = { @@ -84,14 +85,19 @@ function loadConfig(projectRoot: string = process.cwd()): ConfigT { platforms: Object.keys(userConfig.platforms), }, get project() { - const project = {}; + if (lazyProject) { + return lazyProject; + } + + lazyProject = {}; for (const platform in finalConfig.platforms) { - project[platform] = finalConfig.platforms[platform].projectConfig( + lazyProject[platform] = finalConfig.platforms[platform].projectConfig( projectRoot, userConfig.project[platform] || {}, ); } - return project; + + return lazyProject; }, }; From db0ae51cc0005b7102744896265bb42f6455533e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 11 Jul 2019 12:54:05 +0200 Subject: [PATCH 233/234] adjust build-clean and publish scirpts --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d731ffe7b..30d6f00d5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "prebuild": "yarn build:ts", "build": "node ./scripts/build.js", "build:ts": "node ./scripts/buildTs.js", - "build-clean": "rm -rf ./packages/*/build ./packages/*/tsconfig.tsbuildinfo", + "build-clean": "rm -rf ./packages/*/build", + "build-clean-with-ts-cache": "rm -rf ./packages/*/build ./packages/*/tsconfig.tsbuildinfo", "watch": "node ./scripts/watch.js", "test": "jest", "test:ci:unit": "jest packages --ci --coverage", @@ -16,7 +17,7 @@ "test:ci:cocoapods": "ruby packages/platform-ios/native_modules.rb", "flow-check": "flow check", "postinstall": "yarn build", - "publish": "yarn build-clean && yarn build && lerna publish" + "publish": "yarn build-clean && yarn install && lerna publish" }, "dependencies": { "@babel/core": "^7.0.0", From 2fe51156cf27fd71212db32eec0ee6122c1c49f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 11 Jul 2019 12:55:25 +0200 Subject: [PATCH 234/234] v2.4.3 --- lerna.json | 2 +- packages/cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index c5418a0d0..6417ed7a9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.10.6", - "version": "2.4.2", + "version": "2.4.3", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/cli/package.json b/packages/cli/package.json index 521ba1b8b..de2b23148 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/cli", - "version": "2.4.2", + "version": "2.4.3", "description": "React Native CLI", "license": "MIT", "main": "build/index.js",