Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// ESLint
if (pkg.get(`devDependencies.eslint`)) {
const eslintignore = lines('.eslintignore').add('coverage/*');
if (hasBabel) {
eslintignore.add('lib/*');
}
eslintignore.save();
}
// Test template for small projects
if (fs.existsSync('index.js') && !fs.existsSync('test')) {
copyFiles(__dirname, 'test.js');
}
// Dependencies
uninstall(oldPackages);
install(packages);
// Suggest jest-codemods if projects used other test frameworks
if (needsMigration) {
console.log(`\nMigrate your tests to Jest:
npm i -g jest-codemods@latest
jest-codemods
More info:
https://github.com/skovhus/jest-codemods
`);
}
};
module.exports.description = 'Adds Jest';
// Add npm package version badge to Readme.md
const name = pkg.get('name');
const readme = markdown(config('readme', 'Readme.md'));
if (readme.exists()) {
readme
.addBadge(
`https://img.shields.io/npm/v/${name}.svg`,
`https://www.npmjs.com/package/${name}`,
'npm'
)
.save();
}
// Dependencies
uninstall(PACKAGE_NAME);
};
module.exports.description = 'Adds semantic-release';
exts = ` --ext ${args.ext}`;
}
}
pkg
// Remove existing JS linters
.removeScript(/^(lint:js|eslint|jshint|jslint)$/)
.removeScript('test', / (lint|lint:js|eslint|jshint|jslint)( |$)/)
// Add lint script
.setScript('lint', 'eslint . --cache --fix' + exts)
// Add pretest script
.prependScript('pretest', 'npm run lint')
.save();
// Dependencies
uninstall(oldPackages);
install(packages);
}