decentralized-internet
Version:
An NPM library of programs to create decentralized web and distributed computing projects
1 lines • 2.29 kB
JavaScript
var argv=require("minimist")(process.argv.slice(2)),path=require("path");const run=function(e,r,o,i){return(e?require(path.join(__dirname,"migrateUp"))(i,o):require(path.join(__dirname,"updateDesignDocument"))(i,o,r)).then(function(e){console.log(e),process.exit(0)}).catch(function(e){console.error(e),process.exit(1)})},help=function(){console.error("help: To run couch-update-views: "),console.error(process.argv[0]+" "+process.argv[1]+" --migrate | --update <design view name>"),console.error("Options:"),console.error("--migrate Migrate design documents in couchdb. The 'design views' in couchdb are updated with the contents of the 'viewsDir' folder if they differ."),console.error("--update <design view name> Update the design view document stored in 'viewsDirs' with the document stored in 'couchDB'"),console.error("--viewsDir <path> Directory with desgin views documents JSON files. (required)"),console.error("--couchDB <url> CouchDB URL. (required)")};exports.couchUpdateViews=function(){var e=argv.migrate;argv.migrateUp&&(e=argv.migrateUp);var r=argv.update,o=argv.viewsDir;argv.views&&(o=argv.views);var i,t,n,s,c=argv.couchDB;argv.couch&&(c=argv.couch),argv.couchdb&&(c=argv.couchdb),(e||r)&&o&&c||(console.error("help: To run couch-update-views: "),console.error(process.argv[0]+" "+process.argv[1]+" --migrate | --update <design view name>"),console.error("Options:"),console.error("--migrate Migrate design documents in couchdb. The 'design views' in couchdb are updated with the contents of the 'viewsDir' folder if they differ."),console.error("--update <design view name> Update the design view document stored in 'viewsDirs' with the document stored in 'couchDB'"),console.error("--viewsDir <path> Directory with desgin views documents JSON files. (required)"),console.error("--couchDB <url> CouchDB URL. (required)"),process.exit(1)),(i=e,t=r,n=o,s=c,(i?require(path.join(__dirname,"migrateUp"))(s,n):require(path.join(__dirname,"updateDesignDocument"))(s,n,t)).then(function(e){console.log(e),process.exit(0)}).catch(function(e){console.error(e),process.exit(1)})).then(function(){process.exit(0)})},exports.migrateUp=require(path.join(__dirname,"migrateUp")),exports.updateDesignDocument=require(path.join(__dirname,"updateDesignDocument"));