Postleaf / postleaf

Simple, beautiful publishing with Node.js.

Home Page:https://www.postleaf.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: NPM Module for easier installation

bigdogwillfeed opened this issue · comments

Summary

Postleaf is awesome; thanks for building it!

I've been mostly playing around with themes, so I don't really need the whole gulp pipeline and postleaf source. There's an NPM module, but attempting to require from it results in needing to have my .env and themes along-side the postleaf source in the node_modules directory, which kind of defeats the purpose of installing the module. Plus, in my preferred dev/hosting environment, the node_modules directory is read-only.

What if the only thing necessary to get up and running was to have a theme, npm install postleaf, and a short app.js that launches and configures everything? Kind of like... https://glitch.com/edit/#!/night-anger?path=README.md:1:0

This FR needs:

  1. Separation between setting up the routes on the Express app and actually listening on a port
  2. Configurable locations for themes, uploads, and data
  3. Additional docs? Perhaps skipping the dev setup and focusing on installing?

I have 1 and 2 pretty well done, and the readme in my example app is a pass at what might need to be covered in 3 (though it's a bit Glitch-centric).

This approach is in between #29 and the current state, and seems like it works well in the future where themes are installed directly from the admin panel (mentioned in #27)

Interested in a PR? It's 👇

Thanks for submitting this. From what I'm gathering, the ultimate goal here is to make it easier for non-devs to install, which is definitely a good thing.

I haven't used Glitch, so would you mind clarifying something?

  1. Separation between setting up the routes on the Express app and actually listening on a port

This makes things a lot cleaner, and I'm totally fine with it 👍 — just wondering if there's another technical advantage to splitting this logic.

I'm also interested to hear any ideas you have to make installation easier for non-devs. Aside from the npm install it still requires configuring nginx, pm2, etc.

Thanks for taking a look so quickly! The polish around the admin pages makes me think Postleaf is aimed an non-dev users, so I hoped this would be useful.

Re: separation, The only "necessary" piece to separate is the .env validation, otherwise your .env file needs to be in the node_modules directory (absent some more refactoring). The choice to remove app.listen from what happens when you require/init postleaf was mostly motivated by similar divisions in other "modules that add to an Express app" and to be able to write a server.js that matches many of the other Glitch apps out there (require, app.use, app.listen).

Re: installation, The reason I'm using Glitch is so that I don't need to configure nginx, pm2, etc. Glitch takes care of ensuring the process is running when there's an incoming request to be handled, and manages routing 80/443 into the app. (so e.g., http://night-anger.glitch.me and https://night-anger.glitch.me are there automatically)

I've never installed/deployed a node app outside of Glitch, but find the following process to be a friendly goal:

  1. install the package via a common package management tool
  2. optionally modify the single config file with my specific environment settings
  3. make it go via a common service management tool

Merged in #84.