Skip to content

chore: upgrade storybook & docs npm dependencies#3342

Merged
mattinannt merged 4 commits intomainfrom
feature/sb-deps
Oct 9, 2024
Merged

chore: upgrade storybook & docs npm dependencies#3342
mattinannt merged 4 commits intomainfrom
feature/sb-deps

Conversation

@mattinannt
Copy link
Member

@mattinannt mattinannt commented Oct 9, 2024

This pull request includes various updates and improvements across multiple files, focusing on dependency updates, configuration changes, and minor code adjustments. The most important changes include updating dependencies in several package.json files, modifying the .changeset/config.json and .gitpod.yml configurations, and making minor code adjustments for type safety and documentation clarity.

Dependency Updates:

  • apps/docs/package.json: Updated several dependencies, including @calcom/embed-react, @docsearch/react, @headlessui/react, next, and framer-motion to their latest versions. [1] [2]
  • apps/storybook/package.json: Updated dependencies such as eslint-plugin-react-refresh, @chromatic-com/storybook, and storybook to newer versions.
  • apps/web/package.json: Updated various dependencies including @radix-ui/react-collapsible, @sentry/nextjs, framer-motion, and next to their latest versions.

Configuration Changes:

Code Adjustments:

Summary by CodeRabbit

  • New Features
    • Introduced a new section in documentation for integrating Docs Feedback, including installation and implementation steps.
  • Bug Fixes
    • Removed the "website" task from the Gitpod configuration.
  • Documentation
    • Updated documentation to improve clarity on the feedback widget's functionality.
  • Chores
    • Updated various dependencies across multiple projects to their latest versions for improved performance and security.
    • Adjusted TypeScript configuration documentation link for better guidance.
    • Renamed method for handling server errors in action client for clarity.

@vercel
Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
formbricks-cloud ❌ Failed (Inspect) Oct 9, 2024 0:54am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
formbricks-docs ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 0:54am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

Walkthrough

The pull request includes several changes across multiple files. Key modifications involve updating the .changeset/config.json to stop ignoring @formbricks/formbricks-com, removing the "website" task from .gitpod.yml, and enhancing documentation in apps/docs/app/best-practices/docs-feedback/page.mdx. Additionally, various dependency versions are updated in package.json files for multiple applications, including @formbricks/docs, storybook, and @formbricks/web, reflecting routine maintenance and improvements.

Changes

File Path Change Summary
.changeset/config.json Removed @formbricks/formbricks-com from the ignore list.
.gitpod.yml Removed the "website" task and its command.
apps/docs/app/best-practices/docs-feedback/page.mdx Added new section "Docs Feedback" with installation steps and feedback widget implementation details. Added functions handleFeedbackSubmit and updateFeedback.
apps/docs/package.json Updated multiple dependency versions.
apps/storybook/package.json Updated multiple dependency versions, including Storybook-related packages.
apps/web/package.json Updated multiple dependency versions.
apps/web/middleware.ts Changed type assertion for request parameter in middleware function.
apps/web/next-env.d.ts Updated URL reference in TypeScript configuration comment.
packages/ee/package.json Updated react-hook-form dependency version.
packages/lib/actionClient/index.ts Renamed method handleReturnedServerError to handleServerError without altering its functionality.

Possibly related PRs

  • feat: Advanced logic editor #3020: Modifications to the QuestionFormInput component, which may relate to the overall logic and structure of survey questions, similar to the changes in the main PR regarding dependency management for @formbricks/formbricks-com.
  • feat: adds contact info question type #3176: This PR introduces a new question type for collecting contact information, which is relevant to the changes in the main PR as both involve enhancements to survey functionalities.
  • fix: merges the app and website js sdk into @formbricks/js #3314: The merging of the app and website JavaScript SDKs into @formbricks/js aligns with the changes in the main PR that involve configuration updates for dependency management, indicating a broader effort to streamline the Formbricks platform.
  • chore: update js README for v3 release #3334: The updates to the README for the @formbricks/js package reflect the changes made in the main PR regarding the configuration and management of dependencies, emphasizing the importance of clear documentation in conjunction with code changes.

Suggested labels

🕹️ oss.gg, 🕹️ 50 points

Suggested reviewers

  • jobenjada
  • pandeymangg

Poem

In the garden where code does bloom,
Dependencies dance, dispelling gloom.
With feedback widgets, our docs now shine,
A hop, a skip, all changes align!
So let’s celebrate, with joy and cheer,
For every update brings us near! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 394f2c4 and 823fed1.

📒 Files selected for processing (1)
  • packages/lib/actionClient/index.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
packages/lib/actionClient/index.ts (1)

Line range hint 8-16: Method renamed: handleReturnedServerError to handleServerError

The method has been renamed from handleReturnedServerError to handleServerError. This change improves clarity as the new name is more concise while still accurately describing the method's purpose.

To ensure this change doesn't introduce any issues, let's verify if the old method name is used elsewhere in the codebase:

If this search returns any results, we may need to update those occurrences as well.

✅ Verification successful

Renaming Verified Successfully

The method handleReturnedServerError has been successfully renamed to handleServerError. No remaining usages of handleReturnedServerError were found in the codebase, ensuring that the change does not introduce any issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining usage of 'handleReturnedServerError'
rg --type typescript --type javascript 'handleReturnedServerError'

Length of output: 101


Script:

#!/bin/bash
# Corrected search for any remaining usage of 'handleReturnedServerError'
rg --type ts --type js 'handleReturnedServerError'

Length of output: 50


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2024

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (5)
apps/docs/app/best-practices/docs-feedback/page.mdx (5)

122-122: LGTM! Consider adding a link to the Tailwind Template.

The added context about using the Tailwind Template "Syntax" is helpful. To further assist readers, consider adding a link to the specific template you're referring to.


Line range hint 122-185: Great job on the comprehensive widget implementation!

The widget implementation is well-structured and follows React best practices. The use of hooks for state management and the clear separation of concerns are commendable. However, there are a few areas that could be improved:

  1. Consider using TypeScript for better type safety, especially for the responseId state which is initialized as null but later used as a string.

  2. The PopoverTrigger components could be extracted into a separate component to improve readability and reusability.

  3. The handleFeedbackSubmit function is called directly in the onClick handler. Consider wrapping it in a useCallback hook to optimize performance.

Here's a suggested refactor for the PopoverTrigger:

const FeedbackButton = ({ option, onClick }) => (
  <PopoverTrigger
    className="rounded border border-slate-200 bg-slate-50 px-4 py-2 text-slate-900 hover:bg-slate-100 hover:text-slate-600 focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-1 dark:border-slate-700 dark:bg-slate-700 dark:text-slate-300 dark:hover:bg-slate-600 dark:hover:text-slate-300"
    onClick={onClick}
  >
    {option}
  </PopoverTrigger>
);

// Usage
{["Yes 👍", " No 👎"].map((option) => (
  <FeedbackButton
    key={option}
    option={option}
    onClick={async () => {
      const id = await handleFeedbackSubmit(option, router.asPath);
      setResponseId(id);
    }}
  />
))}

Line range hint 186-226: Good implementation of the handleFeedbackSubmit function

The handleFeedbackSubmit function is well-implemented and follows the Formbricks API documentation. However, there are a few improvements that could be made:

  1. Consider using environment variables for the API endpoints and survey IDs, rather than hardcoding them. This will make it easier to switch between development and production environments.

  2. The error handling could be improved by providing more specific error messages and potentially implementing a retry mechanism for network failures.

  3. The function could benefit from TypeScript typing for better type safety.

Here's a suggested refactor with improved error handling and TypeScript typing:

interface FeedbackResponse {
  id: string;
  // Add other properties as needed
}

export const handleFeedbackSubmit = async (YesNo: string, pageUrl: string): Promise<string | null> => {
  const payload = {
    response: {
      data: {
        isHelpful: YesNo,
        pageUrl: pageUrl,
      },
    },
    surveyId: process.env.NEXT_PUBLIC_FORMBRICKS_SURVEY_ID,
  };

  try {
    const res = await fetch(
      `${process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST}/api/v1/client/environments/${process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID}/responses`,
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(payload),
      }
    );

    if (!res.ok) {
      throw new Error(`HTTP error! status: ${res.status}`);
    }

    const responseJson: FeedbackResponse = await res.json();
    return responseJson.id;
  } catch (error) {
    console.error("Error submitting feedback:", error);
    // Implement retry logic here if needed
    return null;
  }
};

Line range hint 227-257: Well-implemented updateFeedback function with room for improvement

The updateFeedback function is correctly implemented according to the Formbricks API documentation. However, there are a few areas that could be enhanced:

  1. Similar to the handleFeedbackSubmit function, consider using environment variables for API endpoints.

  2. The error handling could be more robust, providing specific error messages and potentially implementing a retry mechanism.

  3. The function could benefit from TypeScript typing for improved type safety.

  4. Consider adding a return value to indicate whether the update was successful.

Here's a suggested refactor with these improvements:

