Skip to content

Comments

feat(tasks): add triggers to wrangler deploy config#4046

Open
RihanArfan wants to merge 5 commits intonitrojs:mainfrom
RihanArfan:feat/tasks-wrangler
Open

feat(tasks): add triggers to wrangler deploy config#4046
RihanArfan wants to merge 5 commits intonitrojs:mainfrom
RihanArfan:feat/tasks-wrangler

Conversation

@RihanArfan
Copy link
Member

@RihanArfan RihanArfan commented Feb 19, 2026

🔗 Linked issue

Closes nuxt-hub/core#648

❓ 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)

📚 Description

Automatically adds scheduled Nitro tasks cron expressions to the generated Wrangler config for zero-config scheduled Nitro tasks support on Workers.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@RihanArfan RihanArfan requested a review from pi0 as a code owner February 19, 2026 15:05
@vercel
Copy link

vercel bot commented Feb 19, 2026

@RihanArfan is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Nitro now auto-generates Cloudflare cron triggers from configured scheduledTasks at build time; docs updated to describe this and implementation adds schedules into wrangler.json. A test verifies the generated cron entry.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/1.docs/50.tasks.md, docs/2.deploy/20.providers/cloudflare.md
Updated tasks docs and provider docs to document auto-generation of Cloudflare cron triggers and note Wrangler config is handled at build time.
Cloudflare Preset Implementation
src/presets/cloudflare/utils.ts
Added logic to collect scheduledTasks schedules, ensure wranglerConfig.triggers.crons exists, deduplicate against existing crons, and append new schedules before writing wrangler.json.
Test Coverage
test/presets/cloudflare-module.test.ts
Added test asserting wrangler.json contains the generated triggers.crons entry (e.g., ["* * * * *"]).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(tasks): add triggers to wrangler deploy config' follows conventional commits format with a type (feat) and descriptive scope (tasks).
Description check ✅ Passed The description clearly relates to the changeset, explaining that it automatically adds scheduled Nitro tasks cron expressions to Wrangler config for zero-config support on Workers.
Linked Issues check ✅ Passed The PR successfully addresses the linked issue by automatically injecting scheduled task cron expressions into the Wrangler configuration, eliminating the need for manual trigger setup after deployment.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the objective: code adds cron trigger integration, documentation updates describe the new automatic behavior, and tests verify the functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview, Comment Feb 19, 2026 3:09pm

Request Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@4046

commit: 8f6a6c6

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/1.docs/50.tasks.md (1)

90-91: Inconsistent dash style with the adjacent Vercel line.

Line 90 uses a hyphen-with-spaces (-) while line 91 uses an em-dash (). Consider aligning for consistency.

✏️ Proposed fix
-- `cloudflare_module` preset has native integration with [Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/). Nitro automatically generates the cron triggers in the wrangler config at build time - no manual wrangler setup required.
+- `cloudflare_module` preset has native integration with [Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/). Nitro automatically generates the cron triggers in the wrangler config at build time — no manual wrangler setup required.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/1.docs/50.tasks.md` around lines 90 - 91, The two bullet lines use
inconsistent dash styles; update the `cloudflare_module` preset line to match
the `vercel` preset by replacing the hyphen-with-spaces (" - ") before "no
manual wrangler setup required." with the same em-dash (" — ") used in the
`vercel` preset so both lines use the same dash style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/presets/cloudflare/utils.ts`:
- Around line 292-304: The cron injection block is running for both Pages and
Workers targets; restrict it to Workers module builds by checking the Cloudflare
target before mutating wranglerConfig.triggers. Wrap the existing condition that
checks nitro.options.experimental.tasks and nitro.options.scheduledTasks so it
also requires cfTarget === 'module' (or the variable used for the target in this
file), ensuring wranglerConfig.triggers and its crons are only modified for the
"module" target and not for Pages.

---

Nitpick comments:
In `@docs/1.docs/50.tasks.md`:
- Around line 90-91: The two bullet lines use inconsistent dash styles; update
the `cloudflare_module` preset line to match the `vercel` preset by replacing
the hyphen-with-spaces (" - ") before "no manual wrangler setup required." with
the same em-dash (" — ") used in the `vercel` preset so both lines use the same
dash style.

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.

Have to manually set up triggers in Cloudflare worker settings to run the scheduled tasks

1 participant