Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multi-proc

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multi-proc

Run multiple processes and view their output combined in a single terminal

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

multi-proc

Run multiple command line operations at the same time. For example, if you want to run your Express backend alongside the Vue frontend, you could use this package to run both from the same terminal instance, and view both logs at the same time.

multi-proc in action

Windows:

This was developed and tested on only OSX and *nix. Windows has not been tested, but it should work with cmd syntax for commands. Cannot guarantee it.

Usage

Installation

You can install it locally or globally:

# Global (Recommended)
npm install -g multi-proc
yarn global add multi-proc

# Local
npm install multi-proc
yarn add multi-proc

Globally would a be a pretty good move if you want to use it outside of a project, so you wouldn't have to create a package.json before using it.

Configuration

Generate a configuration file using the init command This hasn't been implemented yet. It's just a json file, so... make it yourself.

multi-proc init

This will generate a file in the working directory called multi-proc.config.json. Paths in this file are not relative to the config file, but to the working directory when the command is called.

[
  {
    "tag": "Process 1",
    "color": "BG_BLUE",
    "command": "yarn start",
    "directory": "/path/to/process1"
  },
  {
    "tag": "Process 2",
    "color": "BG_GREEN",
    "command": "npm run start",
    "directory": "/path/to/process2"
  }
]

This file could also be a .js file as well:

// multi-proc.config.js
module.exports = [
  {
    tag: "Process 1",
    color: "BG_BLUE",
    command: "yarn start",
    directory: "/path/to/process1"
  },
  ...
]
tag

This is the string that is displayed in the terminal output at the beginning of the line when the process prints a line.

color

This is the colorization of the tag when the process outputs a message. Any of the enum names here, such as "BLUE", "BG_RED", "UNDERSCORE", are valid options.

command

Specify the command to start each process. This doesn't have to start a node script, could be any bash command. Be careful when you have to escape characters.

"command": "cd some/directory && yarn start"
directory

Specify the working directory for the "command" to run from. This path should be relative to where the command is used from.

Running

# Run the processes in multi-proc.config.json
multi-proc start

# Filter and only output tags that match regex
multi-proc start --filter 'proc.*?1'

# Run the processes in a specific config file
multi-proc --config path/to/config.json start

# View all commands/options
multi-proc --help

Example 1: Vue + Express

In this case, you only need to run both in the Vue frontend, as the frontend is dependent on the backend.

$ pwd
/home/aklinker1/workspace/Gamer-Elite

$ ls
... express-backend/ ... vue-frontend/ ...

$ cd vue-frontend

$ ls
... multi-proc.config.json ... package.json ...

$ cat multi-proc.config.json
[
  {
    "tag": "Express",
    "color": "BG_BLUE",
    "command": "yarn start:dev",
    "directory": "../express-backend"
  },
  {
    "tag": "Vue",
    "color": "BG_TEAL",
    "command": "yarn serve",
  }
]

$ multi-proc start

Example 2

$ pwd
/home/aaron/programming

$ ls
node-project-1/  node-project-2/  multi-proc.config.json

$ cat multi-proc.config.json
[
  {
    "tag": "Process 1",
    "color": "BG_BLUE",
    "command": "yarn start:dev",
    "directory": "programming/node-project-1"
  },
  {
    "tag": "Project 2",
    "color": "BG_GREEN",
    "command": "cd programming/node-project-2 && node src/index.js"
  }
]

$ cd ..

$ pwd 
/home/aaron

# Note because this isn't running in /home/aaron/programming, I had to add programming/* for the directory on the node-project-1 process and the cd for the node-project-2 process
# Paths in the config need to be relative to where the command is called from
$ multi-proc --config programming/multi-proc.config.json start

Keywords

FAQs

Package last updated on 13 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc