-
Notifications
You must be signed in to change notification settings - Fork 0
npkg
The npkg
command is the one command to rule them all.
It's mostly a convenience.
We want a single command for
- installing and removing commands
- installing and removing services
- starting and stopping services
- configuring services
These are reflected in the commands
npkg [install|uninstall] <PKG>
npkg [start|stop] <PKG>
npkg config
Packages installed with npkg install
are installed to $HOME/lib/node_modules
,
and any executables defined in the package are linked into $HOME/bin
.
Since npkg
always writes to your home directory,
you do not need root permissions.
You can use npkg install
to craft a custom command line interface unique to every user.
For example:
Install a package from npm which includes a bin key.
$ npkg install bin-ifconfig
--> installing bin-ifconfig from npmjs.org
--> linked executable `ifconfig`
Executables are installed to $HOME/bin
, and should be immediately available to the CLI.
$ ifconfig
{
"lo0": { ip: "127.0.0.1", mask: "255.255.255.0" }
}
Packages installed with npkg install
can also be services.
A module defines a service by specifying a scripts:start
key in it's package.json
file.
{
"name": "my_app",
"scripts": {
"start": "node server.js"
}
}
You can one-step daemonize this module with
$ npkg start my_app
Once started with npkg
the server is running in the background.
You can detach from the current login session without interrupting the server.
Started services can be stopped with
$ npkg stop my_app