Compare commits
	
		
			5 Commits
		
	
	
		
			f0ed08bd49
			...
			775d766d14
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 775d766d14 | ||
|   | 383098b147 | ||
|   | 4d51e2b786 | ||
|   | 32cc1f55d9 | ||
|   | 6ee101bf36 | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -198,3 +198,6 @@ $RECYCLE.BIN/ | |||||||
| *.iml | *.iml | ||||||
| google-services.json | google-services.json | ||||||
| pubspec_overrides.yaml | pubspec_overrides.yaml | ||||||
|  | 
 | ||||||
|  | # Mason | ||||||
|  | .mason/ | ||||||
							
								
								
									
										136
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										136
									
								
								README.md
									
									
									
									
									
								
							| @ -51,36 +51,51 @@ and open source. | |||||||
| 
 | 
 | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| ## Development | ## Contribution | ||||||
| 
 | 
 | ||||||
| Clone this repo. | 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 | ```shell | ||||||
| dart pub global activate melos | 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 | ||||||
| 
 | 
 | ||||||
| Create a new package in `packages/` folder. | Create a new package in `packages/` folder. | ||||||
| 
 | 
 | ||||||
| ```shell | ```shell | ||||||
| dart create -t package-simple wyatt_<name> | mason make wyatt_package --package_name  wyatt_<name> --description A new Wyatt package --flutter_only false | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Remove any `example/` subfolder. Then create a new sample project. |  | ||||||
| 
 |  | ||||||
| ```shell |  | ||||||
| flutter create --platforms android --project-name <name>_example example |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Then bootstrap project with `melos bs` command. | Then bootstrap project with `melos bs` command. | ||||||
| 
 | 
 | ||||||
| ### Convention |  | ||||||
| 
 |  | ||||||
| #### Naming | #### Naming | ||||||
| 
 | 
 | ||||||
| In the previous instructions `<name>` variable is important. | In the previous instructions `<name>` variable is important. | ||||||
| @ -93,15 +108,44 @@ You **MUST** use `wyatt` prefix for package. | |||||||
| You **MUST** name example with specific name. | You **MUST** name example with specific name. | ||||||
| 
 | 
 | ||||||
| For example, if name is CRUD BLOC | For example, if name is CRUD BLOC | ||||||
|  | 
 | ||||||
| - name will be crud_bloc | - name will be crud_bloc | ||||||
| - so the package will be: `wyatt_crud_bloc` | - so the package will be: `wyatt_crud_bloc` | ||||||
| - and the example will be: `crud_bloc_example` | - 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. | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||||||
| 
 | 
 | ||||||
| tl;dr : `type(scope): description`. | tl;dr : `type(scope): description #issue`. | ||||||
| Here allowed <type> values: | Here allowed <type> 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. | - **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 <type> values: | |||||||
| 
 | 
 | ||||||
| Some examples : | 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. | - `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 | #### Badging | ||||||
| 
 | 
 | ||||||
| @ -130,6 +231,7 @@ In the package `readme.md` file, please specify the supported SDK: | |||||||
| ```markdown | ```markdown | ||||||
|  |  | ||||||
| ``` | ``` | ||||||
|  | 
 | ||||||
| or | or | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								combine_coverage.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								combine_coverage.sh
									
									
									
									
									
										Executable file
									
								
							| @ -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 | ||||||
							
								
								
									
										1
									
								
								mason-lock.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								mason-lock.json
									
									
									
									
									
										Normal file
									
								
							| @ -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"}}}} | ||||||
							
								
								
									
										13
									
								
								mason.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								mason.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
							
								
								
									
										12
									
								
								melos.yaml
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								melos.yaml
									
									
									
									
									
								
							| @ -37,6 +37,18 @@ scripts: | |||||||
|     run: git clean -x -d -f -q |     run: git clean -x -d -f -q | ||||||
|     description: Clean things very deeply with `git clean`. |     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. |   # Additional cleanup lifecycle script, executed when `melos clean` is run. | ||||||
|   postclean: > |   postclean: > | ||||||
|     melos exec -c 6 -- "flutter clean" |     melos exec -c 6 -- "flutter clean" | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user