at_app_bundler 0.3.0 icon indicating copy to clipboard operation
at_app_bundler: ^0.3.0 copied to clipboard

A command-line bundler for at_app_create templates.


Usage #

The following provides a full guide on how to use at_app_bundler.

Creating a Template #

A template in at_app_bundler is a modified brick from the mason package, see how to create a normal mason brick here.

Setup the template folder structure #

Create a folder with the name for your template, this is preferrably in snake_case. (referred to as <template-name> in the rest of the usage guide)
Within this folder create the following items:

  1. file template.yaml
  2. file brick.yaml
  3. directory __brick__

Configure brick.yaml #

You need to include the following fields:

  • name
    The <template-name>
  • description
    A description of what the template is for
    N.B. this is the description generated in the at_app_create model!
  • version
    A version number for the template
  • vars
    Leave this as an empty map
    (Currently unimplemented by the bundler)

Configure template.yaml #

This file provides configuration options for the app output.

Here is the schema:

  • dependencies: copy from pubspec.yaml
  • env
    • include: boolean
      Whether the template should allow/include the .env file
    • gitignore: boolean
      Whether to ignore the .env file - this one is a WIP
    • override: boolean
      Whether to use the env_override parameters as default values for .env
  • env_override:
    • A map of values to be written to the .env file.
  • android
    • enableR8: boolean
    • gradleVersion: string
    • kotlinVersion: string
    • minSdkVersion: string
    • targetSdkVersion: string
    • compileSdkVersion: string

Add your code to __brick__ #

Add your additional files and assets to this folder.

Keep in mind that the __brick__ folder represents the root of the project, so add your code to __brick__/lib.

N.B. Be careful not to overwrite files that will already be generated by the base templates. (pubspec.yaml, .gitignore,, android/**, ios/**)

N.B. Make sure to use relative imports when referencing other files in the template.

Bundling #

This is an abstraction of the dart bundler in mason_cli.

This bundler writes dart code for at_app_create templates, which provides all of the basic functionality required to generate a Flutter app template from dart code.

Run the bundler #

at_app_bundler bundle <path/to/template>

If you would like to specify the output folder:

at_app_bundler bundle -o <path/to/output> <path/to/template>