Home

mrm 管理你的多个json

mrm

对自己众多的配置文件,烦恼吗 ?!

就像下面这些

codecov contributing editorconfig eslint gitignore jest license lintstaged package prettier readme semantic-release styleguidist stylelint travis typescript

mrm 项目

帮助你管理你的配置

npx mrm gitignore
// 一个 .gitignore 就在运行目录

如何定义

mkdir ~/dotfiles || cd ~/dotfiles && mkdir mrm || cd mrm

npm init -y
npm i --save mrm-core

gitignore

~/dotfiles/mrm/<Task>/index.js

// Mrm module to work with new line separated text files
const {lines} = require('mrm-core');

function task() {
  // Read .gitignore if it exists
  lines('.gitignore')
    // Add lines that do not exist in a file yet,
    // but keep all existing lines
    .add(['node_modules/', '.DS_Store'])
    // Update or create a file
    .save();
}

task.description = 'Adds .gitignore';
module.exports = task;
cd you-project
npx mrm gitignore

.gitignore 就被创建,并以 ~/dotfiles/mrm/gitignore/index.js

node_modules/
.DS_Store%

更具体, 需要参考项目 write-you-own-task