From fc611eb63ac3499588b92535028516c4ca7ab5a0 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 09:34:20 +0200 Subject: [PATCH 1/9] feat: add pub workspace support and update dependencies --- .../analysis_options.yaml | 3 +- .../lib/{{project_name.snakeCase()}}.dart | 2 +- .../{{project_name.snakeCase()}}/pubspec.yaml | 7 +- wnma_dart_package/brick.yaml | 5 ++ .../analysis_options.yaml | 3 +- .../{{project_name.snakeCase()}}/pubspec.yaml | 7 +- wnma_flutter_package/brick.yaml | 6 +- .../{{project_name.snakeCase()}}/melos.yaml | 66 ---------------- .../{{project_name.snakeCase()}}/pubspec.yaml | 75 ++++++++++++++++++- 9 files changed, 94 insertions(+), 80 deletions(-) delete mode 100644 wnma_workspace/__brick__/{{project_name.snakeCase()}}/melos.yaml diff --git a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml index 245ed9f..0556da5 100644 --- a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml +++ b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml @@ -1 +1,2 @@ -include: package:lintervention/analysis_options.yaml +{{#publishable}}include: package:lintervention/package.yaml{{/publishable}} +{{^publishable}}include: package:lintervention/app.yaml{{/publishable}} diff --git a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart index e95435a..a04d5f2 100644 --- a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart +++ b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart @@ -1,4 +1,4 @@ /// {{{description}}} -library {{project_name.snakeCase()}}; +library; export 'src/{{project_name.snakeCase()}}.dart'; diff --git a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 84e1f19..b65f3e4 100644 --- a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -2,11 +2,12 @@ name: {{project_name.snakeCase()}} description: {{{description}}} version: 0.1.0 {{^publishable}}publish_to: none{{/publishable}} +{{#workspace}}resolution: workspace{{/workspace}} environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.9.0 <4.0.0" dev_dependencies: - lintervention: ^0.3.1 + lintervention: ^0.4.0 mocktail: ^1.0.4 - test: ^1.26.2 + test: ^1.26.3 diff --git a/wnma_dart_package/brick.yaml b/wnma_dart_package/brick.yaml index fcc6e98..018028a 100644 --- a/wnma_dart_package/brick.yaml +++ b/wnma_dart_package/brick.yaml @@ -22,3 +22,8 @@ vars: description: Whether the generated package is intended to be published. default: false prompt: Will the package be published? + workspace: + type: boolean + description: Whether this package is part of a dart workspace (such as melos >7.0.0) + default: true + prompt: Is this package part of a workspace? diff --git a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml index 245ed9f..0556da5 100644 --- a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml +++ b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml @@ -1 +1,2 @@ -include: package:lintervention/analysis_options.yaml +{{#publishable}}include: package:lintervention/package.yaml{{/publishable}} +{{^publishable}}include: package:lintervention/app.yaml{{/publishable}} diff --git a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 5789543..862d413 100644 --- a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -2,10 +2,11 @@ name: {{project_name.snakeCase()}} description: {{{description}}} version: 0.1.0 {{^publishable}}publish_to: none{{/publishable}} +{{#workspace}}resolution: workspace{{/workspace}} environment: - sdk: ">=3.8.0 <4.0.0" - flutter: ">=3.32.0" + sdk: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" dependencies: flutter: @@ -14,5 +15,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lintervention: ^0.3.1 + lintervention: ^0.4.0 mocktail: ^1.0.4 diff --git a/wnma_flutter_package/brick.yaml b/wnma_flutter_package/brick.yaml index e5bc29d..2bd584f 100644 --- a/wnma_flutter_package/brick.yaml +++ b/wnma_flutter_package/brick.yaml @@ -22,4 +22,8 @@ vars: description: Whether the generated package is intended to be published. default: false prompt: Will the package be published? - \ No newline at end of file + workspace: + type: boolean + description: Whether this package is part of a dart workspace (such as melos >7.0.0) + default: true + prompt: Is this package part of a workspace? \ No newline at end of file diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/melos.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/melos.yaml deleted file mode 100644 index 74c9d56..0000000 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/melos.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: {{project_name.snakeCase()}}_workspace - -packages: - - packages/* - -command: - version: - updateGitTagRefs: true - workspaceChangelog: false - hooks: - preCommit: | - melos run generate - git add . - -scripts: - analyze: - run: | - dart analyze . --fatal-infos - exec: - # We are setting the concurrency to 1 because a higher concurrency can crash - # the analysis server on low performance machines (like GitHub Actions). - concurrency: 1 - description: | - Run `dart analyze` in all packages. - - Note: you can also rely on your IDEs Dart Analysis / Issues window. - - test:select: - run: flutter test - exec: - failFast: true - concurrency: 6 - packageFilters: - dirExists: test - description: Run `flutter test test` for selected packages. - - test: - run: melos run test:select --no-select - description: Run all tests in this project. - - coverage:select: - run: | - flutter test --coverage - exec: - failFast: true - concurrency: 6 - packageFilters: - dirExists: test - description: Generate coverage for the selected package. - - coverage: - run: melos run coverage:select --no-select - description: Generate coverage for all packages. - - generate:select: - description: Run code generation for selected packages. - run: dart run build_runner build --delete-conflicting-outputs - exec: - concurrency: 1 - failFast: true - packageFilters: - dependsOn: - - build_runner - - generate: - description: Run code generation for all packages. - run: melos run generate:select --no-select \ No newline at end of file diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index ec506a3..84f45d7 100644 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -3,10 +3,77 @@ description: {{{description}}} version: 0.1.0 publish_to: none +workspace: + - # TODO Add your workspace packages or apps here + environment: - sdk: ">=3.8.0 <4.0.0" - flutter: ">=3.32.0" + sdk: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" dev_dependencies: - lintervention: ^0.3.1 - melos: ^6.3.3 + lintervention: ^0.4.0 + melos: ^7.1.1 + + +melos: + command: + version: + updateGitTagRefs: true + workspaceChangelog: false + hooks: + preCommit: | + melos run generate + git add . + + scripts: + analyze: + run: | + dart analyze . --fatal-infos + exec: + # We are setting the concurrency to 1 because a higher concurrency can crash + # the analysis server on low performance machines (like GitHub Actions). + concurrency: 1 + description: | + Run `dart analyze` in all packages. + - Note: you can also rely on your IDEs Dart Analysis / Issues window. + + test:select: + run: flutter test + exec: + failFast: true + concurrency: 6 + packageFilters: + dirExists: test + description: Run `flutter test test` for selected packages. + + test: + run: melos run test:select --no-select + description: Run all tests in this project. + + coverage:select: + run: | + flutter test --coverage + exec: + failFast: true + concurrency: 6 + packageFilters: + dirExists: test + description: Generate coverage for the selected package. + + coverage: + run: melos run coverage:select --no-select + description: Generate coverage for all packages. + + generate:select: + description: Run code generation for selected packages. + run: dart run build_runner build --delete-conflicting-outputs + exec: + concurrency: 1 + failFast: true + packageFilters: + dependsOn: + - build_runner + + generate: + description: Run code generation for all packages. + run: melos run generate:select --no-select \ No newline at end of file From 93741a60352034cbbba96e55ec1449ab6d157e86 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 09:50:27 +0200 Subject: [PATCH 2/9] fix CI --- wnma_dart_package/config.json | 3 ++- wnma_flutter_package/config.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wnma_dart_package/config.json b/wnma_dart_package/config.json index f4a2882..75c058d 100644 --- a/wnma_dart_package/config.json +++ b/wnma_dart_package/config.json @@ -1,5 +1,6 @@ { "project_name": "test_package", "description": "Package for testing", - "publishable": true + "publishable": true, + "workspace": true } \ No newline at end of file diff --git a/wnma_flutter_package/config.json b/wnma_flutter_package/config.json index f4a2882..75c058d 100644 --- a/wnma_flutter_package/config.json +++ b/wnma_flutter_package/config.json @@ -1,5 +1,6 @@ { "project_name": "test_package", "description": "Package for testing", - "publishable": true + "publishable": true, + "workspace": true } \ No newline at end of file From 53d0fc5681d1404fd25fdbfc23f9a6382e37609d Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 09:54:05 +0200 Subject: [PATCH 3/9] again --- wnma_dart_package/config.json | 2 +- wnma_flutter_package/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wnma_dart_package/config.json b/wnma_dart_package/config.json index 75c058d..495fea2 100644 --- a/wnma_dart_package/config.json +++ b/wnma_dart_package/config.json @@ -2,5 +2,5 @@ "project_name": "test_package", "description": "Package for testing", "publishable": true, - "workspace": true + "workspace": false } \ No newline at end of file diff --git a/wnma_flutter_package/config.json b/wnma_flutter_package/config.json index 75c058d..495fea2 100644 --- a/wnma_flutter_package/config.json +++ b/wnma_flutter_package/config.json @@ -2,5 +2,5 @@ "project_name": "test_package", "description": "Package for testing", "publishable": true, - "workspace": true + "workspace": false } \ No newline at end of file From f887fd98535a9e52886e745a64e479a82b788959 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 09:57:57 +0200 Subject: [PATCH 4/9] linter love --- .../test/src/{{project_name.snakeCase()}}_test.dart | 8 +++++++- .../test/src/{{project_name.snakeCase()}}_test.dart | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart index 2405481..7b796b7 100644 --- a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart +++ b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart @@ -1,3 +1,4 @@ +// We ignore prefer_const_constructors here to make testing more convenient. // ignore_for_file: prefer_const_constructors import 'package:test/test.dart'; import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; @@ -5,7 +6,12 @@ import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; void main() { group('{{project_name.pascalCase()}}', () { test('can be instantiated', () { - expect({{project_name.pascalCase()}}(), isNotNull); + expect( + { + {project_name.pascalCase()}, + }(), + isNotNull, + ); }); }); } diff --git a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart index 988c871..375609f 100644 --- a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart +++ b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart @@ -1,3 +1,4 @@ +// We ignore prefer_const_constructors here to make testing more convenient. // ignore_for_file: prefer_const_constructors import 'package:flutter_test/flutter_test.dart'; import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; @@ -5,7 +6,12 @@ import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; void main() { group('{{project_name.pascalCase()}}', () { test('can be instantiated', () { - expect({{project_name.pascalCase()}}(), isNotNull); + expect( + { + {project_name.pascalCase()}, + }(), + isNotNull, + ); }); }); } From da62ea80aa8c26b4cd66e716b5f926ab8e8495d7 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 10:02:01 +0200 Subject: [PATCH 5/9] removed lintervention from workspace --- .../{{project_name.snakeCase()}}/analysis_options.yaml | 1 - .../__brick__/{{project_name.snakeCase()}}/pubspec.yaml | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml deleted file mode 100644 index 245ed9f..0000000 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: package:lintervention/analysis_options.yaml diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 84f45d7..05bbde8 100644 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -11,10 +11,8 @@ environment: flutter: ">=3.35.0" dev_dependencies: - lintervention: ^0.4.0 melos: ^7.1.1 - melos: command: version: From 083ff4ae194d12446446a13c92c56acbcf0d2b98 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 10:02:42 +0200 Subject: [PATCH 6/9] add it back --- .../__brick__/{{project_name.snakeCase()}}/analysis_options.yaml | 1 + .../__brick__/{{project_name.snakeCase()}}/pubspec.yaml | 1 + 2 files changed, 2 insertions(+) create mode 100644 wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml new file mode 100644 index 0000000..08474f6 --- /dev/null +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/analysis_options.yaml @@ -0,0 +1 @@ +include: package:lintervention/app.yaml diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 05bbde8..153ccfc 100644 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -11,6 +11,7 @@ environment: flutter: ">=3.35.0" dev_dependencies: + lintervention: ^0.4.0 melos: ^7.1.1 melos: From 23cfcef7537d612e94f0f124b9ca18ad6d44e034 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 10:09:12 +0200 Subject: [PATCH 7/9] fix test syntax --- .../test/src/{{project_name.snakeCase()}}_test.dart | 7 +------ .../test/src/{{project_name.snakeCase()}}_test.dart | 7 +------ .../__brick__/{{project_name.snakeCase()}}/pubspec.yaml | 3 ++- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart index 7b796b7..ad79e00 100644 --- a/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart +++ b/wnma_dart_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart @@ -6,12 +6,7 @@ import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; void main() { group('{{project_name.pascalCase()}}', () { test('can be instantiated', () { - expect( - { - {project_name.pascalCase()}, - }(), - isNotNull, - ); + expect({{project_name.pascalCase()}}(), isNotNull); }); }); } diff --git a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart index 375609f..ee4a38e 100644 --- a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart +++ b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/test/src/{{project_name.snakeCase()}}_test.dart @@ -6,12 +6,7 @@ import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart'; void main() { group('{{project_name.pascalCase()}}', () { test('can be instantiated', () { - expect( - { - {project_name.pascalCase()}, - }(), - isNotNull, - ); + expect({{project_name.pascalCase()}}(), isNotNull); }); }); } diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index 153ccfc..e464169 100644 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -4,7 +4,8 @@ version: 0.1.0 publish_to: none workspace: - - # TODO Add your workspace packages or apps here + # TODO Add your workspace packages or apps here + # - packages/my_package environment: sdk: ">=3.9.0 <4.0.0" From 986e39ae5285707e20c4afe079e609f8deb41153 Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 10:11:20 +0200 Subject: [PATCH 8/9] comment out entire workspace --- .../__brick__/{{project_name.snakeCase()}}/pubspec.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml index e464169..d62edee 100644 --- a/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml +++ b/wnma_workspace/__brick__/{{project_name.snakeCase()}}/pubspec.yaml @@ -3,9 +3,9 @@ description: {{{description}}} version: 0.1.0 publish_to: none -workspace: - # TODO Add your workspace packages or apps here - # - packages/my_package +# TODO Add your workspace packages or apps here +# workspace: +# - packages/my_package environment: sdk: ">=3.9.0 <4.0.0" From 1b16b1021781231984ad946a5c3b8b6dfaa15c0d Mon Sep 17 00:00:00 2001 From: Tim Lehmann Date: Tue, 30 Sep 2025 10:14:28 +0200 Subject: [PATCH 9/9] removed library name --- .../lib/{{project_name.snakeCase()}}.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart index e95435a..a04d5f2 100644 --- a/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart +++ b/wnma_flutter_package/__brick__/{{project_name.snakeCase()}}/lib/{{project_name.snakeCase()}}.dart @@ -1,4 +1,4 @@ /// {{{description}}} -library {{project_name.snakeCase()}}; +library; export 'src/{{project_name.snakeCase()}}.dart';