Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couch-init2

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couch-init2 - npm Package Compare versions

Comparing version 4.2.1 to 5.0.0

48

lib/sync_design_docs.js

@@ -45,27 +45,13 @@ const { readFile, writeFile } = require('fs').promises

const designDocPath = `${designDocFolder}/${designDocName}.js`
try {
let jsDesignDoc = require(designDocPath)
// Allow to pass just the view object
if (!jsDesignDoc._id) {
jsDesignDoc = {
_id: `_design/${designDocName}`,
language: 'javascript',
views: jsDesignDoc,
}
let jsDesignDoc = require(designDocPath)
// Allow to pass just the view object
if (!jsDesignDoc._id) {
jsDesignDoc = {
_id: `_design/${designDocName}`,
language: 'javascript',
views: jsDesignDoc,
}
stringifyJsDesignDoc(jsDesignDoc.views)
return JSON.stringify(jsDesignDoc)
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') throw err
// Initialize the design doc if none is found
// Return a stringify version to keep consistency
// with what would the normal readFile
const emptyDesignDoc = `module.exports = {}`
// Initializing the missing design doc file
await writeFile(designDocPath, emptyDesignDoc)
return {}
}
stringifyJsDesignDoc(jsDesignDoc.views)
return JSON.stringify(jsDesignDoc)
}

@@ -93,17 +79,3 @@

const designDocPath = `${designDocFolder}/${designDocName}.json`
try {
return await readFile(designDocPath, { encoding: 'utf-8' })
} catch (err) {
if (err.code !== 'ENOENT') throw err
// Initialize the design doc if none is found
// Return a stringify version to keep consistency
// with what would the normal readFile
const emptyDesignDoc = JSON.stringify(emtpyDesignDoc(designDocName), null, 4)
// Initializing the missing design doc file
await writeFile(designDocPath, emptyDesignDoc)
return {}
}
return readFile(designDocPath, { encoding: 'utf-8' })
}

@@ -110,0 +82,0 @@

{
"name": "couch-init2",
"version": "4.2.1",
"version": "5.0.0",
"description": "Opiniated CouchDB databases initializer",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc