From 0ea1a87def5a8a00ac72ad311088392791ae7f4b Mon Sep 17 00:00:00 2001 From: David Ng Date: Wed, 4 Dec 2024 16:42:01 +0000 Subject: [PATCH] GH-5: Add settings.json and expand CMS backend ADR this part of #5 Introduce a new settings.json file for .fleet with properties to enhance backend performance and format code on save. Update the CMS backend ADR document with context about content management needs for a portfolio site and include implementation details for WordPress with pros and cons for using it in the project. --- .fleet/settings.json | 4 ++++ docs/adr/20241203-cms-backend.md | 26 +++++++++++++++++++++----- eslint.config.js | 22 +++++++++++++++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .fleet/settings.json diff --git a/.fleet/settings.json b/.fleet/settings.json new file mode 100644 index 0000000..be71c9f --- /dev/null +++ b/.fleet/settings.json @@ -0,0 +1,4 @@ +{ + "backend.maxHeapSizeMb": 2048, + "editor.formatOnSave": true +} diff --git a/docs/adr/20241203-cms-backend.md b/docs/adr/20241203-cms-backend.md index bf3dba8..fd94401 100644 --- a/docs/adr/20241203-cms-backend.md +++ b/docs/adr/20241203-cms-backend.md @@ -2,6 +2,14 @@ ## Context and Problem Statement +When building my portfolio site, I want the content to be managed by a block-based CMS instead of being hardcoded into +the site so I can change the content easily. + +Because the portfolio sites would contain a lot of content, using local JSON to manage content would be difficult. + +Ideally, it would have a system that supports persistence over JSON files, and I can just commit the JSON file into +GitHub. + ## Decision Drivers - Ability to run locally @@ -40,12 +48,19 @@ ### WordPress -[example | description | pointer to more information | …] +[Example implementation of custom content type on WP](https://github.com/neviaumi/portfolio/blob/556a7aabbb1e978cab26c6767dee30d3b34528ad/systems/cms/wordpress/wp-content/plugins/portfolio/portfolio.php#L1) -- Good, because [argument a] -- Good, because [argument b] -- Bad, because [argument c] -- … +That implementation includes setting up a custom content type and incorporating the custom fields within the content +type. It also exposes the custom content type content on the REST API. + +That experimental implementation is nearly all I want for this portfolio project. + +- Good, because it is a popular CMS (62.2% as written) +- Good, because there are millions of results on the Internet for troubleshooting. +- Bad, because the implementation is complicated, as it requires a lot of custom code to implement just a custom content + type. +- Bad, because it is not a headless CMS natively. That means I have to write a lot of custom code in plugins to expose + the custom content type, including the form on the admin and public-facing API. ### PayloadCMS @@ -59,6 +74,7 @@ ## Links - [Contentful](https://www.contentful.com/) +- [WordPress market share](https://w3techs.com/technologies/overview/content_management) diff --git a/eslint.config.js b/eslint.config.js index fe2cad9..ec21e7d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -10,6 +10,22 @@ import globals from 'globals'; import pkgjson from './package.json' with { type: 'json' }; +function withOverride(overrideConfig) { + return function createEslintConfigHOC(originalConfigFunc) { + return function (...args) { + const originalConfig = originalConfigFunc(...args); + return { + ...originalConfig, + ...overrideConfig, + rules: { + ...originalConfig.rules, + ...overrideConfig.rules, + }, + }; + }; + }; +} + export default [ { ignores: ['package-lock.json'], @@ -26,5 +42,9 @@ export default [ useYamlEslintConfig(), usePackageJsonEslintConfig(), useJSONEslintConfig(), - useMarkdownEslintConfig(), + withOverride({ + rules: { + 'markdownlint/md013': 'off', + }, + })(useMarkdownEslintConfig)(), ];