Skip to content

Commit

Permalink
[PFX-409] - Cleanup deprecated: @gasket/plugin-nextjs (#655)
Browse files Browse the repository at this point in the history
* chore: removed next config support

* chore: updated changelog
  • Loading branch information
jpina1-godaddy authored Jan 22, 2024
1 parent 0da8c6e commit 02af3b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
3 changes: 3 additions & 0 deletions packages/gasket-plugin-nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `@gasket/plugin-nextjs`

- Removed support for deprecated `next` config support ([#655])

### 6.43.0

- Upgrade to Next.js 13.1.1 ([#614])
Expand Down Expand Up @@ -240,3 +242,4 @@
[#541]: https://github.com/godaddy/gasket/pull/541
[#556]: https://github.com/godaddy/gasket/pull/556
[#614]: https://github.com/godaddy/gasket/pull/614
[#655]: https://github.com/godaddy/gasket/pull/655
9 changes: 2 additions & 7 deletions packages/gasket-plugin-nextjs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@ module.exports = {
first: true // Fixup next -> nextConfig early for reference by other plugins
},
handler: function configure(gasket, baseConfig = {}) {
const { logger } = gasket;
const { next, ...rest } = baseConfig;
if (next) {
logger.warning('DEPRECATED `next` in Gasket config - use `nextConfig`');
}
const { nextConfig = next || {} } = baseConfig;
const { nextConfig = {} } = baseConfig;

const serviceWorker = {
webpackRegister: (key) => /_app/.test(key),
...(baseConfig.serviceWorker || {})
};
return { ...rest, serviceWorker, nextConfig };
return { ...baseConfig, serviceWorker, nextConfig };
}
},
async prompt(gasket, context, { prompt }) {
Expand Down
11 changes: 0 additions & 11 deletions packages/gasket-plugin-nextjs/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ describe('configure hook', () => {
expect(entryName('_app')).toEqual(true);
expect(entryName('static/runtime/_app')).toEqual(true);
});

it('fallback support for `next` from gasket.config', async () => {
const gasket = mockGasketApi();
delete gasket.config.nextConfig;
gasket.config.next = {
customConfig: true
};
const results = configureHook(gasket, gasket.config);
expect(results.nextConfig).toHaveProperty('customConfig', true);
expect(gasket.logger.warning).toHaveBeenCalledWith(expect.stringContaining('DEPRECATED'));
});
});

describe('express hook', () => {
Expand Down

0 comments on commit 02af3b4

Please sign in to comment.