-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(cloudflare): added config for _routes.json generation #8459
fix(cloudflare): added config for _routes.json generation #8459
Conversation
🦋 Changeset detectedLatest commit: b07d3ff The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing this documentation @schummar! I left a comment re: the changelog, but I have more questions regarding the README before I can continue reviewing.
I'm confused about whether the 2nd and 3rd items are in fact the options for routes.strategy
. Would that not make them e.g. routes.strategy.include
and routes.strategy.exclude
? Or, are they in fact other routes
configurations (so you're adding three new configurations to routes
)?
Because they are named identically, it is easy to wonder whether these are in fact the same thing, so a code configuration example would be helpful. Can you show an example of a configuration here? And then, I'll review the README! 🙌
EDIT: D'oh! This is once again the case of "devs put helpful stuff in the PR description that should be in the docs!" 😉
Reminder to all who go here: Most of this stuff goes in the docs! If you're telling your fellow devs about it, then maybe the users would benefit from knowing, too! 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @schummar , I found your code example and included it! 😄
Also, please see my comments re: documenting the config options. I'd also love for @alexanderniebuhr and @ematipico to take a look at my comments and provide guidance here!
(Admittedly, the details go beyond my direct knowledge and experience, but my role is to massage the docs to be as consistent as possible, and as accessible as possible to a wide audience and range of experience levels! So thank you in advance for helping me do that! 🙌 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few suggestions to enhance this:
- To maintain consistency, could we rename the test file as follows?
renamed: packages/integrations/cloudflare/test/routes-json.js -> packages/integrations/cloudflare/test/routes-json.test.js
- I'd love to see a variety of test cases (non-blocking for me), such as:
- Tests for mode: 'advanced'
- Tests for both include & exclude strategy using a custom function (they should target the same files but with different syntax)
- Tests for functionPerRoute: true
- A test incorporating assets
- Lastly, I'm concerned that the include strategy might not address all edge cases. (During my manual testing, I encountered some issues. I'd be happy to discuss this on a Discord thread in case I missed something.)
If that's the case, I'd suggest not setting the default to auto. Perhaps making exclude the default would be more appropriate.
UPDATE: Please ignore point 3 for now. I believe I've discovered an existing bug that I need to address. I'm still in the process of evaluating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just putting this here so I get notified when I should come back and look at updated documentation! 🙌
Co-authored-by: Sarah Rainsberger <[email protected]>
I have made some update but did not address all feedback yet. Will continue later, I'll notify you, when I'm done. |
Sorry for missing the ".test" part. Maybe third time's the charm 😁. I did the same adjustment for the test's fixtures, renaming the path from
Done. Executing all test cases for both modes now.
Is this not already covered by the "with additional
Do you expect that option has any impact on the resulting
I've added an asset file as well as a
That is still an interesting question: Defaulting to the |
I believe that users shouldn't be required to add custom functions manually. Nonetheless, this discussion is beyond the scope of this PR. It looks good to me!
Could you clarify this point? I'm uncertain why the
Indeed, the current default seems appropriate. However, if we start receiving feedback or reports, we can consider adjusting the default settings in the future. |
What I mean is, the content of the When a future PR indroduces analzying custom functions in the |
not sure, but at least you should be able to rely on them. But thanks for adding tests :) |
@sarah11918 are the docs ok now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @schummar , the description of the three options is so much more user-friendly! I appreciate the extra attention there! Just one tiny comment on the separate include and exclude options for clarification, but these docs are looking great, so I've removed the blocking review.
As soon as everyone here is confident my comment below is satisfactorily represented in the docs, this will be good to go!
removing the block as the docs are in very good shape!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution. LGTM!
Changes
Follow up to #7846
_routes.json
. By default the strategy producing the smaller file will be chosen. If users want more control over it, they can override it by settingroutes.strategy
to"include"
(current default behavior) or"exclude"
(old default behavior).include
andexclude
entries.Testing
Added test cases ✅
Docs
Added docs ✅
/cc @withastro/maintainers-docs for feedback!