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

refactor(workspaces): editor package #3183

Merged
merged 13 commits into from
Dec 15, 2023
Merged

refactor(workspaces): editor package #3183

merged 13 commits into from
Dec 15, 2023

Conversation

elbotho
Copy link
Member

@elbotho elbotho commented Dec 8, 2023

status

  • VSCode works as expected now
  • You can now run yarn lint inside of the editor package as well
  • global prettier and eslint scripts now run in editor and frontend workspace in parallel
  • tsc is only checked for the frontend now, the editor code that is used is checked by the frontend yarn lint:tsc as well

Remining errors inside of editor

  • tsc: some errors because svg import only works with the fileLoader and svgr correctly set up within the webpack config of nextjs. This will have to be solved when we build an editor package.

This is the first step of a cleaner separation between editor and frontend again.

what I did:

  • moved src/serlo-editor to package/editor/src
  • copied and adapted config and package.json in editor package
  • import @serlo/editor in frontend and @serlo/frontend in editor via workspace:*
  • adding path @editor/* that resolves to packages/editor/src/* in both workspaces
  • adapt all imports
  • had to import/fix some types that broke because of codegen (see TODOs)

diff view filtered (no ts*)

follow ups (help welcome):

  • run linter on all workspaces
  • share config files (eslint mandatory, prettier and tailwind optional) instead of separating
  • prepare build for standalone editor build (inspired by tmp: editor package with vite #3136)
  • cleanup types / move graphql stuff in frontend
  • move frontend/serlo specific stuff (especially nextjs) back to the frontend
  • check the > 300 imports from the frontend

Just a note:
I did not use references in the root tsconfig. I'm not sure if that would be the better solution but since it now works like this I'd probably leave it like it is. 🤷
https://www.typescriptlang.org/docs/handbook/project-references.html#what-is-a-project-reference

Copy link

vercel bot commented Dec 8, 2023

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

Name Status Preview Updated (UTC)
frontend ✅ Ready (Inspect) Visit Preview Dec 14, 2023 2:29pm

Copy link
Contributor

github-actions bot commented Dec 8, 2023

📦 Next.js Bundle Analysis for @serlo/frontend

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 103.71 KB (🟢 -11 B)
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!

Forty-one Pages Changed Size

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

Page Size (compressed) First Load
/500 38.24 KB (-1 B) 141.95 KB
/[...slug] 78.17 KB (🟡 +45 B) 181.88 KB
/___bot_or_not 95.39 KB (🟡 +28 B) 199.1 KB
/___editor_preview 477.61 KB (-47 B) 581.32 KB
/___old_comments 101.72 KB (-3 B) 205.43 KB
/auth/login 80.73 KB (🟡 +1 B) 184.45 KB
/auth/oauth/login 80.74 KB (🟡 +1 B) 184.45 KB
/auth/recovery 62.62 KB (🟡 +1 B) 166.33 KB
/auth/registration 63.56 KB (🟡 +1 B) 167.28 KB
/auth/settings 63.68 KB (🟡 +1 B) 167.39 KB
/auth/verification 62.97 KB (🟡 +1 B) 166.69 KB
/biologie 156.57 KB (🟡 +26 B) 260.28 KB
/chemie 156.56 KB (🟡 +26 B) 260.28 KB
/content-only/[...slug] 72.01 KB (🟡 +46 B) 175.72 KB
/discussions 96.41 KB (-2 B) 200.12 KB
/editor 104.41 KB (🟡 +38 B) 208.12 KB
/entity/create/[type]/[taxonomyId] 479.28 KB (-48 B) 583 KB
/entity/link/order/[id]/link 93.18 KB (🟡 +4 B) 196.89 KB
/entity/repository/add-revision/[...id] 478.49 KB (🟢 -50 B) 582.21 KB
/entity/repository/compare/[entity_id]/[revision_id] 105.66 KB (🟡 +27 B) 209.37 KB
/entity/taxonomy/update/[id] 68.88 KB (🟢 -43 B) 172.59 KB
/event/history 129.54 KB (🟢 -42 B) 233.26 KB
/event/history/[...slug] 133.3 KB (🟢 -43 B) 237.01 KB
/informatik 156.57 KB (🟡 +27 B) 260.28 KB
/jobs/[[...jobId]] 51.37 KB (-1 B) 155.08 KB
/lerntipps 156.57 KB (🟡 +27 B) 260.28 KB
/license/detail/[id] 57.95 KB (🟡 +27 B) 161.66 KB
/mathe 156.56 KB (🟡 +28 B) 260.28 KB
/metadata 46.73 KB (🟡 +3 B) 150.45 KB
/nachhaltigkeit 156.57 KB (🟡 +27 B) 260.29 KB
/page/create 478.51 KB (🟢 -52 B) 582.22 KB
/privacy 40.28 KB (🟡 +4 B) 144 KB
/subscriptions/manage 111.38 KB (-1 B) 215.09 KB
/taxonomy/term/[copyOrMove]/batch/[id] 70.7 KB (-3 B) 174.42 KB
/taxonomy/term/create/[parent_id]/[id] 478.2 KB (🟢 -52 B) 581.91 KB
/taxonomy/term/sort/entities/[id] 95.71 KB (🟡 +5 B) 199.42 KB
/taxonomy/term/update/[id] 478.11 KB (🟢 -52 B) 581.83 KB
/user/[...userslug] 176.78 KB (-13 B) 280.5 KB
/user/notifications 132.28 KB (🟢 -42 B) 236 KB
/user/settings 476.85 KB (🟢 -53 B) 580.56 KB
/uuid/recycle-bin 84.36 KB (-2 B) 188.07 KB
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.

@elbotho elbotho marked this pull request as ready for review December 14, 2023 14:24
Copy link
Member

@kulla kulla left a comment

Choose a reason for hiding this comment

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

Thx ❤️

Copy link
Member

@Entkenntnis Entkenntnis left a comment

Choose a reason for hiding this comment

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

looks good so far - hopefully no surprises 🤷‍♀️

@elbotho elbotho merged commit e95d423 into staging Dec 15, 2023
9 checks passed
@elbotho elbotho deleted the editor-package branch December 15, 2023 09:11
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.

4 participants