node-minibase/minibase-create-plugin

Compatibility with Base

Closed this issue · 1 comments

Should detect if typeof app.is === 'function' && app.isBase then to use the third argument, not the second.

module.exports = function minibaseCreatePlugin (name, fn) {
  return function _generatedPlugin (options) {
    return function _generatedPlugin (app, opts, pluginOptionsOfBaseApps) {
      if (typeof app.is === 'function' && app.isBase) {
        opts = pluginOptionsOfBaseApps
      }

      app.use(betterUse())
      app.use(name, fn, mixinDeep({}, options, opts))
      return app
    }
  }
}

probably should use betterUse only when not isBase, but then will work for apps that uses base-plugins, but it won't work for the default Base .use method. So may need detection if base-plugins is used, probably detection could be done if fourth parameter is passed (because it is this.env)