pixelnest / presskit.html

Re-implementation of presskit() as a static site generator
http://pixelnest.io/2017/03/presskit-html/
MIT License
306 stars 51 forks source link

add node 12 support #15

Closed TheOddLinguist closed 5 years ago

TheOddLinguist commented 5 years ago

Locally (on node 12.6.0) I wasn't able to install presskit due to the sharp dependency. I tried updating the version in package.json, and it appears to have worked.

I haven't tested it extensively beyond running jest and successfully building a site. If there's something specific I should test beyond that, let me know. Thanks!

valryon commented 5 years ago

Hello! I think the calls to sharp need to be changed a bit. Using updated sharp on the default presskit gives me few errors similar to "background is not a function" because sharp changed its API.

Looks like in builder.js line 256 the background option needs to be in flatten now.

 await sharp(imagePath)
        .resize(450)
        .flatten({ background: { r: 255, g: 255, b: 255, alpha: 1 }})
        .jpeg()
        .toFile(thumbPath)

I need to check with @solarsailer if I'm missing something, but yes we need to update the dependencies. :)

solarsailer commented 5 years ago

Thanks for your contribution.

We indeed needed to update all the dependencies anyways, which included this fix.