How to deploy flutter web site on GitHub using peanut

This Article is posted by nikhilchaudhary12155 at 10/13/2019 4:59:45 AM



What is peanut?
Peanut is a dart package to use for deploy flutter web site directly to Github Repo. 
Do you ever want to pub run build_runner build into another branch? This is your ticket. For Example: https://flutter.github.io/samples/

Install #

$ pub global activate peanut

Run #

$ cd ~/my_dart_proj/
$ peanut

This will build your project into a temporary directory, and then it will update the local gh-pages branch with its contents.

Flutter #

Flutter apps can be built by running peanut with the Flutter SDK.

Installing:

$ flutter pub global activate peanut

Running:

$ flutter pub global run peanut:peanut

Options #

$ peanut --help
Usage: peanut [<args>]

Arguments:
-d, --directories                The directories that should be built.
                                 (defaults to "web")

-b, --branch                     The git branch where the built content should
                                 be committed.
                                 (defaults to "gh-pages")

-c, --build-config               The configuration to use when running
                                 `build_runner`.

    --[no-]release               (defaults to on)
-m, --message                    (defaults to "Built <directories>")
    --[no-]source-branch-info    Includes the name of the source branch and SHA
                                 in the commit message
                                 (defaults to on)

    --post-build-dart-script     Optional Dart script to run after all builds
                                 have completed, but before files are committed
                                 to the repository.

    --builder-options            Builder options YAML or a path to a file
                                 containing builder options YAML.
                                 See the README for details.

    --[no-]verbose               Print more details when running.
    --dry-run                    Verifies configuration and prints commands that
                                 would be executed, but does not do any work.

-h, --help                       Prints usage information.
    --version                    Print the current version.

Configuration file #

You can also configure peanut with a configuration file. Convenient if you have one-off settings you'd rather not time you deploy.

The peanut.yaml from this repository:

# Configuration for https://pub.dev/packages/peanut
directories:
- example

Examples #

Git tricks #

The easiest way to push your gh-pages branch to Github (without switching from your working branch) is:

$ git push origin --set-upstream gh-pages

To create (or update) your local gh-pages branch to match what's on the server.

$ git update-ref refs/heads/gh-pages origin/gh-pages

This is also useful if you want to undo a peanut run.

__________________________________________________________________________________________

For More Info About Flutter :

Check Out Live Flutter Web Demo: http://nikhil.cf/
Follow us on Github Account https://github.com/nikhil269

Tags: flutter flutterweb flutterisfuture dart flutterforweb peanut








0 Comments
Login to comment.
Recent Comments












© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com