@percy/config
Advanced tools
Comparing version 1.0.0-beta.29 to 1.0.0-beta.30
@@ -49,3 +49,4 @@ "use strict"; | ||
reload = false, | ||
bail = false | ||
bail = false, | ||
print = false | ||
} = {}) { | ||
@@ -55,3 +56,6 @@ var _Array$from; | ||
// load cached config; when no path is specified, get the last config cached | ||
let config = path ? cache.get(path) : (_Array$from = Array.from(cache)[cache.size - 1]) === null || _Array$from === void 0 ? void 0 : _Array$from[1]; // load config or reload cached config | ||
let config = path ? cache.get(path) : (_Array$from = Array.from(cache)[cache.size - 1]) === null || _Array$from === void 0 ? void 0 : _Array$from[1]; | ||
let infoDebug = print ? 'info' : 'debug'; | ||
let errorDebug = print ? 'error' : 'debug'; | ||
let log = (0, _logger.default)('config'); // load config or reload cached config | ||
@@ -63,6 +67,6 @@ if (path !== false && (!config || reload)) { | ||
if (result && result.config) { | ||
_logger.default.debug(`Found config file: ${(0, _path.relative)('', result.filepath)}`); | ||
log[infoDebug](`Found config file: ${(0, _path.relative)('', result.filepath)}`); | ||
if (result.config.version !== 2) { | ||
_logger.default.warn('Ignoring config file - ' + (!result.config.version ? 'missing version' : 'unsupported version')); | ||
log.warn('Ignoring config file - ' + (!result.config.version ? 'missing version' : 'unsupported version')); | ||
} else { | ||
@@ -73,8 +77,7 @@ config = result.config; | ||
} else { | ||
_logger.default.debug('Config file not found'); | ||
log[infoDebug]('Config file not found'); | ||
} | ||
} catch (error) { | ||
_logger.default.debug('Failed to load or parse config file'); | ||
_logger.default.debug(error); | ||
log[errorDebug]('Failed to load or parse config file'); | ||
log[errorDebug](error); | ||
} | ||
@@ -88,3 +91,3 @@ } // merge found config with overrides and validate | ||
if (validation && !validation.result) { | ||
_logger.default.warn('Invalid config:'); | ||
log.warn('Invalid config:'); | ||
@@ -95,4 +98,3 @@ for (let { | ||
} of validation.errors) { | ||
_logger.default.warn(`- ${path.join('.')}: ${message}`); | ||
log.warn(`- ${path.join('.')}: ${message}`); | ||
let [k, t] = [path.pop(), path.reduce((d, p) => d[p], config)]; | ||
@@ -107,5 +109,5 @@ if (t && k in t) delete t[k]; | ||
config = (0, _normalize.default)(config); | ||
if (config) _logger.default.debug(`Using config:\n${(0, _stringify.inspect)(config)}`); // merge with defaults | ||
if (config) log[infoDebug](`Using config:\n${(0, _stringify.inspect)(config)}`); // merge with defaults | ||
return (0, _defaults.default)(config); | ||
} |
{ | ||
"name": "@percy/config", | ||
"version": "1.0.0-beta.29", | ||
"version": "1.0.0-beta.30", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@percy/logger": "^1.0.0-beta.29", | ||
"@percy/logger": "^1.0.0-beta.30", | ||
"ajv": "^7.0.3", | ||
@@ -35,3 +35,3 @@ "cosmiconfig": "^7.0.0", | ||
}, | ||
"gitHead": "d8ece55981a5b9ef52abda65783c2aa874ac87e6" | ||
"gitHead": "584a401d8cb349a90d0eea964c6ac2a3682591f1" | ||
} |
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
16440
325
Updated@percy/logger@^1.0.0-beta.30