Skip to content

Conversation

Sanlovty
Copy link
Contributor

Description of the Change

Groups now have package property.
Global scope package property is always root for the group packages.

1) if we have case:

use_part_of: true
package: res

groups:
  - class_name: example

then we will have

 ./lib/res/example.dart
 ./lib/res/resources.dart

2) If we have case:

use_part_of: true
package: res

groups:
  - class_name: example
    package: exampleFolder

then we will have

 ./lib/res/exampleFolder/example.dart
 ./lib/res/resources.dart

3) If we have case:

use_part_of: true
# package: res
groups:
  - class_name: example
    package: exampleFolder

then we will have ( if package in globlal scope is empty, than group packages are the subfolders of Constants.DEFAULT_PACKAGE)

 ./lib/resources/exampleFolder/example.dart
 ./lib/resources/resources.dart

Alternate Designs

It's possible to do fully custom directories for both classes and resource files but i don't think it's needed

Benefits

Now user is able to make some type of structure (passing different groups into different folders)

Possible Drawbacks

Can't find

Verification Process

dart test, hand tests

Applicable Issues

Closes #57

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #61 (12c92c0) into main (5381d36) will increase coverage by 1.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   70.97%   72.00%   +1.02%     
==========================================
  Files          15       15              
  Lines         572      593      +21     
==========================================
+ Hits          406      427      +21     
  Misses        166      166              
Impacted Files Coverage Δ
lib/src/asset_subgroup.dart 81.81% <ø> (ø)
lib/spider.dart 42.42% <100.00%> (+1.79%) ⬆️
lib/src/asset_group.dart 84.37% <100.00%> (+0.50%) ⬆️
lib/src/dart_class_generator.dart 92.16% <100.00%> (+0.24%) ⬆️
lib/src/data/export_template.dart 80.00% <100.00%> (ø)
lib/src/data/test_template.dart 90.00% <100.00%> (+10.00%) ⬆️
lib/src/subgroup_property.dart 100.00% <100.00%> (ø)
lib/src/utils.dart 80.43% <100.00%> (+1.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5381d36...12c92c0. Read the comment docs.

@Sanlovty
Copy link
Contributor Author

There's still 1 todo i need to finish, but the main part is ready. I will appreciate if u check tihs, @BirjuVachhani

@Sanlovty
Copy link
Contributor Author

Sanlovty commented Jul 15, 2022

And i will also add tests for getTestConfig method

Comment on lines 21 to +35
String get ignoreRulesTemplate => '// ignore_for_file: [IGNORED_RULES]\n\n';

/// A template to generate export statements in dart source code.
String get exportFileTemplate => "export '[FILE_NAME]';";
String get exportFileTemplate =>
"export 'package:[PROJECT_NAME]/[PACKAGE]/[FILE_NAME]';";

/// A template to generate `part` directive statement in the dart
/// library source file.
String get partTemplate => "part '[FILE_NAME]';";
String get partTemplate =>
"part 'package:[PROJECT_NAME]/[PACKAGE]/[FILE_NAME]';";

/// A template to generate `part of` directive statements in the dart
/// asset reference files.
String get partOfTemplate => "part of '[FILE_NAME]';";
String get partOfTemplate =>
"part of 'package:[PROJECT_NAME]/[PACKAGE]/[FILE_NAME]';";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an oversight or am I not getting this? I have never seen part directive with package: in the path.

for (final group in groups) {
group.forEach((key, value) {
if (value == null) {
if (value == null && key != 'package') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we checking for key != 'package'? package key shouldn't be present with explicit null value. That's what this should be checking!

@BirjuVachhani
Copy link
Owner

@Sanlovty Hey, Would you please take a look at those comments I left? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature/package-property-for-groups

3 participants