Skip to content

Commit

Permalink
Remove usage of flutter format (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Oct 4, 2023
1 parent f9c1ba9 commit 52d28dc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
2 changes: 2 additions & 0 deletions mono_repo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 6.6.1

- Update to latest action versions.
- Remove usage of removed `flutter format` command in
the generated `tool/ci.sh` file.

## 6.6.0

Expand Down
17 changes: 14 additions & 3 deletions mono_repo/lib/src/ci_test_script.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ import 'package_config.dart';
import 'shell_utils.dart';
import 'user_exception.dart';

String _commandContent(String commandName) => '''
String _commandContent(String commandName, {bool dartOnly = false}) {
if (dartOnly) {
return '''
function $commandName() {
command dart $commandName "\$@"
}''';
}

return '''
# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter $commandName" is called instead of "dart $commandName".
# This assumes that the Flutter SDK has been installed in a previous step.
function $commandName() {
if grep -Fq "sdk: flutter" "\${PWD}/pubspec.yaml"; then
Expand All @@ -18,14 +28,15 @@ function $commandName() {
command dart $commandName "\$@"
fi
}''';
}

final bashScriptHeader = '''
#!/bin/bash
$createdWith
# Support built in commands on windows out of the box.
${_commandContent('pub')}
${_commandContent('format')}
${_commandContent('format', dartOnly: true)}
${_commandContent('analyze')}''';

String generateTestScript(
Expand Down
16 changes: 6 additions & 10 deletions mono_repo/test/script_integration_outputs/readme_ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# Created with package:mono_repo v1.2.3

# Support built in commands on windows out of the box.

# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter pub" is called instead of "dart pub".
# This assumes that the Flutter SDK has been installed in a previous step.
function pub() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
Expand All @@ -12,18 +13,13 @@ function pub() {
command dart pub "$@"
fi
}
# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# This assumes that the Flutter SDK has been installed in a previous step.

function format() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
command flutter format "$@"
else
command dart format "$@"
fi
command dart format "$@"
}

# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter analyze" is called instead of "dart analyze".
# This assumes that the Flutter SDK has been installed in a previous step.
function analyze() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
Expand Down
16 changes: 6 additions & 10 deletions tool/ci.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52d28dc

Please sign in to comment.