The TinaCMS CLI
Available Commands
$ tinacms <command>Commands:dev [options] Builds Tina and starts the dev serverbuild [options] Build the CMS and autogenerated modules for usage with TinaCloudinit [options] Add TinaCloud to an existing projectaudit [options] Audit your schema and the files to check for errorssearch-index [options] Builds the TinaCMS search index and uploads it to TinaCloudhelp [command] display help for command
Common options
Here are some common options that can be used in both tinacms dev and tinacms build
Argument | Description |
|---|---|
|
|
| Specify a port to run the server on. (default 4001) |
| Specify a port to run the local level server. (default 9000) |
| 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. |
| Don't generate the generated client SDK. Read here for more details about the SDK. |
| increase verbosity of logged output (default: false) |
| Specify the root directory to run the CLI from (defaults to current working directory) |
| don't report anonymous telemetry |
Basic Usage:
"tinacms dev"
To run this command, you must have a validtina/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 |
|---|---|
| Specify the version of |
| Will start the local Graphql server and generate the local client. This is useful for static builds but will not work with SSR |
| Skip the TinaCloud checks (dangerous and not recommended) |
| Skip the search indexing |
| 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
tinadirectory. - Create example content in the demo directory.
- Edit the
package.jsonto have thedev,build, andstartscripts run the tina GraphQL API.
Options
Argument | Description |
|---|---|
| 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 |
|---|---|
| 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 |
| 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.