export const updateFeedback = async (freeText: string, responseId: string | null): Promise<boolean> => {
  if (!responseId) {
    console.error("No response ID available");
    return false;
  }

  const payload = {
    response: {
      data: {
        additionalInfo: freeText,
      },
      finished: true,
    },
  };

  try {
    const res = await fetch(
      `${process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST}/api/v1/client/environments/${process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID}/responses/${responseId}`,
      {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(payload),
      }
    );

    if (!res.ok) {
      throw new Error(`HTTP error! status: ${res.status}`);
    }

    return true;
  } catch (error) {
    console.error("Error updating response:", error);
    // Implement retry logic here if needed
    return false;
  }
};

Line range hint 1-257: Excellent comprehensive guide for Docs Feedback implementation

This documentation provides a thorough and well-structured guide for implementing the Docs Feedback feature using Formbricks. The step-by-step instructions, accompanied by visual aids and code snippets, make it easy for developers to follow along and implement the feature in their own projects.

Some final suggestions for improvement:

  1. Consider adding a troubleshooting section to address common issues developers might encounter during implementation.
  2. It might be helpful to include a brief section on best practices for using the collected feedback data to improve documentation.
  3. Add a summary or quick reference guide at the end for developers who want to quickly review the key steps.

Overall, great job on creating this comprehensive and user-friendly guide!

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f31cc9f and 22ec013.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/config.json (1 hunks)
  • .gitpod.yml (0 hunks)
  • apps/docs/app/best-practices/docs-feedback/page.mdx (1 hunks)
  • apps/docs/components/Header.tsx (2 hunks)
  • apps/docs/package.json (2 hunks)
  • apps/storybook/package.json (1 hunks)
  • apps/web/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .gitpod.yml
✅ Files skipped from review due to trivial changes (1)
  • apps/docs/package.json
🧰 Additional context used
🔇 Additional comments (20)
.changeset/config.json (1)

10-10: Verify the intent of removing @formbricks/formbricks-com from the ignore list.

The removal of @formbricks/formbricks-com from the ignore array means that changes to this package will now be tracked by changesets. This change could have the following impacts:

  1. Changes to @formbricks/formbricks-com will now trigger version bumps and changelog entries.
  2. It may affect the release process and how updates to this package are communicated.

Please confirm if this change aligns with the project's versioning strategy. Consider running the following command to check recent changes in the @formbricks/formbricks-com package that might now be included in the next release:

This will help ensure that the change is intentional and that you're aware of any immediate effects on versioning.

apps/storybook/package.json (10)

15-15: LGTM: Minor version update for eslint-plugin-react-refresh

The update from ^0.4.9 to ^0.4.12 for eslint-plugin-react-refresh is a minor version bump, which should be backwards compatible and likely includes bug fixes and small improvements.


22-30: LGTM: Consistent minor version update for Storybook packages

The update from ^8.2.9 to ^8.3.5 for multiple Storybook packages (addon-a11y, addon-essentials, addon-interactions, addon-links, addon-onboarding, blocks, react, react-vite, test) is consistent across all packages. This is a good practice to maintain compatibility between Storybook components.


31-32: LGTM: Consistent update for TypeScript ESLint packages

The update from ^8.0.0 to ^8.8.1 for both @typescript-eslint/eslint-plugin and @typescript-eslint/parser maintains version consistency between these related packages, which is crucial for their proper functioning together.


33-33: LGTM: Patch update for @vitejs/plugin-react

The update from ^4.3.1 to ^4.3.2 for @vitejs/plugin-react is a patch version bump, which typically includes only backwards-compatible bug fixes.


34-34: LGTM: Minor version update for esbuild

The update from ^0.23.0 to ^0.24.0 for esbuild is a minor version bump, which may include new features while maintaining backwards compatibility.


37-37: LGTM: Consistent update for storybook package

The update from ^8.2.9 to ^8.3.5 for the storybook package is consistent with the earlier updates to other Storybook-related packages, maintaining version alignment across the Storybook ecosystem.


38-38: LGTM: Minor version update for tsup

The update from ^8.2.4 to ^8.3.0 for tsup is a minor version bump, which should be backwards compatible and may include new features or improvements.


39-39: LGTM: Patch update for vite

The update from ^5.4.1 to ^5.4.8 for vite is a patch version bump, which typically includes only backwards-compatible bug fixes and minor improvements.


15-39: Summary of dependency updates

The package.json file has been updated with various dependency version bumps, mostly minor and patch updates. These updates are generally good for maintaining the project with the latest bug fixes and improvements. Key points:

  1. Most updates are backwards-compatible and should not cause issues.
  2. Storybook-related packages have been consistently updated to version 8.3.5.
  3. The major version update for @chromatic-com/storybook (1.x to 2.x) requires attention to potential breaking changes.

