10up / headstartwp

Build a headless website fast with WordPress, the world’s most popular CMS, and Next.js, the most popular React framework. A free and open source solution by the experts at 10up.
https://headstartwp.10up.com
160 stars 16 forks source link

Feature/typescript project #773

Closed nicholasio closed 4 months ago

nicholasio commented 4 months ago

Description of the Change

Removes the old TS projects and makes the default project (wp-nextjs) TypeScript based.

How to test the Change

Simply browse through the vercel preview url and ensure everything still works as expected

Checklist:

vercel[bot] commented 4 months ago

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

Name Status Preview Comments Updated (UTC)
headstarwp ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 5:12pm
changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: b66776fded66ab3aba5b0bf7c9fefa5dec77931d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ----------------- | ----- | | @headstartwp/next | Patch | | @headstartwp/core | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.52 KB (🟢 -38 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!

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 % of Budget (145 KB)
/ 10.14 KB 133.66 KB 92.18% (🟢 -0.03%)
/404 404 B 123.92 KB 85.46% (+/- <0.01%)
/[...path] 7.13 KB 130.65 KB 90.11% (🟢 -0.03%)
/author/[...path] 5.67 KB 129.19 KB 89.10% (🟢 -0.05%)
/blog/[[...path]] 10.49 KB 134.01 KB 92.42% (🟢 -0.03%)
/category/[...path] 5.43 KB 128.96 KB 88.94% (🟢 -0.05%)
/search/[[...path]] 3.54 KB 127.07 KB 87.63% (+/- <0.01%)
/tag/[...path] 5.46 KB 128.99 KB 88.96% (🟢 -0.04%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.52 KB (🟢 -38 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!

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 % of Budget (145 KB)
/ 10.14 KB 133.66 KB 92.18% (🟢 -0.03%)
/404 404 B 123.92 KB 85.46% (+/- <0.01%)
/[...path] 7.13 KB 130.65 KB 90.11% (🟢 -0.03%)
/author/[...path] 5.67 KB 129.19 KB 89.10% (🟢 -0.05%)
/blog/[[...path]] 10.49 KB 134.01 KB 92.42% (🟢 -0.03%)
/category/[...path] 5.43 KB 128.96 KB 88.94% (🟢 -0.05%)
/search/[[...path]] 3.54 KB 127.07 KB 87.63% (+/- <0.01%)
/tag/[...path] 5.46 KB 128.99 KB 88.96% (🟢 -0.04%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.52 KB (🟢 -38 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!

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 % of Budget (145 KB)
/ 10.14 KB 133.66 KB 92.18% (🟢 -0.03%)
/404 404 B 123.92 KB 85.46% (+/- <0.01%)
/[...path] 7.13 KB 130.65 KB 90.11% (🟢 -0.03%)
/author/[...path] 5.67 KB 129.19 KB 89.10% (🟢 -0.05%)
/blog/[[...path]] 10.49 KB 134.01 KB 92.42% (🟢 -0.03%)
/category/[...path] 5.43 KB 128.96 KB 88.94% (🟢 -0.05%)
/search/[[...path]] 3.54 KB 127.07 KB 87.63% (+/- <0.01%)
/tag/[...path] 5.46 KB 128.99 KB 88.96% (🟢 -0.04%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.52 KB (🟢 -38 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!

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 % of Budget (145 KB)
/ 10.14 KB 133.66 KB 92.18% (🟢 -0.03%)
/404 404 B 123.92 KB 85.46% (+/- <0.01%)
/[...path] 7.13 KB 130.65 KB 90.11% (🟢 -0.03%)
/author/[...path] 5.67 KB 129.19 KB 89.10% (🟢 -0.05%)
/blog/[[...path]] 10.49 KB 134.01 KB 92.42% (🟢 -0.03%)
/category/[...path] 5.43 KB 128.96 KB 88.94% (🟢 -0.05%)
/search/[[...path]] 3.54 KB 127.07 KB 87.63% (+/- <0.01%)
/tag/[...path] 5.46 KB 128.99 KB 88.96% (🟢 -0.04%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

nicholasio commented 4 months ago

I've added a few comments throughout code, mostly as questions/clarifications :)

Love the amount of satisfies usage ❤️

A note on usage of interfaces. Is there a particular reason why you opt for using interfaces over types? Although nowadays there's barely any differences between types & interfaces, there's a couple of things worth considering (I'm sure you're aware of these already):

  • Declaration Merging - ensure that this may not produce unwanted side-effects, unless you explicitly do want to use it.
  • Types are generally a bit more flexible, and can provide slightly cleaner syntax when using utility types and typeof for extracting types, using type aliases & unions, etc.

We generally tend to prefer using types, and stick to interfaces in specific situations:

  • when using with a class, for example if we write SOLID compliant code - our classes and sometimes also function parameters will use interfaces over types;
  • in scenarios where we know in advance that there will be a case of extending the base interface with additional properties, especially if it is exposed outside of its own project/library.

All in all, from our experience, types seem to provide slightly nicer DX and cleaner syntax, and interfaces we tend to leave for specific use-cases.

interface has been mostly a personal prefernece. I'll update to use types as we haven't been very consistent with types versus interfaces and I prefer to favor consistency versus personal preferences.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.15 KB (🟢 -418 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!

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 % of Budget (145 KB)
/ 10.12 KB 133.27 KB 91.91% (🟢 -0.04%)
/404 404 B 123.54 KB 85.20% (+/- <0.01%)
/[...path] 7.16 KB 130.31 KB 89.87% (🟢 -0.01%)
/author/[...path] 5.67 KB 128.82 KB 88.84% (🟢 -0.03%)
/blog/[[...path]] 10.52 KB 133.67 KB 92.18% (🟢 -0.01%)
/category/[...path] 5.44 KB 128.59 KB 88.68% (🟢 -0.03%)
/search/[[...path]] 3.54 KB 126.7 KB 87.38% (+/- <0.01%)
/tag/[...path] 5.44 KB 128.59 KB 88.68% (🟢 -0.05%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.15 KB (🟢 -418 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!

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 % of Budget (145 KB)
/ 10.12 KB 133.27 KB 91.91% (🟢 -0.04%)
/404 404 B 123.54 KB 85.20% (+/- <0.01%)
/[...path] 7.16 KB 130.31 KB 89.87% (🟢 -0.01%)
/author/[...path] 5.67 KB 128.82 KB 88.84% (🟢 -0.03%)
/blog/[[...path]] 10.52 KB 133.67 KB 92.18% (🟢 -0.01%)
/category/[...path] 5.44 KB 128.59 KB 88.68% (🟢 -0.03%)
/search/[[...path]] 3.54 KB 126.7 KB 87.38% (+/- <0.01%)
/tag/[...path] 5.44 KB 128.59 KB 88.68% (🟢 -0.05%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.16 KB (🟢 -418 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!

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 % of Budget (145 KB)
/ 10.12 KB 133.29 KB 91.92% (🟢 -0.04%)
/404 404 B 123.56 KB 85.21% (+/- <0.01%)
/[...path] 7.16 KB 130.32 KB 89.88% (🟢 -0.01%)
/author/[...path] 5.67 KB 128.84 KB 88.85% (🟢 -0.03%)
/blog/[[...path]] 10.52 KB 133.68 KB 92.19% (🟢 -0.01%)
/category/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.03%)
/search/[[...path]] 3.54 KB 126.71 KB 87.39% (+/- <0.01%)
/tag/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.05%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.16 KB (🟢 -418 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!

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 % of Budget (145 KB)
/ 10.12 KB 133.29 KB 91.92% (🟢 -0.04%)
/404 404 B 123.56 KB 85.21% (+/- <0.01%)
/[...path] 7.16 KB 130.32 KB 89.88% (🟢 -0.01%)
/author/[...path] 5.67 KB 128.84 KB 88.85% (🟢 -0.03%)
/blog/[[...path]] 10.52 KB 133.68 KB 92.19% (🟢 -0.01%)
/category/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.03%)
/search/[[...path]] 3.54 KB 126.71 KB 87.39% (+/- <0.01%)
/tag/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.05%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

github-actions[bot] commented 4 months ago

📦 Next.js Bundle Analysis for @10up/headless_framework

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 123.16 KB (🟢 -418 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!

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 % of Budget (145 KB)
/ 10.12 KB 133.29 KB 91.92% (🟢 -0.04%)
/404 404 B 123.56 KB 85.21% (+/- <0.01%)
/[...path] 7.16 KB 130.32 KB 89.88% (🟢 -0.01%)
/author/[...path] 5.67 KB 128.84 KB 88.85% (🟢 -0.03%)
/blog/[[...path]] 10.52 KB 133.68 KB 92.19% (🟢 -0.01%)
/category/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.03%)
/search/[[...path]] 3.54 KB 126.71 KB 87.39% (+/- <0.01%)
/tag/[...path] 5.44 KB 128.61 KB 88.69% (🟢 -0.05%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.