Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(config) {
// Create Contributing.md (no update)
const filename = 'Contributing.md';
const readme = template(filename, path.join(__dirname, filename));
if (!readme.get()) {
readme
.apply(config(), {
package: path.basename(process.cwd()),
})
.save()
;
}
};
module.exports.description = 'Adds contributing guidelines';
function task(config) {
const { name, url, github, readmeFile, licenseFile } = config
.defaults({ github: gitUsername(), readmeFile: 'Readme.md', licenseFile: 'License.md' })
.defaults(meta)
.require('name', 'url', 'github')
.values();
// Create Readme.md (no update)
const readme = template(readmeFile, path.join(__dirname, 'Readme.md'));
if (!readme.exists()) {
readme
.apply({
name,
url,
github,
license: licenseFile,
package: packageJson().get('name'),
})
.save();
}
}
const { name, email, url, licenseFile } = config
.defaults({ licenseFile: 'License.md' })
.defaults(meta)
.require('name', 'email', 'url')
.values();
const pkg = packageJson();
const license = pkg.get('license', defaultLicense);
const templateFile = path.join(__dirname, `templates/${license}.md`);
if (!fs.existsSync(templateFile)) {
console.log(`No template for the "${license}" found, skipping`);
return;
}
template(licenseFile, templateFile)
.apply({
name,
email,
url,
year: new Date().getFullYear(),
})
.save();
}
task.description = 'Adds license file';