hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Register unpublish cli command to the console

Open awongCM opened this issue 2 years ago • 10 comments

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.

awongCM avatar Jun 11 '22 07:06 awongCM

How to test

git clone -b unplublish-cli https://github.com/awongCM/hexo.git
cd hexo
npm install
npm test

github-actions[bot] avatar Jun 11 '22 07:06 github-actions[bot]

👇 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!

awongCM avatar Jun 19 '22 10:06 awongCM

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 avatar Nov 25 '22 04:11 stevenjoezhang

@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).

yoshinorin avatar Nov 25 '22 08:11 yoshinorin

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 avatar Dec 05 '22 11:12 awongCM

@awongCM You can check these failed tests: https://github.com/hexojs/hexo/actions/runs/3619487925/jobs/6127574239

stevenjoezhang avatar Dec 06 '22 18:12 stevenjoezhang

@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.

awongCM avatar Dec 07 '22 12:12 awongCM