hexo
hexo copied to clipboard
Register unpublish cli command to the console
What does it do?
As a long time user of Octopress static site generator, I'm porting one of its useful commands, unpublish
over there to here.
The explanation is simple - unpublish
will move any published posts from _posts
folder back to the _drafts
folder. This is the reverse operation of publish
command.
I find this old command feature from Octopress is useful a lot so I thought it would make good use case to have it for Hexo's counterpart. :)
Here's the original Ruby source for it - https://github.com/octopress/octopress/blob/master/lib/octopress/commands/unpublish.rb#L27 and https://github.com/octopress/octopress/blob/af048361405919605d50fc45e2e1fd0c7eb02703/lib/octopress/post.rb#L37
Pull request tasks
- [x] Add test cases for the changes.
- [ ] Passed the CI test.
How to test
git clone -b unplublish-cli https://github.com/awongCM/hexo.git
cd hexo
npm install
npm test
👇 Can someone please help with the open CI/CD failures ie all 13 of them?
Where do I start in resolving these failures so they all get passed?
Thanks!
Some tests may fail due to race conditions:
1) Hexo
Console
unpublish
rename if target existed:
Error: ENOENT: no such file or directory, unlink '/Users/runner/work/hexo/hexo/test/scripts/console/unpublish_test/source/_posts/Hello-World.md'
Do we need to fix them?
@stevenjoezhang
Do we need to fix them?
~~I think NO.~~ Sorry, I don't know.
But, one of the reasons why I don't approve and merge this PR is I can't understand how to use this command. I pull this PR to my local machine and tried to use it for review. I spent around 1h for try-and-error. Finally, I gave up.
Honestly, I also don't know the publish
command (I have never been using publish
command).
Some tests may fail due to race conditions:
1) Hexo Console unpublish rename if target existed: Error: ENOENT: no such file or directory, unlink '/Users/runner/work/hexo/hexo/test/scripts/console/unpublish_test/source/_posts/Hello-World.md'
Do we need to fix them?
Hi there,
Sorry. I'm just catching up on my old PR that's been left open for over 6 months.
Can you help me to point out where the errors are failing so I can find and fix them?
Thanks.
@awongCM You can check these failed tests: https://github.com/hexojs/hexo/actions/runs/3619487925/jobs/6127574239
@awongCM You can check these failed tests: https://github.com/hexojs/hexo/actions/runs/3619487925/jobs/6127574239 Thanks @stevenjoezhang
I realised where my mistake was... I forgot to follow the contribution guidelines of the npm test
before submitting. My bad! 🤦
I will get this sorted asap.