@guardian/paparazzi
Advanced tools
Comparing version 0.1.2 to 0.2.0
32
index.js
@@ -13,22 +13,12 @@ #!/usr/bin/env node | ||
const getConfig = () => { | ||
const defaultConfig = { | ||
sizes: { | ||
phone: { | ||
width: 375, | ||
height: 1100, | ||
}, | ||
}, | ||
out: 'screenshots', | ||
screenshot: {}, | ||
}; | ||
const fetchConfigFile = file => { | ||
try { | ||
const handle = readFileSync(resolve(process.cwd(), config), 'utf8'); | ||
return { | ||
...defaultConfig, | ||
...JSON.parse(handle), | ||
}; | ||
return require(file); | ||
} catch (error) { | ||
console.error(chalk.red(`error! ${error}`)); | ||
return defaultConfig; | ||
try { | ||
return JSON.parse(readFileSync(resolve(process.cwd(), config), 'utf8')); | ||
} catch (error) { | ||
console.error(chalk.red(`error! ${error}`)); | ||
return {}; | ||
} | ||
} | ||
@@ -38,3 +28,7 @@ }; | ||
const getConfigOrFail = () => { | ||
const conf = getConfig(); | ||
const conf = { | ||
...fetchConfigFile(resolve(__dirname, '.defaultpaparazzirc')), | ||
...fetchConfigFile(resolve(process.cwd(), config)), | ||
}; | ||
if (!conf.prefix || !conf.routes || !conf.out) { | ||
@@ -41,0 +35,0 @@ console.error( |
{ | ||
"name": "@guardian/paparazzi", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Automated manual visual regression testing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
4808
4
65
2