What is Volta?
The creators of Volta designed the library to stay out of your way. We joked during the broadcast that a new tagline for Volta is “Works so good you’ll forget it’s installed”. You specify your tool configuration using declarative syntax, and Volta handles the tactical details to properly stand-up the environment to your liking.
Who needs Volta?
YOU do if you are the sort of person who wants to avoid diagnostic and troubleshooting work caused by version mismatches. It seems we all have many projects on our file system. You can tell the last time a project was run by the version of the libraries, sort of like the rings of a tree. Environments can get messy when versions compete with each other or are even just slightly different. Volta lets you configure the exact environment needed and then automatically orchestrates the setup and configuration.
A Practical Example of Volta Helping You Out
Imagine you had a project that used TypeScript. You have TypeScript v3.9 installed globally, but your project dependency is TypeScript 3.8. If TypeScript 3.8 was not installed in the project, likely your environment will be “helpful” by finding and using the globally installed TypeScript binary. This version mismatch could potentially cause problems with your project.
Volta will avoid calling the globally registered TypeScript binary and throw an error. This error will prevent the opportunity for your application to run on the wrong binary version.
How to Configure Environments with Volta
The configuration is available at the global or project level. You specify the recipe needed for your project using the familiar package.json file. You’ll need to insert a Volta key into the package.json file for node, and any package managers you use. Volta also provides CLI commands for convenience to set the version and write the appropriate configurations.
The rest of your project toolchain configuration is found in the regular ‘dependencies’ key in your package.json. Any package installable through a supported package manager is administrable by Volta.
Supported Package Managers:
Coming Soon Package Managers:
How does Volta Work?
Volta creates shims for commands. A call process looks like this:
- A command is executed for a toolchain binary.
- Usually, the system will call the toolchain binary and execute the command, but Volta intercepts the command
- Volta validates the correct version of the binary is installed and available in the project directory.
- If the binary is not in place, Volta looks to see if it has a copy of the binary/version. If it does, Volta makes that binary available to the project. If not, it downloads and installs the binary/version and makes the binary available to the project directory.
- Volta executes the original command to the binary.
Because of this shim nature, the Volta team wanted to ensure there wouldn’t be undue performance issues arising from Volta serving as an intermediary. To squeeze maximum performance, the Volta team chose the Rust programming environment. Rust is a systems-level language with functional language capability. Rust is also cross-platform, allowing Volta to work on Windows, Mac, and Linux. Chuck said the impact of Volta is about 20ms, which is exceptionally lightweight, as I’m sure you’ll agree.
Who Sponsors the Development of Volta?
Chuck is an employee of LinkedIn. LinkedIn uses Volta internally and chose to make Volta available as an open-source project. Chuck primarily works on the Volta project. It is reassuring to know a dedicated resource is in charge of the project.
How is Volta Licensed?
Volta is licensed under the BSD 2-clause license. The BSD 2-clause license is highly permissive and free of weird requirements, so you’ll be able to use Volta in your projects, even if your organization requires a legal review of the license.
Where to Go for More Info on Volta