clite is a lightweight command-line interface (CLI) framework for Node.js applications, designed to provide essential boilerplate functionality. Its current stable version is 0.3.0, last released in March 2016, indicating that the project is likely no longer actively maintained. The library focuses on automating common CLI tasks such as displaying version information from `package.json`, generating help documentation, handling `stdin` input, notifying users of updates via `update-notifier`, and managing exceptions with non-zero exit codes. It leverages `abbrev` for command/option aliasing and `yargs` for robust argument parsing, including booleans and options. Commands are promise-based and lazy-loaded to optimize boot times. A key differentiator is its minimal configuration approach, allowing developers to quickly scaffold CLI tools without extensive setup, though its age might pose compatibility challenges with modern Node.js environments.
npm install cliteVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up a basic `clite` application with a default command, a named command (`greet`), and an asynchronous command (`delay`), including configuration for options, booleans, aliases, and a help file. The code shows how `clite` consumes a configuration object and how individual command modules are structured.
Consider migrating to a actively maintained CLI framework (e.g., `oclif`, `commander`, `yargs`) or thoroughly test compatibility with your target Node.js runtime and dependencies using a lockfile.
To handle errors within your application code, set the `return: true` property in your clite configuration. This will cause errors to be returned as rejected promises to your main script instead of causing a `process.exit(1)`.
Ensure your project uses a lockfile (`package-lock.json` or `yarn.lock`) to maintain consistent dependency versions. If conflicts arise, manual intervention or a full migration to a more current framework might be necessary.
Develop new CLI projects using native ES Modules with a modern CLI framework. For existing clite projects, continue using CommonJS or plan for a full migration.
Change `import clite from 'clite';` to `const clite = require('clite');` in your main CLI entry file.Ensure `es6-promise` is installed and that clite's internal polyfill is effective, or preferably, upgrade to Node.js v4.0 or higher where Promises are natively available.
Verify that the path to your config file passed to `require()` in your main script (e.g., `clite(require('./config'));`) is correct and relative to the calling script's location.