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:
npm
npx croct@latest use template.json5Properties
These are the supported properties:
- namestring
The action identifier. Always add-dependency for this action.
- dependenciesArray<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