Skip to content

Shorten script logic for better maintainability #3077

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

Merged
merged 8 commits into from
Jun 11, 2025
Merged

Shorten script logic for better maintainability #3077

merged 8 commits into from
Jun 11, 2025

Conversation

khangronky
Copy link
Collaborator

@khangronky khangronky commented Jun 11, 2025

Summary by CodeRabbit

  • Chores
    • Standardized and simplified development and database management scripts across all apps, replacing long commands and directory changes with concise aliases.
    • Added and unified utility scripts for formatting, linting, and UI component management.
    • Improved script consistency for Supabase operations, making workflows easier and reducing repetition.
    • Removed redundant configuration and streamlined preview and development commands.

Copy link
Contributor

coderabbitai bot commented Jun 11, 2025

Walkthrough

The changes refactor and standardize npm scripts across multiple package.json files in the project. Supabase-related commands are now consistently invoked using custom bun sb:<command> aliases, replacing explicit directory navigation and direct CLI invocations. Additional scripts for development, UI utilities, and formatting are added or reorganized. The root package.json also switches script runners from node to bun and removes a pnpm configuration section.

Changes

File(s) Change Summary
apps/db/package.json Simplified sb:reset script to delegate type generation and formatting to sb:typegen.
apps/external/package.json Expanded scripts: added composite dev scripts, preview, formatting, Supabase (sb:*), and UI utils.
apps/famigo/package.json
apps/nova/package.json
apps/rewise/package.json
apps/upskii/package.json
apps/web/package.json
Refactored scripts: replaced explicit Supabase commands and directory changes with bun sb:<command> aliases; unified dev/preview scripts; added UI utility scripts in some cases.
apps/playground/package.json Expanded scripts: added dev, preview, build, lint, format, Supabase (sb:*), and UI utility scripts.
package.json Replaced node with bun in scripts; refactored dev scripts to use bun sb:<command>; removed pnpm.onlyBuiltDependencies.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant App as App Package.json
    participant Bun as Bun Runtime
    participant DB as Supabase DB Scripts

    Dev->>App: Run "devx" or "devrs" script
    App->>Bun: Invoke bun sb:stop/start/reset/typegen
    Bun->>DB: Execute Supabase operation (stop/start/reset/typegen)
    Bun->>App: Return to run "bun dev"
    App->>Bun: Start development server
Loading

Poem

A hop, a skip, a script anew,
With bun sb: the chores are few!
No more wandering through each path,
Supabase dances at our command—
UI and linting join the band.
Rabbits rejoice, the scripts are neat,
Our project’s workflow is a treat! 🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch refactor/scripts
  • Post Copyable Unit Tests in 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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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

graphite-app bot commented Jun 11, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.84%. Comparing base (3bdfb4e) to head (e313c34).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3077   +/-   ##
=======================================
  Coverage    0.84%    0.84%           
=======================================
  Files        2488     2488           
  Lines      306692   306692           
  Branches     2990     2990           
=======================================
  Hits         2577     2577           
  Misses     301987   301987           
  Partials     2128     2128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khangronky khangronky marked this pull request as ready for review June 11, 2025 08:46
@khangronky khangronky requested a review from vhpx June 11, 2025 08:47
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: 4

🧹 Nitpick comments (1)
apps/playground/package.json (1)

12-13: Extend format scope

Consider including .js or .json in the format and lint globs if Playground contains such files.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 648ef06 and f3429c0.

📒 Files selected for processing (9)
  • apps/db/package.json (1 hunks)
  • apps/external/package.json (1 hunks)
  • apps/famigo/package.json (1 hunks)
  • apps/nova/package.json (1 hunks)
  • apps/playground/package.json (1 hunks)
  • apps/rewise/package.json (1 hunks)
  • apps/upskii/package.json (1 hunks)
  • apps/web/package.json (1 hunks)
  • package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Verify generated types
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Prettier Check (23)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
🔇 Additional comments (27)
apps/upskii/package.json (3)

7-8: Consolidate Supabase setup in devx/devrs using aliases
The devx and devrs scripts now leverage bun sb: aliases to streamline supabase stop/start/reset operations before launching development. This simplifies maintenance and removes redundant directory changes.


11-11: Remove unnecessary cd in preview script
Dropping the cd ../upskii command ensures preview runs directly and avoids redundant navigation.


14-23: Unify Supabase commands under sb: namespace
The addition of sb:* scripts centralizes all Supabase operations behind bun sb: aliases, improving discoverability and consistency across the monorepo.

