templetor_cli 1.0.4
templetor_cli: ^1.0.4 copied to clipboard
A CLI tool to bootstrap Flutter projects from a local template directory, handling dynamic name and organization replacement.
Templetor CLI #
A command-line tool to bootstrap Flutter projects from a bundled template, handling dynamic name and organization replacement.
Installation #
Activate the CLI from pub.dev:
dart pub global activate templetor_cli
Troubleshooting #
If you encounter errors like command not found or 'templetor_cli' is not recognized as an internal or external command, it means your system environment needs to be updated.
On Windows, you can resolve this by following these steps:
- Open PowerShell as an administrator.
- Run the following command to add the Dart Pub cache to your user's PATH:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:LOCALAPPDATA\Pub\Cache\bin", "User") - Close all open terminal or PowerShell windows.
- Open a new terminal and try using the CLI again.
Usage #
List Available Templates #
To see which templates are available, run the list-templates command:
templetor_cli list-templates
Create a New Project #
Run the create command to generate a new project. You only need to provide a project name.
templetor_cli create <project_name>
Options #
--org: Specify the organization. Defaults tocom.example.--description: The description for the new project. Defaults to "A new Flutter project.".--template,-t: The template to use. Defaults toredux.
Example:
templetor_cli create my_app --org com.mycompany --description "My amazing new app." --template redux
How it Works #
The CLI now uses a template that is bundled with the tool itself.
- Creates a fresh Flutter project using
flutter createwith your specified project name, organization, and description. - Deletes the default
libandtestdirectories from the new project. - Locates the chosen template and reads its configuration from a
templetor.jsonfile to determine the placeholder name. - Recursively copies files from the bundled template directory to the new project.
- During the copy process, it dynamically replaces placeholders based on the template's configured name. It handles snake_case, camelCase, and PascalCase conversions.