{"id":20468485,"url":"https://github.com/clawstudios/wholesome-cli","last_synced_at":"2025-04-13T10:26:17.105Z","repository":{"id":54311423,"uuid":"209137960","full_name":"clawstudios/wholesome-cli","owner":"clawstudios","description":"Command Line Tool for managing Flutter projects","archived":false,"fork":false,"pushed_at":"2021-02-24T22:26:51.000Z","size":92,"stargazers_count":58,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T01:48:10.931Z","etag":null,"topics":["bloc","boilerplate","command-line-tool","dart","facilitates","flutter","pub","subcommands"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clawstudios.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":"2019-09-17T19:18:21.000Z","updated_at":"2024-07-20T04:28:14.000Z","dependencies_parsed_at":"2022-08-13T11:40:46.435Z","dependency_job_id":null,"html_url":"https://github.com/clawstudios/wholesome-cli","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/clawstudios%2Fwholesome-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawstudios%2Fwholesome-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawstudios%2Fwholesome-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawstudios%2Fwholesome-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clawstudios","download_url":"https://codeload.github.com/clawstudios/wholesome-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248697164,"owners_count":21147273,"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":["bloc","boilerplate","command-line-tool","dart","facilitates","flutter","pub","subcommands"],"created_at":"2024-11-15T14:05:40.517Z","updated_at":"2025-04-13T10:26:17.084Z","avatar_url":"https://github.com/clawstudios.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"![A Command Line Tool that facilitates code generation for Flutter projects.](https://www.clawstudios.com/assets/wholesome/icon.png)\n\nWholesome is a Command Line Tool that aims to facilitate code generation for [Flutter](https://flutter.dev/) projects, proposing a default architecture based on BLoC pattern.\n\n## Requeriments\nThis tool is executed using [pub](https://pub.dev/) and generate code for [Flutter](https://flutter.dev/) projects this means that you will need:\n - [Dart SDK](https://dart.dev/get-dart)\n - [Flutter](https://flutter.dev/docs/get-started/install)\n\n## Installation\nWholesome-cli now is a (pub.dev package)[https://pub.dev/packages/wholesome_cli/versions/1.0.0] and you can install the stable version from pub, or installit from this repo if you want the latest dev version.\n\n### Pub\n    pub global activate wholesome_cli\n\n### Git Online\nYou can install the tool from this repo link by running the following line:\n\n    pub global activate --source git https://github.com/clawstudios/wholesome-cli.git\n\n### Git Local\nIf you cloned the repository, you can install the tool with the following line replacing `\u003cpath\u003e` with the path where the repo is located on your computer.\n\n    pub global activate --source path \u003cpath\u003e\n\n### Add the executable folder to $PATH\nTo execute Wholesome from your command line, you need to add the [pub](https://pub.dev/) cache folder to the PATH.\nCheck out the [Running Script](https://dart.dev/tools/pub/cmd/pub-global#running-a-script) section in the [pub-global](https://dart.dev/tools/pub/cmd/pub-global) Dart documentation to add the path correctly for your system.\n\n## Before Starting\n\nThis tool is based on the following folder structure.\n*You can read more about each folder in the section of each subcommand of the generator.*\n\n    / myproject\n      |- .idea\n      |- android\n      |- assets\n      |- ios\n      |- lib\n        |- common\n        |- components\n            |- mycomponent\n                |- mycomponent.bloc.dart\n                |- mycomponent.events.dart\n                |- mycomponent.state.dart\n                |- mycomponent.view.dart\n        |- guards\n        |- models\n        |- pages\n            |- mypage\n                |- mypage.bloc.dart\n                |- mypage.events.dart\n                |- mypage.state.dart\n                |- mypage.view.dart\n        |- services\n      |- test\n\n\n\n## Commands\nEvery Wholesome command needs to be executed by the **wsm** binary. At the moment, it supports the following commands and subcommands:\n - [new](https://github.com/clawstudios/wholesome-cli#new)\n - [generate](https://github.com/clawstudios/wholesome-cli#generate)\n     - [component](https://github.com/clawstudios/wholesome-cli#component)\n     - [guard](https://github.com/clawstudios/wholesome-cli#guard)\n     - [model](https://github.com/clawstudios/wholesome-cli#model)\n     - [page](https://github.com/clawstudios/wholesome-cli#page)\n     - [service](https://github.com/clawstudios/wholesome-cli#service)\n\n## New\n\nThe **new** command generates a new Flutter project with the provided name, the [previously detailed folder](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) folder structure, and some boilerplate code.\n\n    wsm new myproject\n    \n*This command will run 'flutter new' and then will generate the structure and files.*\n\nThis command also generates the following files inside the **common** folder:\n - assets.dart\n - colors.dart\n - helpers.dart\n - routes.dart\n - styles.dart\n\n### Assets, Colors and Styles\nThese are files for storing constants with asset paths, custom colors, or custom styles that you need to reuse on every part of the app.\n\nYou can import the files in the following way:\n\n    import  'package:myproject/common/assets.dart'  as ASSETS;\n    import  'package:myproject/common/colors.dart'  as COLORS;\n    import  'package:myproject/common/styles.dart'  as STYLES;\n\n### Helpers\nThis is a file created to put all the helper functions that you will use to develop your app.\n\nYou need to import it like this:\n\n    import  'package:myproject/common/helpers.dart'  as HELPERS;\n \nAnd you will find two methods for printing to console.\n\n    HELPERS.printError('This is an error message.');\n    HELPERS.printWarn('This is a warning message.');\n\n### Routes\nIn this file, you will find a ROUTES Map in where you can add routes and associate them with the generated Page constructor.\n\nFor more information about routing, please check [Flutter Routing Docs](https://flutter.dev/docs/development/ui/navigation).\n\n## Generate\n\nThis command generates boilerplate code, it receives **one subcommand as a parameter** and you must **execute this command under a Flutter Project** \n\n    wsm generate \u003csubcommand\u003e\n\n### Component\n\nA component is a reusable implementation of code that could have one or more files.\n\n#### Stateful Component\nFor components that need state management, Wholesome generates a set of files inside a folder named the same as the component (as you can see in the [Before Starting](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) section, inside the 'components' folder)\n\n    wsm generate component \u003cname\u003e\n\n**Generated Files:** \n\n**name.bloc.dart**\nThis file contains all the Business Logic and also is intended to manage the State of the component through events.\n\n**name.events.dart**\nContains an abstract class ready to be extended by custom events used to comunicate between BLoC and View.\n\n**name.state.dart**\nContains a class with the State data of the component and only can be modified by the BLoC.\n\n**name.view.dart:**\nIs a StatefulWidget with a BLoC instance in it and a dispose implementation that includes the _bloc.dispose() call that is needed to shutdown the BLoC controllers when disposing the view.\n\n#### Stateless Component\nFor components without state management, Wholesome will generate only a StatelessWidget that will be used as a view.\n\n    wsm generate component \u003cname\u003e -s\n    # or\n    wsm generate component \u003cname\u003e -stateless\n\n### Guard\n\nGuard functionality is to manage the access to one or more views, that's why you will find a default **canActivate** method that returns a boolean ready to be used from a Page. Guards can be extended as needed.\n*These files are created under the 'guards' folder as shown in the [Before Starting](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) section.*\n\n    wsm generate guard \u003cname\u003e\n\n#### Usage\n\nGuards are implemented as mixins, you can use it on a generated page adding the 'with' keyword to the state class. \n*[More info about mixins here](https://github.com/dart-lang/language/blob/master/accepted/2.1/super-mixins/feature-specification.md#dart-2-mixin-declarations)*\n\n    ...\n    class _HomePageState extends State\u003cHomePage\u003e with ExampleGuard {\n\n      HomePageBloc _bloc = HomePageBloc();\n\n      @override\n      void initState() {\n          if (!this.canActivate(context)) {\n              // Get out of here\n          }\n      }\n    ...\n\n### Model\n\nModels are classes that represent different data models handled inside an app such as user data to show in a profile view.\n*Models are located inside the 'models' folder. (check the [previously detailed folder](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) structure).*\n\n    wsm generate model \u003cname\u003e\n\n### Page\n\nPages are StatefulWidgets with the same structure as components, but they can be accessed navigating to their specific route that is also generated by this subcommand. \nIn pages is where you will instantiate components and trigger events to the BLoC for handling state and model mutations.\n\n\n*Pages are located inside 'pages' folder. (check the [previously detailed folder](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) folder structure).*\n\n    wsm generate page \u003cname\u003e\n\n*See the (Routes)[https://github.com/clawstudios/wholesome-cli/blob/master/README.md#routes] section if youe need to add a route manually.*\n\n### Service\n\nServices are singletons that expose methods to interact with external resources such as APIs or databases.\n\n*Services are located inside the 'services' folder. (check the [previously detailed folder](https://github.com/clawstudios/wholesome-cli/blob/master/README.md#before-starting) folder structure).*\n\n    wsm generate service \u003cname\u003e\n\n## Credits\nThis tool is a development in progress by [Claw Studios](https://www.clawstudios.com/) and is under BSD License. \n\nIf you want to help, contribute or report a bug please use the following channels\n- [Slack](https://join.slack.com/t/clawstudios/shared_invite/enQtNzYyNTY2NzI1ODEwLWM1MzEzODc2ZDYxNDY5MmY4NWRkNWRhMzM4MTliM2I3NjM5MjIzM2Q5Y2U0ZTYwZmRkNjc0N2Q3NjRlYTA0MmI)\n- [Discord](https://discord.gg/zyghfFq)\n- info@clawstudios.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclawstudios%2Fwholesome-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclawstudios%2Fwholesome-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclawstudios%2Fwholesome-cli/lists"}