npm.io
1.2.75 • Published 5 years agoCLI

eco2

Licence
—
Version
1.2.75
Deps
6
Size
15 kB
Vulns
1
Weekly
0

Module was inspired by architecture of mono-repositories

Why

The module was written to simplify local development of microservices

How

The module searches and groups the services, calls them for one window, logging in pm2

Result

We will get comfortable using services

install
$ yarn global add eco2
Searches modules and return app.json
$ eco2 build
Start
$ eco2 start

Commands

init [out = app.json] - init and searches services for pm2
  • -s, --search <search...> - filter src (default: [/applications/, /tools/, /services/])
  • -i, --ignores <ignores...> - ignore src (default: [/node_modules//*])
  • -c, --cwd - cwd src, where search
build [out = app.json] - searches services and return out
  • -s, --search <search...> - filter src (default: [/applications/, /tools/, /services/])
  • -i, --ignores <ignores...> - ignore src (default: [/node_modules//*])
  • -c, --cwd - cwd src, where search
start [out = app.json] - it's command pm2 mutations
  • -m, --modules <modules...> - names of modules (default: [])
  • -g, --groups <groups...> - names of groups of modules (default: [])
groups [out = app.json] - add group at out
modules [out = app.json] - add pre modules at out
logs [all] - it's command pm2 mutations
stop [all] - it's command pm2 mutations

What's so app.json?

const app = {
    "options": { // it's global pm2 options for services
        "watch": true,
        "script": "C:\\Program Files\\nodejs\\node_modules\\eco2\\node_modules\\yarn\\bin\\yarn.js",
        "args": "debug",
        "env": {}
    },
    "modules": {
        "module-a": {
            "groups": [], // it's groups of module
            "modules": ["module-b"], // it's depends modules (relation to module-b)
            "options": { // it's local pm2 options for service
                "name": "modules-a",
                "cwd": "path/to/modules/a"
            }
        },
        "module-b": {
            "groups": [], // it's groups of module
            "modules": [], // it's depends modules
            "options": { // it's local pm2 options for service
                "name": "modules-b",
                "cwd": "path/to/modules/b"
            }
        }
    }
}

To hides windows

$ yarn global add pm2-windows-service
$ pm2-service-install