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

Update setup-care-apps scripts to remove existing apps that are not configured in env if any #9052

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Nov 8, 2024

Proposed Changes

  • Update setup-care-apps scripts to remove (backup to another folder) existing apps that are not configured in env if any
image

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • New Features

    • Enhanced management of applications in the apps directory by automatically removing unused application directories.
    • Improved logging for identified and removed directories.
  • Bug Fixes

    • Retained existing functionality for cloning or updating applications while integrating new cleanup logic.

@rithviknishad rithviknishad requested a review from a team as a code owner November 8, 2024 05:59
@rithviknishad rithviknishad self-assigned this Nov 8, 2024
Copy link
Contributor

coderabbitai bot commented Nov 8, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in the setup-care-apps.js script enhance the management of application directories within the apps directory. A new backup directory, apps_backup, is created if it does not exist. The script now includes a cleanup process that identifies and backs up any application directories not listed in the REACT_ENABLED_APPS environment variable, logging and removing these unused directories. Existing functionalities for cloning or updating applications are retained, with added error handling for the cleanup process.

Changes

File Change Summary
scripts/setup-care-apps.js Enhanced management of application directories by adding cleanup and backup processes. Existing cloning/updating logic retained.
.gitignore Added entry to ignore the /apps_backup/* directory, excluding it from version control tracking.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant AppsDir
    participant BackupDir

    User->>Script: Run setup-care-apps.js
    Script->>AppsDir: Read contents of apps directory
    AppsDir-->>Script: Return list of directories
    Script->>Script: Filter directories based on REACT_ENABLED_APPS
    Script->>BackupDir: Create apps_backup if not exists
    Script->>BackupDir: Log and backup unused directories
    Script->>AppsDir: Remove unused directories
    Script->>AppsDir: Check existing applications
    Script->>AppsDir: Clone or update specified applications
Loading

🐰 "In the apps directory, a cleanup spree,
Unused folders gone, oh what glee!
With each clone and update, we cheer,
A tidy space, the goal is clear!
Hopping along, we manage with care,
A script so bright, beyond compare!" 🐇

Possibly related PRs

Suggested reviewers

  • sainak

Warning

Tool Failures:

Tool Failure Count:


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.

Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit c471b31
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/672e22e35776240008306dbb
😎 Deploy Preview https://deploy-preview-9052--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Nov 8, 2024

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: c471b31
Status:⚡️  Build in progress...

View logs

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: 1

🧹 Outside diff range and nitpick comments (1)
scripts/setup-care-apps.js (1)

Line range hint 1-65: Consider architectural improvements for better reliability.

The script handles critical operations and could benefit from:

  1. Implementing a transaction-like mechanism for atomic operations
  2. Adding progress tracking for long-running operations
  3. Implementing a rollback mechanism for failed operations
  4. Adding telemetry for monitoring script execution

This would make the script more reliable and easier to debug in production environments.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4b8b4a4 and 0bb16a2.

📒 Files selected for processing (1)
  • scripts/setup-care-apps.js (1 hunks)
🔇 Additional comments (1)
scripts/setup-care-apps.js (1)

56-65: Verify dependencies before removing apps.

The cleanup operation might remove apps that are dependencies of enabled apps. Consider:

  1. Checking for dependencies between apps
  2. Optimizing the process to avoid unnecessary removals and re-clones

Let's verify if any removed apps are referenced as dependencies:

scripts/setup-care-apps.js Outdated Show resolved Hide resolved
Copy link

cypress bot commented Nov 8, 2024

rithviknishad and others added 3 commits November 8, 2024 20:07
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@gigincg gigincg merged commit 66ef112 into develop Nov 8, 2024
16 of 18 checks passed
@gigincg gigincg deleted the rithviknishad/fix/cleanup-existing-apps branch November 8, 2024 14:42
Copy link

github-actions bot commented Nov 8, 2024

@rithviknishad @rithviknishad Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants