$ npm install @vltpkg/configConfig utilities for the vlt client.
These are config utilities used by the vlt cli.
import { get, set, edit, list, del } from '@vltpkg/config'
// Assuming you have a LoadedConfig instance from @vltpkg/cli-sdk
// const conf = await loadConfig()
// Get a config value by key
const colorValue = await get(conf) // requires conf.positionals[1] to be the key name
// Supports dot notation for nested properties in record fields
// e.g., conf.positionals = ['get', 'registry.npmjs.org']
// Set config values using key=value pairs
// conf.positionals should contain pairs like ['set', 'color=auto', 'timeout=5000']
await set(conf)
// Creates config file if it doesn't exist when called with no pairs
// Supports dot notation for record fields: 'registry.npmjs.org=https://registry.npmjs.org/'
// Edit the config file with the configured editor
await edit(conf) // opens conf.get('config') file in conf.get('editor')
// List all current config values as key=value pairs
const allConfig = list(conf) // returns array of 'key=value' strings
// Delete config keys
// conf.positionals should contain keys to delete: ['del', 'color', 'timeout']
await del(conf) // removes specified keys from conf.get('config') file
get(conf: LoadedConfig)string | number | boolean | string[] | Record<string, string> | undefinedconf.positionals[1]set(conf: LoadedConfig)conf.positionalsregistry.npmjs.org=value)conf.get('config')edit(conf: LoadedConfig)conf.get('editor')spawnSync to launch the editor with the config file pathlist(conf: LoadedConfig)del(conf: LoadedConfig)conf.positionals (after the command
name)conf.get('config')