diff --git a/packages/wyatt_analysis/.latest_version b/packages/wyatt_analysis/.latest_version new file mode 100644 index 00000000..005119ba --- /dev/null +++ b/packages/wyatt_analysis/.latest_version @@ -0,0 +1 @@ +2.4.1 diff --git a/packages/wyatt_analysis/.vscode/extensions.json b/packages/wyatt_analysis/.vscode/extensions.json index 30cd2233..bc053a4b 100644 --- a/packages/wyatt_analysis/.vscode/extensions.json +++ b/packages/wyatt_analysis/.vscode/extensions.json @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 WYATT GROUP + * Copyright (C) 2023 WYATT GROUP * Please see the AUTHORS file for details. * * This program is free software: you can redistribute it and/or modify diff --git a/packages/wyatt_analysis/README.md b/packages/wyatt_analysis/README.md index bd675c4a..28b5244d 100644 --- a/packages/wyatt_analysis/README.md +++ b/packages/wyatt_analysis/README.md @@ -20,10 +20,18 @@ ![SDK: Dart & Flutter](https://img.shields.io/badge/SDK-Dart%20%7C%20Flutter-blue?style=flat-square) -This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.0.yaml**. +This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.1.yaml**. **Note**: This package was heavily inspired by [pedantic](https://github.com/dart-lang/pedantic), [Very Good Analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) and the official [flutter_lints](https://pub.dev/packages/flutter_lints). +## Adding Wyatt Analysis to your project + +Using CLI: + +```sh +dart pub add wyatt_analysis:2.4.1 --dev --hosted-url=https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ +``` + ## Usage To use the lints, add a dependency in your `pubspec.yaml` : @@ -31,7 +39,7 @@ To use the lints, add a dependency in your `pubspec.yaml` : ```yaml wyatt_analysis: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ - version: 2.4.0 + version: 2.4.1 ``` Then, add an include in `analysis_options.yaml` : @@ -49,13 +57,13 @@ include: package:wyatt_analysis/analysis_options.flutter.yaml If you wish to restrict the lint version, specify a version of `analysis_options.yaml` instead: ```yaml -include: package:wyatt_analysis/analysis_options.flutter.2.4.0.yaml +include: package:wyatt_analysis/analysis_options.flutter.2.4.1.yaml ``` If you just want **Dart** version: ```yaml -include: package:wyatt_analysis/analysis_options.2.4.0.yaml +include: package:wyatt_analysis/analysis_options.2.4.1.yaml ``` ## Suppressing Lints @@ -109,10 +117,11 @@ To indicate your project is using `wyatt_analysis` → [![style: wyatt analysis] When you want to create a new version of the plugin. Before any modification, execute the following command to create new files: ```sh -./new_version.sh +./new_version.sh ``` -> Where `` is 2.4.0 +The previous version is automatically detected thanks to the `.latest_version` file. +So `.latest_version` needs to be versioned! ## Notes diff --git a/packages/wyatt_analysis/new_version.sh b/packages/wyatt_analysis/new_version.sh index 625f89c5..2c40cb61 100755 --- a/packages/wyatt_analysis/new_version.sh +++ b/packages/wyatt_analysis/new_version.sh @@ -18,20 +18,12 @@ usage=" usage: - $(basename "$0") -- create new analyzer files. + $(basename "$0") -- create new analyzer files. where: - previous_version: last version, for example \`2.3.0\` new_version: new version, for example \`2.4.0\`" -old=$1 -new=$2 - -if [ -z "$old" ]; then - echo "previous_version cannot be null" - echo "${usage}" - exit 1 -fi +new=$1 if [ -z "$new" ]; then echo "new_version cannot be null" @@ -43,6 +35,19 @@ SCRIPT_PATH="${BASH_SOURCE:-$0}" ABS_SCRIPT_PATH="$(realpath "${SCRIPT_PATH}")" ABS_DIRECTORY="$(dirname "${ABS_SCRIPT_PATH}")" +LATEST_VERSION="${ABS_DIRECTORY}/.latest_version" + +# Read latest version +if [ -e "$LATEST_VERSION" ]; then + old=$(cat "$LATEST_VERSION") + echo "> latest package version is: $old" + echo "> new package version is: $new" +else + echo "latest version is not set" + echo "create a file named \`.latest_version\` in the root of the project" + exit 1 +fi + LIB="${ABS_DIRECTORY}/lib/wyatt_analysis.dart" OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.yaml" OLD_OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.${old}.yaml" @@ -52,6 +57,7 @@ OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.yaml" OLD_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${old}.yaml" NEW_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${new}.yaml" + if [ ! -e "$OLD_OPTIONS" ]; then echo "analysis_options.${old}.yaml doesn't exists" echo "${usage}" @@ -91,7 +97,7 @@ sed -e "s/${old}/${new}/g" "README.md" > tempfile.tmp mv -f tempfile.tmp "README.md" echo " -# Copyright (C) 2022 WYATT GROUP +# Copyright (C) 2023 WYATT GROUP # Please see the AUTHORS file for details. # # This program is free software: you can redistribute it and/or modify @@ -111,7 +117,7 @@ include: package:wyatt_analysis/analysis_options.${new}.yaml " > "${OPTIONS}" echo " -# Copyright (C) 2022 WYATT GROUP +# Copyright (C) 2023 WYATT GROUP # Please see the AUTHORS file for details. # # This program is free software: you can redistribute it and/or modify @@ -130,4 +136,7 @@ echo " include: package:wyatt_analysis/analysis_options.flutter.${new}.yaml " > "${OPTIONS_FLUTTER}" +# Update latest version +echo "${new}" > "$LATEST_VERSION" + exit 0