diff --git a/README.md b/README.md index 128f83c..32c2224 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ When you build plugins for Fastify and you want that them to be accessible in th 1. Use the `skip-override` hidden property 2. Use this module +__Note: the v4.x series of this module covers Fastify v4__ __Note: the v2.x & v3.x series of this module covers Fastify v3. For Fastify v2 support, refer to the v1.x series.__ ## Usage @@ -50,7 +51,7 @@ const fp = require('fastify-plugin') module.exports = fp(function (fastify, opts, next) { // your plugin code next() -}, { fastify: '3.x' }) +}, { fastify: '4.x' }) ``` If you need to check the Fastify version only, you can pass just the version string. @@ -69,7 +70,7 @@ function plugin (fastify, opts, next) { } module.exports = fp(plugin, { - fastify: '3.x', + fastify: '4.x', name: 'your-plugin-name' }) ``` @@ -86,7 +87,7 @@ function plugin (fastify, opts, next) { } module.exports = fp(plugin, { - fastify: '3.x', + fastify: '4.x', decorators: { fastify: ['plugin1', 'plugin2'], reply: ['compress'] diff --git a/package.json b/package.json index 1f239d7..4de0a1a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "homepage": "https://github.com/fastify/fastify-plugin#readme", "devDependencies": { "@types/node": "^17.0.0", - "fastify": "^3.3.0", + "fastify": "^4.0.1", "proxyquire": "^2.1.3", "standard": "^17.0.0", "tap": "^16.0.1", diff --git a/test/bundlers.test.js b/test/bundlers.test.js index 7ae9e39..a48ff5b 100644 --- a/test/bundlers.test.js +++ b/test/bundlers.test.js @@ -20,7 +20,7 @@ test('webpack removes require.main.filename', (t) => { fp((fastify, opts, next) => { next() }, { - fastify: '^3.0.0' + fastify: '^4.0.0' }) t.end() diff --git a/test/checkVersion.test.js b/test/checkVersion.test.js index 3989cf3..f64a8fa 100644 --- a/test/checkVersion.test.js +++ b/test/checkVersion.test.js @@ -17,7 +17,7 @@ test('checkVersion having require.main.filename', (t) => { fp((fastify, opts, next) => { next() }, { - fastify: '^3.0.0' + fastify: '^4.0.0' }) t.end() @@ -40,7 +40,7 @@ test('checkVersion having no require.main.filename but process.argv[1]', (t) => fp((fastify, opts, next) => { next() }, { - fastify: '^3.0.0' + fastify: '^4.0.0' }) t.end() @@ -66,7 +66,7 @@ test('checkVersion having no require.main.filename and no process.argv[1]', (t) fp((fastify, opts, next) => { next() }, { - fastify: '^3.0.0' + fastify: '^4.0.0' }) t.end() diff --git a/test/test.js b/test/test.js index 2d68d66..fc75588 100644 --- a/test/test.js +++ b/test/test.js @@ -183,12 +183,12 @@ test('should check fastify dependency graph - plugin', t => { const fastify = Fastify() fastify.register(fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'plugin1-name' })) fastify.register(fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'test', dependencies: ['plugin1-name', 'plugin2-name'] })) @@ -203,12 +203,12 @@ test('should check fastify dependency graph - decorate', t => { const fastify = Fastify() fastify.decorate('plugin1', fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'plugin1-name' })) fastify.register(fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'test', decorators: { fastify: ['plugin1', 'plugin2'] } })) @@ -223,12 +223,12 @@ test('should check fastify dependency graph - decorateReply', t => { const fastify = Fastify() fastify.decorateReply('plugin1', fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'plugin1-name' })) fastify.register(fp((fastify, opts, next) => next(), { - fastify: '3.x', + fastify: '4.x', name: 'test', decorators: { reply: ['plugin1', 'plugin2'] } }))