rse / node-prince

Node API for executing PrinceXML via prince(1) CLI
https://npmjs.com/prince
49 stars 24 forks source link

Support latest prince version #59

Open arjangeertsema opened 2 months ago

arjangeertsema commented 2 months ago

Hi,

Can you make the princeXml version configurable:

  1. Exact version
  2. Current version
  3. Latest version

Thank you!

Arjan

rse commented 1 month ago

That's not such easy, as the URLs for downloading are heavily depending on the current available operating systems and PrinceXML versions. As a workaround, you can always just install your favorite PrinceXML version somewhere in your system (just ensure the prince binary is in your $PATH) and this Node.js module which pick it up before trying to download anything.

arjangeertsema commented 1 month ago

Thank you for responding. My suggestion is to make the version configurable. So that you can specify which version to download. When this is possible we can ask PrinceXML to create an npm package with version information which is create from their CI/CD script. This json file holds the current version and the latest version so that you can also configure current and latest.

In this way you will recieve a pull request ccreated by dependabot as soon as there is a new release.

arjangeertsema commented 1 month ago

If have asked Micheal Day (@adrianwong) to create an NPM package (which is linked to their release pipeline) with latest and current version information so that this project can link and consume this information.

I think a good first step is to create a NPM package with one file: version.json. This file contains the current and the latest PrinceXML version information:

current: version: 15.4 latest: version: 20240704

You can add a step to your release pipeline to create and publish this NPM artifact when you release a new PrinceXML version.

Then https://github.com/rse/node-prince can be changed to add a dependency to this NPM package and to get version information from the json file inside the referenced npm package (current and latest).

Dependabot will then automatically create a pull request for https://github.com/rse/node-prince when PrinceXml has released a new version, which is what we want.

rse commented 1 month ago

Well, for determining the current version a version.json file could be just placed onto their website. There is no need to publish a whole NPM package. But the main issue is that one would need actually a file where all the particular binaries (with their platform/OS identifiers) is listed. That's the main issue.

arjangeertsema commented 1 month ago

Well, for determining the current version a version.json file could be just placed onto their website. There is no need to publish a whole NPM package.

Then you do not have controlled upgrade via a pull request created automatically by dependabot, right?

But the main issue is that one would need actually a file where all the particular binaries (with their platform/OS identifiers) is listed. That's the main issue.

Maybe I am wrong, but from what I can see, the file paths are created by convention where only the version changes. So only templating the urls with version will be sufficient.... @adrianwong can you elaborate on this?

mikeday commented 1 month ago

Hi, we've been looking at this and perhaps we can submit a pull request to refactor the if-then-else chain that determines princeDownloadURL with a JSON table of download URLs indexed by platform/arch instead? That would be a good starting point for subsequent developments.

(By the way Adrian Wong and I are separate people at YesLogic working on Prince).