package.json (4)

7-7: Switch dev runner from Node to Bun
Moving dev to use bun scripts/dev-selector.js dev aligns with the monorepo's adoption of Bun and ensures consistency with other scripts.


15-23: Standardize devx:* workflows across all services
The devx:* scripts now uniformly stop the database, install dependencies, start Supabase, and delegate to the corresponding dev targets. This DRY refactor enhances maintainability.


24-30: Streamline devrs:* scripts for full resets
By chaining bun sb:stop, bun i, bun sb:start, bun sb:reset, bun sb:typegen, and the dev command, the devrs:* set provides a single command for a full environment reset.


47-47: Update sb:diff to include migration up
Adding bun sb:up before bun sb:diff ensures migrations are applied before generating diffs, preventing stale diff outputs.

apps/db/package.json (1)

14-14: Modularize sb:reset to use sb:typegen alias
Replacing the inline typegen command with a call to bun sb:typegen improves reuse and clarity.

apps/web/package.json (3)

7-8: Leverage bun sb: aliases in devx/devrs
Consistent with other apps, the devx and devrs scripts now chain Supabase operations before launching the Next.js server.


11-11: Cleanup preview script by removing cd
Direct execution of next build && next start on port 7803 simplifies the preview flow.


16-25: Standardize Supabase commands in sb:* scripts
Centralizing the DB commands under bun sb: without directory changes aligns with the monorepo pattern and makes scripts more discoverable.

apps/external/package.json (3)

6-8: Align dev, devx, and devrs for Supabase integration
Updating dev to explicitly set port 3000, and refactoring devx/devrs to use the sb: aliases ensures a consistent developer experience across services.


11-13: Add formatting and preview scripts for consistent workflows
Introducing preview, reorganizing lint, and adding format align with patterns in other apps, promoting uniformity.


14-23: Centralize Supabase operations under sb: namespace
The addition of stop, sb:status, sb:start, etc., removes dependency on manual directory navigation and direct CLI calls, streamlining DB control.

apps/rewise/package.json (3)

7-8: Consolidated Supabase commands look good

The devx and devrs scripts correctly chain the new bun sb:* aliases before bun dev, improving readability and maintainability.


11-11: Verify if preview should manage the Supabase service

The preview script now omits any sb:start invocation; confirm whether a running Supabase instance is required in preview mode or if this is intentional.


24-25: UI scaffolding scripts are well scoped

The new ui:add and ui:diff scripts provide clear helpers for Shadcn-UI operations without overloading existing scripts.

apps/nova/package.json (3)

7-8: Supabase command chaining is consistent

Using bun sb:stop && bun sb:start in devx and adding sb:reset in devrs aligns Nova with other apps. This streamlines the dev setup flow.


11-11: Confirm preview DB requirements

The preview script drops any sb:start step. Ensure Nova’s preview environment doesn’t need a Supabase instance, or add the necessary alias.


26-27: Approve new UI helper scripts

Adding ui:add and ui:diff for Shadcn-UI operations is a helpful addition and follows the pattern in other apps.

apps/playground/package.json (4)

6-6: Enable Turbopack in dev

Switching dev to use --turbopack on port 3002 aligns Playground with performance optimizations adopted elsewhere.


7-8: Dev orchestration matches monorepo pattern

devx and devrs now chain sb:* scripts before bun dev, mirroring other apps for a unified workflow.


11-11: Review preview database dependency

preview no longer starts Supabase; verify whether Playground preview should auto-start the service or if manual start is acceptable.


24-25: UI scaffolding helpers are on point

The ui:add and ui:diff commands are consistent with other apps and add value.

apps/famigo/package.json (3)

7-8: Unified dev scripts improve consistency

The devx and devrs definitions now follow the monorepo convention of orchestrating sb:* before starting the app.


11-11: Double-check preview Supabase handling

Confirm whether the preview script should include a Supabase start step or if it's purposely omitted.


26-27: Approve UI command additions

The new ui:add and ui:diff scripts for Shadcn-UI are concise and follow the established pattern.

Copy link
Member

@vhpx vhpx left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @khangronky.

@vhpx vhpx enabled auto-merge June 11, 2025 08:57
@vhpx vhpx merged commit da848b7 into main Jun 11, 2025
19 checks passed
@vhpx vhpx deleted the refactor/scripts branch June 11, 2025 09:01
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.

2 participants