Skip to content

Commit 4ea0a12

Browse files
feat: mason - usecase bricks (#45)
* feat: added mason and [cubit, bloc, usecase, output_usecase] * feat: added usecase mason bricks * fix: exclude `bricks/**` * doc: bricks collection README.md * doc: updated README.md to reflect the brick usecases
1 parent 5338a09 commit 4ea0a12

36 files changed

+472
-22
lines changed

.mason/bricks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"cubit":"/Users/mlj/.mason-cache/hosted/registry.brickhub.dev/cubit_0.1.1","bloc":"/Users/mlj/.mason-cache/hosted/registry.brickhub.dev/bloc_0.1.1","usecase":"/Users/mlj/work/flutter-template/bricks/usecase","output_usecase":"/Users/mlj/work/flutter-template/bricks/output_usecase","stream_usecase":"/Users/mlj/work/flutter-template/bricks/stream_usecase","stream_output_usecase":"/Users/mlj/work/flutter-template/bricks/stream_output_usecase","future_output_usecase":"/Users/mlj/work/flutter-template/bricks/future_output_usecase","future_usecase":"/Users/mlj/work/flutter-template/bricks/future_usecase"}

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ analyzer:
8080
- "**/*.freezed.dart"
8181
# Ignore warnings in files generated by NStack specifically.
8282
- "**/*nstack.dart"
83+
# Ignore bricks
84+
- bricks/**

bricks/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Monstar Bricks 🧱
2+
3+
A collection of bricks.
4+
5+
## Installation
6+
7+
Ensure you have the [mason_cli](https://github.com/felangel/mason/tree/master/packages/mason_cli) installed. Bricks can be installed from [brickhub.dev](https://brickhub.dev).
8+
9+
> brickhub is currently in closed alpha testing.
10+
11+
```sh
12+
mason add <BRICK> [--path <LOCAL_BRICK_PATH>]
13+
```
14+
15+
## Bricks
16+
17+
| Brick | Description |
18+
| ----------------------- | ------------------------------------ |
19+
| `bloc` | Generate a new Bloc |
20+
| `cubit` | Generate a new Cubit |
21+
| `usecase` | Generate a new usecase |
22+
| `output_usecase` | Generate a new output usecase |
23+
| `stream_usecase` | Generate a new stream usecase |
24+
| `stream_output_usecase` | Generate a new stream output usecase |
25+
| `future_usecase` | Generate a new future usecase |
26+
| `future_output_usecase` | Generate a new future output usecase |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.1.0+1
2+
3+
- TODO: Describe initial release.

bricks/future_output_usecase/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# usecase
2+
3+
Generate a new FutureOutputUseCase in [Dart][1].
4+
5+
## Usage 🚀
6+
7+
```sh
8+
mason make future_output_usecase --name GetStories --output_type List<Story>
9+
```
10+
11+
## Variables ✨
12+
13+
| Variable | Description | Default | Type |
14+
| ------------- | ------------------------------ | -------- | -------- |
15+
| `name` | The name of the usecase class | None | `string` |
16+
| `output_type` | The output type of the usecase | `String` | `string` |
17+
18+
## Output 📦
19+
20+
```sh
21+
└── get_stories_usecase.dart
22+
```
23+
24+
[1]: https://dart.dev
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class {{name.pascalCase()}}UseCase extends FutureOutputUseCase<{{output_type.pascalCase()}}> {
2+
@override
3+
Future<{{output_type.pascalCase()}}> run() {
4+
// TODO: implement usecase
5+
}
6+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: future_output_usecase
2+
description: A new brick created with the Mason CLI.
3+
4+
# The following defines the version and build number for your brick.
5+
# A version number is three numbers separated by dots, like 1.2.34
6+
# followed by an optional build number (separated by a +).
7+
version: 0.1.0+1
8+
9+
# The following defines the environment for the current brick.
10+
# It includes the version of mason that the brick requires.
11+
environment:
12+
mason: ">=0.1.0-dev <0.1.0"
13+
14+
# Variables specify dynamic values that your brick depends on.
15+
# Zero or more variables can be specified for a given brick.
16+
# Each variable has:
17+
# * a type (string, number, or boolean)
18+
# * an optional short description
19+
# * an optional default value
20+
# * an optional prompt phrase used when asking for the variable.
21+
vars:
22+
name:
23+
type: string
24+
description: Use case name
25+
prompt: What is the use case name?
26+
output_type:
27+
type: string
28+
description: The use case output type (example String)
29+
default: String
30+
prompt: What is the output type for the use case?

bricks/future_usecase/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.1.0+1
2+
3+
- TODO: Describe initial release.

bricks/future_usecase/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.

0 commit comments

Comments
 (0)