Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move and Refactor convert to Template #2349

Merged
merged 8 commits into from
Sep 23, 2023

Conversation

WillCWX
Copy link
Contributor

@WillCWX WillCWX commented Jul 31, 2023

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-1 July 31, 2023 07:55
@lhw-1
Copy link
Contributor

lhw-1 commented Aug 4, 2023

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

Copy link
Contributor

@lhw-1 lhw-1 left a comment

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 👍

packages/core/src/Site/template.ts Outdated Show resolved Hide resolved
@lhw-1 lhw-1 added this to the v5.0.2 milestone Aug 13, 2023
packages/cli/src/cmd/init.js Outdated Show resolved Hide resolved
@tlylt tlylt removed this from the v5.0.2 milestone Aug 19, 2023
@codecov
Copy link

codecov bot commented Aug 23, 2023

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 Changed Coverage Δ
packages/core/src/Site/template.ts 29.24% <18.60%> (-39.99%) ⬇️
packages/core/src/Site/SiteConfig.ts 94.73% <88.88%> (-1.82%) ⬇️
packages/core/src/Site/constants.ts 100.00% <100.00%> (ø)
packages/core/src/Site/index.ts 29.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
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:master Sep 23, 2023
7 of 8 checks passed
@tlylt tlylt added this to the v5.1.1 milestone Sep 23, 2023
@tlylt tlylt added the r.Patch Version resolver: increment by 0.0.1 label Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r.Patch Version resolver: increment by 0.0.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants