CLI
docStatic provides a set of scripts to help you generate, serve, and deploy your website.
{
// ...
"scripts": {
"docusaurus": "docusaurus",
"dev": "tinacms dev -c \"docusaurus start\"",
"start": "docusaurus start",
"generate-media-index": "node scripts/generate-media-index.js",
"generate-git-identity": "node scripts/generate-git-identity.js",
"generate-files": "node scripts/generate-file-list.js",
"generate-docs-metadata": "node scripts/generate-docs-metadata.js",
"update-theme-css": "node scripts/update-theme-css.js",
"prebuild": "yarn generate-media-index && yarn generate-files && yarn generate-docs-metadata && yarn update-theme-css && yarn generate-git-identity",
"predev": "yarn generate-media-index && yarn generate-files && yarn generate-docs-metadata && yarn update-theme-css && yarn generate-git-identity",
"build": "tinacms build && docusaurus build",
"build-local": "tinacms build --local --skip-indexing --skip-cloud-checks && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"setup-git-hooks": "git config core.hooksPath .githooks && chmod +x .githooks/pre-commit",
"sync-template": "node scripts/sync-template.js",
"sync-template:check": "node scripts/sync-template.js --check",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"gen-api-docs": "docusaurus gen-api-docs all",
"clean-api-docs": "docusaurus clean-api-docs all",
"gen-graphql": "docusaurus docs:generate:graphql",
"gen-api-docs:version": "docusaurus gen-api-docs:version",
"clean-api-docs:version": "docusaurus clean-api-docs:version",
"lint": "biome check config/ reuse/ scripts/ src/ tina/",
"lint:fix": "biome check config/ reuse/ scripts/ src/ tina/ --fix",
"mcp:install": "cd mcp-server && npm install",
"mcp:build": "cd mcp-server && npm run build",
"mcp:dev": "cd mcp-server && npm run dev",
"mcp:start": "cd mcp-server && npm start",
"mcp:test": "node mcp-server/test.js",
"postinstall": "npm run mcp:install"
}
}
docStatic CLI commands
To invoke the commands, use npm or yarn. For example, npm run dev or yarn dev.
Key docStatic scripts:
dev: Start development server with TinaCMS integrationbuild: Build for production (runs TinaCMS build then Docusaurus build)build-local: Build locally without cloud featuresgenerate-media-index: Generate index of media filesgenerate-git-identity: Generate git identity informationgenerate-files: Generate file lists for the applicationgenerate-docs-metadata: Generate metadata index used by dashboards and searchupdate-theme-css: Update theme CSS filesmcp:install: Install Model Context Protocol server dependenciesmcp:build: Build the MCP server from TypeScriptmcp:dev: Start MCP server in development mode with auto-restartmcp:start: Start the compiled MCP server for AI assistant integrationmcp:test: Run MCP server connectivity tests
For more information about the MCP server, see MCP Server Integration.
These commands are built on top of standard Docusaurus commands described in CLI in the Docusaurus documentation:
docusaurusstartbuildswizzledeployclearservewrite-translationswrite-heading-ids
Automated commands
These commands are run automatically at build time or when starting the dev server:
generate-filesgenerate-docs-metadataprebuildpredev
API commands
clean-api-docsgen-api-docsgen-graphql
For more information on the OpenAPI commands, refer to CLI Usage in the Docusaurus OpenAPI Plugin documentation.
For more information on the GraphQL command, refer to Usage in the Docusaurus GraphQL Plugin documentation.
Site creation and update commands
These commands come from the create-docstatic package rather than package.json, so they work anywhere—you don't need a docStatic site to run them.
npx create-docstatic@latest <project-name>: Create a new docStatic site. See Installation for details.npx create-docstatic@latest --update: Update an existing site to the latest docStatic release. Run it from the root folder of a site created withcreate-docstatic. It updates the docStatic-owned files and dependency versions, and leaves your content untouched.
The update command accepts these options:
--dry-run: Report what would change without writing anything.--force: Proceed even if the git working tree isn't clean. Without it, the command asks you to commit or stash your changes first so you can review the update withgit diff.--tag <dist-tag>: Update to a specificdocstaticpackage version or dist-tag instead oflatest.--no-install: Skip installing dependencies after the update.
Template sync commands
These commands only exist in the docStatic repository itself (and forks of it)—not in sites created with create-docstatic. They keep the scaffolding template in the template/ folder in sync with the main site.
The template is what npx create-docstatic@latest ships to new sites, so whenever you change code that the template shares with the main site—React components in src/, the build scripts in scripts/, tina/config.jsx, docusaurus.config.ts or sidebars.ts—the template needs the same change.
sync-template: Copy the shared code surface from the main site intotemplate/, align the template'spackage.jsondependencies and scripts, and regenerateupdate-manifest.json(the file thatnpx create-docstatic@latest --updateuses to update existing sites). Template content such as the starter docs and configuration values is left alone.sync-template:check: Report what would change without writing anything, and exit with an error if the template has drifted. The pre-commit hook runs this check, so a commit fails withtemplate out of syncuntil you runyarn sync-templateand stage the result.
A typical flow after changing a shared file:
yarn sync-template
git add template/ update-manifest.json
git commit
Linting commands
For more information about the linting commands, refer to CLI in the Biome documentation.
Related topics
- Configuration – Configuring your site's behaviour through docusaurus.config.ts and more.
- Internationalization – Translating documents with docStatic.
- Introduction – docStatic was designed from the ground up to be easily installed and used to get your website up and running quickly.
- Creating pages – Creating pages in the CMS.
- Static assets – Static assets are the non-code files that are directly copied to the build output. Learn about how they are handled and the best practices for using static assets.
- Hosted CMS – Using docStatic with cloud-hosted or self-hosted TinaCMS.
- Upgrading – Upgrading Node.js modules.