Skip to content

Commit

Permalink
Merge pull request #3 from strapi/chore/upgrade
Browse files Browse the repository at this point in the history
Update: migrate to Strapi 5 + clean files
  • Loading branch information
Mcastres authored Sep 26, 2024
2 parents dcfe22d + 341eb7d commit 4d2cf40
Show file tree
Hide file tree
Showing 16 changed files with 534 additions and 282 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 🌎 Content to manage
about: Create a request about creating/updating/deleting content
labels: content
---

## Content management

### Describe your request

A clear and concise description of your request. Please include text, components, style, everything.

### Expected behavior

A clear and concise description of what you expected to have.

### Screenshots

If applicable, add screenshots to help explain your request.

### Additional context

Add any other context about the request here.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 🤩 New feature
about: Create a request about a new feature
labels: enhancement
assignees: mcastres
---

## New feature

### Describe your request

A clear and concise description of your the feature you want to see on LaunchPad.

### Expected behavior

A clear and concise description of what you expected to have.

### Screenshots

If applicable, add screenshots to help explain your request.

### Additional context

Add any other context about the request here.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: 👩‍🔧 Something to fix
about: Create a request about fixing a bug on LaunchPad
labels: bug
assignees: mcastres
---

## Fix

### Describe your request

A clear and concise description of what needs to be fixed.

### Steps to reproduce the behavior

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

### Expected behavior

A clear and concise description of what you expected to happen.

### Screenshots

If applicable, add screenshots to help explain your request.

### Additional context

Add any other context about the request here.
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### What does it do?

Describe the technical changes you did.

### Why is it needed?

Describe the issue you are solving.

### How to test it?

Simply make sure the whole Strapi application doesn't crash and the connected Next.js application is fully working.

Some additional things to check:

- [ ] Strapi project uuid is "LAUNCHPAD". `strapi/packages.json`.
- [ ] 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.
- [ ] Strapi version is the latest possible.

### Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request.
22 changes: 4 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,6 @@ yarn && yarn seed && yarn develop

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

#### 🧑‍🚀 Credentials for your Crew:

- Super Admin:
- email: [email protected]
- password: welcomeToStrapi123

- Editor
- email: [email protected]
- password: welcomeToStrapi123

- Author
- email: [email protected]
- password: welcomeToStrapi123

Feel free to change these credentials if you’re worried aliens might hack your content! (jk)

## 3. Start Next.js

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

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

## Customization

- 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.

- 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.
- 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.

- 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.
6 changes: 3 additions & 3 deletions next/components/dynamic-zone/features/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const Features = ({ heading, sub_heading, globe_card, ray_card, graph_car
)}

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

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

{social_media_card && (
<Card className={`lg:col-span-${convertWordToNumber(social_media_card.span) || '1'}`} >
<Card className={`lg:col-span-${convertWordToNumber(social_media_card?.span) || '1'}`} >
<CardSkeletonContainer showGradient={false}>
<SkeletonFour />
</CardSkeletonContainer>
Expand Down
2 changes: 1 addition & 1 deletion next/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Footer = async ({ data, locale }: { data: any, locale: string }) =>
className="text-white underline"
href="https://framer.com/motion"
>
Framer Motion
Motion Animation Lib
</a>
, and{" "}
<a
Expand Down
2 changes: 1 addition & 1 deletion next/lib/strapi/fetchContentType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface StrapiResponse {
data: StrapiData | StrapiData[];
}

function spreadStrapiData(data: StrapiResponse): StrapiData | null {
export function spreadStrapiData(data: StrapiResponse): StrapiData | null {
if (Array.isArray(data.data) && data.data.length > 0) {
return data.data[0];
}
Expand Down
1 change: 0 additions & 1 deletion strapi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ $RECYCLE.BIN/
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
Expand Down
Binary file not shown.
13 changes: 7 additions & 6 deletions strapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "strapi build",
"strapi": "strapi",
"deploy": "strapi deploy",
"seed": "strapi import -f ./data/export_20240916150535.tar.gz",
"seed": "strapi import -f ./data/export_20240925113338.tar.gz",
"postinstall": "node ./scripts/updateUuid.ts"
},
"devDependencies": {
Expand All @@ -19,10 +19,11 @@
"typescript": "^5"
},
"dependencies": {
"@strapi/plugin-cloud": "5.0.0-rc.28",
"@strapi/plugin-users-permissions": "5.0.0-rc.28",
"@strapi/strapi": "5.0.0-rc.28",
"@strapi/plugin-cloud": "5.0.0",
"@strapi/plugin-users-permissions": "5.0.0",
"@strapi/strapi": "5.0.0",
"better-sqlite3": "9.4.3",
"patch-package": "^8.0.0",
"pluralize": "^8.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand All @@ -34,11 +35,11 @@
"name": "A Strapi developer"
},
"strapi": {
"uuid": "LAUNCHPAD-LOCAL-b38c4028-6edf-45c1-9f09-7e8467af4066"
"uuid": "LAUNCHPAD"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}
}
15 changes: 15 additions & 0 deletions strapi/patches/@strapi+admin+5.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs b/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
index 75eb9cc..cb58cb4 100644
--- a/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
+++ b/node_modules/@strapi/admin/dist/admin/index-hoTsgrwy.mjs
@@ -1966,8 +1966,8 @@ const Login = ({ children }) => {
{
method: "PUT",
initialValues: {
- email: "",
- password: "",
+ email: "[email protected]",
+ password: "welcomeToStrapi123",
rememberMe: false
},
onSubmit: (values) => {
3 changes: 3 additions & 0 deletions strapi/src/admin/app.example.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { StrapiApp } from '@strapi/strapi/admin';

// import PreviewButton from "./extensions/components/PreviewButton";

export default {
config: {
locales: [
Expand Down Expand Up @@ -32,5 +34,6 @@ export default {
],
},
bootstrap(app: StrapiApp) {

},
};
44 changes: 44 additions & 0 deletions strapi/src/admin/extensions/components/PreviewButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { Button } from '@strapi/design-system/Button';
import Eye from '@strapi/icons/Eye';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { useIntl } from 'react-intl';

const PreviewButton = () => {
const { formatMessage } = useIntl();
const { modifiedData, layout } = useCMEditViewDataManager();

const bannedApiID = ['category'];

if (bannedApiID.includes(layout.apiID)) {
return null;
}

if (
!process.env.STRAPI_ADMIN_CLIENT_URL ||
!process.env.STRAPI_ADMIN_CLIENT_PREVIEW_SECRET
) {
return null;
}

const handlePreview = () => {
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}`;

window.open(previewUrl, '_blank').focus();
};

const content = {
id: 'components.PreviewButton.button',
defaultMessage: 'Preview',
};

return (
<>
<Button variant="secondary" startIcon={<Eye />} onClick={handlePreview}>
{formatMessage(content)}
</Button>
</>
);
};

export default PreviewButton;
Loading

0 comments on commit 4d2cf40

Please sign in to comment.