MEMI, a smart task-runner for JSer

3846masa
3846masa
Sep 13, 2018 · 2 min read

TL;DR

Why create a new task-runner?

Inspired by mimorisuzuko/memi (Japanese).

This requires the following:

  • The new task-runner allows users to write write the tasks in JavaScript; it is difficult for me to write Shell Script and Makefiles.
  • Can use it anywhere; I would like to avoid putting node_modules or package.json in a non-Node.js working directory.
  • Put the dependencies in a directory except npm root -g; it is not cool to install them globally.

Issues of existing task-runners

Makefile
Shell Script is difficult, e.g. in Windows, it is troubling to install a make command.

npm scripts
I hate to put package.json in a non-Node.js working directory.

gulp
Although dependencies of gulp should be installed globally or locally, I hate to put node_modules in a non-Node.js working directory and to install dependencies to npm root -g.

MEMI, a smart task-runner

First, you define tasks via Memifile.js.

Or, you can use a named exports.

Also, you can write as CommonJS.

Typing memi <taskname> allows you to run the task. For example, if you would like to run a build task, you should type memi build.

Then, MEMI finds up Memifile.js recursively. So MEMI can work on subdirectories.

In the other words, if you want to run MEMI anywhere, you should put Memifile.js in a home directory.

When you pass arguments as memi <taskname> arg1 arg2 ..., the task function receives as function arguments. Also, MEMI allows you to use node modules for CLI (e.g. Inquirer).

It is notable that MEMI will install dependencies automatically! For example, when you write Memifile.js as the above, MEMI installs fs-extra and execa.

A directory whre the dependencies are installed by MEMI is $HOME/.memi or %USERPROFILE%\.memi, and thus you don't have to install the dependencies globally nor locally.


In summary, you can write the tasks in JavaScript easily, and if you putting Memifile.js in the home directory, you can use MEMI anywhere.

MIME is the task-runner that can be used casually and in full swing.

Please try to use MEMI once!

BTW: Medium API and MEMI

I wrote this article in markdown via VSCode, and I posted it from Medium API via Memifile.js.

When I type memi medium filename.md, the article is posted via Medium API, and then the draft URL opens.

This is very simple code, but re-usable thanks to MEMI.

BTW: What’s MEMI?

MEMI was named after Memi Kakizaki (柿崎芽実), who is a member of Keyakizaka46.

3846masa

Written by

3846masa

Web Developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade