couchdb-compile is a Node.js utility designed to build CouchDB documents from various sources, including local directory trees, JSON files, or CommonJS modules. It processes a hierarchical filesystem structure, mirroring the CouchDB design document mapping, and converts it into a single JSON document suitable for direct upload to CouchDB. The current stable version is 1.11.2, with the last significant update in late 2021. Its release cadence has been infrequent in recent years, primarily focusing on bug fixes and dependency updates within the 1.x series. A key differentiator is its adherence to the Couchapp Filesystem Mapping, providing a structured way to manage CouchDB design documents and attachments outside the database, simplifying deployment and version control compared to manual JSON construction.
npm install couchdb-compileVerified import paths — ran on the pinned version, not inferred.
Demonstrates compiling a CouchDB design document from a directory structure and an object, including attachments and function stringification.
Be aware that client-side logic embedded in CouchDB design documents must be self-contained JavaScript strings. Test the stringified output for correctness.
Ensure your file names accurately reflect the desired property names in the resulting JSON, excluding their extensions.
Consult the documentation for the '_attachments' directory structure and the 'multipart' option to ensure correct attachment processing for your use case.
Verify the `source` argument points to an existing directory or file. Use an absolute path or ensure it's relative to `process.cwd()`.
Use CommonJS `require` syntax: `const compile = require('couchdb-compile');` as the library does not support ES module imports.Inspect the JSON source file for syntax errors, ensuring it is valid JSON.
No dependency data recorded yet.