format-code
Learn how to format code files.
This action formats code files using the project's configured formatter, if available. If no formatter is found or formatting fails, the action completes silently without error.
Example
The following template downloads a component and formats it:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Component installer", "description": "Downloads and formats a component file.", "actions": [ { "name": "download", "source": "./code/hero.tsx", "destination": "src/components" }, { "name": "format-code", "files": ["src/components/hero.tsx"] } ]}To apply this template, run:
npm
npx croct@latest use template.json5Properties
These are the supported properties: