mpetrovich / stylemark

Generate interactive style guides from Markdown.
MIT License
218 stars 35 forks source link

Fixing rfrModule loading issues #59

Closed Cyclodex closed 5 years ago

Cyclodex commented 6 years ago

Issue

I forked your project and doing some changes. I then use my package as dependency on an other client project.

The problem now is, that npm install somehow installs the rfr module in the client projects node_modules instead of within the stylemark package (node_modules/stylemark/node_modules) which would solve the problem. I don't understand yet completely why this is happening, and why

"bundleDependencies": [
    "rfr"
  ],

doesn't work as expected...

This is of course problematic, because you then use the RFR module to build up the file paths and this is in the wrong location.

Solution

I could fix the path issues with setting the Root relative to its loaded file.

Within bin/stylemark:

var stylemarkRootPath = path.resolve(__dirname, '..');
rfr.setRoot(stylemarkRootPath);

Feature Sponsored by

If you like this change, feel free to review and accept this PR ;) This feature/PR is sponsored by the company I work: Garaio AG

mpetrovich commented 5 years ago

Thanks for taking the time to look into this issue and for your patience!

I'm a big fan of this idea: It is better to fix a bug by removing rather than adding code. Due to the flat nature of the source files, rfr doesn't add much value, so we can eliminate this issue entirely by removing our use of rfr. That change has been made and will be available in the next release.

mpetrovich commented 5 years ago

Fixed in v3.0.4