-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat(load_config): support theme_dir in node_modules #4112
Conversation
I don't see any bluebird functions. can the whole |
@curbengh Refactored into async / await syntax |
ctx.theme_dir = themeDirFromNodeModules; | ||
} | ||
ctx.theme_script_dir = join(ctx.theme_dir, 'scripts') + sep; | ||
ctx.theme = new Theme(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.theme = new Theme(ctx); | |
ctx.theme = new Theme(ctx); | |
ctx.theme.ignore = ['**/node_modules/hexo-theme-*/node_modules/**', '**/node_modules/hexo-theme-*/.git/**'] |
see: https://github.com/hexojs/hexo/blob/master/lib/box/index.js#L11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in _readDir
https://github.com/hexojs/hexo/blob/master/lib/box/index.js#L88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another problem is that whether it is ignored or not, it will affect the performance of watch.
My theme tried to do the same thing in index.js https://github.com/jiangtj/hexo-theme-cake/blob/master/index.js, but when I debug using yarn command (yarn link), Because there are more develop dependencies, hexo cl && hexo s
will take longer
May be better solution is to listen only to the specified directory, like source
scripts
layout
languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more symmetrical
let ignoreCfg;
if (await exists(themeDirFromThemes)) {
ctx.theme_dir = themeDirFromThemes;
ignoreCfg = ['**/themes/*/node_modules/**', '**/themes/*/.git/**'];
} else if (await exists(themeDirFromNodeModules)) {
ctx.theme_dir = themeDirFromNodeModules;
ignoreCfg = ['**/node_modules/hexo-theme-*/node_modules/**', '**/node_modules/hexo-theme-*/.git/**'];
}
ctx.theme_script_dir = join(ctx.theme_dir, 'scripts') + sep;
ctx.theme = new Theme(ctx);
ctx.theme.ignore = ignoreCfg;
And https://github.com/hexojs/hexo/blob/master/lib/box/index.js#L11 can be removed
Actually .git
is not uploaded to npm by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiangtj @stevenjoezhang This could be done in another PR then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that another PR can be used to deal with the efficiency issues caused by watch()
. After resolving the conflict, this PR can be merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevenjoezhang Rebased.
Rebased to latest master. |
@SukkaW Does it support scoped package name? I.e. |
Currently, no. |
Any plans to introduce it? |
You can opened a new issue for Feature Request so that we can track it. |
Added #4496 |
What does it do?
The part of #3890
How to test
Screenshots
Pull request tasks