How to use the mrm-core.template function in mrm-core

To help you get started, we’ve selected a few mrm-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sapegin / mrm / src / tasks / contributing / index.js View on Github external
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';
github sapegin / mrm / src / tasks / readme / index.js View on Github external
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();
	}
}
github sapegin / mrm / src / tasks / license / index.js View on Github external
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';