1.0.0 • Published 4 years ago

makreo v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Automate repetitive manipulations with your codebase. Or create a codebase generator. Or something else.

Features

  • Both API and CLI usage
  • Human readable ao-down format
  • Manipulation with files
  • Installing and uninstalling npm packages

Usage

CLI

1. Install makreo globaly

yarn global add makreo
# OR
npm install -g makreo

2. Write some macros

3. Use

makreo --help

  Usage
    $ makreo [path to your macros directory]

  Examples
    $ makreo ~/Documents/Macros

API

1. Add makreo to your dev dependencies

yarn add -D makreo
# OR
npm install -dev makreo

2. Create your makreo file

// makreo.js contents
require('makreo')('your/macro/directory')

3. Write some macros and add them to this directory

4. Done! You can now use your macros!

node makreo.js

Tip: You may also add it to your npm scripts!

Docs

How to create a macro

All makreo macros must be named as <name>.macro.md.

Macros are written in the ao-down format:

Everything not matching the syntax is considered a comment

// Action parameter is required by makreo
`Action:` Action name

// Other parameters depend on Action
`First parameter:` Inline value

`Second parameter:`
^
| Specifying the language isn't required

Multiline value

`Third parameter:` 

---

`Action:` Another action name

...

Actions

Insert

ParameterDescription
targetPath to the file(s) you want to modify. Supports wildcards.
regexThis defines where the Content will be placed (see Position).
positionIs either before or after. Defines whether the Content is placed before or after the RegEx match.
contentThe text you want to insert.

Replace

ParameterDescription
TargetPath to the file(s) you want to modify. Supports wildcards.
RegExThis defines what should be replaced by Content.
ContentThe text you want to replace RegEx match by.

New file

ParameterDescription
PathPath to the directory you want to create a file in. Supports wildcards.
FilenameA name for your file
ContentThe text you want to insert into the new file

New folder

ParameterDescription
PathPath to the directory you want to create a folder in. Supports wildcards.
Folder nameA name for your folder

Install

ParameterDescription
PackageName of the package you want to install from npm.
Project rootDefines where to run the install comand.

Uses yarn if lock present in Project root.

Uninstall

ParameterDescription
PackageName of the package you want to uninstall.
Project rootDefines where to run the uninstall comand.

Uses yarn if lock present in Project root.