forked from react-native-community/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…act-native-community#447) * wip * add warnings for run-ios and run-android * memoize in place * cleanup
- Loading branch information
Showing
9 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/platform-android/src/link/warnAboutManuallyLinkedLibs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<typeof getLinkConfig> = 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.`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/platform-ios/src/link/warnAboutManuallyLinkedLibs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<typeof getLinkConfig> = 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.`, | ||
); | ||
} | ||
} |