Loving Tina? ⭐️ us on GitHubStar

Docs

Learn

v.Latest
Introduction
Core Concepts
Querying Content
Editing
Customizing Tina
Going To Production
Media
Drafts
Guides
Further Reference

Available Commands

$ tinacms <command>
Commands:
dev [options] Builds Tina and starts the dev server
build [options] Build the CMS and autogenerated modules for usage with TinaCloud
init [options] Add TinaCloud to an existing project
audit [options] Audit your schema and the files to check for errors
search-index [options] Builds the TinaCMS search index and uploads it to TinaCloud
help [command] display help for command

Common options

Here are some common options that can be used in both tinacms dev and tiancms build

Argument

Description

-c

-c allows you to optionally run a command as a child process. For example, you could run your Next.js project alongside the graphQL server yarn tinacms dev -c next dev.

--port <port>

Specify a port to run the server on. (default 4001)

--datalayer-port <port>

Specify a port to run the local level server. (default 9000)

--noWatch

Don't regenerate config on file changes. This option is good to add when building in CI or if you do not want to watch the file system for changes.

--noSDK

Don't generate the generated client SDK. Read here for more details about the SDK.

-v,--verbose

increase verbosity of logged output (default: false)

--rootPath

Specify the root directory to run the CLI from (defaults to current working directory)

--noTelemetry

don't report anonymous telemetry

Basic Usage:

"tinacms dev"

To run this command, you must have a valid tina/config.{ts,tsx,js,jsx} file.

dev will compile the schema into static files, generate typescript types for use in your project and start a graphQL server on http://localhost:4001

This command takes the arguments listed in the common options

NextJS Example:
tinacms dev -c \"next dev\"
Other SSG Frameworks Example
tinacms dev -c \"<Yor Dev Command>\"

"tinacms build"

This command compiles and validates the schema and generates the client and types. It will also ensure your content has finished indexing.

Options

This command takes all the common options as well as a few others:

Argument

Description

--tina-graphql-version

Specify the version of @tinacms/graphql that the backend will use. (Only needed in advanced cases)

--local

Will start the local Graphql server and generate the local client. This is useful for static builds but will not work with SSR

--skip-cloud-checks

Skip the TinaCloud checks (dangerous and not recommended)

--skip-search-indexing

Skip the search indexing

--no-client-build-cache

Disables automatic caching of queries by local client

Examples:

Building for production with TinaCloud for data fetching

tinacms build && next build

Building for production with a SSG

tinacms build && <Your SSG build command>

Using the local client and local graphql server

tinacms build --local -c "next build"

This will

  • Start the local graphql server
  • Generate the local TinaCMS client that will query the local file system
  • Produce local image paths
  • build production SPA
  • run Next build

"npx @tinacms/cli@latest init"

The init command must be run inside of an existing project (E.g a NextJS project, Hugo, Jekyll, etc).
npx @tinacms/cli init

This will:

  • Install all required dependencies for Tina.
  • Define a basic content schema in the tina directory.
  • Create example content in the demo directory.
  • Edit the package.json to have the dev, build, and start scripts run the tina GraphQL API.
Options

Argument

Description

--noTelemetry

Disables Open Source Telemetry

"tinacms audit"

The audit command is used for checking for errors in your in your files. It currently does two things.

  • Checks to see if the files have the correct extension
  • Submits each file as a Graphql mutation and checks for Graphql errors

By default the mutation will not change the content of the files.

Options

Argument

Description

--clean

When this flag is used, it submits actual Graphql mutations to the file system. This means that it will clean out any fields that are not defined in your schema. It is a good practice to do a git commit before doing this so unintended changes can be easily undone.

-v,--verbose

increase verbosity of logged output (default: false)

"tinacms search-index"

This command builds the search-index using the content in your repository and uploads it to TinaCloud.