feat: dal-runtime templates support pkg alias#198
Conversation
WalkthroughThe overarching change involves standardizing and updating import paths and references across various files in the project. This includes transitioning to dynamic package references for improved flexibility and updating import paths for specific types to reflect changes in their locations. The introduction of optional properties in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #198 +/- ##
==========================================
- Coverage 91.62% 91.56% -0.06%
==========================================
Files 276 276
Lines 6446 6487 +41
Branches 935 950 +15
==========================================
+ Hits 5906 5940 +34
- Misses 540 547 +7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (10)
- core/dal-decorator/src/type/MySql.ts (1 hunks)
- core/dal-runtime/src/CodeGenerator.ts (3 hunks)
- core/dal-runtime/src/templates/base_dao.njk (1 hunks)
- core/dal-runtime/src/templates/dao.njk (1 hunks)
- core/dal-runtime/src/templates/extension.njk (1 hunks)
- core/dal-runtime/test/CodeGenerator.test.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/dao/base/BaseFooDAO.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/dao/base/BaseMultiPrimaryKeyDAO.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/extension/FooExtension.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/extension/MultiPrimaryKeyExtension.ts (1 hunks)
Additional comments: 12
core/dal-decorator/src/type/MySql.ts (1)
- 1-1: The update to the import path simplifies and clarifies the source of
InsertResult,UpdateResult, andDeleteResult, aligning with the PR's objectives. This change should make the codebase more maintainable and flexible.core/dal-runtime/test/fixtures/modules/generate_codes/dal/extension/FooExtension.ts (1)
- 1-1: The update to the import path for
SqlMapaligns with the PR's objectives. However, the commented-out code snippet referencesSqlType, which is not imported. Consider updating or removing this snippet to avoid confusion.core/dal-runtime/test/fixtures/modules/generate_codes/dal/extension/MultiPrimaryKeyExtension.ts (1)
- 1-1: Identical to the previous file, the update to the import path for
SqlMapis appropriate. Again, consider updating or removing the commented-out code snippet that referencesSqlTypeto maintain clarity.core/dal-runtime/src/templates/extension.njk (1)
- 1-1: The use of dynamic package references (
{{dalPkg}}) forSqlMapimport is a good improvement for flexibility. However, the commented-out code snippet should also be updated to use dynamic references for consistency and clarity.core/dal-runtime/src/templates/dao.njk (1)
- 1-1: The update to use dynamic package references (
{{teggPkg}}) for imports indao.njkenhances flexibility and aligns with the PR's objectives. This is a positive change for maintainability.core/dal-runtime/test/CodeGenerator.test.ts (1)
- 13-13: Including the
dalPkgproperty in theCodeGeneratorconstructor is a necessary update to ensure that the tests reflect the changes made in the PR. This aligns well with the objectives of supporting package aliasing.core/dal-runtime/test/fixtures/modules/generate_codes/dal/dao/base/BaseMultiPrimaryKeyDAO.ts (1)
- 1-1: The update to the import paths for
InsertResult,UpdateResult, andDeleteResultsimplifies and clarifies the source of these types, aligning with the PR's objectives. This change should enhance the maintainability and flexibility of the codebase.core/dal-runtime/src/templates/base_dao.njk (1)
- 71-71: The use of dynamic package references (
{{dalPkg}},{{teggPkg}}) in thebase_dao.njktemplate enhances flexibility and aligns with the PR's objectives. This approach makes the template more adaptable to different project configurations, which is a positive change for maintainability.core/dal-runtime/src/CodeGenerator.ts (3)
- 14-15: The addition of
teggPkganddalPkgproperties toCodeGeneratorOptionsis clear and follows the existing code style.- 27-34: The constructor's handling of
teggPkganddalPkg, including the assignment of default values, is correctly implemented.- 58-59: Including
teggPkganddalPkgin the template data preparation ensures templates can dynamically reference package paths, enhancing flexibility.core/dal-runtime/test/fixtures/modules/generate_codes/dal/dao/base/BaseFooDAO.ts (1)
- 1-3: The updated import statements correctly reflect the new package structure, aligning with the PR's objectives to support package aliasing.
|
Checklist
npm testpassesAffected core subsystem(s)
Description of change
Summary by CodeRabbit
CodeGeneratorfunctionality to support optional properties for better customization.