Learn how to use the ForSure command-line interface.
The ForSure CLI provides commands for generating file structures from ForSure files:
forsure [command] [options]Generates a file structure from a ForSure file:
forsure generate <file> --output <directory>Example:
forsure generate project.forsure --output ./my-projectValidates a ForSure file without generating the structure:
forsure validate <file>Example:
forsure validate project.forsureCreates a new ForSure file with a basic structure:
forsure init [filename]Example:
forsure init my-project.forsureGenerate a new React component with TypeScript support:
forsure gen component -n my-button -t basic --typescript --test --storybookGenerate a custom React hook:
forsure gen hook -n use-data-fetcher -t api --typescript --testGenerate a utility function:
forsure gen utility -n format-currency --typescript --testGenerate a Next.js page:
forsure gen page -n dashboard -t admin --typescript --testGenerate a layout component:
forsure gen layout -n main-layout -t default --typescript --testGenerate CSS variables from design tokens:
forsure design tokens --format cssGenerate SCSS variables:
forsure design tokens --format scssWatch for changes and auto-generate:
forsure design tokens --watchSetup development environment:
forsure setupClean build artifacts:
forsure cleanLint and fix code:
forsure lint --fixRun tests with coverage:
forsure test --coverageBuild project for production:
forsure build --productionPublish package to registry:
forsure publish --registry npm --tag latest| Option | Description |
|---|---|
| --output, -o | Specify the output directory |
| --force, -f | Overwrite existing files |
| --dry-run, -d | Show what would be generated without actually creating files |
| --verbose, -v | Show detailed output |
| --help, -h | Show help information |
forsure generate project.forsure --output ./my-projectforsure validate project.forsureforsure generate project.forsure --output ./my-project --verboseforsure generate project.forsure --output ./my-project --forceYou can configure the ForSure CLI using a configuration file:
{
"defaultOutput": "./output",
"ignorePatterns": [
"node_modules",
".git"
],
"attributes": {
"defaultPermissions": "644"
}
}Learn more about configuration options:
CLI Configuration →Now that you understand the CLI, you can: