Skip to content

Commit 4d2cf40

Browse files
authored
Merge pull request #3 from strapi/chore/upgrade
Update: migrate to Strapi 5 + clean files
2 parents dcfe22d + 341eb7d commit 4d2cf40

File tree

16 files changed

+534
-282
lines changed

16 files changed

+534
-282
lines changed

.github/ISSUE_TEMPLATE/content.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: 🌎 Content to manage
3+
about: Create a request about creating/updating/deleting content
4+
labels: content
5+
---
6+
7+
## Content management
8+
9+
### Describe your request
10+
11+
A clear and concise description of your request. Please include text, components, style, everything.
12+
13+
### Expected behavior
14+
15+
A clear and concise description of what you expected to have.
16+
17+
### Screenshots
18+
19+
If applicable, add screenshots to help explain your request.
20+
21+
### Additional context
22+
23+
Add any other context about the request here.

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: 🤩 New feature
3+
about: Create a request about a new feature
4+
labels: enhancement
5+
assignees: mcastres
6+
---
7+
8+
## New feature
9+
10+
### Describe your request
11+
12+
A clear and concise description of your the feature you want to see on LaunchPad.
13+
14+
### Expected behavior
15+
16+
A clear and concise description of what you expected to have.
17+
18+
### Screenshots
19+
20+
If applicable, add screenshots to help explain your request.
21+
22+
### Additional context
23+
24+
Add any other context about the request here.

.github/ISSUE_TEMPLATE/fix.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: 👩‍🔧 Something to fix
3+
about: Create a request about fixing a bug on LaunchPad
4+
labels: bug
5+
assignees: mcastres
6+
---
7+
8+
## Fix
9+
10+
### Describe your request
11+
12+
A clear and concise description of what needs to be fixed.
13+
14+
### Steps to reproduce the behavior
15+
16+
1. Go to '...'
17+
2. Click on '....'
18+
3. Scroll down to '....'
19+
4. See error
20+
21+
### Expected behavior
22+
23+
A clear and concise description of what you expected to happen.
24+
25+
### Screenshots
26+
27+
If applicable, add screenshots to help explain your request.
28+
29+
### Additional context
30+
31+
Add any other context about the request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### What does it do?
2+
3+
Describe the technical changes you did.
4+
5+
### Why is it needed?
6+
7+
Describe the issue you are solving.
8+
9+
### How to test it?
10+
11+
Simply make sure the whole Strapi application doesn't crash and the connected Next.js application is fully working.
12+
13+
Some additional things to check:
14+
15+
- [ ] Strapi project uuid is "LAUNCHPAD". `strapi/packages.json`.
16+
- [ ] If you updated content, make sure to create a new export in the `strapi/data` folder and update the `strapi/packages.json` seed command if necessary.
17+
- [ ] Strapi version is the latest possible.
18+
19+
### Related issue(s)/PR(s)
20+
21+
Let us know if this is related to any issue/pull request.

README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ yarn && yarn seed && yarn develop
4848

4949
This will install dependencies, sprinkle in some data magic, and run the server. (You can run these commands separately, but why not be efficient?)
5050

51-
#### 🧑‍🚀 Credentials for your Crew:
52-
53-
- Super Admin:
54-
55-
- password: welcomeToStrapi123
56-
57-
- Editor
58-
59-
- password: welcomeToStrapi123
60-
61-
- Author
62-
63-
- password: welcomeToStrapi123
64-
65-
Feel free to change these credentials if you’re worried aliens might hack your content! (jk)
66-
6751
## 3. Start Next.js
6852

6953
We're almost ready for lift-off! Next.js is your sleek, futuristic interface for getting all that glorious content out into the world. 🚀
@@ -111,12 +95,14 @@ This installs dependencies, builds your project, and starts your server. You’r
11195
## Todo
11296

11397
- [ ] Implement the official Strapi SEO plugin
114-
- [ ] Implement the official Strapi preview plugin
98+
- [ ] Implement the community Strapi preview plugin
11599
- [ ] Create localized content for the pricing plans and products
116100
- [ ] Populate creator fields when it'll work on Strapi 5 (article authors information are missing)
117101

118102
## Customization
119103

120104
- The Strapi application contains a custom population middleware in order to populate more data than what it is set by default. You can find it in the `./strapi/src/middlewares/deepPopulate.ts` file.
121105

122-
- The Strapi application contains a postinstall script that will regenerate an uuid for the project in order to get some anonuymous usage information concerning this demo. You can disable it by removing the uuid inside the `./strapi/packages.json` file.
106+
- The Strapi application contains a postinstall script that will regenerate an uuid for the project in order to get some anonymous usage information concerning this demo. You can disable it by removing the uuid inside the `./strapi/packages.json` file.
107+
108+
- The Strapi application contains a patch for the @strapi/admin package. It is only necessary for the hosted demos since we automatically create the Super Admin users for them when they request this demo on our website.

next/components/dynamic-zone/features/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Features = ({ heading, sub_heading, globe_card, ray_card, graph_car
5252
)}
5353

