@react-native-community/cli-config
Advanced tools
Comparing version 9.0.0-alpha.2 to 9.0.0-alpha.3
@@ -18,12 +18,2 @@ "use strict"; | ||
function _chalk() { | ||
const data = _interopRequireDefault(require("chalk")); | ||
_chalk = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _cliTools() { | ||
@@ -104,17 +94,4 @@ const data = require("@react-native-community/cli-tools"); | ||
const localDependencyRoot = userConfig.dependencies[dependencyName] && userConfig.dependencies[dependencyName].root; | ||
let root; | ||
let config; | ||
try { | ||
root = localDependencyRoot || (0, _cliTools().resolveNodeModuleDir)(projectRoot, dependencyName); | ||
config = (0, _readConfigFromDisk.readDependencyConfigFromDisk)(root); | ||
} catch (error) { | ||
_cliTools().logger.warn((0, _cliTools().inlineString)(` | ||
Package ${_chalk().default.bold(dependencyName)} has been ignored because it contains invalid configuration. | ||
Reason: ${_chalk().default.dim(error.message)}`)); | ||
return acc; | ||
} | ||
let root = localDependencyRoot || (0, _cliTools().resolveNodeModuleDir)(projectRoot, dependencyName); | ||
let config = (0, _readConfigFromDisk.readDependencyConfigFromDisk)(root, dependencyName); | ||
const isPlatform = Object.keys(config.platforms).length > 0; | ||
@@ -121,0 +98,0 @@ return (0, _assign.default)({}, acc, { |
@@ -11,3 +11,3 @@ import { UserConfig, UserDependencyConfig } from '@react-native-community/cli-types'; | ||
*/ | ||
export declare function readDependencyConfigFromDisk(rootFolder: string): UserDependencyConfig; | ||
export declare function readDependencyConfigFromDisk(rootFolder: string, dependencyName: string): UserDependencyConfig; | ||
//# sourceMappingURL=readConfigFromDisk.d.ts.map |
@@ -23,2 +23,22 @@ "use strict"; | ||
function _cliTools() { | ||
const data = require("@react-native-community/cli-tools"); | ||
_cliTools = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _chalk() { | ||
const data = _interopRequireDefault(require("chalk")); | ||
_chalk = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
@@ -60,3 +80,3 @@ | ||
function readDependencyConfigFromDisk(rootFolder) { | ||
function readDependencyConfigFromDisk(rootFolder, dependencyName) { | ||
const explorer = (0, _cosmiconfig().default)('react-native', { | ||
@@ -68,6 +88,13 @@ stopDir: rootFolder, | ||
const config = searchResult ? searchResult.config : emptyDependencyConfig; | ||
const result = schema.dependencyConfig.validate(config); | ||
const result = schema.dependencyConfig.validate(config, { | ||
abortEarly: false | ||
}); | ||
if (result.error) { | ||
throw new _errors.JoiError(result.error); | ||
const validationError = new _errors.JoiError(result.error); | ||
_cliTools().logger.warn((0, _cliTools().inlineString)(` | ||
Package ${_chalk().default.bold(dependencyName)} contains invalid configuration: ${_chalk().default.bold(validationError.message)}. | ||
Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.`)); | ||
} | ||
@@ -74,0 +101,0 @@ |
{ | ||
"name": "@react-native-community/cli-config", | ||
"version": "9.0.0-alpha.2", | ||
"version": "9.0.0-alpha.3", | ||
"license": "MIT", | ||
@@ -11,3 +11,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@react-native-community/cli-tools": "^9.0.0-alpha.0", | ||
"@react-native-community/cli-tools": "^9.0.0-alpha.3", | ||
"cosmiconfig": "^5.1.0", | ||
@@ -34,3 +34,3 @@ "deepmerge": "^3.2.0", | ||
}, | ||
"gitHead": "61797e4c71a655f613fb9a38d41c73013fea9d60" | ||
"gitHead": "379ca2d095943b498d18dfefb33e88ffc877f698" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59308
587