-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Considering we can now do module.exports.extension = {}
, it would be nice if we could require standard npm modules too. I'm thinking this could be a plugin that is added to the chainy
package. It would allow us to do the following:
require('chainy').create().require('lodash.flatten set log')
.set([1,[2,3],4]).flatten().log() // [1,2,3,4]
The potential for this is to finally stop having framework specific plugins being created, instead we can just update existing modules with the required configuration, that then works in different frameworks.
It would also allow us to create our own cli tools using chainy, then have them themselves be chainy plugins too, without the chainy-plugin-
namespace. E.g. geojson-github-communities bevry docpad chainyjs
could be a CLI tool, but also a chainy plugin without the need for chainy-plugin-geojsongithubcommunities
. Instead, you do chainy install geojson-github-communities
, and in chainy .require('geojson-github-communities')
and it works as expected. Probably attempting for a chainy-plugin first, and then falling back on without one if not.
One side issue here, is that things like chainy-plugin-map
etc, use this.create()
, now this inheritance is important as it allows for greater debugging due to the tracking of children and parents. If we were to do require('chainy-core').create()
it is now true that the plugin would be standalone, but it would lose it's inheritance abilities. Perhaps what we need is this: require('chainy-core').create().inherit(this)
, which then sets up the parent etc, while maintaining standalone abilities.