Skip to content

wellyngson/create-script-features

Repository files navigation

Feature Generation Script for Android Projects

This script streamlines the creation of new features for Android projects by integrating Jetpack Compose with MVVM-I and Clean Architecture. It helps maintain a clean separation of layers (UI, Data, Domain), ensuring a consistent and maintainable codebase.

Architecture

Captura de Tela 2024-05-17 às 11 57 12

Setup

  1. Create Script File:

  2. Apply Script in Build Configuration:

    • Add the following line to your build.gradle.kts module: apply(from = "scripts/createfeature.gradle.kts")
    Captura de Tela 2024-03-26 às 16 44 26
    • Sync Your Project.

Package Structure

Captura de Tela 2024-03-26 às 16 16 59

How to Use

In your terminal, execute the following command:

./gradlew createfeature -PfeatureName=MyNewFeature -PapplicationId=welias.createscriptsfeatures

Replace MyNewFeature with your desired feature name, and welias.createscriptsfeatures with your application ID for your module.

BaseScriptViewModel

Firstly, create a BaseScriptViewModel in the current package where you are using the MVVM-I (Model, View, ViewModel, Intent) architecture to manage interactions between Composables and ViewModel. If you want to change the BaseScriptViewModel to another name, ensure you update the filename accordingly in the script.

Captura de Tela 2024-03-26 às 16 18 42

Result

In just milliseconds, your files will be generated, following a consistent architecture and automating repetitive tasks.

Captura de Tela 2024-03-26 às 16 30 57

Error Handling

If you attempt to create a new feature package with an existing name, an error will occur. Ensure your feature names are unique.

Captura de Tela 2024-03-26 às 16 32 46

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages