create-directory
Learn how to create a directory.
This action creates a directory, including any missing parents.
Idempotent
If the directory already exists, the action completes without error, making it safe to run multiple times.
This is helpful for setting up project structure before writing files, such as creating src/components or src/lib directories during scaffolding.
Example
The following template creates a components directory and prints a confirmation:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Directory setup", "description": "Creates a components directory.", "actions": [ { "name": "create-directory", "path": "src/components" }, { "name": "print", "semantics": "info", "message": "Directory src/components is ready." } ]}To apply this template, run:
npm
npx croct@latest use template.json5Properties
These are the supported properties: