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
CWD problem serving or generating from another dir #3352
Comments
Hi @rottmann 👋 It looks interesting what you're doing. Are you able to add It should be able to execute within the context of the cwd. |
Maybe we can put together a sample repo to demonstrate how to do this. |
Yes added server to bin. Currently i use a littly hacky solution which needs to patch some hexo-files manually (with package-patch in package.json - postinstall)
Then i can call hexo from our-doc-gen bin in an another dir and hexo uses the templates from our-doc-gen (which is installed globally) In Run let args = {
base: '/home/rottmann/test', // <- this is new
config: '/home/rottmann/test/doc/_config.yml',
cwd: '/home/rottmann/.nvm/versions/node/v8.12.0/lib/node_modules/our-doc-gen',
output: '/home/rottmann/test/.tmp/doc',
_: [ 'server' ]
}
let cwd = 'doc'
hexoCli(cwd, args) |
🤔 Hmmm this is interesting. It will take me a bit of time before I can read and understand. If the idea is using a preconfigured hexo, like a hexo recipe, we should look into supporting that use case. |
That's right, we create a complete package with hexo, theme, plugins, etc. but only need to install our-doc-gen to use it. Possible problem (with my hacky solution) could be the warehouse ID in db.json, if paths e.g. from theme has the same name as paths in doc. I did not check it in detail if full or rel paths are used. Currently i always remove the db before generate. |
According to your code
Since hexo-renderer-marked is not loaded, html document cannot be generated. |
Environment Info
Node version(
node -v
):8.12.0Hexo and Plugin version(
npm ls --depth 0
): 3.7.0For question
For our company i want to create a npm package with hexo, themes, scripts
our-doc-gen
, so that users can installour-doc-gen
and run it withour-doc-gen server
orour-doc-gen generate
to view or generate the documentation.This package has default _config.yml, scripts, etc. and you did not need to define them each time in your local project.
How is it possible to start hexo, with modules from
our-doc-gen/node_modules
and let it servemy-project/doc/file.md
I can't see how cwd should be configured to serve the files.
Example:
our-doc-gen/bin/serve
This example serves only static files, but no .html is generated or served.
If i run generate the
public
dir will be created with all static files, instead of .html files. The original .md files are published and not the .html files.local package.json
with all local installed dependencies the generate and serve method work, but for this you always have to install all the deps locally instead of only
our-doc-gen
For feature request
I think the problem is, that cwd and base_dir are the same.
A separate option
input
could solve this problem. Input-dir is by default cwd, if input dir has a value, the .md files should be loaded from inputdir and the plugins/modules from cwd.Or other way around a
modules
-dir to specify the node_modules dir to load from.The text was updated successfully, but these errors were encountered: