BirjuVachhani / spider

A small dart library to generate Assets dart code from assets folder.
https://spider.birju.dev/
Apache License 2.0
190 stars 19 forks source link

Feature/group-packages #61

Open Sanlovty opened 2 years ago

Sanlovty commented 2 years ago

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 commented 2 years ago

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%) :arrow_up:
lib/src/asset_group.dart 84.37% <100.00%> (+0.50%) :arrow_up:
lib/src/dart_class_generator.dart 92.16% <100.00%> (+0.24%) :arrow_up:
lib/src/data/export_template.dart 80.00% <100.00%> (ø)
lib/src/data/test_template.dart 90.00% <100.00%> (+10.00%) :arrow_up:
lib/src/subgroup_property.dart 100.00% <100.00%> (ø)
lib/src/utils.dart 80.43% <100.00%> (+1.20%) :arrow_up:

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 commented 2 years ago

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

Sanlovty commented 2 years ago

And i will also add tests for getTestConfig method

BirjuVachhani commented 1 year ago

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