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

fix(save_database): should not clear database when use 'hexo new', 'hexo --help', etc. #3793

Merged
merged 1 commit into from Nov 2, 2019

Conversation

dailyrandomphoto
Copy link
Member

What does it do?

After run hexo commands such as hexo --version, hexo new,
the content of `db.json' file was cleared.
It is inconvenient for a site with a lot of posts.

This PR fixes this issue by saving the database only when the database was loaded.

How to test

git clone -b fix-save-database https://github.com/dailyrandomphoto/hexo.git
cd hexo
npm install
npm test
git clone https://github.com/hexojs/site.git
cd site
vi package.json

Change the version of hexo.

- "hexo": "hexojs/hexo"
+ "hexo": "dailyrandomphoto/hexo#fix-save-database"

Install and generate site.

npm install
npm run build

Check out the db.json file.

hexo --version
# or 
hexo new page "somepage"

Check out the db.json file.
The content of db.json should not be cleared.

Screenshots

Pull request tasks

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

@dailyrandomphoto dailyrandomphoto changed the title should not clear database when use 'hexo new', 'hexo --help', etc. co… fix(save_database): should not clear database when use 'hexo new', 'hexo --help', etc. Oct 23, 2019
@coveralls
Copy link

coveralls commented Oct 23, 2019

Coverage Status

Coverage remained the same at 97.269% when pulling bc9748f on dailyrandomphoto:fix-save-database into d8ec214 on hexojs:master.

@curbengh curbengh added this to the v4.1.0 milestone Nov 2, 2019
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.

None yet

4 participants