GithubHelp home page GithubHelp logo

thomasecalle / app_starter Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 4.0 213 KB

Enables you to start a flutter application based on a template repository

License: MIT License

Dart 83.02% Kotlin 0.75% Swift 6.97% Objective-C 0.23% HTML 9.04%
flutter dart flutter-apps starter-template

app_starter's Introduction

app_starter ๐Ÿš€

A package that helps you start a flutter application from a specific template

Getting Started

Simply activate the package:

flutter pub global activate app_starter       

How to use it ?

Place yourself where you want to create your app and then simply run:

app_starter --name <package_identifier> --org <organisation> --template <template_git_repository>      

For example:

app_starter --name toto --org io.example --template https://github.com/ThomasEcalle/flappy_template        

Or, more concise, using abbreviations:

app_starter -n toto -o io.example -t https://github.com/ThomasEcalle/flappy_template      

Showing configuration file store values:

app_starter --config      

Showing help:

app_starter --help      

Arguments

Here are the list of arguments you could use :

key abbreviation description example
name n the dart package identifier example
org o the organisation identifier com.example
template t the git repository of your template https://github.com/ThomasEcalle/flappy_template
config c shows values stored in configuration file --config
save s save values in configuration file --save
help h shows help --help

How does it works ?

  1. This tool creates a fresh new flutter application using the basic flutter create command from the flutter version installed on your computer.

  2. It will get your model repository and clone it.

  3. Then, it will copy and paste the lib and test folders, as well as the pubspec.yaml file from your model repository to your new app.

  4. Fourth step: it will change all imports in these directories (and in pubspec.yaml) in order to put the right new dart package identifier.

  5. Finally, the tool will delete temporary cloned repository and...

    you are good to go !

Motivation

As a Flutter developper, you may have to create new apps very often.
Each time you create an application, you usually have to do the same things:

  • create the app with the right name and organization
  • put on the architecture you are used to work with
  • put all the dependencies you are used to work with
  • (depending on your needs): create several flavors
  • etc.

Being a freelance developer and having multiple customers or being a tech lead in a company always creating new apps, this kind of scenario may happen a lot in your life.

This package is here to make you save some time on these processes.

Several philosophies

Now that you want to automate these processes, you have to choose how to do it.

Using an already existing "starter"โ“

You could use an already existing starter as the famous one from very good ventures : very_good_cli

Let's be honest : this is a good starter !

But you can't really customize it depending on your needs.. and developers often have different needs !

Different philosophies on architecture, on dependencies, etc.

Cloning a repository and "change the name"โ“

An other option that I previously used was to create a model repository.
This repository would implement all I need for a "basic" app.
Then, I just had to clone it and change the app's name.

But... that was never so simple.

Creating a flutter app with the command line automate a bunch of things for you.
From putting the right packages on Android & iOS to the right names in configurations files, and a lot of other things.

So, to "just change the name of your app" is never simple.
Without mentioning the fact that the number of configuration files which need to be update may evolve as Flutter evolves itself !

Using app_starter ๐Ÿš€

I wanted to create a way to reunite the best of the 2 worlds:

  • creating the app using flutter's command-line flutter create prevents developer from putting his hands in all configuration files

  • cloning architecture from a model repository enables developer to build his own architecture and template

Flutter evolves ?

No problem, you will still be able to create a new app cloning your base architecture without any effort ๐ŸŽ‰

About app flavors

Flavors are really important in app develoment.
Most of the time, apps have at least a dev and a prod flavor, some times more.
But creating flavors is not really simple (see the official doc)

On Android, it is quite simple.

On iOS ... well... it is not "hard", but it takes you a little bit of time to be sure everything is ok.

I didn't want to force app_starter users to use flavors.
At first because app_starter should be really generic to fit with every developer needs.
Also because automating flavors creation is not really easy.

BUT, app_starter can still help you handling flavors easily in your templates ๐Ÿ”ฅ

For example, in the default template, I use the great package flutter_flavorizr.

Thanks to this package, I just have to say which flavors I would like to create in the pubspec.yaml.

Then, after app_starter run, I can generate these flavors using the flutter_flavorizr command-line ๐ŸŽ‰
As you can see, the way app_starter works enable each developer to make its own starter easily, without the constraint to base itself on someone else "template".

Feel free to create your own templates and to play with it !

app_starter's People

Contributors

thomasecalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

app_starter's Issues

ProcessException: The system cannot find the file specified.

I'm trying to generate preoject with my own custom template using app_starter -n toto -o io.example -t https://github.com/thealteria/getx_start_project command but everytime it's giving me these error:

[WARNING] Missing directory test in your template, it will be ignored
[ERROR] Error creating project : ProcessException: The system cannot find the file specified

shows this error?

app_starter -n toto -o io.example -t https://github.com/ThomasEcalle/flappy_template
[INFO] Let's create toto application !
[INFO] Creating flutter project using your current flutter version...
[INFO] Retrieving your template from https://github.com/ThomasEcalle/flappy_template...
[ERROR] Error creating project : ProcessException: The system cannot find the file specified.

Command: rm -rf C:\Users\faiz/toto/lib
Unhandled exception:
ProcessException: The system cannot find the file specified.

Command: rm -rf C:\Users\faiz/toto
#0 _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:476:7)
#1 _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:619:18)
#2 Process.runSync (dart:io-patch/process_patch.dart:66:12)
#3 CommandRunner.create (package:app_starter/src/command_runner.dart:204:15)

No active package app_starter.

Support for copy files from the root directory of a flutter project

Hello,

I wanted to express my gratitude for the incredible work you've done on this project.

As of now, the project efficiently supports copying only 'libs' folders, which adequately meets the needs of most users. However, I had a specific requirement to copy the '.vscode' folder as well. One approach could have been to fork your repository and add a script for copying the additional folders as per individual requirements. But, I felt that this solution might not be very scalable.

After careful consideration, I opted for using Mason, a solution that offers scalability and modularity. This choice provides a more scalable and modular way to handle diverse copying needs.

I'm sharing my experience and thoughts here to assist others who might face a similar decision-making process. Lastly, thank you once again for this amazing repository. I've learned a lot from studying your code.

Error in app_starter command

I get the following error when I try to create a new app from my package:

Error:

>app_starter --name myapp3 --org smeup.myapp3.com  --template https://pub.dev/packages/xxx

[INFO] Let's create myapp3 application !
[INFO] Creating flutter project using your current flutter version...
[INFO] Retrieving your template from https://pub.dev/packages/xxx...
[ERROR] Error creating project : FileSystemException: Cannot open file, path = 'C:\Users\tony\Source\smeup\repos-flutter/temp/pubspec.yaml' (OS Error: The system cannot find the path specified.
, errno = 3)
Unhandled exception:
ProcessException: The system cannot find the file specified.

  Command: rm -rf C:\Users\tony\Source\smeup\repos-flutter/myapp3
#0      _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:487:7)
#1      _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:632:18)
#2      Process.runSync (dart:io-patch/process_patch.dart:68:12)
#3      CommandRunner.create (package:app_starter/src/command_runner.dart:204:15)
<asynchronous suspension>
[INFO] Let's create myapp3 application !
[INFO] Creating flutter project using your current flutter version...
[INFO] Retrieving your template from https://pub.dev/packages/xxxx...
[ERROR] Error creating project : FileSystemException: Cannot open file, path = 'C:\Users\tony\Source\smeup\repos-flutter/temp/pubspec.yaml' (OS Error: The system cannot find the path specified.
, errno = 3)
Unhandled exception:
ProcessException: The system cannot find the file specified.

  Command: rm -rf C:\Users\tony\Source\smeup\repos-flutter/myapp3
#0      _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:487:7)
#1      _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:632:18)
#2      Process.runSync (dart:io-patch/process_patch.dart:68:12)
#3      CommandRunner.create (package:app_starter/src/command_runner.dart:204:15)
<asynchronous suspension>

Flutter Version:
Flutter 2.10.3 โ€ข channel stable โ€ข https://github.com/flutter/flutter.git
Framework โ€ข revision 7e9793dee1 (4 weeks ago) โ€ข 2022-03-02 11:23:12 -0600
Engine โ€ข revision bd539267b4
Tools โ€ข Dart 2.16.1 โ€ข DevTools 2.9.2

Opertating System:
Windows 10

Notes:
I noticed that there is a wrong file path:

Command: rm -rf C:\Users\tony\Source\smeup\repos-flutter/myapp3

The new pubspec.yaml in the new app does not have all the dependencies of the original file in the package

I think that the error is in the file "command_runner.dart" statement 144

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.