5454
{ray_card && (
55-
<Card className={`lg:col-span-${convertWordToNumber(ray_card.span) || '1'}`} >
55+
<Card className={`lg:col-span-${convertWordToNumber(ray_card?.span) || '1'}`} >
5656
<CardSkeletonContainer className="max-w-[16rem] mx-auto">
5757
<SkeletonTwo />
5858
</CardSkeletonContainer>
@@ -64,7 +64,7 @@ export const Features = ({ heading, sub_heading, globe_card, ray_card, graph_car
6464
)}
6565

6666
{graph_card && (
67-
<Card className={`lg:col-span-${convertWordToNumber(graph_card.span) || '2'}`} >
67+
<Card className={`lg:col-span-${convertWordToNumber(graph_card?.span) || '2'}`} >
6868
<CardSkeletonContainer
6969
showGradient={false}
7070
className="max-w-[16rem] mx-auto"
@@ -79,7 +79,7 @@ export const Features = ({ heading, sub_heading, globe_card, ray_card, graph_car
7979
)}
8080

8181
{social_media_card && (
82-
<Card className={`lg:col-span-${convertWordToNumber(social_media_card.span) || '1'}`} >
82+
<Card className={`lg:col-span-${convertWordToNumber(social_media_card?.span) || '1'}`} >
8383
<CardSkeletonContainer showGradient={false}>
8484
<SkeletonFour />
8585
</CardSkeletonContainer>

next/components/footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const Footer = async ({ data, locale }: { data: any, locale: string }) =>
4646
className="text-white underline"
4747
href="https://framer.com/motion"
4848
>
49-
Framer Motion
49+
Motion Animation Lib
5050
</a>
5151
, and{" "}
5252
<a

next/lib/strapi/fetchContentType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface StrapiResponse {
1515
data: StrapiData | StrapiData[];
1616
}
1717

18-
function spreadStrapiData(data: StrapiResponse): StrapiData | null {
18+
export function spreadStrapiData(data: StrapiResponse): StrapiData | null {
1919
if (Array.isArray(data.data) && data.data.length > 0) {
2020
return data.data[0];
2121
}

strapi/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ $RECYCLE.BIN/
4040
*.csv
4141
*.dat
4242
*.dmg
43-
*.gz
4443
*.iso
4544
*.jar
4645
*.rar

strapi/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "strapi build",
1010
"strapi": "strapi",
1111
"deploy": "strapi deploy",
12-
"seed": "strapi import -f ./data/export_20240916150535.tar.gz",
12+
"seed": "strapi import -f ./data/export_20240925113338.tar.gz",
1313
"postinstall": "node ./scripts/updateUuid.ts"
1414
},
1515
"devDependencies": {
@@ -19,10 +19,11 @@
1919
"typescript": "^5"
2020
},
2121
"dependencies": {
22-
"@strapi/plugin-cloud": "5.0.0-rc.28",
23-
"@strapi/plugin-users-permissions": "5.0.0-rc.28",
24-
"@strapi/strapi": "5.0.0-rc.28",
22+
"@strapi/plugin-cloud": "5.0.0",
23+
"@strapi/plugin-users-permissions": "5.0.0",
24+
"@strapi/strapi": "5.0.0",
2525
"better-sqlite3": "9.4.3",
26+
"patch-package": "^8.0.0",
2627
"pluralize": "^8.0.0",
2728
"react": "^18.0.0",
2829
"react-dom": "^18.0.0",
@@ -34,11 +35,11 @@
3435
"name": "A Strapi developer"
3536
},
3637
"strapi": {
37-
"uuid": "LAUNCHPAD-LOCAL-b38c4028-6edf-45c1-9f09-7e8467af4066"
38+
"uuid": "LAUNCHPAD"
3839
},
3940
"engines": {
4041
"node": ">=18.0.0 <=20.x.x",
4142
"npm": ">=6.0.0"
4243
},
4344
"license": "MIT"
44-
}
45+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs b/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
2+
index 75eb9cc..cb58cb4 100644
3+
--- a/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
4+
+++ b/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
5+
@@ -1966,8 +1966,8 @@ const Login = ({ children }) => {
6+
{
7+
method: "PUT",
8+
initialValues: {
9+
- email: "",
10+
- password: "",
11+
+ email: "[email protected]",
12+
+ password: "welcomeToStrapi123",
13+
rememberMe: false
14+
},
15+
onSubmit: (values) => {

strapi/src/admin/app.example.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { StrapiApp } from '@strapi/strapi/admin';
22

3+
// import PreviewButton from "./extensions/components/PreviewButton";
4+
35
export default {
46
config: {
57
locales: [
@@ -32,5 +34,6 @@ export default {
3234
],
3335
},
3436
bootstrap(app: StrapiApp) {
37+
3538
},
3639
};
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import { Button } from '@strapi/design-system/Button';
3+
import Eye from '@strapi/icons/Eye';
4+
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
5+
import { useIntl } from 'react-intl';
6+
7+
const PreviewButton = () => {
8+
const { formatMessage } = useIntl();
9+
const { modifiedData, layout } = useCMEditViewDataManager();
10+
11+
const bannedApiID = ['category'];
12+
13+
if (bannedApiID.includes(layout.apiID)) {
14+
return null;
15+
}
16+
17+
if (
18+
!process.env.STRAPI_ADMIN_CLIENT_URL ||
19+
!process.env.STRAPI_ADMIN_CLIENT_PREVIEW_SECRET
20+
) {
21+
return null;
22+
}
23+
24+
const handlePreview = () => {
25+
const previewUrl = `${process.env.STRAPI_ADMIN_CLIENT_URL}/api/preview?secret=${process.env.STRAPI_ADMIN_CLIENT_PREVIEW_SECRET}&slug=${modifiedData.slug}&locale=${modifiedData.locale}&apiID=${layout.apiID}&kind=${layout.kind}`;
26+
27+
window.open(previewUrl, '_blank').focus();
28+
};
29+
30+
const content = {
31+
id: 'components.PreviewButton.button',
32+
defaultMessage: 'Preview',
33+
};
34+
35+
return (
36+
<>
37+
<Button variant="secondary" startIcon={<Eye />} onClick={handlePreview}>
38+
{formatMessage(content)}
39+
</Button>
40+
</>
41+
);
42+
};
43+
44+
export default PreviewButton;

0 commit comments

Comments
 (0)