Skip to Content
vovk init

vovk init

Quick CLI Ref
$ npx vovk init --help Usage: vovk init [options] Initialize Vovk.ts in an existing Next.js project Options: --prefix <prefix> directory to initialize project in -y, --yes skip all prompts and use default values --log-level <level> set log level (default: "info") --use-npm use npm as package manager --use-yarn use yarn as package manager --use-pnpm use pnpm as package manager --use-bun use bun as package manager --skip-install skip installing dependencies --update-ts-config add "experimentalDecorators" to tsconfig.json --no-update-ts-config leave tsconfig.json as it is --update-scripts <mode> update package.json scripts ("implicit" or "explicit") --bundle set up "tsdown" bundler --lang <languages...> generate client for other programming languages by default ("py" for Python and "rs" for Rust are supported) --validation-library <library> validation library to use ("zod", "valibot", "arktype"); set to "none" to skip --channel <channel> channel to use for fetching packages (default: "latest") --dry-run do not write files to disk -h, --help display help for command

init sets up Vovk.ts in an existing Next.js project: it writes the configuration and installs the dependencies.

npx vovk-cli init

In a project that already has a config, init asks before it sets the project up again (with --yes, it doesn’t ask). An existing config that differs from the new one is kept as a backup next to it, such as vovk.config.mjs.bak, so you can move your settings over.

Available Flags

--prefix <prefix>

The project folder. Defaults to the current folder.

-y, --yes

Skips prompts and uses default values.

--log-level <level>

Sets the log level: trace, debug, info, warn, error, silent. Default: info.

--use-npm, --use-yarn, --use-pnpm, --use-bun

Sets the package manager that installs the dependencies, so init doesn’t detect it. Without these flags, init takes the packageManager field of package.json, then the project’s lockfile (pnpm-lock.yaml, yarn.lock, bun.lock, package-lock.json), then the package manager that runs it (pnpm dlx, yarn dlx, bunx), and npm otherwise.

--skip-install

Doesn’t install the dependencies, but still updates package.json.

--update-ts-config

Adds experimentalDecorators to tsconfig.json without asking. Webpack builds need it; see Enable decorators. With --yes, this is the default.

--no-update-ts-config

Leaves tsconfig.json as it is, also with --yes.

--update-scripts <mode>

Updates the package.json scripts to run Next.js and Vovk.ts together. Modes:

  • implicit — uses the concurrently API inside vovk dev. It fits a dev script that is next dev with flags. A dev script that runs more, such as prisma generate && next dev, gets the explicit form.
  • explicit — uses the concurrently CLI: cross-env PORT=3000 concurrently "next dev" "vovk dev" --kill-others. cross-env  and double quotes let the script run on Windows too. PORT is the port from next dev -p when the old script has one.

The flag also sets prebuild to vovk generate, so the client is generated before next build. Yarn 2+ doesn’t run pre scripts, so there it puts vovk generate at the start of build: vovk generate && next build. With --bundle, it adds a bundle script that runs vovk bundle. An existing prebuild or bundle script stays, and the command runs after it, for example prisma generate && vovk generate.

--bundle

Sets up tsdown  to bundle the TypeScript client: adds it to devDependencies and a bundle.build function to the config.

--lang <languages...>

Generates clients for more languages: adds “py” (Python) or “rs” (Rust) to composedClient.fromTemplates.

--validation-library <library>

Sets the validation library: “zod”, “valibot”, “arktype”, or “none” to set up validation later.

--channel <channel>

Sets the channel: the npm tag the Vovk.ts packages are installed from. The channels:

  • latest (default) for stable releases.
  • beta for beta releases, when there is one.

Run the CLI from the same channel, as vovk-cli@beta for beta. A Vovk.ts package with no release on the channel, such as vovk-ajv without a beta, is added at its latest version.

--dry-run

Shows what it would do, without writing files.

-h, --help

Shows help.

Last updated on