Socket
Book a DemoInstallSign in
Socket

@vltpkg/vlt-json

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vltpkg/vlt-json

utility for finding, reading, and updating the vlt.json file

latest
Source
npmnpm
Version
1.0.0-rc.13
Version published
Maintainers
0
Created
Source

@vltpkg/vlt-json

Facilities for finding, loading, and updating the vlt.json vlt project configuration file.

Usage

import { find, load, save } from '@vltpkg/xdg'

// finds the project config file.
const projectRoot = find()

// Load a bit of data, providing a typedef check for it
// If a matching field is not found, then `undefined` is returned.

const isWorkspaceConfig = (x: unknown): x is WorkspaceConfig => { ... }
const workspaceOptions = load('workspaces', isWorkspaceConfig)
// now workspaceOptions is WorkspaceConfig | undefined

// do whatever and then save it back. This organizes writes so
// that we do not clobber the file if there are multiple parts
// of vlt all trying to write to it. Once the validator function
// is established, it'll be re-used on that field when saving.
save('workspaces', workspaceConfig)

// If you need a user-level instead of project-level file, use
// the third argument to specify that file instead.
const userConfig = load('config', isValidConfig, 'user')
const projectConfig = load('config', isValidConfig)
userConfig.color = true
save('config', userConfig, 'user')

// Note that save() ALWAYS clobbers, so if you want to do
// a merge, load() first, make the change, and then save back.
// If the file was edited since it was opened, then this will
// fail.

FAQs

Package last updated on 19 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts