hoodiehq-archive / documentation

⛔️ deprecated. Moved to hoodiehq/hoodie/docs
https://hoodie.readthedocs.io
76 stars 49 forks source link

Document how to test a pull request or development branch locally with a full Hoodie app #189

Open janl opened 9 years ago

janl commented 9 years ago

@Charlotteis asked:

What would the best way to test this, be? https://github.com/hoodiehq/node-multicouch/pull/28 It looks good syntatically, but I would like to make sure it works :smile:

Jan replied:

multicouch is a dependency of hoodie-server, so when you create a new hoodie app, it lives in ./node_modules/hoodie-server/node_modules/multicouch

If you now also check out the node-multicouch repo, and get the branch of the PR owner (separate how-to on that in a sec), you can run npm link in there.

Then you into you hoodie app again, and then cd ./node_modules/hoodie-server/node_modules in there you run npm link multicouch.

What happens is this: npm link in the multicouch repo makes this package available globally on your system, with a symlink, when you then npm link multicouch inside a project like we do above, npm will uninstall the multicouch version it downloaded and replace it with another symlink, that points to the global installation of multicouch.

That is now, your checkout of multicouch that you are on the special in is the code that is loaded when you start your Hoodie app

So you can stop hoodie, add a console.log for debugging, start hoodie again and check out what console.log printed

To test the issue at hand: do the npm link dance, uninstall all CouchDB from your system and then start your hoodie app

How to get into that branch that the PR was created from:

On every PR, next to the merge button is a link to “command line instructions”, click on that and copy the two commands from step 1, ignore step 2.

In our case here:

git checkout -b ivanbatic-master master
git pull https://github.com/ivanbatic/node-multicouch.git master

Then you are on the ivanbatic-master branch, and you can do the npm link dance as described above

End of Slack transcript.


It’d be great if somebody could turn this into actual documentation-prose and submit it to the docs.

Let’s put it under http://docs.hood.ie/en/tutorials/, say http://docs.hood.ie/en/tutorials/development and leave it there until we have more relevant content for a separate developer handbook section.

varjmes commented 9 years ago

Would the multicouch one come under something like: docs.hood.ie/en/tutorials/development/package-testing do you think? Node multicouch could be the example.