Utilities to make tasks for Mrm
New API method:
const { deleteFiles } = require('mrm-core')
deleteFiles('file name 1') // Delete file or folder
deleteFiles(['file name 1', 'folder name 1']) // Delete files or folders
Minor bug fixes and UI improvements.
Fix TypeScript typings.
packageJson().removeScript()
method to remove scripts from package.json:
const { packageJson } = require('mrm-core')
const file = packageJson({ default: 'values' })
file.removeScript('test') // Remove script
file.removeScript(/^mocha|ava$/) // Remove all scripts that match a regexp
file.removeScript('test', /b/) // Remove subcommands from a script: a && b -> a
uninstall()
method to remove npm packages
const { uninstall } = require('mrm-core')
uninstall('eslint') // Uninstall from devDependencies
uninstall(['tamia', 'lodash'], { dev: false }) // Uninstall from dependencies
packageJson()
.lines()
.Always use npm to install packages: do not try to use Yarn.
New API to work with package.json
:
const { packageJson } = require('mrm-core')
const file = packageJson({ default: 'values' })
file.exists() // File exists?
file.get() // Return everything
file.getScript('test') // Return script
file.setScript('test', 'jest') // Replace a script with a command: a -> b
file.appendScript('test', 'jest') // Append command to a script: a -> a && b
file.prependScript('test', 'jest') // Prepend a script with a command: a -> b && a
file.save() // Save file
// All methods of json() work too
Example:
packageJson()
.appendScript('lint', 'eslint . --ext .js --fix')
.save();