memi

Simple task-runner with JavaScript.

Usage no npm install needed!

<script type="module">
  import memi from 'https://cdn.skypack.dev/memi';
</script>

README

MEMI

NPM

Simple task-runner with JavaScript.

MEMI is simple task-runner, inspired by mimorisuzuko/memi.

  • Write tasks with JavaScript
  • Auto install dependencies

Install

npm i -g memi
# When you install via yarn, you should install `npm` too.
yarn global add npm memi

Usage

  1. Put Memifile on working directory

    • MEMI loads Memifile named as below
      • Memifile / .memifile
      • Memifile.{js,mjs} / .memifile.{js,mjs}
  2. Write task functions as module

    • See example

      import inquirer from 'inquirer';
      import cowsay from 'cowsay';
      
      export default {
        async start() {
          const { text } = await inquirer.prompt([
            {
              name: 'text',
              message: "How's it going?",
            },
          ]);
          this.echo(text);
        },
        echo(text = 'Hello Memi!') {
          console.log(cowsay.say({ text }));
        },
      };
      
  3. Run task

    memi <taskname> [<args>...]
    

Tips: Useful libraries when you write tasks

  • execa - npm
    • A better child_process
  • fs-extra - npm
    • Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
  • shelljs - npm
    • Portable Unix shell commands for Node.js
  • simple-git - npm
    • A light weight interface for running git commands in any node.js application.
  • glob - npm
    • Match files using the patterns the shell uses, like stars and stuff.
  • opn - npm
    • A better node-open. Opens stuff like websites, files, executables. Cross-platform.
  • inquirer - npm
    • A collection of common interactive command line user interfaces.

Note

  • Auto-installed dependencies are in $HOME/.memi/node_modules.
    • For Windows: %USERPROFILE%\.memi\node_modules.

Contribute

PRs accepted.

What's MEMI?

MEMI have been named after Memi Kakizaki (柿崎芽実).

License

MIT © 3846masa

Buy Me A Coffee