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

fix: make scheduledTasks types consistent #2284

Closed
wants to merge 4 commits into from
Closed

Conversation

noook
Copy link
Contributor

@noook noook commented Mar 21, 2024

πŸ”— Linked issue

Closes #2283, related to nuxt/devtools#626

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
    • Not exactly breaking, but I put a deprecation warning, not sure if that's the best usage

πŸ“š Description

  • Make scheduledTasks default to {} instead of undefined -> Should be fixed to match the type
  • Make scheduledTasks type consistent with the array notation -> I can revert if unwanted.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly. (no change)

@@ -128,6 +128,12 @@ export async function createNitro(
nitro.options.virtual["#internal/nitro/virtual/tasks"] = () => {
const _scheduledTasks = Object.entries(nitro.options.scheduledTasks || {})
.map(([cron, _tasks]) => {
if (!Array.isArray(_tasks)) {
nitro.logger.warn(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still like to support non array format.

@pi0
Copy link
Member

pi0 commented Mar 21, 2024

#2283 (comment)

@pi0 pi0 closed this Mar 21, 2024
@noook
Copy link
Contributor Author

noook commented Mar 21, 2024

Yes of course ! I don't mind reverting my changes at all I explained it in the PR.

However, there is still something that could be fixed, which is the default empty object for scheduledTasks that doesn't reflect the nitro config's typings. And it still falls under the "make type consistent" (ok, maybe not consistent but at least coherent). Should I reopen the PR with only this change ?

@pi0
Copy link
Member

pi0 commented Mar 21, 2024

sure

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.

Scheduled tasks type on nitro options are incorrect
2 participants