👋Welcome
Saffron is a tool for building robust, configurable command-line interfaces for Node applications. It is an integration between Yargs and Cosmiconfig, two best-in-class tools for creating CLIs and working with configuration files, respectively.
General familiarity with Yargs and Cosmiconfig is recommended (but not required) before using Saffron.
Rationale
Yargs is undeniably one of the best command-line argument parsers in the Node ecosystem. However, its API has grown tremendously over the years to support the myriad idiosyncratic use-cases of its users while maintaining backward compatibility, leading to bloat. And while it does have limited support for loading configuration files, it only supports files in the JSON format.
Saffron focuses on the most flexible, robust Yargs API: the command module API, which supports every Yargs use-case while only involving a single method from the Yargs API: .command()
.
Cosmiconfig is an extremely powerful and configurable utility for adding support for configuration files to an application in several different formats, allowing the end-users of your application to choose between JSON, YAML, and JavaScript-based configuration files with a single tool.
Saffron aims to integrate these two tools, solving for many common cases and applying sensible defaults where possible, making it easy to create robust, self-documenting CLIs that deliver excellent user experiences in as few lines of code as possible.
If you've used tools like Vite, Webpack, ESLint, or TypeScript, then you are already familiar with the CLI + configuration file application architecture that Saffron is designed for. With Saffron, the aim is to deliver parsed command-line arguments and configuration data to your app with as little effort as possible so you can focus on building an amazing application. ✨
Last updated