Conversation
| dependencies: { | ||
| fastify: ['plugin1', 'plugin2'], | ||
| reply: ['compress'] | ||
| } |
There was a problem hiding this comment.
I'm a bit lost on how this dependencies block would be used.
There was a problem hiding this comment.
Is still a WIP, checkout fastify/fastify#466.
| const console = require('console') | ||
|
|
||
| function plugin (fn, version) { | ||
| function plugin (fn, options) { |
There was a problem hiding this comment.
I would keep it backward-compatible.
There was a problem hiding this comment.
this is not true anymore, correct?
README.md
Outdated
| `fastify-plugin` can do three things for you: | ||
| - Add the `skip-override` hidden property | ||
| - Check the bare-minimum version of Fastify | ||
| - Ass some custom meta to the plugin |
There was a problem hiding this comment.
How about we lose the "Ass" and go with this instead:
Asses plugin metadata
README.md
Outdated
|
|
||
| You can check [here](https://github.com/npm/node-semver#ranges) how to define a `semver` range. | ||
|
|
||
| You can also pass some metadata thatr will be handled by Fastify, such as the dependencies of your plugin. |
There was a problem hiding this comment.
Strike "thatr" and replace with "that".
88997b0 to
6deaba4
Compare
test.js
Outdated
|
|
||
| try { | ||
| fp(() => {}, 12) | ||
| fp(() => {}, { version: 12 }) |
There was a problem hiding this comment.
Can we keep this test? Or this PR is a breaking change?
There was a problem hiding this comment.
At the moment the second parameter should be a string or object.
|
Hello folks! From now we will accept only one option object with all the metadata inside, for example if you need to check the Fastify version you should pass an object like the following: {
fastify: '>=0.x',
name: 'cool-plugin',
dependencies: {
fastify: ['plugin1', 'plugin2'],
reply: ['compress']
},
decorators: {
reply: ['setCookie']
}
}@fastify/fastify do we all agree with this change? |
jsumners
left a comment
There was a problem hiding this comment.
LGTM with a couple grammar items updated.
README.md
Outdated
| 1. Use the `skip-override` hidden property | ||
| 2. Use this module | ||
|
|
||
| In addition if you use this module when creating new plugins, you can declare the dependencies, the name and the expected Fastify version that your plugins needs. |
README.md
Outdated
| - Add the `skip-override` hidden property | ||
| - Check the bare-minimum version of Fastify | ||
| - Pass some custom meta to the plugin | ||
| - Pass some custom meta of the plugin to Fastify |
e8c19fc to
d934095
Compare
First part of the work started from the discussion in fastify/fastify#456.
Once the core is ready we will merge and release this as well.