diff --git a/package-lock.json b/package-lock.json index 1455cbf13..d3c4d7f19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43704,7 +43704,6 @@ "dependencies": { "@gasket/plugin-cypress": "7.0.0-next.69", "@gasket/plugin-express": "7.0.0-next.69", - "@gasket/plugin-fastify": "7.0.0-next.69", "@gasket/plugin-https": "7.0.0-next.69", "@gasket/plugin-intl": "7.0.0-next.69", "@gasket/plugin-jest": "7.0.0-next.69", diff --git a/packages/gasket-plugin-fastify/package.json b/packages/gasket-plugin-fastify/package.json index e5bb66bc8..f97e470e8 100644 --- a/packages/gasket-plugin-fastify/package.json +++ b/packages/gasket-plugin-fastify/package.json @@ -5,6 +5,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "files": [ + "generator", "lib" ], "scripts": { diff --git a/packages/gasket-preset-api/lib/create.js b/packages/gasket-preset-api/lib/create.js index 39599056a..36447f7d3 100644 --- a/packages/gasket-preset-api/lib/create.js +++ b/packages/gasket-preset-api/lib/create.js @@ -21,7 +21,7 @@ export default function create(gasket, context) { pkg.add('scripts', { start: 'node server.js', local: 'nodemon server.js', - preview: 'npm run build && npm run start' + preview: 'npm run start' }); } } diff --git a/packages/gasket-preset-api/test/create.test.js b/packages/gasket-preset-api/test/create.test.js index 9844c296c..cf8b20e14 100644 --- a/packages/gasket-preset-api/test/create.test.js +++ b/packages/gasket-preset-api/test/create.test.js @@ -53,7 +53,7 @@ describe('create', function () { expect(mockPkgAdd).toHaveBeenCalledWith('scripts', { start: 'node server.js', local: 'nodemon server.js', - preview: 'npm run build && npm run start' + preview: 'npm run start' }); }); diff --git a/packages/gasket-preset-nextjs/lib/index.d.ts b/packages/gasket-preset-nextjs/lib/index.d.ts index 1d336224e..afa069bb9 100644 --- a/packages/gasket-preset-nextjs/lib/index.d.ts +++ b/packages/gasket-preset-nextjs/lib/index.d.ts @@ -1,5 +1,4 @@ import '@gasket/plugin-express'; -import '@gasket/plugin-fastify'; import '@gasket/plugin-https'; import '@gasket/plugin-nextjs'; import '@gasket/plugin-webpack'; diff --git a/packages/gasket-preset-nextjs/lib/preset-config.js b/packages/gasket-preset-nextjs/lib/preset-config.js index 13e16b822..b745725c5 100644 --- a/packages/gasket-preset-nextjs/lib/preset-config.js +++ b/packages/gasket-preset-nextjs/lib/preset-config.js @@ -23,10 +23,9 @@ export default async function presetConfig(gasket, context) { pluginLint ]; - if ('server' in context) { - const frameworkPlugin = context.server === 'express' - ? await import('@gasket/plugin-express') - : await import('@gasket/plugin-fastify'); + + if (context.nextServerType === 'customServer') { + const frameworkPlugin = await import('@gasket/plugin-express'); plugins.push(frameworkPlugin.default || frameworkPlugin); } diff --git a/packages/gasket-preset-nextjs/lib/preset-prompt.js b/packages/gasket-preset-nextjs/lib/preset-prompt.js index 7ee51da19..56e860ad5 100644 --- a/packages/gasket-preset-nextjs/lib/preset-prompt.js +++ b/packages/gasket-preset-nextjs/lib/preset-prompt.js @@ -13,21 +13,5 @@ export default async function presetPrompt(gasket, context, { prompt }) { await nextJsPrompts.promptNextServerType(context, prompt); await nextJsPrompts.promptNextDevProxy(context, prompt); - if (!('server' in context) && context.nextServerType === 'customServer') { - const { server } = await prompt([ - { - name: 'server', - message: 'Which custom server framework would you like to use?', - type: 'list', - choices: [ - { name: 'Express', value: 'express' }, - { name: 'Fastify', value: 'fastify' } - ] - } - ]); - - Object.assign(context, { server }); - } - return context; } diff --git a/packages/gasket-preset-nextjs/package.json b/packages/gasket-preset-nextjs/package.json index f5669ae23..60b9c98dd 100644 --- a/packages/gasket-preset-nextjs/package.json +++ b/packages/gasket-preset-nextjs/package.json @@ -33,7 +33,6 @@ "dependencies": { "@gasket/plugin-cypress": "7.0.0-next.69", "@gasket/plugin-express": "7.0.0-next.69", - "@gasket/plugin-fastify": "7.0.0-next.69", "@gasket/plugin-https": "7.0.0-next.69", "@gasket/plugin-intl": "7.0.0-next.69", "@gasket/plugin-jest": "7.0.0-next.69", diff --git a/packages/gasket-preset-nextjs/test/preset-config.test.js b/packages/gasket-preset-nextjs/test/preset-config.test.js index a2e0b003c..c290718f4 100644 --- a/packages/gasket-preset-nextjs/test/preset-config.test.js +++ b/packages/gasket-preset-nextjs/test/preset-config.test.js @@ -58,7 +58,7 @@ describe('presetConfig', () => { describe('adds server framework plugin', () => { it('express', async () => { - mockContext.server = 'express'; + mockContext.nextServerType = 'customServer'; const config = await presetConfig({}, mockContext); expect(config.plugins).toEqual( expect.arrayContaining([ @@ -66,15 +66,5 @@ describe('presetConfig', () => { ]) ); }); - - it('fastify', async () => { - mockContext.server = 'fastify'; - const config = await presetConfig({}, mockContext); - expect(config.plugins).toEqual( - expect.arrayContaining([ - expect.objectContaining({ name: '@gasket/plugin-fastify' }) - ]) - ); - }); }); }); diff --git a/packages/gasket-preset-nextjs/test/preset-prompt.test.js b/packages/gasket-preset-nextjs/test/preset-prompt.test.js index 5233ea70f..e5f2d92a4 100644 --- a/packages/gasket-preset-nextjs/test/preset-prompt.test.js +++ b/packages/gasket-preset-nextjs/test/preset-prompt.test.js @@ -62,36 +62,4 @@ describe('presetPrompt', () => { expect(mockNextDevProxyPrompt).toHaveBeenCalled(); expect(mockPrompt.prompt).toHaveBeenCalled(); }); - - it('prompts for server if nextServerType is customServer', async () => { - mockContext.nextServerType = 'customServer'; - await presetPrompt({}, mockContext, mockPrompt); - expect(mockPrompt.prompt).toHaveBeenCalledWith([ - { - name: 'server', - message: 'Which custom server framework would you like to use?', - type: 'list', - choices: [ - { name: 'Express', value: 'express' }, - { name: 'Fastify', value: 'fastify' } - ] - } - ]); - }); - - it('does not prompt for server if nextServerType is not customServer', async () => { - mockContext.nextServerType = 'defaultServer'; - await presetPrompt({}, mockContext, mockPrompt); - expect(mockPrompt.prompt).not.toHaveBeenCalledWith([ - { - name: 'server', - message: 'Which server framework would you like to use?', - type: 'list', - choices: [ - { name: 'Express', value: 'express' }, - { name: 'Fastify', value: 'fastify' } - ] - } - ]); - }); });