From 6ee101bf36f355fe0a4c182f0fb5541eed566b90 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 20:54:57 -0500 Subject: [PATCH 1/8] doc: update readme --- README.md | 148 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 125 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 09a5d74f..b7360572 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ @@ -51,39 +51,54 @@ and open source. --- -## Development +## Contribution Clone this repo. -You have to install [melos](https://github.com/invertase/melos). +```shell +git clone ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git +``` + +### Prerequisite + +- [Flutter](https://github.com/flutter/flutter). + +- [Melos](https://github.com/invertase/melos). Used to manage Dart projects with multiple packages. ```shell dart pub global activate melos ``` -Then bootstrap with `melos bs`. +- [Mason](https://github.com/felangel/mason). Used for code generation. + +```shell +dart pub global activate mason_cli +``` + +- [Lcov](https://github.com/linux-test-project/lcov). Used to generate coverage data. + +```shell +# on macos +brew install lcov +``` + +- genhtml. Used to convert coverage data into html pages. + +After installing all these packages, bootstrap with `melos bs`. ### Create a new package Create a new package in `packages/` folder. ```shell -dart create -t package-simple wyatt_ -``` - -Remove any `example/` subfolder. Then create a new sample project. - -```shell -flutter create --platforms android --project-name _example example +mason make wyatt_package --package_name wyatt_ --description A new Wyatt package --flutter_only false ``` Then bootstrap project with `melos bs` command. -### Convention - #### Naming -In the previous instructions `` variable is important. +In the previous instructions `` variable is important. It have to be clear and intelligible. You **MUST** use underscores. @@ -93,15 +108,44 @@ You **MUST** use `wyatt` prefix for package. You **MUST** name example with specific name. For example, if name is CRUD BLOC + - name will be crud_bloc - so the package will be: `wyatt_crud_bloc` - and the example will be: `crud_bloc_example` -#### Commits +### Create issues + +Add the issues directly related to what you want to develop and label them correctly. + +``` +Type(scope): issue. +``` + +For example, on notification bloc package : + +- `Feature(notification_bloc): add firebase messaging data source.` +- `Test(notification_bloc): add test for pushwoosh datasource.` + +### Branches + +Master is protected. You can't push on it. Please develop your feature on another branch. The name of your branch has to match with the issue opened. + +`type(scope):issue` + +Example : +Issue : + +- `Feature(notification_bloc): add firebase messaging data source.` + +Branch related to this issue : + +- `feature(notification_bloc)/add_firebase_messaging_data_source` + +### Commits See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -tl;dr : `type(scope): description`. +tl;dr : `type(scope): description #issue`. Here allowed values: - **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version. @@ -115,11 +159,68 @@ Here allowed values: Some examples : -- `feat(auth): add AWS support.` = add a feature in authentication_bloc package. +- `feat(auth): add AWS support. (#31)` = add a feature in authentication_bloc package, linked to the 31st issue. - `docs: update readme.` = update **this** readme file. -- `fix(crud)!: fix bug in awesome() function.` = fix a bug, `!` is important and indicate `BREAKING CHANGES`. +- `fix(crud)!: fix bug in awesome() function. (#32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue. -Conventional commits are important for `melos version` command ! +When you have finished developing, and are ready to close the issue, close it via your commit : + +`feat(auth): add AWS support. (close #31)` + +Note that your issue will be close after merging on master. +Before closing the issue, please check tests and update coverage. You might run : + +```shell +melos run test +melos run gen_coverage +``` + +#### Merge your work + +After closing your issue, some work may have been done on master in the meantime. To keep a clean git history, please rebase before opening a change request. + +Two situations : + +- You have not yet created your branch and have committed locally : + +```shell +git pull --rebase +``` + +- You are already working on your branch : + +```shell +git rebase -i master +``` + +If possible, please use `--fixup` on your commit in interactive rebase. + +Then, opend your PR, get the necessary approval and merge your work. Then you're done ✅. + +#### Update version. + +Once your work is on the master, you can update your package version. Please filter packages to update only your package. `--scope` is used to do it. +For example, after merging changes on `nwyatt_otification_bloc` package, you might run : + +```shell +melos version --scope="*wyatt_notification_bloc*" +``` + +In fact, melos will filter all packages that match the `wyatt_notification_block` pattern. + +You can update check all packages tests by running : + +```shell +melos run test +``` + +#### Publish your package + +If package is ready for procution, publish it runnig : + +```shell +melos publish --scope"*package*" +``` #### Badging @@ -130,7 +231,8 @@ In the package `readme.md` file, please specify the supported SDK: ```markdown ![SDK: Dart & Flutter](https://img.shields.io/badge/SDK-Dart%20%7C%20Flutter-blue?style=flat-square) ``` -or + +or ![SDK: Dart](https://img.shields.io/badge/SDK-Dart-blue?style=flat-square) @@ -161,4 +263,4 @@ Here you can change `package name` and `package version`. ![Status: Experimental](https://img.shields.io/badge/Status-WIP-red?style=flat-square) -This repository is maintained by Wyatt Studio but work is in progress. \ No newline at end of file +This repository is maintained by Wyatt Studio but work is in progress. From 32cc1f55d95ba3949c7ead5a1a5de9b316df0be5 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 20:57:52 -0500 Subject: [PATCH 2/8] chore: update gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 65b6eace..37e175bc 100644 --- a/.gitignore +++ b/.gitignore @@ -197,4 +197,7 @@ $RECYCLE.BIN/ .idea/ *.iml google-services.json -pubspec_overrides.yaml \ No newline at end of file +pubspec_overrides.yaml + +# Mason +.mason/ \ No newline at end of file From 4d51e2b7864cff2c8352edb787f855e7513617c8 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 20:58:18 -0500 Subject: [PATCH 3/8] build: add coverage script --- combine_coverage.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 combine_coverage.sh diff --git a/combine_coverage.sh b/combine_coverage.sh new file mode 100755 index 00000000..00ba80b7 --- /dev/null +++ b/combine_coverage.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +escapedPath="$(echo `pwd` | sed 's/\//\\\//g')" + +if grep flutter pubspec.yaml > /dev/null; then + if [ -d "coverage" ]; then + # combine line coverage info from package tests to a common file + if [ ! -d "$MELOS_ROOT_PATH/coverage" ]; then + mkdir "$MELOS_ROOT_PATH/coverage" + fi + sed "s/^SF:lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> "$MELOS_ROOT_PATH/coverage/lcov.info" + rm -rf "coverage" + fi +fi \ No newline at end of file From 383098b14790376ee881affbdb33ac47de85f726 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 20:59:02 -0500 Subject: [PATCH 4/8] build: add mason configuration files --- mason-lock.json | 1 + mason.yaml | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 mason-lock.json create mode 100644 mason.yaml diff --git a/mason-lock.json b/mason-lock.json new file mode 100644 index 00000000..229f2288 --- /dev/null +++ b/mason-lock.json @@ -0,0 +1 @@ +{"bricks":{"wyatt_clean_code":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_clean_code","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}},"wyatt_feature_brick":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_feature_brick","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}},"wyatt_package":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}}}} \ No newline at end of file diff --git a/mason.yaml b/mason.yaml new file mode 100644 index 00000000..c9c22317 --- /dev/null +++ b/mason.yaml @@ -0,0 +1,13 @@ +bricks: + wyatt_clean_code: + git: + url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git + path: bricks/wyatt_clean_code + wyatt_feature_brick: + git: + url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git + path: bricks/wyatt_feature_brick + wyatt_package: + git: + url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git + path: bricks/wyatt_package \ No newline at end of file From 775d766d14045c7c66a9a777825e3ff18b6751e7 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 20:59:36 -0500 Subject: [PATCH 5/8] build: update melos configuration and update targets --- melos.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/melos.yaml b/melos.yaml index fa0becc3..580261a6 100644 --- a/melos.yaml +++ b/melos.yaml @@ -36,6 +36,18 @@ scripts: clean:deep: run: git clean -x -d -f -q description: Clean things very deeply with `git clean`. + + test:selective_unit_test: + run: melos exec --dir-exists="test" -- flutter test --no-pub --coverage + description: Run Flutter tests for a specific package in this project. + select-package: + flutter: true + + test: + run: melos run test:selective_unit_test --no-select + description: Run all Flutter tests in this project. + + gen_coverage: melos exec -- sh "\$MELOS_ROOT_PATH/combine_coverage.sh" && genhtml coverage/lcov.info -o coverage/html # Additional cleanup lifecycle script, executed when `melos clean` is run. postclean: > From 5918a5cf1fee14222fcc3bbc828423f0feeb302a Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 21:20:01 -0500 Subject: [PATCH 6/8] doc: add simple workflow diagramm --- doc/work_flow.puml | 15 +++++++++++++++ doc/workflow.svg | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 doc/work_flow.puml create mode 100644 doc/workflow.svg diff --git a/doc/work_flow.puml b/doc/work_flow.puml new file mode 100644 index 00000000..5e6e983d --- /dev/null +++ b/doc/work_flow.puml @@ -0,0 +1,15 @@ +@startuml Simple Developpment Workflow +start +:Create an issue; +:Create branch related to the issue; +repeat :Commit related to the issue; +repeat while (feature is done) +:Update coverage; +:Close issue via last commit; +:Rebase from `master`; +:Create pull request; +:Merge branches; +:Update version; +:Publish package; +stop +@enduml \ No newline at end of file diff --git a/doc/workflow.svg b/doc/workflow.svg new file mode 100644 index 00000000..c8443191 --- /dev/null +++ b/doc/workflow.svg @@ -0,0 +1,25 @@ +Create an issueCreate branch related to the issueCommit related to the issuefeature is doneUpdate coverageClose issue via last commitRebase from `master`Create pull requestMerge branchesUpdate versionPublish package \ No newline at end of file From cd881da0720e7f287765af4e470246669e96e14c Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 21:20:25 -0500 Subject: [PATCH 7/8] doc: update readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b7360572..d789fbb7 100644 --- a/README.md +++ b/README.md @@ -264,3 +264,9 @@ Here you can change `package name` and `package version`. ![Status: Experimental](https://img.shields.io/badge/Status-WIP-red?style=flat-square) This repository is maintained by Wyatt Studio but work is in progress. + +## Simple work flow diagramm + +To sum up, here a simple work flow diagramm. + +![Dev Wokflow](doc/workflow.svg) From 0dbde68d7d16ad15771cb2ba53fd51ba9de78b81 Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 21 Nov 2022 21:32:36 -0500 Subject: [PATCH 8/8] typo: fix readme typo error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d789fbb7..babeca68 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Then, opend your PR, get the necessary approval and merge your work. Then you're #### Update version. Once your work is on the master, you can update your package version. Please filter packages to update only your package. `--scope` is used to do it. -For example, after merging changes on `nwyatt_otification_bloc` package, you might run : +For example, after merging changes on `wyatt_otification_bloc` package, you might run : ```shell melos version --scope="*wyatt_notification_bloc*"