Skip to content

Commit

Permalink
Fix starter as mason brick
Browse files Browse the repository at this point in the history
ErrorManager now accepts an AsyncCallback
  • Loading branch information
ibrahim-mubarak committed Apr 20, 2022
1 parent 113519e commit cd1bef4
Show file tree
Hide file tree
Showing 44 changed files with 567 additions and 40 deletions.
1 change: 1 addition & 0 deletions .mason/bricks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 4 additions & 2 deletions packages/flrx_test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.0.1
## 0.0.2
Fixed: TestErrorManager init signature

* TODO: Describe initial release.
## 0.0.1
initial release.
4 changes: 1 addition & 3 deletions packages/flrx_test/lib/src/error_manager.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'dart:ui';

import 'package:flrx/components/error_manager/error_manager.dart';
import 'package:flutter/foundation.dart';

class TestErrorManager extends ErrorManager {
TestErrorManager() : super();

@override
void init(VoidCallback runAppFunction) => runAppFunction();
Future<void> init(AsyncCallback runAppFunction) => runAppFunction();

@override
void reportCheckedError(error, stackTrace) {
Expand Down
4 changes: 2 additions & 2 deletions packages/flrx_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flrx_test
description: A new Flutter package project.
version: 0.0.1
version: 0.0.2
homepage: https://github.com/flrx/framework

environment:
Expand All @@ -13,7 +13,7 @@ dependencies:
sdk: flutter
flutter_test:
sdk: flutter
flrx: ^0.0.9
flrx: ^0.0.11

dev_dependencies:
flutter_lints: ^1.0.0
Expand Down
4 changes: 4 additions & 0 deletions packages/framework/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [v0.0.11]
### Changed
- ErrorManager now accepts an AsyncCallback instead of VoidCallback

## [v0.0.10]
### Changed
- `CatcherConfig` now returns asynchronously
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export 'catcher_error_manager.dart';
abstract class ErrorManager {
ErrorManager();

Future<void> init(VoidCallback runAppFunction);
Future<void> init(AsyncCallback runAppFunction);

void reportCheckedError(dynamic error, dynamic stackTrace);
}
4 changes: 2 additions & 2 deletions packages/framework/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flrx
description: A Redux Application Framework.
version: 0.0.10
version: 0.0.11
homepage: https://github.com/flrx/framework

environment:
Expand Down Expand Up @@ -32,7 +32,7 @@ dev_dependencies:
dart_code_metrics: ^4.5.0
flutter_launcher_icons: "^0.9.2"
flutter_lints: ^1.0.4
flutter_native_splash: ^2.0.5
flutter_native_splash: ^2.1.6
flutter_test:
sdk: flutter
mockito: ^5.0.16
Expand Down
61 changes: 61 additions & 0 deletions starter/__brick__/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# {{name}}

A new Flutter project.

## Getting Started

This project is a starting point for a Flrx based Flutter application.
The app is setup using melos for scripts and multi package.

### Default scripts
You can run the following scripts as "melos <script name>"

#### analyze

Run `flutter analyze` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.

#### gen

Runs all generate scripts

#### gen:build

Runs `flutter pub run build_runner build --delete-conflicting-outputs` build in all packages

#### gen:watch

Build generated files from build_runner and watch them for changes
Runs `flutter pub run build_runner watch --delete-conflicting-outputs` build in all packages

#### gen:icons

Generate native Launcher Icons
You can customize the config from `app/config/icons.yaml`
See https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/README.md#book-guide

#### gen:splash

Generate Native Splash Screen
You can customize the config from `app/config/splash.yaml`
See https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md#usage

#### gen:assets

Generate an Asset class using spider
You can customize the config from `app/spider.yaml`
See https://birjuvachhani.github.io/spider/

#### env:print

Generate dart define strings from `app/.env` and prints them to console
See https://github.com/ibrahim-mubarak/define-env/blob/master/README.md#usage

#### env:copy

Generate dart define strings from `app/.env` and copies it to clipboard
See https://github.com/ibrahim-mubarak/define-env/blob/master/README.md#usage

##### test

Runs test in all packages with coverage
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
11 changes: 11 additions & 0 deletions starter/__brick__/app/config/env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://github.com/ibrahim-mubarak/define-env/blob/master/README.md#usage
define_env:
file_path: lib/config
class: Env
fields:
APP_NAME:
default: {{name}}
type: String
APP_ENV:
default: staging
type: String
8 changes: 8 additions & 0 deletions starter/__brick__/app/config/icons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## See https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/README.md#book-guide
flutter_icons:
image_path: "logo.png"

android: true

ios: true
remove_alpha_ios: true
40 changes: 14 additions & 26 deletions __brick__/flrx.yaml → starter/__brick__/app/config/splash.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
flutter_icons:
android: true
ios: true
# image_path: "logo.png"

# See https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md#usage
flutter_native_splash:
# Customize the parameters below, and run the following command in the terminal:
# flutter pub run flutter_native_splash:create
# To restore Flutter's default white splash screen, run the following command in the terminal:
# flutter pub run flutter_native_splash:remove

### Light or Default Parameters
# color or background_image is the only required parameter. Use color to set the background
# of your splash screen to a solid color. Use background_image to set the background of your
# splash screen to a png image. This is useful for gradients. The image will be stretch to the
# size of the app. Only one parameter can be used, color and background_image cannot both be set.
color: "#f0f0fa"
color: "#FFFFFF"
#background_image: "assets/background.png"

# Optional parameters are listed below. To enable a parameter, uncomment the line by removing
# the leading # character.

# The image parameter allows you to specify an image used in the splash screen. It must be a
# png file and should be sized for 4x pixel density.
# image: "logo.png"
image: "logo.png"

# This property allows you to specify an image used as branding in the splash screen. It must be
# a png file. Currently, it is only supported for Android and iOS.
#branding: "logo.png"
# branding: "assets/images/logos/logo-color.png"

# To position the branding image at the bottom of the screen you can use bottom, bottomRight,
# and bottomLeft. The default values is bottom if not specified or specified something else.
Expand All @@ -41,10 +29,10 @@ flutter_native_splash:
# parameters from above. If the image_dark parameter is specified, color_dark or
# background_image_dark must be specified. color_dark and background_image_dark cannot both be
# set.
color_dark: "#1b1b1e"
#background_image_dark: "assets/dark-background.png"
#image_dark: assets/splash-invert.png
#branding_dark: assets/dart_dark.png
color_dark: "#1B1B1D"
# background_image_dark: "branding_dart.png"
# image_dark: "logo_dark.png"
# branding_dark: "assets/images/logos/logo.png"

# The android, ios and web parameters can be used to disable generating a splash screen on a given
# platform.
Expand Down Expand Up @@ -76,15 +64,15 @@ flutter_native_splash:
# To show the notification bar, add the following code to your Flutter app:
# WidgetsFlutterBinding.ensureInitialized();
# SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
#fullscreen: true
fullscreen: true

# If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
# with the info_plist_files parameter. Remove only the # characters in the three lines below,
# do not remove any spaces:
info_plist_files:
# - 'ios/Runner/Info-Debug.plist'
# - 'ios/Runner/Info-Profile.plist'
# - 'ios/Runner/Info-Release.plist'
#info_plist_files:
# - 'ios/Runner/Info-Debug.plist'
# - 'ios/Runner/Info-Profile.plist'
# - 'ios/Runner/Info-Release.plist'

# To enable support for Android 12, set the following parameter to true. Defaults to false.
android12: false
android12: true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added starter/__brick__/app/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions __brick__/pubspec.yaml → starter/__brick__/app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.4
flrx: ^0.0.9
flrx: ^0.0.11
dev_toolkit:
git:
url: https://github.com/flrx/dev_toolkit.git
Expand All @@ -34,11 +34,11 @@ dependencies:
redux_future_middleware: ^0.4.1

dev_dependencies:
flrx_test: ^0.0.1
flrx_test: ^0.0.2
flutter_launcher_icons: ^0.9.2
flutter_native_splash: ^1.3.3
flutter_native_splash: ^2.1.6
flutter_lints: ^1.0.4
dart_code_metrics: ^4.9.0
dart_code_metrics: ^4.14.0
test: any
integration_test:
sdk: flutter
Expand Down
22 changes: 22 additions & 0 deletions starter/__brick__/app/spider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Spider

# Generates unit tests to verify that the assets exists in assets directory
generate_tests: false

# Use this to remove vcs noise created by the `generated` comments in dart code
no_comments: true

# Exports all the generated file as the one library
export: true

# This allows you to import all the generated references with 1 single import!
use_part_of: true

# Location where all the generated references will be stored
package: resources

groups:
- paths:
- assets/images
class_name: Images
types: [ .png, .jpg, .jpeg, .webp, .webm, .bmp ]
File renamed without changes.
64 changes: 64 additions & 0 deletions starter/__brick__/melos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: {{name}}

packages:
- /**

scripts:
postbootstrap:
run: melos run gen

analyze:
run: melos exec -c 1 -- flutter analyze .
description: |
Run `flutter analyze` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
gen:
name: "gen"
description: "Run all generate scripts to build"
run: "melos gen:build && melos gen:icons && melos gen:splash && melos gen:assets"

# Build Runner Scripts
gen:build:
name: "gen:build"
description: 'Build generated files from build_runner'
run: melos exec -c 1 --depends-on="build_runner" -- "flutter pub run build_runner build --delete-conflicting-outputs"

gen:watch:
name: "gen:watch"
description: 'Build generated files from build_runner and watch them for changes'
run: melos exec -c 1 --depends-on="build_runner" -- "flutter pub run build_runner watch --delete-conflicting-outputs"

# Generate Icons
gen:icons:
name: "gen:icons"
description: 'Generate Launcher Icons'
run: melos exec --scope "{{name}}" -- "flutter pub run flutter_launcher_icons:main -f config/icons.yaml"

# Generate Splash Screens
gen:splash:
name: "gen:splash"
description: 'Generate Splash Screen'
run: melos exec --scope "{{name}}" -- "flutter pub run flutter_native_splash:create --path=config/splash.yaml"

# Generate Assets
gen:assets:
name: "gen:assets"
description: 'Generate assets using spider'
run: melos exec --file-exists="spider.yaml" -- "spider build"

# Generate Dart define string
env:print:
name: "env:print"
description: 'Generate Dart define strings from env and print to console'
run: melos exec --scope "{{name}}" -- "define_env -s config/env.yaml"

env:copy:
name: "env:copy"
description: 'Generate Dart define strings from env and copy to clipboard'
run: melos exec --scope "{{name}}" -- "define_env -s config/env.yaml --no-print -c"

# Run Tests
test:
name: "test"
description: 'Run all unit tests'
run: melos exec --dir-exists test --flutter -- "flutter test --coverage"
File renamed without changes.
Loading

0 comments on commit cd1bef4

Please sign in to comment.