<img width="500" src="https://res.cloudinary.com/adonisjs/image/upload/q_100/v1532274184/Dimer_Readme_Banner_lyy7wv.svg" alt="Dimer App">
<a href="https://dimerapp.com/what-is-dimer"> Dimer is an open source project and CMS to help you publish your documentation online. </a>
<sub>We believe every project/product is incomplete without documentation. <br /> We want to help you publish user facing documentation, without worrying <code>about tools or code</code> to write.</sub>
Runtime context for dimer
Dimer is a combination of several small modules, joining together to build the final app. Passing user options from top-level to all these libraries can be daunting and hence a
contextis used to read and write runtime values.
At the lowest level, context starts with the
basePathand new values are added, as it is passed through several modules. Also you can debug the actions taken on the context by defining
DEBUG=dimer:context node yourapp.js
npm i @dimerapp/context # Yarn yarn add @dimerapp/context
const Context = require('@dimerapp/context') const ctx = new Context(__dirname) // later pass around other libs const config = new (require('@dimerapp/config-parser'))(ctx) const store = new (require('@dimerapp/datastore'))(ctx)
APIThe following methods are available to read/write to the context.
constructor(basePath, distPath = 'dist')
const ctx = new Context(__dirname, 'dist')
set(lib, key, value)The
liboption is required for debugging, so that context can log name of the library, which has mutated the state.
ctx.set('config-parser', 'config', value)
get(key)Get value for a given key. We recommend you not to mutate the return value and instead transform it.
remove(key)Remove value for a given key
Change logThe change log can be found in the CHANGELOG.md file.
ContributingEveryone is welcome to contribute. Please take a moment to review the contributing guidelines.
Authors & Licensethetutlage and contributors.
MIT License, see the included MIT file.