Skip to content

Move and Refactor convert to Template - #2349

Merged
kaixin-hc merged 8 commits into
MarkBind:masterfrom
WillCWX:isolate-init-convert
Sep 23, 2023
Merged

Move and Refactor convert to Template#2349
kaixin-hc merged 8 commits into
MarkBind:masterfrom
WillCWX:isolate-init-convert

Conversation

@WillCWX

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Helps with #1756
Helps make #2308 less messy

Overview of changes:

Moves convert from Site/index.ts to Site/template.ts.
Moves readSiteConfig from Site/index.ts to SiteConfig.ts.
Moves _ to constants.ts

Anything you'd like to highlight/discuss:

This reduces Site/index.ts by 130 lines without affecting any functions.
Site/index.ts now has nothing to do with markbind init and markbind convert

template.ts is now more bloated but with the #2308 , it maybe made more streamline.

Testing instructions:

NIL other than npm run test

Proposed commit message: (wrap lines at 72 characters)

Move and refactor convert to template.ts


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

@WillCWX
WillCWX requested a review from lhw-1July 31, 2023 07:55
@lhw-1

lhw-1 commented Aug 4, 2023

Copy link
Copy Markdown
Contributor

Hi @WillCWX, sorry for the delay & thanks for the PR! I'll get to reviewing it over the weekend.

@lhw-1lhw-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR, @WillCWX! Sorry for the delay 😅

The PR seems to be a straightforward refactor and reshuffle of existing functionalities without changes to the logic, but helpful in the long run for refactoring Site/index.js. And of course, it should help us get back to #2308!

You can update the branch & it should be good to go 👍

Comment threadpackages/core/src/Site/template.ts Outdated
@lhw-1lhw-1 added this to the v5.0.2 milestone Aug 13, 2023
Comment threadpackages/cli/src/cmd/init.js Outdated
@tlylttlylt removed this from the v5.0.2 milestone Aug 19, 2023
@codecov

codecovBot commented Aug 23, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2349 (997ee6b) into master (9c5db5f) will increase coverage by 0.06%.
The diff coverage is 37.71%.

@@ Coverage Diff @@## master #2349 +/- ##
==========================================
+ Coverage 44.82% 44.89% +0.06% 
==========================================
Files 122 122 Lines 5133 5157 +24 Branches 1082 1085 +3 ==========================================
+ Hits 2301 2315 +14 - Misses 2513 2523 +10 
Partials 319 319 
Files ChangedCoverage Δ
packages/core/src/Site/template.ts29.24% <18.60%> (-39.99%)⬇️
packages/core/src/Site/SiteConfig.ts94.73% <88.88%> (-1.82%)⬇️
packages/core/src/Site/constants.ts100.00% <100.00%> (ø)
packages/core/src/Site/index.ts29.84% <100.00%> (+0.32%)⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kaixin-hc

Copy link
Copy Markdown
Contributor

Hi @WillCWX ! Took a look at this. You might not have noticed but codecov/patch is failing - I think the area that you are refactoring did not have tests. In this case since the overall project coverage didn't drop and a manual review of the code on my part looks okay, I'll merge this so that you can work on #2308 . But when you're over there, please check the tests for site.js and try to increase the coverage.

While these few lines might seem trivial, adding unit tests to cover them would help greatly especially with refactors like these, reducing the time needed for manual review and increasing our confidence in approving these changes.

@kaixin-hc
kaixin-hc merged commit 19ac4c2 into MarkBind:masterSep 23, 2023
@tlylttlylt added this to the v5.1.1 milestone Sep 23, 2023
@tlylttlylt added the r.Patch Version resolver: increment by 0.0.1 label Sep 23, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r.PatchVersion resolver: increment by 0.0.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@WillCWX@lhw-1@kaixin-hc@tlylt