ant add, ant install, and ant run directly, using the same package.json format you already know from the npm ecosystem. Packages are resolved from the public npm registry at https://registry.npmjs.org, and every install produces a binary lockfile (ant.lockb) so your dependencies are reproducible across machines.
Project structure
A standard Ant project contains two files at its root:| File | Purpose |
|---|---|
package.json | Standard npm-format manifest: name, version, scripts, dependencies |
ant.lockb | Binary lockfile for reproducible installs — commit this to version control |
node_modules/ | Installed packages, populated by ant install or ant add |
Starting a new project
Initialize package.json
Run The generated file looks like this:
ant init in an empty directory. Ant prompts you for a package name, version, and entry point, then writes a package.json with a start script pre-configured.package.json
Add dependencies
Use To save a package as a development dependency only, pass
ant add to install a package and save it to dependencies. Ant resolves the package from the npm registry, writes node_modules/, and updates both package.json and ant.lockb.-D:Install from lockfile
On a fresh clone, run If no lockfile exists yet, Ant resolves all versions from
ant install (or ant i) to restore the exact package versions recorded in ant.lockb.package.json and creates one.The lockfile
ant.lockb is a binary lockfile that records the exact resolved version, integrity hash, and download URL for every package in your dependency tree. Commit this file to version control so every developer and CI environment installs identical packages.
You should never need to edit
ant.lockb by hand. Run ant update to re-resolve and refresh the lockfile when you want to pull in newer versions.The antx binary
antx is a convenience binary that is equivalent to ant x. It lets you run executables from node_modules/.bin without typing the full ant x prefix:
npx.
Command overview
All package management commands live under theant binary. See the Commands reference for full syntax and options.
| Command | Alias | Description |
|---|---|---|
ant init | — | Create a new package.json |
ant install | ant i | Install all dependencies from the lockfile |
ant update | ant up | Re-resolve dependencies and refresh the lockfile |
ant add <pkg> | ant a <pkg> | Add a package to dependencies |
ant remove <pkg> | ant rm <pkg> | Remove a package |
ant trust | — | Run lifecycle scripts for packages |
ant run <script> | — | Run a script from package.json |
ant exec <cmd> | ant x <cmd> | Run a binary from node_modules/.bin |
ant why <pkg> | ant explain <pkg> | Show why a package is installed |
ant info <pkg> | — | Show package information from the registry |
ant ls | ant list | List installed packages |
ant cache | — | Manage the package cache |
ant create <template> | — | Scaffold a project from a template |