npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amx

v1.0.1

Published

AMX: automatic process manager

Downloads

111

Readme

AMX

AMX is a process and task runner/automator written in Node JS. It's designed to be super easy to use, and requires no external dependencies, except nodemailer for sending email alerts.

NOTE

Currently AMX only supports tasks written in Node. In the future it will support other arbitrary scripts.

Getting started

Install AMX with

npm install -g amx

If you are on Linux this command may fail because you aren't root. Do not install AMX as root. If you install AMX as root then all of your services will run as root as well. Instead change the global npm directory as described in the node docs here.

Make a new task with:

amx make <taskname>

Then edit the config file in ~/.amx/procs/taskname/config.json, or with amx edit <taskname>, to set the directory and script to run. For example, to run the program server.js in /home/me/radcode/, run amx make radserver then edit the config file to look like this

{
    "name":"radserver",
    "directory":"/home/me/radcode",
    "type":"node",
    "script":"server.js"
}

Now start it with

amx start radserver

and stop it with

amx stop radserver

List all running processes with

amx list

Remove a task

amx remove taskname

This will stop the task if running, then delete the config files

View task log

All tasks log their output to ~/.amx/procs/<taskname>/stdout.log and stderr.log. Run amx log taskname to view the current stdout log. Run amx follow taskname to wait and continuually show new log output from both stdout and stderr.

Edit task's config

amx edit taskname

This will open up your preferred command line editor as specified by the EDITOR environment variable.

Change the script type

set type to node for nodejs scripts. set it to npm to run a script through npm. set it to exe for a native binary. For example the following is equivalent to npm run build

{
   "name": "my-task",
   "directory":"some-dir",
   "type": "npm",
   "script": "build"
}

Set command line arguments

set args to an array of strings. ex:

{
  "args": ["--foo", "--bar", "baz.out"]
}

Set Environment Variables

set the env property in the config file. ex:

{
   "env" : {
       "SECRET_KEY":"my_special_secret",
       "FOO_HOME":"/some/path/to/foo"
   }
}

Now these variable can be accessed from inside the script with process.env.SECRET_KEY, etc.

Monitor a git hub repo

Run amx make taskname to create the task. Then edit it like this:

{
   "watch": {
        "secret":"the secret you are looking for",
        "repo":"https://github.com/joshmarinacci/cool.git"
   }
}

event push will make it check out and update on every 'push' event.

Code will be checked out to the 'directory' directory.

archive a task

Run amx archive taskname to mark a task as archived. If the task was already running you will still need to stop it as well.

un-archive a task

Run amx unarchive taskname to mark a task as not archived. If the task was stopped you will still need to start it as well.

Shortcuts

Make a new task for a node script in one step.

cd myproject
amx make proj1 start.js
amx start proj1

If you provide a filepath after the task name AMX will assume it is a node script and fill in the directory and type and script fields of the config file for you.

How it works

AMX actually has two components: the command line interface and a server process. The server will be started automatically if it's not already running when you execute the commandline interface. The server will monitor the running tasks and restart them if they crash. If a task needs to be restarted more than 5 times in 60 seconds then AMX will disable it.

Send Email Alerts

To have AMX send emails whenever a process stops simply create or edit ~.amx/config.json

{
   "alerts": {
        "email":{
           "transport":"smtps://me%40mydomain.com:[email protected]",
           "to":"[email protected]",
           "from":"[email protected]"
        }
   }
}

The transport parameter is a URL which will be passed to nodemailer to send an email. Note that you must escape the @ sign as %40 and if you use gmail you probably need to generate a new application specific password.

get status of AMX itself

amx selfstatus

AMX
0.0.11
Config /Users/josh/.amx/config.json
{
    "alerts": {
        "email": {
            "transport": "smtps://user%40domain:[email protected]",
            "from": "\"amx\" <[email protected]>",
            "to": "[email protected]"
        }
    }
}
server on port  48999
process descriptions /Users/josh/.amx/procs

update AMX to a new version

npm install -g amx