vlt
Configure the vlt client for your vlt.io registries, and publish to main.
Verified against vlt 1.0.
Quick start
One command configures both registries for your account:
vlt setup acmeThat authenticates in the browser and writes the npm and main
registry aliases to your user config, so vlt install and vlx work
everywhere. Then:
vlt installIf you would rather not use the wizard, or you are scripting it, see manual configuration.
Manual configuration
vlt config set registry=https://registry.vlt.io/acme/npm/ \
registries.npm=https://registry.vlt.io/acme/npm/ \
registries.main=https://registry.vlt.io/acme/main/ \
scoped-registries.@acme=https://registry.vlt.io/acme/main/That writes vlt.json. Add --config=user to apply it to every
project instead of just this one:
{
"config": {
"registry": "https://registry.vlt.io/acme/npm/",
"registries": {
"npm": "https://registry.vlt.io/acme/npm/",
"main": "https://registry.vlt.io/acme/main/"
},
"scoped-registries": {
"@acme": "https://registry.vlt.io/acme/main/"
}
}
}What each field does:
registry— the default registry all packages resolve against. Pointing it at your mirror makes it a drop-in npm replacement.registries— named aliases. They powervlt registry <alias> <command>and the<alias>:specifier syntax.scoped-registries— routes a scope to a registry, like@scope:registryin npm. Note the key keeps the@.
Authentication
The wizard stores a token in your system keychain. To add one by hand:
vlt login --registry=https://registry.vlt.io/acme/main/Or set it in the environment, which is what you want for scripts and CI:
export VLT_TOKEN=<your token>
export VLT_REGISTRY=https://registry.vlt.io/acme/npm/VLT_TOKEN with VLT_REGISTRY covers the default registry. For
scoped-registries, also export that registry's
VLT_TOKEN_<registry>, e.g.
VLT_TOKEN_https_registry_vlt_io_acme_main (see
Authentication).
Install from the npm mirror
vlt install abbrevTo move an existing project onto the mirror, delete the lockfile: vlt
doesn't yet re-resolve a kept vlt-lock.json against a new registry
(#1579).
rm -rf vlt-lock.json node_modules
vlt installInstall from your main registry
With scoped-registries configured:
vlt install @acme/my-packageYou can also pull from a named registry explicitly, without any scope
config, using the <alias>: specifier syntax:
vlt install @acme/my-package@main:@acme/my-package@1.0.0which records the alias in package.json:
{
"dependencies": {
"@acme/my-package": "main:@acme/my-package@1.0.0"
}
}Public packages
Public packages on main install without a token — the registry
mapping alone is enough, with no token in the environment or keychain:
{
"config": {
"scoped-registries": {
"@acme": "https://registry.vlt.io/acme/main/"
}
}
}Publish to main
vlt publish --registry=https://registry.vlt.io/acme/main/Or set registry in the project vlt.json and just run
vlt publish. Useful flags: --access public, --tag, --dry-run,
and --recursive to publish every workspace in a monorepo.
With a personal token, every publish returns a one-time-password
challenge with a vlt.io URL. Open it, approve, and re-run — or pass
the code through the environment:
VLT_OTP=<code> vlt publishA service token skips the challenge, which is how you publish from CI. See CI & automation.
Working with a named registry
vlt registry <alias> <command> runs an account command against one
of your configured registries:
vlt registry main whoami
vlt registry main token list
vlt registry main access
vlt ping # check connectivity to every configured registrySupported commands are whoami, logout, login, token, access,
publish, unpublish, deprecate, dist-tag, profile and ping.
Gotchas
vlt token addneeds an interactive terminal. It reads the token with raw keyboard input, so piping it in (echo $TOKEN | vlt token add) fails withstdin.setRawMode is not a function. UseVLT_TOKENin scripts.scoped-registrieskeeps the@—scoped-registries.@acme, unlike Yarn'snpmScopes.- The config key is
scoped-registries, notscope-registries. VLT_TOKENcovers one registry only; scoped (and other) registries need their ownVLT_TOKEN_<registry>.