Skip to content

Commit

Permalink
[DEV-1340] Add homepage to strapi (#592)
Browse files Browse the repository at this point in the history
* update strapi

* Fix error on managing endpoint permission

* add homepage and related link

* Fix linting problems

* add generated to gitignore

* update package-lock

* update gitignore

* add change set

* Revert tsconfig update

* add compile and precompile

* Fix permission error and add comment

* Update apps/strapi-cms/package.json

Co-authored-by: AF <[email protected]>

* Update package-lock after merge with main

* Rename home-page to homepage for consistency reasons

---------

Co-authored-by: marcobottaro <[email protected]>
Co-authored-by: AF <[email protected]>
Co-authored-by: Marco Bottaro <[email protected]>
  • Loading branch information
4 people authored Feb 8, 2024
1 parent 908bcaa commit b0c18a7
Show file tree
Hide file tree
Showing 11 changed files with 3,162 additions and 2,986 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-impalas-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"strapi-cms": minor
---

Add Homepage content to strapi and RelatedLinks and Link components
3 changes: 3 additions & 0 deletions apps/strapi-cms/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ node_modules
coverage

# End of https://www.toptal.com/developers/gitignore/api/strapi

types/generated/*
*.strapi
16 changes: 11 additions & 5 deletions apps/strapi-cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
"version": "0.0.0",
"scripts": {
"clean": "shx rm -rf dist/",
"compile": "npm run clean && tsc --noEmit",
"generate": "strapi ts:generate-types",
"precompile": "npm run clean && npm run generate",
"compile": "tsc --noEmit",
"dev": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"lint": "eslint --ignore-path .gitignore src",
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "4.13.6",
"@strapi/plugin-users-permissions": "4.13.6",
"@strapi/strapi": "4.13.6",
"better-sqlite3": "8.6.0"
"@strapi/plugin-i18n": "4.19.0",
"@strapi/plugin-users-permissions": "4.19.0",
"@strapi/strapi": "4.19.0",
"better-sqlite3": "8.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.3.4",
"styled-components": "^5.3.11"
},
"devDependencies": {
"eslint": "^8.50.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"kind": "singleType",
"collectionName": "homepages",
"info": {
"singularName": "homepage",
"pluralName": "homepages",
"displayName": "Homepage"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"comingsoonDocumentation": {
"type": "component",
"repeatable": false,
"component": "common.related-links"
}
}
}
7 changes: 7 additions & 0 deletions apps/strapi-cms/src/api/homepage/controllers/homepage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* homepage controller
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreController('api::homepage.homepage');
7 changes: 7 additions & 0 deletions apps/strapi-cms/src/api/homepage/routes/homepage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* homepage router
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreRouter('api::homepage.homepage');
7 changes: 7 additions & 0 deletions apps/strapi-cms/src/api/homepage/services/homepage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* homepage service
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreService('api::homepage.homepage');
27 changes: 27 additions & 0 deletions apps/strapi-cms/src/components/common/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"collectionName": "components_common_links",
"info": {
"displayName": "Links",
"icon": "link"
},
"options": {},
"attributes": {
"text": {
"type": "string",
"required": true
},
"href": {
"type": "string",
"required": true
},
"target": {
"type": "enumeration",
"enum": [
"_self",
"_blank",
"_parent",
"_top"
]
}
}
}
19 changes: 19 additions & 0 deletions apps/strapi-cms/src/components/common/related-links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"collectionName": "components_common_related_links",
"info": {
"displayName": "RelatedLinks",
"icon": "bulletList",
"description": ""
},
"options": {},
"attributes": {
"title": {
"type": "string"
},
"links": {
"type": "component",
"repeatable": true,
"component": "common.links"
}
}
}
5 changes: 5 additions & 0 deletions apps/strapi-cms/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"../../tsconfig.json"
],
"compilerOptions": {
// with declaration to true strapi raises a runtime error
// error: Cannot read properties of undefined (reading 'type')
// TypeError: Cannot read properties of undefined (reading 'type')
// at /node_modules/@strapi/plugin-users-permissions/server/services/users-permissions.js:115:39
"declaration": false,
"outDir": "dist",
"rootDir": "."
},
Expand Down
Loading

0 comments on commit b0c18a7

Please sign in to comment.