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

Generate draft assets in draft mode #4563

Merged
merged 1 commit into from
Mar 29, 2021
Merged

Conversation

darekkay
Copy link
Contributor

What does it do?

Since #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.

How to test

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: #4556

Pull request tasks

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

@coveralls
Copy link

coveralls commented Oct 23, 2020

Coverage Status

Coverage increased (+0.002%) to 98.31% when pulling 27c098e on darekkay:missing-assets into 2acded6 on hexojs:master.

@darekkay
Copy link
Contributor Author

The failing jobs do not seem to be related to my changes

ghost
ghost previously approved these changes Dec 22, 2020
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

LGTM

@jiangtj
Copy link
Member

jiangtj commented Mar 12, 2021

image

Can you merge the latest master? It fix some Action issues

@darekkay
Copy link
Contributor Author

I've rebased my branch onto the latest master. But now I can't see any GitHub actions being executed anymore.

lib/plugins/processor/post.js Outdated Show resolved Hide resolved
@jiangtj
Copy link
Member

jiangtj commented Mar 15, 2021

I've rebased my branch onto the latest master. But now I can't see any GitHub actions being executed anymore.

I also don't understand why 😂

@darekkay
Copy link
Contributor Author

I'm happy if someone wants to take over the 0.05% drop in test coverage.

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
@jiangtj jiangtj merged commit 92b979f into hexojs:master Mar 29, 2021
@ylbeethoven
Copy link

I am surprised this fix is not included in 5.4.0. Can anyone please add this fix to the new version?

@darekkay darekkay deleted the missing-assets branch March 1, 2022 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Draft assets not rendered
4 participants