Skip to content

Repository files navigation

👉 Visit the DatoCMS homepage or see What is DatoCMS?


DatoCMS CLI

DatoCMS CLI tool for managing DatoCMS projects, environments and schemas.

Development

This is an npm-workspaces monorepo: npm install links the packages to each other, and Turborepo derives the build order from their dependencies, so there is nothing to bootstrap.

npm install
npm run build
npm test

npm test includes the WordPress and Contentful import suites, which talk to live APIs: they need a .env at the root (copy .env.sample) and, for WordPress, docker compose up in packages/cli-plugin-wordpress. Each suite checks its prerequisites first and tells you which one is missing.

Trying a change before it's released

Every push to a branch here publishes a preview of all the packages, which you can run or install anywhere — no npm release, no npm link:

npx https://pkg.pr.new/datocms@<commit-sha> environments:list
npm i https://pkg.pr.new/@datocms/cli-plugin-wordpress@<commit-sha>

The exact URLs show up in the commit's check run on GitHub, and in a comment on the pull request once there is one. Installing one preview pulls in the previews of its siblings built from the same commit, so a change spanning several packages can be tried as one coherent set.

Previews are throwaway: they are never published to npm, and the URL stops resolving after a while. Never commit one to a package.json that ships.

Releasing

Maintainers only. A release publishes the packages that changed, and gives them all the same version number; the ones you didn't touch keep the version they already had.

  1. Describe your change. Run npx changeset in the same PR that makes the change: it asks which packages are affected and whether the bump is a patch/minor/major, then writes a small markdown file under .changeset/ which you commit. patch is for bug fixes only; new API surface is minor. See .changeset/README.md.
  2. Release. From an up-to-date, clean main, run npm run release. It builds and tests first, then applies the pending changesets (bumping the versions and writing the CHANGELOG.mds), regenerates the oclif command reference in the READMEs of the packages that moved, publishes to npm, and only then tags each of them name@X.Y.Z, pushes, and publishes one GitHub release per tag — its notes are the changelog entries changesets just wrote.

If a release is interrupted, do not undo anything: run npm run release again. It detects that some package is still missing from the registry and resumes the publish instead of starting a new release.

npm run release:next does the same under the next dist-tag, leaving latest untouched; its GitHub releases are marked as prereleases, so they don't become the repository's "Latest release" either.

The script is @datocms/release-toolchain, shared with every other DatoCMS repository and pinned here by tag; toolchain/release.mjs is the twenty lines that are only true here, where the oclif command reference has to be regenerated between the version bump and the release commit.

Releases up to v4.0.29 carried a single vX.Y.Z tag covering the whole repo. Those tags stay where they are; new ones are per package, which is also what the source links in the generated command reference now point at.


What is DatoCMS?

DatoCMS - The Headless CMS for the Modern Web

DatoCMS is Headless CMS for the modern web. Trusted by 25,000+ businesses, agencies, and individuals, it gives your team one place to manage content and ship it to any website, app, or device via API.

New here? Start with Create free account and the Documentation. Stuck? Ask the Community. Curious what's new? Product Updates.

Building with AI: Agent Skills turn coding assistants (Claude Code, Cursor) into expert DatoCMS developers, with full read/write via the auto-installed CLI. No local terminal? Use the MCP Server instead.

Talking to DatoCMS from code:

  • Content Delivery API (CDA) — the fast, read-only GraphQL API your website/app uses to fetch published content.
  • Content Management API (CMA) — the REST API for creating and updating content, models, and project settings (think scripts, migrations, integrations).
  • CLI — terminal tool for schema migrations and importing from Contentful/WordPress.

Framework guides: end-to-end recipes for fetching content, rendering Structured Text, optimizing images/video, handling SEO, and setting up live preview with visual editing in Next.js, Nuxt, Svelte, and Astro.

Want a head start? Browse our starter projects — ready-to-deploy example sites for popular frameworks.

About

Official CLI to interact with DatoCMS projects!

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages