Skip to content
/ mrm Public
forked from sapegin/mrm

Codemods for your project configuration

License

Notifications You must be signed in to change notification settings

TheLarkInn/mrm

 
 

Repository files navigation

Marmot (mrm)

Build Status npm

Command line tool to help you keep dotfiles (.gitignore, .eslintrc, etc.) of all your open source project in sync.

Features

  • Will not overwrite your date if you don’t want
  • Has tools to work with JSON, YAML, INI, Markdown and text files
  • Has bunch customizable taks (see the list below)
  • Easy to write your own tasks

Motivation

Most of the available tools are template based. It works moderately well for new project generation but doesn’t work well for updating. Marmot’s approach is closer to codemods than templates.

Installation

npm install -g mrm

Usage

  • mrm — Print list of task
  • mrm <task> — Run taks

Configuration

Create ~/.mrm/config.json or ~/dotfiles/mrm/config.json:

{
    "name": "Tobias Müller",
    "email": "tobias2000@gmail.com",
    "url": "http://tobias2000.io",
    "github": "tobias2000",
    "indent": "tab", // "tab" or number of spaces
    "readme", "Readme.md", // Name of readme file
    "license", "License.md", // Name of license file
    "aliases": {  // Aliases to run multiple tasks at once
        "node": ["license", "readme", "package", "editorconfig", "eslint", "gitignore"]
    }
}

Tasks

editorconfig

Adds .editorconfig.

eslint

Adds .eslintrc and .eslintignore, adds npm script and inistalls dependencies.

Config options:

  • eslintPreset — preset name (not npm package name, by default will instal eslint:recommended preset)

gitignore

Adds .gitignore with node_modules, logs and artifacts of popular code editors.

license

Adds MIT license file.

lintstaged

Adds lint-staged: creates .lintstagedrc, sets up pre-commit Git hook and inistalls dependencies.

package

Creates package.json and adds npm badge to Readme.

readme

Creates readme file.

travis

Creates .travis.ymland adds Travis CI badge to Readme.

Custom tasks

Create either ~/.mrm/<taskname>/index.js or ~/dotfiles/mrm/<taskname>/index.js. If <taskname> is the same as one of the internal tasks, then your task will override internal one:

const { /* ... */ } = require('mrm-core');
module.exports = function(config) {
  // config('name', 'default value') - config value
  // config() - all config values
};
module.exports.description = 'Taks description';

See mrm-core library for useful functions for your tasks.

You can find some examples here or check code of internal tasks.

Changelog

The changelog can be found on the Releases page.

Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

Authors and license

Artem Sapegin and contributors.

MIT License, see the included License.md file.

About

Codemods for your project configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%