How to use the mrm-core.install 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 / jest / index.js View on Github external
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';
github sapegin / mrm / src / tasks / lintstaged / index.js View on Github external
module.exports = function() {
	// package.json
	json('package.json')
		.merge({
			scripts: {
				precommit: 'lint-staged',
			},
			'lint-staged': {
				'*.js': ['eslint --fix', 'git add'],
			},
		})
		.save();

	// package.json: dependencies
	install(packages);
};
module.exports.description = 'Adds lint-staged';
github sapegin / mrm / src / tasks / eslint / index.js View on Github external
}
	}

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

	// package.json
	const pkg = packageJson();

	pkg
		// Add lint script
		.setScript('lint:css', `stylelint '**/*${ext}'`)
		// Add pretest script
		.prependScript('pretest', 'npm run lint:css')
		.save();

	// Dependencies
	install(packages);
}