0.2.0 • Published 5 years ago

@leeruniek/depend-on-me v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

depend on me

General purpose dependency container

Install

npm i --save-exact @leeruniek/depend-on-me

Use

// plugins/thing.plugin.js
module.exports = {
  create: () =>
    new Promise(resolve => {
      setTimeout(() => {
        resolve({
          foo: "bar",
        })
      }, 50)
    }),
}

// plugins/something.plugin.js
module.exports = {
  depend: ["Thing"],

  // First "Thing" resolves to { foo: "bar" } and then continue with create
  create: Thing => ({
    lorem: `ipsum ${Thing.foo}`,
  }),
}

// index.js
const path = require("path")
const depend = require("@leeruniek/depend-on-me")

depend-on-me({
  folders: path.join(__dirname, "plugins"),
}).then(({ Thing, Something }) => {
  // {
  //   Thing: { foo: 'bar' },
  //   Something: { lorem: 'ipsum bar' }
  // }
})

Develop

git clone git@github.com:leeruniek/depend-on-me.git && \
  cd depend-on-me && \
  npm run setup

# run tests (any `*.test.js`) once
npm test

# watch `src` folder for changes and run test automatically
npm run tdd

Changelog

History of all changes in CHANGELOG.md

0.2.0 - 15 October 2018

Change

  • Update packages, use prettier for formating
  • Changed files param to also accept an array of either string or regular expressions. Duplicate files are deleted.
  • Rename root param to folders. Accept more than one folder where to scan for files.
0.2.0

5 years ago

0.1.3

6 years ago