Coder Social home page Coder Social logo

Comments (5)

alexnitta avatar alexnitta commented on June 3, 2024 1

My plenti.json file is at packages/web/src/plenti.json - so it's in the usual location relative to the content folder.

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.

from plenti.

alexnitta avatar alexnitta commented on June 3, 2024 1

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.

from plenti.

jimafisk avatar jimafisk commented on June 3, 2024

Good idea @alexnitta, I had not thought about monorepo-style projects. Is your plenti.json at the project root or packages/web/src/plenti.json?

I think we could probably just add a file_prefix option to the cms settings defined in plenti.json. We're planning on modifying that API a bit anyways now that we're adding other providers like Gitea.

from plenti.

alexnitta avatar alexnitta commented on June 3, 2024

I was able to work around this by adding a shell script to my .gitlab-ci.yml. The shell script uses sed to append the packages/web/src/ subdirectory before the file path in pubic/spa/core/cms/publish.js. Now I am able to use the CMS editor to save changes - so @jimafisk there's no need to rush the official fix into a release, but whenever you have time for that I'd be happy to remove this patch from my codebase.

To restate the problem, my issue is that my JSON content is not located in ./content relative to the root of the repo; since I'm using a monorepo, it's located in ./packages/web/src/content instead. This breaks the current version of the CMS editor when trying to save changes, because the generated JS file in public/spa/core/cms/publish.js assumes the file paths are relative to the root of the repository.

For anyone else facing this same problem, here's my .gitlab-ci.yml with some comments added where I changed things.

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 packages/web/patch_cms_publish.sh script:

#!/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 git add --chmod=+x packages/web/patch_cms_publish.sh so that it can be executed.

from plenti.

jimafisk avatar jimafisk commented on June 3, 2024

I'm really excited to deliver this project to the client - which happens to be my son's preschool, a nonprofit organization

That's wonderful, so glad it's fitting your needs! Providing a low-overhead solution for nonprofits is one of our primary goals.

I was able to work around this by adding a shell script

That's very clever, thanks for sharing your workaround!

there's no need to rush the official fix into a release

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!

from plenti.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.