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

skip assets of unpublished posts and delete them if exist #3489

Merged
merged 2 commits into from
Jun 20, 2020

Conversation

DaemondShu
Copy link
Contributor

@DaemondShu DaemondShu commented Mar 15, 2019

What does it do?

Fixed issue #3478.

How to test

git clone -b BRANCH https://github.com/USER/hexo.git
cd hexo
npm install
npm test

Screenshots

  • the result before adding the unittest
    image
    The result is the same as the original master branch on my machine.

  • the result after adding the unittest
    image

  • code coverage summary
    image

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

coveralls commented Mar 15, 2019

Coverage Status

Coverage increased (+0.0006%) to 97.819% when pulling 6c59cba on DaemondShu:fix-copy-unpublished-assets into 29e28e2 on hexojs:master.

@tomap
Copy link
Contributor

tomap commented Mar 15, 2019

Hi, the build failed because of codecoverage reduction & some eslint warning. Are you able to fix those?

@DaemondShu
Copy link
Contributor Author

Thanks for your review.
I understand the eslint warning and will fix it.
But for codecoverage, I am an nodejs beginner, is there any way to run coverage locally so that I can code and test offline?

@DaemondShu
Copy link
Contributor Author

Thanks for your review.
I understand the eslint warning and will fix it.
But for codecoverage, I am an nodejs beginner, is there any way to run coverage locally so that I can code and test offline?

Oh, I found it, it's "npm run test-cov". So what's your coverage requirement? 100%, 98% or a specific num?

@stale
Copy link

stale bot commented May 15, 2019

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 15, 2019
@yoshinorin yoshinorin added enhancement New feature or request and removed stale labels May 16, 2019
@tomap
Copy link
Contributor

tomap commented Nov 11, 2019

There is no coverage requirement, just that this new behavior is covered by new tests

@darekkay
Copy link
Contributor

darekkay commented Jun 4, 2020

@DaemondShu thanks for providing a fix. could you please resolve the merge conflicts, so the PR hopefully gets merged? If not, I could do it and open a new PR based on this one.

@curbengh curbengh added this to the 5.0.0 milestone Jun 20, 2020
@curbengh curbengh force-pushed the fix-copy-unpublished-assets branch from 83cc7e7 to 6c59cba Compare June 20, 2020 11:06
@curbengh
Copy link
Contributor

curbengh commented Jun 20, 2020

I've fixed the merge conflict and also rebased to the latest master.

@curbengh curbengh requested a review from a team June 20, 2020 11:08
Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

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

LGTM!

@SukkaW SukkaW merged commit edcd677 into hexojs:master Jun 20, 2020
@SukkaW
Copy link
Member

SukkaW commented Jun 20, 2020

Merged, thanks!

@stevenjoezhang stevenjoezhang linked an issue Jun 20, 2020 that may be closed by this pull request
@SukkaW SukkaW mentioned this pull request Jul 25, 2020
22 tasks
@darekkay darekkay mentioned this pull request Oct 14, 2020
5 tasks
darekkay added a commit to darekkay/hexo that referenced this pull request Oct 23, 2020
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
darekkay added a commit to darekkay/hexo that referenced this pull request Mar 12, 2021
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
darekkay added a commit to darekkay/hexo that referenced this pull request Mar 15, 2021
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
darekkay added a commit to darekkay/hexo that referenced this pull request Mar 15, 2021
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
darekkay added a commit to darekkay/hexo that referenced this pull request Mar 15, 2021
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
darekkay added a commit to darekkay/hexo that referenced this pull request Mar 16, 2021
Since hexojs#3489, no draft assets are generated. This is the desired behavior when not rendering draft posts. But when working on drafts, the according assets are never rendered. This change checks if draft posts should be rendered, and if this is the case, the assets will not be deleted.

I validated this fix by

- Running `hexo clean && rm -rf public/ && hexo generate` - Draft assets are not generated (as before)
- Running `hexo clean && rm -rf public/ && hexo generate --draft` - Draft assets are generated
- Running `hexo server --draft` - Draft assets are generated
- Adjusting the existing unit test

Fixes: hexojs#4556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
7 participants