Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(filePath => {
if (filePath == null) {
return Promise.reject();
}
const pkg = JSON.parse(fs.readFileSync(filePath));
pkg['browserslist'] = defaultBrowsers;
fs.writeFileSync(filePath, JSON.stringify(pkg, null, 2) + os.EOL);
browserslist.clearCaches();
console.log();
console.log(
`${chalk.green('Set target browsers:')} ${chalk.cyan(
defaultBrowsers.join(', ')
)}`
);
console.log();
})
// Swallow any error
.then(filePath => {
if (filePath == null) {
return Promise.reject();
}
const pkg = JSON.parse(fs.readFileSync(filePath));
pkg['browserslist'] = defaultBrowsers;
fs.writeFileSync(filePath, JSON.stringify(pkg, null, 2) + os.EOL);
browserslist.clearCaches();
console.log();
console.log(
`${chalk.green('Set target browsers:')} ${chalk.cyan(
defaultBrowsers.join(', ')
)}`
);
console.log();
})
// Swallow any error