Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
travisYml
// Add global semantic-release runner to .travis.yml
.merge({
after_success: [
`npm install -g semantic-release`,
'semantic-release pre && npm publish && semantic-release post',
],
branches: {
except: ['/^v\\d+\\.\\d+\\.\\d+$/'],
},
})
.save();
// Add Changelog.md to .gitignore
lines('.gitignore').add(config('changelog', 'Changelog.md')).save();
// 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 = function() {
// .gitignore
lines('.gitignore').remove(badIgnores).add(ignores).save();
};
module.exports.description = 'Adds .gitignore';
},
});
}
// Clean up old scripts
pkg
.removeScript(/^mocha|mocha:.*?|ava|ava:.*?|test:mocha|test:ava$/)
.removeScript('test', /mocha|ava/);
// package.json: test command
pkg.appendScript('test', 'npm run test:jest');
pkg.save();
// .gitignore
lines('.gitignore').add('coverage/').save();
// .npmignore
lines('.npmignore').add('__tests__/').save();
// 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');
.removeScript('test', /mocha|ava/);
// package.json: test command
pkg.appendScript('test', 'npm run test:jest');
pkg.save();
// .gitignore
lines('.gitignore').add('coverage/').save();
// .npmignore
lines('.npmignore').add('__tests__/').save();
// 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
// Clean up old scripts
pkg
.removeScript(/^mocha|mocha:.*?|ava|ava:.*?|test:mocha|test:ava$/)
.removeScript('test', /mocha|ava/);
// package.json: test command
pkg.appendScript('test', 'npm run test:jest');
pkg.save();
// .gitignore
lines('.gitignore').add('coverage/').save();
// .npmignore
lines('.npmignore').add('__tests__/').save();
// 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