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(meta_generator): parse correct version #3925

Merged
merged 2 commits into from Dec 11, 2019
Merged

Conversation

@curbengh
Copy link
Contributor

curbengh commented Dec 10, 2019

What does it do?

#3919 (comment)

How to test

git clone -b meta-gen https://github.com/curbengh/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

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

This comment has been minimized.

Copy link

coveralls commented Dec 10, 2019

Coverage Status

Coverage increased (+0.0008%) to 97.131% when pulling bb430d2 on curbengh:meta-gen into 140ed36 on hexojs:master.

@curbengh curbengh added this to the 4.2.1 milestone Dec 10, 2019
test/scripts/helpers/meta_generator.js Outdated Show resolved Hide resolved
@SukkaW

This comment has been minimized.

Copy link
Member

SukkaW commented Dec 10, 2019

@curbengh

The version is not only exposed to hexo.env.version:

version: pkg.version,

but also exposed to hexo.version:

Hexo.version = pkg.version;

It should be accessible in both ways.

The issue might be related to #3780.


Update

FYI:

hexo.version.should.eql(version);

hexo.env.should.eql({
args: {},
debug: false,
safe: false,
silent: false,
env: process.env.NODE_ENV || 'development',
version,
cmd: '',
init: false
});

@SukkaW

This comment has been minimized.

Copy link
Member

SukkaW commented Dec 10, 2019

FYI, meta_generator filter is using hexo.version as well:

const hexoGeneratorTag = `<meta name="generator" content="Hexo ${this.version}">`;

@curbengh

This comment has been minimized.

Copy link
Contributor Author

curbengh commented Dec 10, 2019

I'm guessing the way this/hexo is exposed is different in filter and helper.
I can confirm that meta_generator helper doesn't work currently, so this fix is necessary. I tested this fix and it works.
meta_generator filter is working.

@curbengh

This comment has been minimized.

Copy link
Contributor Author

curbengh commented Dec 11, 2019

The issue might be related to #3780.

I tried revert the PR, still the same issue.

@SukkaW
SukkaW approved these changes Dec 11, 2019
@SukkaW SukkaW merged commit 00a47ed into hexojs:master Dec 11, 2019
4 checks passed
4 checks passed
Travis CI - Pull Request Build Passed
Details
codeclimate All good!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage increased (+0.0008%) to 97.131%
Details
@curbengh curbengh deleted the curbengh:meta-gen branch Dec 11, 2019
@SukkaW SukkaW mentioned this pull request Dec 12, 2019
1 of 1 task complete
oncletom added a commit to oncletom/hexo that referenced this pull request Jan 17, 2020
* fix(meta_generator): parse correct version
* refactor(meta_generator_helper): destructure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.