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

Chore: monorepo setup #4690

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Chore: monorepo setup #4690

merged 3 commits into from
Dec 20, 2024

Conversation

compojoom
Copy link
Contributor

@compojoom compojoom commented Dec 18, 2024

What it solves

This PR restructures the repository into a monorepo format to facilitate code sharing between the mobile app and web app. The mobile app code will be added in a subsequent update.

While this PR touches many files, the changes are straightforward and easy to review commit by commit:

  • First Commit: Moves existing files into the monorepo structure (apps/web).
  • Second Commit: Sets up the monorepo configuration.
  • Third Commit: Updates and fixes GitHub Actions to align with the new structure.

How to test it

  1. Clone the repository.
  2. Run yarn from the root directory to install dependencies and set up the monorepo.
  3. Start the web app using one of the following options
  • From the root directory:
    yarn workspace @safe-global/web start

  • From the apps/web directory:
    yarn start

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Dec 18, 2024

Copy link

github-actions bot commented Dec 18, 2024

Coverage report for apps/web

St.
Category Percentage Covered / Total
🟡 Statements 74.09% 14565/19659
🔴 Branches 51.63% 3468/6717
🔴 Functions 57.07% 2062/3613
🟡 Lines 75.63% 13211/17468

Test suite run success

1752 tests passing in 237 suites.

Report generated by 🧪jest coverage report action from 7825b1c

Copy link

github-actions bot commented Dec 19, 2024

📦 Next.js Bundle Analysis for @safe-global/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1 MB (🟡 +12.25 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Thirty-eight Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/ 509 B (🟢 -1 B) 1 MB
/404 704 B (🟡 +1 B) 1 MB
/_offline 1.1 KB (🟡 +3 B) 1 MB
/addOwner 560 B (🟢 -4 B) 1 MB
/address-book 22.96 KB (🟢 -108 B) 1.02 MB
/apps 35.79 KB (🟡 +2.07 KB) 1.04 MB
/apps/bookmarked 474 B (🟢 -1 B) 1 MB
/apps/custom 33.87 KB (🟡 +2.08 KB) 1.03 MB
/apps/open 55.69 KB (🟡 +2.08 KB) 1.06 MB
/balances 29.61 KB (🟢 -102 B) 1.03 MB
/balances/nfts 9.54 KB (🟢 -3 B) 1.01 MB
/bridge 2.55 KB (🟢 -6 B) 1 MB
/cookie 8.8 KB (🟡 +32 B) 1.01 MB
/home 61.41 KB (🟡 +2.15 KB) 1.06 MB
/imprint 1.41 KB (🟢 -1 B) 1 MB
/licenses 2.46 KB (🟢 -4 B) 1 MB
/new-safe/advanced-create 26.47 KB (🟡 +18 B) 1.03 MB
/new-safe/create 25.61 KB (🟡 +19 B) 1.03 MB
/new-safe/load 6.09 KB (🟡 +1 B) 1.01 MB
/settings/appearance 2.25 KB (🟡 +2 B) 1 MB
/settings/environment-variables 3.27 KB (🟢 -1 B) 1 MB
/settings/modules 4.06 KB (🟡 +3 B) 1 MB
/settings/notifications 21 KB (🟢 -318 B) 1.02 MB
/settings/safe-apps 20.35 KB (🟡 +2.08 KB) 1.02 MB
/settings/security 2.34 KB (🟡 +2 B) 1 MB
/settings/setup 30.63 KB (🟢 -107 B) 1.03 MB
/share/safe-app 7.56 KB (🟢 -4 B) 1.01 MB
/swap 756 B (🟢 -4 B) 1 MB
/terms 12.93 KB (🟡 +1 B) 1.01 MB
/transactions 98.77 KB (🟡 +2.2 KB) 1.1 MB
/transactions/history 98.73 KB (🟡 +2.19 KB) 1.1 MB
/transactions/messages 60.38 KB (🟡 +2.08 KB) 1.06 MB
/transactions/msg 56.63 KB (🟡 +2.08 KB) 1.06 MB
/transactions/queue 49.48 KB (🟡 +2.08 KB) 1.05 MB
/transactions/tx 48.84 KB (🟡 +2.08 KB) 1.05 MB
/wc 701 B (🟢 -6 B) 1 MB
/welcome 6.92 KB (🟢 -6 B) 1.01 MB
/welcome/accounts 408 B (🟡 +1 B) 1 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@compojoom compojoom marked this pull request as ready for review December 19, 2024 11:16
@safe-global safe-global deleted a comment from github-actions bot Dec 19, 2024
@katspaugh katspaugh changed the title Monorepo Chore: monorepo setup Dec 19, 2024
- **Add a dependency to a specific workspace:**

```bash
yarn workspace <workspace-name> add <package-name>
Copy link
Member

@usame-algan usame-algan Dec 20, 2024

Choose a reason for hiding this comment

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

Is there a difference to navigating into an app and running yarn add <package-name> there directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. When you execute the command it would run in the package directory context (meaning root will be the directory). Sometimes the output coloring is a bit off and yarn is adding some prefixes to every line (but I can't tell you when this exactly occurs)

README.md Show resolved Hide resolved
@compojoom compojoom merged commit 7825b1c into dev Dec 20, 2024
11 of 15 checks passed
@compojoom compojoom deleted the monorepo branch December 20, 2024 15:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants