New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Base #3

Closed
tunnckoCore opened this Issue Apr 2, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@tunnckoCore
Copy link
Collaborator

tunnckoCore commented Apr 2, 2017

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

@tunnckoCore

This comment has been minimized.

Copy link
Collaborator

tunnckoCore commented Apr 2, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment