Here’s the code. The script expects a designs/ folder at the same level as the loader script, with a subfolder for each design document underneath. A design folder should have a .js file for each view. A view file looks like this:
1 2 3 4 5 6
CouchDB document update handlers are supported as well by assigning a function to design.update. Once your view files are ready, just run loader.js with the CouchDB database URL as the parameter:
node db/couchdb/loader.js http://localhost:5984/myDatabase
So what do you think? Does something like this exist already? Is there a better way to do this?