-
Notifications
You must be signed in to change notification settings - Fork 325
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
docs: add link to FileRoute API in copy-pasteable code block #1060
Conversation
|
WalkthroughThe changes involve extensive updates to the documentation for the Changes
Possibly related PRs
Suggested labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
📦 Bundle size comparison
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
docs/src/app/(docs)/getting-started/remix/page.mdx (1)
65-74
: LGTM! Well-documented configuration with API reference.The code example effectively demonstrates the FileRoute configuration with proper documentation links. Consider making the API reference link more prominent by adding a dedicated comment line:
imageUploader: f({ image: { /** * For full list of options and defaults, see the File Route API reference * @see https://docs.uploadthing.com/file-routes#route-config + * + * 👉 See API Reference: https://docs.uploadthing.com/file-routes#route-config */ maxFileSize: "4MB", maxFileCount: 1, }, })docs/src/app/(docs)/api-reference/ut-api/page.mdx (3)
35-37
: Consider enhancing the example with common configuration optionsThe current example shows an empty options object. To make it more practical and educational, consider showing common configuration options that users typically need.
export const utapi = new UTApi({ - // ...options, + // Configure logging level for better debugging + logLevel: "Info", + // Override default key type if using custom IDs + defaultKeyType: "fileKey", + // See FileRoute API docs for more configuration options: + // https://docs.uploadthing.com/api-reference/file-routes });
43-43
: Fix grammar: "variables follows" should be "variables follow"There's a subject-verb agreement issue in this sentence.
-Environment variables follows the naming convention +Environment variables follow the naming convention🧰 Tools
🪛 LanguageTool
[grammar] ~43-~43: It seems that the correct verb form here is “follow”.
Context: ...onment variables. Environment variables follows the naming convention of `UPLOADTHING_<...(AGREEMENT_SENT_START_2)
42-46
: Consider clarifying environment variable precedenceThe current text states that "If both are set, the config object takes precedence" but it might be helpful to provide an example demonstrating this precedence.
You can configure the SDK either by passing them as options to the constructor, or by setting them as environment variables. Environment variables follow the naming convention of `UPLOADTHING_<NAME>`, where `<NAME>` is the name of the config option in constant case, e.g. `UPLOADTHING_LOG_LEVEL`. If both are set, -the config object takes precedence. +the config object takes precedence. For example: + +```ts +// Environment: UPLOADTHING_LOG_LEVEL=Error + +// This will use "Debug" level despite the environment variable +const utapi = new UTApi({ logLevel: "Debug" }); +```🧰 Tools
🪛 LanguageTool
[grammar] ~43-~43: It seems that the correct verb form here is “follow”.
Context: ...onment variables. Environment variables follows the naming convention of `UPLOADTHING_<...(AGREEMENT_SENT_START_2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (14)
docs/src/app/(docs)/api-reference/ut-api/page.mdx
(1 hunks)docs/src/app/(docs)/backend-adapters/express/page.mdx
(2 hunks)docs/src/app/(docs)/backend-adapters/fastify/page.mdx
(2 hunks)docs/src/app/(docs)/backend-adapters/fetch/page.mdx
(2 hunks)docs/src/app/(docs)/backend-adapters/h3/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/appdir/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/astro/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/expo/page.mdx
(3 hunks)docs/src/app/(docs)/getting-started/nuxt/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/pagedir/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/remix/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/solid/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/svelte/page.mdx
(2 hunks)docs/src/app/(docs)/getting-started/tanstack-start/page.mdx
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/src/app/(docs)/api-reference/ut-api/page.mdx
[grammar] ~43-~43: It seems that the correct verb form here is “follow”.
Context: ...onment variables. Environment variables follows the naming convention of `UPLOADTHING_<...
(AGREEMENT_SENT_START_2)
🔇 Additional comments (29)
docs/src/app/(docs)/backend-adapters/fastify/page.mdx (2)
43-44
: LGTM! Clear and concise documentation.
The added bullet point about file count limits enhances the FileRoute configuration documentation, making it more comprehensive.
57-65
: Excellent addition of the API reference link!
The changes effectively address the PR's objective by:
- Adding a clear TSDoc comment with the API reference link
- Making it easily discoverable within the code block
- Setting a consistent
maxFileCount
value
This improves the documentation's usability, especially for users who copy-paste code snippets.
docs/src/app/(docs)/backend-adapters/express/page.mdx (2)
43-44
: LGTM! Clear and concise documentation addition
The added line about file count limitations provides important information about FileRoute configuration options.
60-63
: Excellent documentation enhancement!
The added JSDoc comment effectively implements the PR's objective by:
- Making the API reference link visible in the copy-pasteable code block
- Using proper JSDoc format for better IDE integration
- Providing a clear pointer to comprehensive documentation
The maxFileCount: 1
update aligns with the standardization across other adapters.
Also applies to: 65-65
docs/src/app/(docs)/backend-adapters/h3/page.mdx (2)
47-48
: LGTM! Clear and informative documentation addition.
The added documentation clearly explains the optional features available in FileRoutes.
61-69
: Excellent documentation improvements!
The changes effectively enhance the code block with:
- Clear guidance about unique route slugs
- A well-formatted JSDoc comment with the API reference link
- Consistent configuration values
This aligns perfectly with the PR objective of making API documentation more accessible within copy-pasteable code blocks.
docs/src/app/(docs)/getting-started/solid/page.mdx (3)
41-42
: LGTM: Clear documentation addition
The new bullet point about file count limits is a valuable addition to the FileRoute feature list, providing users with important information about upload constraints.
59-68
: Excellent addition of API reference link in the code block
The changes successfully implement the PR objective by:
- Adding a well-formatted JSDoc comment with the API reference link
- Placing it where users are most likely to see it when copying the code
- Including the maxFileCount configuration as a practical example
This improves the documentation's usefulness for copy-paste scenarios.
63-64
: Verify documentation consistency
Let's ensure the API reference link and maxFileCount configuration are consistent across all documentation files.
✅ Verification successful
Documentation is consistent across all files
The verification shows that:
- The API reference link
@see https://docs.uploadthing.com/file-routes#route-config
is consistently used across all framework-specific documentation files - The
maxFileCount: 1
configuration is uniformly applied in all getting-started guides and backend adapter documentation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for consistency of API reference links and maxFileCount configurations
# Check for API reference links in code blocks
echo "Checking API reference links in code blocks..."
rg -U '@see https://docs\.uploadthing\.com/file-routes#route-config' docs/
# Check for maxFileCount configurations
echo "Checking maxFileCount configurations..."
rg -U 'maxFileCount: 1' docs/
Length of output: 3046
docs/src/app/(docs)/getting-started/pagedir/page.mdx (3)
45-46
: Documentation additions look good!
The new entries about file count limits and input validation enhance the completeness of the FileRoute description.
66-75
: Excellent documentation enhancement!
The addition of the JSDoc comment with the API reference link is a great practice as it:
- Makes the documentation accessible right in the code
- Will be visible in IDEs during copy-paste
- Helps users find the complete API reference when needed
70-70
: Verify the documentation link
Let's ensure the File Route API documentation link is valid and accessible.
docs/src/app/(docs)/getting-started/remix/page.mdx (1)
44-45
: LGTM! Clear documentation addition.
The added bullet point about file count limits provides important context for the FileRoute configuration options.
docs/src/app/(docs)/getting-started/tanstack-start/page.mdx (2)
41-42
: LGTM! Clear and helpful additions to the FileRoute capabilities list.
The new bullet points effectively document the maxFileCount
parameter and input validation feature.
60-69
: Excellent documentation enhancement!
The added JSDoc comment with the API reference link is a great solution for making documentation more accessible in copy-pasteable code blocks. The example also correctly demonstrates the maxFileCount
parameter usage.
docs/src/app/(docs)/getting-started/expo/page.mdx (3)
57-58
: LGTM: Clear documentation of file count limits
The addition clearly explains that FileRoutes can specify how many files are allowed to be uploaded.
74-82
: Excellent documentation improvements!
The changes enhance the code example by:
- Clarifying that multiple FileRoutes can be defined
- Adding a helpful link to the API reference directly in the code comments
- Demonstrating the maxFileCount configuration consistently with the documentation
159-159
: LGTM: Consistent usage example
The example correctly demonstrates using the imageUploader
route, maintaining consistency with the FileRoute definition shown earlier.
docs/src/app/(docs)/getting-started/nuxt/page.mdx (2)
86-87
: LGTM: Clear documentation addition
The new bullet point about file count limits is well-placed and clearly explains this configuration option.
112-121
: Excellent documentation enhancement!
The changes effectively address the PR objective by:
- Adding the API reference link in a JSDoc comment, making it visible when code is copied
- Providing helpful context about available options
- Demonstrating the
maxFileCount
usage with a practical example
This is a great example of documentation that stays with the code even after copy-pasting.
docs/src/app/(docs)/backend-adapters/fetch/page.mdx (3)
45-46
: LGTM: Clear documentation addition
The added bullet point about file count limitations is clear and helpful for users understanding FileRoute constraints.
59-67
: Excellent documentation improvements!
The changes effectively enhance the code example by:
- Adding a clear reference to the File Route API documentation
- Including the maxFileCount configuration
- Providing context about multiple FileRoutes capability
This is particularly valuable since users often copy-paste code examples, and the embedded API link increases the likelihood they'll find the complete documentation.
Line range hint 45-67
: Documentation maintains high quality and achieves PR objectives
The changes successfully integrate the API reference link into the code block while maintaining clear structure and readability. The additions about file count limitations and multiple FileRoutes provide valuable context exactly where users need it.
docs/src/app/(docs)/getting-started/astro/page.mdx (2)
50-51
: LGTM! Clear documentation addition.
The new bullet point about file count limits is a valuable addition that helps users understand the available configuration options for FileRoutes.
68-77
: Well-implemented API reference link in the code block!
The addition of the JSDoc comment with the API reference link is strategically placed where users are most likely to need it when configuring their FileRoute. This effectively achieves the PR's goal of making the API documentation more accessible to users who copy-paste code.
The maxFileCount configuration is also clearly documented with a practical example.
docs/src/app/(docs)/getting-started/appdir/page.mdx (2)
44-45
: LGTM! Clear documentation about file count limits.
The addition clearly documents that FileRoutes can specify how many files are allowed to be uploaded.
63-72
: Great addition of the API reference link in the code block!
The JSDoc comment with the link to the File Route API reference is a good practice as it:
- Makes the documentation accessible within copy-pasteable code
- Follows proper JSDoc conventions
- Provides immediate access to detailed API information
This aligns perfectly with the PR objective of improving documentation accessibility.
docs/src/app/(docs)/getting-started/svelte/page.mdx (2)
41-42
: LGTM! Clear and concise documentation additions.
The new bullet points effectively explain the maxFileCount
and input
validation features of FileRoutes.
60-69
: Excellent implementation of the API reference link!
The changes effectively achieve the PR's objective by:
- Adding the API reference link in a JSDoc comment that will be preserved when users copy the code
- Using the
@see
tag which is a standard documentation practice - Providing a practical example of the
maxFileCount
configuration
Co-authored-by: Mark R. Florkowski <mark.florkowski@gmail.com>
More templates
commit: |
Since we've concluded people don't read the docs and just copy-paste the snippets (the link to the API referncce is literally the last word before the code block), including it in the actual code seems like a good shout to perhaps increase the chance they'll click it when they wanna make some changes - who knows...
Summary by CodeRabbit
Release Notes
UTApi
TypeScript SDK, including constructor options and detailed property descriptions.maxFileCount
limit of 1 for file uploads and optional input validation.onUploadComplete
callback and middleware options.