Skip to content
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

Configure staleTimes in next.config.js for next15 #1301

Closed
wants to merge 7 commits into from

Conversation

nishant2253
Copy link

📚 Description

This codemod refactors the next.config.js file to introduce the staleTimes configuration option, allowing you to control cache durations for different types of page segments. By specifying cache durations for dynamic and static pages, this codemod enhances caching behavior and improves application performance.

1.Find Configuration Object: Identifies the nextConfig object within the next.config.js file.
2.Add staleTimes Property: Adds the staleTimes property to the experimental object to define cache durations.
3. Specify Cache Durations: Sets cache durations for dynamic and static pages in seconds.
4. Clean Up: Removes the experimental object if it becomes empty after adding the staleTimes property.

To run this codemod, run the following command in the project directory:
codemod Next/15/Add-Experimental-Stale-Times

🧪 Test Plan

Test the codemod by applying it to a specified repository to ensure that the next.config.js file is correctly updated with the staleTimes configuration. Verify that the cache durations for dynamic and static pages are properly set and that the application behaves as expected with the new caching settings.

  • Apply the codemod to the repository available at (https://github.com/OlegJytnik/JSSNextJSDemo).

  • Confirm that the staleTimes property is correctly added to the experimental object in next.config.js

  • Test the application to ensure it functions correctly with the updated cache duration settings.

    All other test cases are run in the codemod studio and are present in /codemod/packages/codemods/next/15/configure-staletimes/textfix

📄 Documentation to Update

  • If applicable, update any relevant documentation to reflect the new staleTimes configuration in next.config.js. This may include README files or other developer guides that reference caching strategies for dynamic and static pages

Copy link

vercel bot commented Aug 30, 2024

@nishant2253 is attempting to deploy a commit to the Codemod Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Aug 30, 2024

CLA assistant check
All committers have signed the CLA.

@alexbit-codemod
Copy link
Contributor

closing, see: #1348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants