inferCliName
Generated reference page for the inferCliName function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/config/package-json.ts - Source link:
src/core/config/package-json.ts:591
Signatures
ts
function inferCliName(pkg: PackageJsonData, options: { stripScope?: boolean; }): string | undefined;| Parameter | Type | Description |
|---|---|---|
pkg | PackageJsonData | Parsed manifest metadata. |
options | { stripScope?: boolean; } = {} | stripScope (default true): strip a leading @scope/from the name fallback. |
Members
Members
inferCliName
Infer the CLI binary name from manifest data.
Resolution order:
- First key of
binobject (e.g.{"mycli": "./dist/cli.js"}→"mycli") - Package
name, scope stripped by default (e.g."@scope/mycli"→"mycli"); pass{ stripScope: false }to keep the full scoped name undefinedif neither exists
Note: bin keys are never scoped, so stripScope only affects the name fallback (relevant for deno.json / jsr.json, which have no bin field).
ts
(pkg: PackageJsonData, options: { stripScope?: boolean; }): string | undefined;Examples
ts
import { inferCliName } from '@kjanat/dreamcli';
inferCliName({ bin: { mycli: './dist/cli.js' } }); // 'mycli'
inferCliName({ name: '@scope/mycli' }); // 'mycli'
inferCliName({ name: '@scope/mycli' }, { stripScope: false }); // '@scope/mycli'
inferCliName({ name: 'mycli' }); // 'mycli'
inferCliName({}); // undefined