herbsjs / herbsshelf

Dynamically generated documentation for your domain
Other
8 stars 16 forks source link

fix(shelf.js): Fix replacement of single quotes from replace to replaceAll #55

Closed gustavobigardi closed 1 year ago

gustavobigardi commented 1 year ago

Fixes #39

Inside the function getReadme on default.js, there is a replacement of single quotes by nothing. But it's using the method replace instead of replaceAll or a regex to cover all occurrences of single quotes. If the readme contains more than one single quote, it will break the herbs shelf page for project, like described in the issue that this PR fixes.

Proposed Changes

  1. Change the string "replace" method usage by "replaceAll" Using replace with regex instead of replaceAll due to Node v14 compatibility.
  2. Add "sinon" library as a development dependency, to mock the "fs" methods and test the fix

Readiness Checklist

Author/Contributor

Reviewing Maintainer

dalssoft commented 1 year ago

thanks @gustavobigardi for the contrib! please, check the comment above in order to move forward with this PR

gustavobigardi commented 1 year ago

thanks @gustavobigardi for the contrib! please, check the comment above in order to move forward with this PR

Thanks. I removed the .only (my bad!) and answered the reason of the new dependency.

gustavobigardi commented 1 year ago

I submited an update using regex instead of the replaceAll method, to allow compatibility with Node v14, as the version used inside the CI.

codecov[bot] commented 1 year ago

Codecov Report

Merging #55 (e14199c) into main (47ca026) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head e14199c differs from pull request most recent head 4eb8383. Consider uploading reports for the commit 4eb8383 to get more accurate results

@@           Coverage Diff           @@
##             main      #55   +/-   ##
=======================================
  Coverage   97.22%   97.22%           
=======================================
  Files           8        8           
  Lines          72       72           
=======================================
  Hits           70       70           
  Misses          2        2           
Impacted Files Coverage Δ
src/template/default.js 100.00% <100.00%> (ø)

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

dalssoft commented 1 year ago

Great. The only missing part is the "signed commit"

gustavobigardi commented 1 year ago

Great. The only missing part is the "signed commit"

Yes, just noticed that... I did this PR on another pc that I usually use and github was missing the key from it. I did a rebase signing the commits, waiting for the CI again.

herbsjs-robot commented 1 year ago

:tada: This PR is included in version 5.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: