chainyjs / chainy

The chainy core + autoloader plugin
https://github.com/chainyjs/chainy/wiki
Other
79 stars 4 forks source link

Abstract out plugins into their own repos/packages #4

Closed balupton closed 10 years ago

balupton commented 10 years ago

Questions:

  1. What namespace should they use: chainy-pluginname, or chainy-plugin-pluginname
  2. Should this be for all plugins? or just plugins that aren't common or have deps?
  3. Should direct inclusion even be allowed?
balupton commented 10 years ago

/cc @JedWatson, and thoughts on the namespacing?


Example of what installing deps would look like with both options:

npm install --save chainy chainy-set chainy-map chainy-feed chainy-geocode
npm install --save chainy chainy-plugin-set chainy-plugin-map chainy-plugin-feed chainy-plugin-geocode
require('chainy').subclass().require('set', 'map', 'feed', 'geocode')

Installing deps could be simplified by a CLI:

npm install -g chainy
chainy install set map feed geocode

Bundles could help:

npm install chainy chainy-common
npm install chainy chainy-plugin-common
require('chainy').subclass().require('common')

Enabling direct inclusion in the bundle by doing:

// support direct inclusion
module.exports = require('chainy').subclass().require('common').freeze()
// support normal custom plugin type include
module.exports.setupPlugin = function(chain){
  chain.require('set', 'map', 'feed', 'geocode')
}

Could also help:

npm install chainy-common
npm install chainy-plugin-common
require('chainy-common').subclass()
require('chainy-plugin-common').subclass()

Automatic installation and inclusion is also an option, however that requires harmony features: https://github.com/chainyjs/chainy/issues/5

balupton commented 10 years ago

Regarding whether it is for all plugins or just some, I'm in favour of all plugins. It allows:

balupton commented 10 years ago

Solved. See the wiki for the latest details. To answer the questions:

  1. chainy-plugin-blah, and chainy-bundle-blah, the chainy cli will reduce friction here allowing chainy install blah
  2. all plugins
  3. no. instead bundles are just package.json files with a peerDependencies field and no scripts, you are to require them manually or use the autoload extension