OpenTechStrategies / SimpleBook

A fork of the Collection Extension to print books from MediaWiki instances
1 stars 1 forks source link

Should we split this into packages? #18

Open slifty opened 3 years ago

slifty commented 3 years ago

This repository has three projects:

  1. The SimpleBook mediawiki plugin (PHP)
  2. The SimpleBook API, which is a python / flask based service which reads and writes to rq
  3. mw2pdf, which is a nodejs tool that takes URL (+ MW credentials) and converts it to a PDF.

These tools have various integration points, but ultimately could exist separately from the code bases that depend on them.

For instance: mw2pdf should not depend on the SimpleBook API (rather, it implements features necessary for the API to utilize it, but this can be done generically)

I think we should consider:

slifty commented 3 years ago

This issue isn't a priority yet, but I wanted to document the thought.

I'd like to add linting and tests to mw2pdf, which is probably the point at which separating it into its own repository and treating it as an imported dependency would make the most sense.

slifty commented 3 years ago

Another note:

I just realized that the majority of mw2pdf is actually agnostic to MediaWiki. If you look at the API it provides, it takes in cookies and a set of URLs, navigates to those urls, and combines them into a PDF.

I'm about to add MW auth to it via #11 but if we decide to release it as a package we might consider separating that MediaWiki logic / changing the cookie support to more generic HTTP header forwarding ad releasing that code as a new core as url2pdf.

From there we could either create a second npm package mw2pdf that utilizes the generic generation while providing mediawiki wrappers, or we could put that MW authentication logic in the SimpleBook API service.