This package provides a schema definition and normalization utility specifically designed for the `base-cli` plugin. Its primary function is to process and normalize command-line argument values (`argv`) before they are consumed by `cli.process()` within a `base` application. It allows for defining custom fields with specified types (e.g., 'string') and provides a `normalize` function that applies these definitions, including custom normalizer functions, to an `argv` object. The package is currently at version 0.1.19 and was last published in May 2016. Given its age and low version number, the release cadence is effectively inactive, indicating it is no longer actively maintained. Key differentiators include its tight integration with the `base` framework and its focused purpose of defining and applying schemas for CLI arguments, offering a structured approach to argument normalization within the `base` ecosystem, unlike more general-purpose validation libraries.
npm install base-cli-schemaVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing a `base` application, attaching `base-cli`, creating a `cliSchema` instance, defining a custom field with a normalizer, and using it to process a mock argv object.
Use a CommonJS environment or project. For ESM projects, consider alternative, more modern CLI argument parsing and schema validation libraries. If absolutely necessary, configure a CommonJS-to-ESM wrapper or bundler like Webpack/Rollup with appropriate plugins (e.g., `@rollup/plugin-commonjs`).
Evaluate if the functionality can be replaced by a more actively maintained library or custom code. If continued use is critical, ensure thorough testing against your specific Node.js version and dependencies. Be aware of potential unpatched vulnerabilities.
Familiarize yourself with the `base` framework's documentation. Ensure all necessary `base` plugins (like `base-cli`) are correctly installed and used with `app.use()`.
Change your file to a CommonJS module (`.js` without `type: "module"`) or use a tool like `createRequire` from the `module` module if you must mix ESM and CJS (e.g., `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const cliSchema = require('base-cli-schema');`). Ideally, migrate to an ESM-compatible alternative.Ensure `const Base = require('base');` and `const cli = require('base-cli');` are present, and that `app.use(cli());` is called on your `new Base()` instance before using `cliSchema`.