-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using CMS editor with GitLab Pages in a monorepo #289
Comments
Good idea @alexnitta, I had not thought about monorepo-style projects. Is your I think we could probably just add a |
My plenti.json file is at I think the extra config option sounds great. Do you have any idea of when that feature might make it into a release? I'm on the verge of finishing a project for a client, and this is the last piece of the CMS that is not working. Thanks for building such a great framework for nonprofits, by the way. I'm really excited to deliver this project to the client - which happens to be my son's preschool, a nonprofit organization - and Plenti is a perfect match for their needs. |
I was able to work around this by adding a shell script to my To restate the problem, my issue is that my JSON content is not located in For anyone else facing this same problem, here's my image: docker:stable
pages:
before_script:
- apk add --update curl wget && rm -rf /var/cache/apk/*
script:
# Move to the subdirectory of the monorepo where the plenti.json file is.
# This is also where the `content` folder is located which contains all of the JSON content.
- cd packages/web/src
# These next three steps are the same as in the example at https://plenti.co/docs/gitlab-piplines/
- wget -c $(curl -s https://api.github.com/repos/plentico/plenti/releases/latest | grep -o 'http.*linux_64-bit.tar.gz')
- tar -zxvf *_linux_64-bit.tar.gz
- ./plenti build
# Move back up one folder to where the patch script is located
- cd ..
# Run the patch script
- ./patch_cms_publish.sh
artifacts:
paths:
- packages/web/public
publish: packages/web/public
only:
- main
And here is the #!/bin/sh
# This script is used to patch the public/spa/core/cms/publish.js script to use the correct file path
# when committing changes with the GitLab API. This is necessary because the script expects the
# JSON `content` folder path to start from the root of the repo, but our JSON `content` folder is in
# a subdirectory of the monorepo.
sed -i.bak 's/file_path:/&"packages\/web\/src\/" + /' public/spa/core/cms/publish.js
The script needs to be committed with |
That's wonderful, so glad it's fitting your needs! Providing a low-overhead solution for nonprofits is one of our primary goals.
That's very clever, thanks for sharing your workaround!
Sounds great, thanks for letting me know. I'm a little overbooked this month and next, but this is something I'm interested in adding to the project. Thanks for the suggestion! |
My pleasure, glad that I could be helpful in some way! As I mentioned, this is a really great fit for my client's needs, and I totally appreciate your contributions to the ecosystem. Plenti fills a niche that I haven't seen addressed by any other framework. |
My project is set up as a monorepo, which means that my JSON content lives in a non-standard folder. For example, my
_index.json
file is inpackages/web/src/content/_index.json
, rather thancontent/_index.json
. This seems to break the publishing capability of the CMS editor.When I make some changes in the CMS editor and click "Save", I see an "Error Saving" message in the button. I opened the network tab in the dev tools and found the request body that gets sent to
https://gitlab.com/api/v4/projects/...
, which looks like this:and the 400 response body is:
This makes sense, because my repo doesn't have a file at
content/_index.json
; it's actually atpackages/web/src/content/_index.json
. It seems that thefile_path
for each element of theactions
array should be modified if thecontent
folder is in a non-standard location. This should be possible by locating theplenti.json
file and using its location as the starting directory for thefile_path
in each action, or possibly by adding some kind of config option inplenti.json
to help with non-standard (i.e. nested) locations for thecontent
folder that contains the JSON files.The text was updated successfully, but these errors were encountered: