{"id":21059085,"url":"https://github.com/ganeshrvel/pub-scaff","last_synced_at":"2025-10-19T00:16:53.659Z","repository":{"id":56838528,"uuid":"240443031","full_name":"ganeshrvel/pub-scaff","owner":"ganeshrvel","description":"A command-line utility for generating Dart and Flutter components from template files.","archived":false,"fork":false,"pushed_at":"2023-07-29T08:52:44.000Z","size":56,"stargazers_count":29,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T17:39:37.194Z","etag":null,"topics":["dart","dart2","flutter","flutter-plugin","pubdev"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/scaff","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ganeshrvel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-14T06:28:47.000Z","updated_at":"2024-09-09T12:00:06.000Z","dependencies_parsed_at":"2022-09-12T10:20:10.517Z","dependency_job_id":null,"html_url":"https://github.com/ganeshrvel/pub-scaff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fpub-scaff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fpub-scaff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fpub-scaff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fpub-scaff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganeshrvel","download_url":"https://codeload.github.com/ganeshrvel/pub-scaff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254447820,"owners_count":22072754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dart2","flutter","flutter-plugin","pubdev"],"created_at":"2024-11-19T17:09:53.625Z","updated_at":"2025-10-19T00:16:53.651Z","avatar_url":"https://github.com/ganeshrvel.png","language":"Dart","funding_links":["https://paypal.me/ganeshrvel"],"categories":[],"sub_categories":[],"readme":"### Introduction\n\n##### Scaffold Generator for Dart and Flutter.\n\n**scaff** is a simple command-line utility for generating Dart and Flutter components from template files.\nIt is a very tedious job to keep replicating the boilerplate codes every time you try to add a new component in your app. Using scaff, you can generate dart or flutter components from the custom-defined templates. You can even include template variables in the component files and directories name for easy and flexible scaffolding.\n\n**scaff** uses 'Mustache templating library' variable schemes for defining and processing the template files.\n\n\n## Installation/Upgrade\n\n```shell\n$ dart pub global activate scaff\n```\n\n## Usage\n```shell\n$ dart pub global run scaff\n```\n\n## Example\nLet us create a simple component. First of all, we need to create a working directory and it should contain a scaff.setup.json file. The scaff.setup.json file should contain all the template variables used in the working directory.\nThe component subdirectories and files should be included inside the working directory. \nThe files and directories name may contain template variables as well.\n\nTemplate variable examples: {{var1}}, {{className}}Base, {{fileName}}_store\n\nThe example template directory structure:\n```\ncomponent_templates\n│   └── general_store_architecture\n│       ├── scaff.setup.json\n│       └── {{componentName}}\n│           ├── {{componentName}}.dart\n│           └── {{componentName}}_store.dart\n```\n\n1) Create a new directory in the project root\n\n```shell\n$ mkdir -p component_templates/general_store_architecture\n$ cd component_templates/general_store_architecture\n```\n\n2) Create the component directory\n\n```shell\n$ mkdir {{componentName}}\n$ cd {{componentName}}\n```\n\n3) Create the component template file\n\n```shell\n$ touch {{componentName}}.dart\n```\n\n4) Add the code to {{componentName}}.dart file\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:provider/provider.dart';\n\nimport '../../data/mobx/{{componentName}}_store.dart';\n\nclass {{className}}Screen extends StatelessWidget {\n  {{className}}Screen({\n    Key key,\n  }) : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    final {{componentName}} = Provider.of\u003c{{className}}Store\u003e(context);\n\n    return Scaffold(\n      body: Center(\n        child: Column(),\n      ),\n    );\n  }\n}\n```\n\n5) Create the store template file\n\n```shell\n$ touch {{componentName}}_store.dart\n```\n\n6) Add the code to {{componentName}}_store.dart file\n\n```dart\nimport 'package:mobx/mobx.dart';\n\nabstract class {{className}}StoreBase with Store {\n  @observable\n  bool dummyValue = false;\n}\n```\n\n7) Create the *scaff.setup.json* file\n\n```shell\n$ cd ..\n$ touch scaff.setup.json\n```\n\n8) Add all the template variables used in the working directory to scaff.setup.json file as\n\n```json\n{\n  \"variables\": [\n\t\"componentName\",\n\t\"className\"\n  ],\n  \"mappedVariables\": {\n\t\"componentName\": \"login\",\n\t\"className\": \"LoginScreen\"\n  }\n}\n```\n\n- `variables` holds a list of template variables. The CLI will prompt for the user input.\n- `mappedVariables` holds the values for the template variables. The generator will pick values from the `mappedVariables` automatically, if required.\n- You may use either of the one or in combination. CLI will skip the prompt if the value for a template variable is already available inside the `mappedVariables`.\n\n9) cd into general_store_architecture folder.\n\n```shell\n$ pwd # it should be pointing to =\u003e  /path/component_templates/general_store_architecture\n```\n\n10) Run scaff globally\n\n```shell\n$ dart pub global run scaff\n```\n\n11) You will be prompted to:\n```shell\nEnter source directory (/path/component_templates/general_store_architecture) »\nEnter destination directory (/path/component_templates/general_store_architecture/__component__) »\nEnter template extension (dart) » \nEnter 'componentName' variable value » login\nEnter 'className' variable value » Login\n```\n\n12) The destination directory will have the newly generated component.\nThe destination directory structure:\n\n```\n└── login\n    ├── login.dart\n    └── login_store.dart\n```\n\n\n- Development and debugging\n```shell\ndart pub global activate --source path /path/to/scaff\ndart pub global run scaff\n```\n\n### Buy me a coffee\nHelp me keep the app FREE and open for all.\nPaypal me: [paypal.me/ganeshrvel](https://paypal.me/ganeshrvel \"paypal.me/ganeshrvel\")\n\n### Contacts\nPlease feel free to contact me at ganeshrvel@outlook.com\n\n### About\n\n- Author: [Ganesh Rathinavel](https://www.linkedin.com/in/ganeshrvel \"Ganesh Rathinavel\")\n- License: [MIT](https://github.com/ganeshrvel/openmtp/blob/master/LICENSE \"MIT\")\n- Package URL: [https://pub.dev/packages/scaff](https://pub.dev/packages/scaff \"https://pub.dev/packages/scaff\")\n- Repo URL: [https://github.com/ganeshrvel/pub-scaff](https://github.com/ganeshrvel/pub-scaff/ \"https://github.com/ganeshrvel/pub-scaff\")\n- Contacts: ganeshrvel@outlook.com\n\n### License\nscaff | Scaffold Generator for Dart and Flutter. [MIT License](https://github.com/ganeshrvel/pub-scaff/blob/master/LICENSE \"MIT License\").\n\nCopyright © 2018-Present Ganesh Rathinavel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fpub-scaff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganeshrvel%2Fpub-scaff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fpub-scaff/lists"}