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 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
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
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
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
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
Copy link
Contributor Author

The issue might be related to #3780.

I tried revert the PR, still the same issue.

@SukkaW SukkaW merged commit 00a47ed into hexojs:master Dec 11, 2019
@curbengh curbengh deleted the meta-gen branch December 11, 2019 09:25
@SukkaW SukkaW mentioned this pull request Dec 12, 2019
1 task
thom4parisot pushed a commit to thom4parisot/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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants