← 全部工具

@datocms/cli

热度 65 更新于 开发与构建

Legacy scoped alias for the `datocms` package

npmauto-collected

安装

npm
npm install -g @datocms/cli

通过 npm 安装。

<a href="https://www.datocms.com/"<img src="https://www.datocms.com/images/fulllogo.svg" height="60"</a

👉 Visit the DatoCMS homepage or see What is DatoCMS?

---

DatoCMS CLI

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

  • @datocms/cli: Main CLI package
  • @datocms/cli-plugin-wordpress: CLI plugin to import WordPress websites into DatoCMS projects
  • @datocms/cli-plugin-contentful: CLI plugin to import Contentful spaces into DatoCMS projects

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.

  • Describe your change. Run npx changeset in the same PR that makes the