How to use the mrm-core.MrmError 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 / codecov / index.js View on Github external
const travisYml = yaml('.travis.yml');

	// Require .travis.yml
	if (!travisYml.exists()) {
		throw new MrmError(
			`Run travis task first:

  mrm travis`
		);
	}

	const pkg = packageJson();

	// Require coverage npm script
	if (!pkg.getScript(coverageScript)) {
		throw new MrmError(
			`${coverageScript} npm script not found. To add Jest run:

  mrm jest`
		);
	}

	// .travis.yml
	if (!travisYml.get('after_success', []).includes(uploadCommand)) {
		travisYml
			.merge({
				script: [`npm run ${coverageScript}`],
				after_success: [uploadCommand],
			})
			.save();
	}