decentralized-internet
Version:
An NPM library of programs to create decentralized web and distributed computing projects
1 lines • 2.12 kB
JavaScript
var argv=require("minimist")(process.argv.slice(2)),path=require("path");const run=function(e,r,o,i){(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,r,o,i=argv.migrate,t=argv.update,n=argv.viewsDir,s=argv.couchDB;(i||t)&&n&&s||(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)),e=t,r=n,o=s,(i?require(path.join(__dirname,"migrateUP"))(o,r):require(path.join(__dirname,"updateDesignDocument"))(o,r,e)).then(function(e){console.log(e),process.exit(0)}).catch(function(e){console.error(e),process.exit(1)})},exports.migrateUp=require(path.join(__dirname,"migrateUp")),exports.updateDesignDocument=require(path.join(__dirname,"updateDesignDocument"));