projgen 0.0.1

SDKdartflutter
Platformandroidioswindowslinuxmacos

A Dart command-line tool for generation of project structure i.e folders, and files based on a YAML configuration

projgen

This Dart command-line tool automates the generation of the project structure, folders, and files based on a YAML configuration. It simplifies project setup and ensures consistent organization across projects and teams.

Installation

To install projgen, ensure you have Dart SDK installed. Then run the following command:

dart pub global activate projgen

Usage

Navigate to the folder where you want to generate the structure.

To generate the necessary folders and files, use the following command:

projgen create --structure or projgen create -s

YAML Configuration

The YAML configuration file defines the project structure at a high level.

Create a projgen.yaml file at the root of project.

Here is an example:

# Name of your project
name: projgen demo

# Overall folder structure of the project
structure:
  # demo is used to show how the project works, in a typical Flutter
  # or Dart project, this will be lib
  - demo:
      - src:
          - main_dev.dart
          - main_prod.dart
          - app.dart
          - config.dart
          - core:
              - core.dart
              - network:
                  - network.dart
              - shared:
                  - shared.dart
              - routes:
                  - routes.dart
              - styles:
                  - styles.dart
          - features:
          - repositories:
          - services:
          - widgets:
              - widgets.dart

  # this tool is not limited to Dart and Flutter projects
  # demo structure for a REST API built in Golang.
  - demo_go:
      - cmd:
          - api:
          - examples:
      - internal:
          - data:
          - jsonlog:
          - mailer:
              - templates:
          - validator:
      - migrations:
      - remote:
      - vendor:
      - Makefile

# each feature
feature:
  - domain:
      - repositories:
      - models:
  - data:
      - data_provider:
  - presentation:
      - controller:
      - views:

You can also include a feature tag to specify feature folder structure. To generate a feature cd into the features directory and create a new feature using projgen create --feature <name> or projgen create -f <name>.

Check the demo and demo_go folders to see the folder structure and features generated by the tool.

Modify the YAML configuration file to match your desired project structure. Define directories, files, and their hierarchy according to your project's requirements.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please create a new issue or submit a pull request.

License

This project is licensed under the MIT License