Skip to content

Commit

Permalink
Add top level pubspec key
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Nov 17, 2023
1 parent 2290acf commit db2e4d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions pkgs/messages/example_json/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ dev_dependencies:
path: ^1.8.3
test: ^1.16.0

messages_builder:
generateMethods: true
generateFindById: false
generateFindBy: integer
package_options:
messages_builder:
generateMethods: true
generateFindById: false
generateFindBy: integer
9 changes: 5 additions & 4 deletions pkgs/messages_builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ The builder for [`package:messages`](../messages/README.md).
The options can be configured by setting configuring the following in the `pubspec.yaml`:

```yaml
messages_builder:
generateMethods: true
generateFindById: true
generateFindBy: [enumerate | integer | none]
package_options:
messages_builder:
generateMethods: true
generateFindById: true
generateFindBy: [enumerate | integer | none]
```
3 changes: 2 additions & 1 deletion pkgs/messages_builder/lib/generation_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class GenerationOptions {
final pubspecId = await buildStep.findAssets(Glob('pubspec.yaml')).first;
final pubspecData = await buildStep.readAsString(pubspecId);
final pubspec = loadYaml(pubspecData) as YamlMap;
final messagesOptions = pubspec['messages_builder'] as YamlMap?;
final packageOptions = pubspec['package_options'] as YamlMap?;
final messagesOptions = packageOptions?['messages_builder'] as YamlMap?;
final generationOptions = GenerationOptions(
serialization: SerializationType.json,
deserialization: DeserializationType.web,
Expand Down

0 comments on commit db2e4d0

Please sign in to comment.