Knob is a stand-alone binary for MacOS, Windows, and Linux that packages a recent Node LTS release (currently, 16.13.2) along with a collection of third-party packages that are useful for creating CLI utilities.
The intended use case is to place knob within the user's PATH, thus allowing the creation of executable shell scripts in a language more expressive than bash:
#!/usr/bin/env knob
const path = require('path');
const os = require('os');
module.exports = async ({ express, morgan }) => {
const app = express();
app.use(morgan('combined'));
app.use(express.json());
app.use('/files', express.static(__dirname));
app.route('/').get((req, res, next) => {
return res.send({
message: 'Hello, world.',
});
});
app.listen(9070, () => {
console.log('App is listening on port: 9070');
});
};
If no target script is passed to knob, it will walk up the directory tree in search of a knobfile.js
file. If found, it will execute that. Otherwise, it will print an error to the console and exit with status code 1. To override this behavior and prevent knob from searching for knobfile.js
, set the IGNORE_KNOBFILE
environment variable to 1.
To install or update knob, run the install script. To do that, you may either download and run the script manually, or use the following wget or curl command:
wget -qO- https://raw.githubusercontent.com/tkambler/knob/v0.0.6/install.sh | bash
curl -o- https://raw.githubusercontent.com/tkambler/knob/v0.0.6/install.sh | bash
Just run make
. Distributable binaries for MacOS, Linux, and Windows will be saved to ./dist
.
- async
- AWS SDK
- axios
- Bluebird
- chalk
- commander
- conf
- delay
- enquirer
- execa
- express
- find-up
- fs-extra
- get-port
- glob
- inquirer
- is-elevated
- is-port-reachable
- is-root
- js-yaml
- js-yaml
- json-to-pretty-yaml
- listr2
- lodash
- marked, marked-terminal
- moment
- morgan
- node-ssh
- ora
- p-retry
- prettyjson
- progress
- ssh-config
- sudo-block
- sudo
- underscore.string