Recommendations:

  1. Test the application thoroughly after applying these updates.
  2. Pay special attention to any Chromatic-related functionality due to the major version bump.
  3. Review the changelogs of updated packages, especially @chromatic-com/storybook, for any breaking changes or new features that may impact your project.

To ensure all dependencies are properly installed and the project builds correctly after these updates, run:

#!/bin/bash
# Clean install dependencies and build the project
npm ci
npm run build

# Check for any deprecation warnings or errors in the build output

20-20: Verify compatibility: Major version update for @chromatic-com/storybook

The update from ^1.6.1 to ^2.0.2 for @chromatic-com/storybook is a major version bump. This may include breaking changes. Please review the changelog and ensure compatibility with your current setup.

To check for potential breaking changes, you can run:

apps/web/package.json (6)

70-70: DevDependency updates are beneficial.

The updates to development dependencies (@neshca/cache-handler and @types/lodash) are approved. These updates should improve the development experience and provide more accurate type definitions.

Also applies to: 72-72


34-34: Monitoring and analytics dependency updates are valuable.

The updates to monitoring and analytics dependencies (@sentry/nextjs and posthog-js) are approved. These updates should enhance error tracking and analytics capabilities.

Please review the changelogs for any new features or configuration changes that could benefit your application. Run the following commands:

npm view @sentry/[email protected] changelog
npm view [email protected] changelog

Also applies to: 55-55


43-44: Utility and tooling dependency updates are generally good, but require attention.

The updates to utility and tooling dependencies are approved. Most updates are minor and should bring performance improvements and bug fixes.

Special attention is needed for the jiti update (1.21.6 to 2.3.3), as it's a major version change. Please review the changelog for any breaking changes:

npm view [email protected] changelog

Also, ensure thorough testing of features that rely on these updated packages, especially those using googleapis, lru-cache, sharp, and webpack.

Also applies to: 47-47, 62-64


Line range hint 1-77: Overall, the dependency updates are beneficial and approved.

The package.json updates primarily consist of version bumps for various dependencies, which should bring bug fixes, performance improvements, and new features to the project.

Key points:

  1. UI and React-related dependencies have been updated, with a significant update to framer-motion.
  2. Next.js and related packages have been updated, which is crucial for security and performance.
  3. Monitoring and analytics tools (@sentry/nextjs and posthog-js) have been upgraded.
  4. Various utility and tooling dependencies have been updated, with a major version change for jiti.
  5. Some development dependencies have been updated to improve the development experience.

To ensure a smooth transition with these updates:

  1. Review changelogs of major updates, especially for framer-motion, next, and jiti.
  2. Conduct thorough testing of UI components, animations, and core functionality.
  3. Check for any new features or configuration options in updated packages that could benefit the project.
  4. Run the application in a staging environment to catch any potential issues before deploying to production.

Run the following command to update all dependencies and then test the application:

npm update && npm run build && npm test

32-32: UI and React-related dependency updates look good.

The updates to UI and React-related dependencies (@radix-ui/react-collapsible, @react-email/components, @tanstack/react-table, framer-motion, lucide-react, and react-hook-form) are approved. These updates should bring bug fixes and potential performance improvements.

Please ensure thorough testing of UI components and animations, especially those using framer-motion, as it has a more significant version jump (11.3.28 to 11.11.4). Run the following command to check for any breaking changes or new features in the framer-motion changelog:

Also applies to: 33-33, 35-35, 42-42, 48-48, 59-59


36-36: Next.js and related dependency updates are beneficial.

The updates to Next.js and related dependencies (next, @vercel/og, and next-safe-action) are approved. These updates likely include important bug fixes and performance improvements.

Please review the Next.js changelog for any breaking changes or new features that might affect your application. Run the following command to check the changelog:

Also applies to: 50-50, 51-51

apps/docs/components/Header.tsx (3)

6-6: LGTM: Improved type safety with MotionStyle import

The addition of the MotionStyle type import from 'framer-motion' enhances type safety for the component. This change is consistent with the existing imports and follows best practices for using typed properties with framer-motion.


49-49: LGTM: Improved type safety for motion styles

The change from React.CSSProperties to MotionStyle for the style prop is a good improvement. This provides better type checking for motion-specific style properties, which can help catch potential errors earlier in the development process. The change enhances type safety without altering the runtime behavior of the component.


Line range hint 1-93: Overall assessment: Positive improvements to type safety

The changes made to this file are small but meaningful improvements to the codebase. They enhance type safety for the Header component, particularly in its use of framer-motion styles. These changes align well with the PR objectives of updating dependencies and making minor code adjustments. The implementation is clean and consistent with the existing code structure.

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.

1 participant