add-dependency

Learn how to add packages to a project.

This action adds packages to the project using the detected package manager.

For example, you can install libraries required by downloaded components or additional tooling needed for the setup.

Example

The following template adds runtime and development dependencies:

template.json5
{  "$schema": "https://schema.croct.com/json/v1/template.json",  "title": "Dependency setup",  "description": "Adds project dependencies.",  "actions": [    {      "name": "add-dependency",      "dependencies": [        "zod",        "lucide-react"      ]    },    {      "name": "add-dependency",      "dependencies": ["tailwindcss"],      "development": true    }  ]}

To apply this template, run:

npx croct@latest use template.json5

Properties

These are the supported properties:

name
string

The action identifier. Always add-dependency for this action.

dependencies
Array<string>

The list of packages to add.

You can include version specifiers, for example tailwindcss@4.

development(optional)
boolean

Whether to add the packages as development dependencies.

Default:false