I'm using Poet for a blogging/static site generator engine and it's great.
It is currently a dependency listed in my packages.json, so I simply npm install
it and require
it in my express app.
However, I'd like to change one behavior in the library (especifically the way a "post.preview" is constructed, which right now simply gets the first line, and I'd like to perhaps be able to configure a number of lines for each post).
To do that, I'm considering cloning the repo and making the change.
But I'm wondering if I should:
require
it as usual or,require
it from a different path.Keep in mind that I'd like to publish soon to Heroku or Nodejitsu.
What are your thoughts on that?
UPDATE: I had a few problems having a git repo with the cloned lib under my git repo. It somehow added the whole folder as a file. I promptly removed '.git' from the lib folder and everything went back to normal... I don't know the cause of this behavior!
I don't know if there's any guidelines on this, but personally I would fork poet and make the change, and add that as an external repository for your application in a different directory from node_modules. I just like to keep node_modules managed by npm.
My goal would be able to deploy using a git pull + npm install, while being able to easily continue merging updates from the poet mainline.
IMHO, a good practice is to clone and keep this repository into the folder /lib
. Once you feel you are done with your changes, push them into your version, and make the right references to your copy in the package.json
file.
Now, if you think your changes could be introduced into the module, make the pull request.
My two cents.