nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
400 stars 25 forks source link

fix: stop using 'terminate' package to avoid GPL #217

Closed sethidden closed 3 months ago

sethidden commented 3 months ago

Fixes #212

  1. The licensing issues

The 'terminate' package is licensed under GPL-2.0: https://github.com/dwyl/terminate/blob/main/LICENSE

However, this og-image package is licensed under MIT.

Because 'terminate' was being used in the og-image runtime rather than as a dev tool as the author of 'terminate' intended...: https://github.com/dwyl/terminate/issues/35#issuecomment-441572754 ... this caused og-image to be a work derived from GPL-licensed code.

As per GPL-2.0 section 2 point B:

https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html#section2 You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

This essentially meant that if you use GPL code (here, it's 'terminate') as a part of your code (here, 'og-image'), your work MUST be licensed under GPL as well.

However the intention of og-image is to still be licensed under MIT.


  1. Replacing 'terminate'

Now, 'terminate' was first introduced in 'og-image' on September 6, 2023: https://github.com/nuxt-modules/og-image/commit/e0cdde74906c5862757c070b379b393e2a9e8bd7#diff-030fc083b2cbf5cf008cfc0c49bb4f1b8d97ac07f93a291d068d81b4d1416f70R687

As Harlan said (https://github.com/nuxt-modules/og-image/issues/212#issuecomment-2149392241), 'terminate' was added to circumvent an issue where the npx playwright install chromium process would hang and never exit.

Do note that at the time, the version of 'playwright' in the repo was 1.37.1: https://github.com/nuxt-modules/og-image/blob/e0cdde74906c5862757c070b379b393e2a9e8bd7/package.json#L63

The issue where playwright doesn't exit after installing browsers sounds like this issue: https://github.com/microsoft/playwright/issues/28189

The issue was fixed on November 22, 2023 in these two commits:

We can see at the top of the UI that this commit is tagged 1.41.0.

At the time Harlan occured came across this issue the version was again, 1.37.1. However now it's: https://github.com/nuxt-modules/og-image/blob/4e0fa43a92f7bad8544647fbd0e8e471d54b96e2/package.json#L73

So my guess it's that I could just revert to the previous way of killing the process (from before September 6, 2023) and installation is not going to freeze anymore, as the underlying Playwright issue is fixed.

sethidden commented 3 months ago

I didn't test this yet. I'm just uploading my detective work, but perhaps this issue is really fixed in the latest versions of playwright and terminate can just be removed.

sethidden commented 3 months ago

I ran this on my fork and the CI's e2e prerender integration tests seem to be passing https://github.com/sethidden/og-image/actions/runs/9560988925/job/26354214621

@harlan-zw Is there any additional way I can test the CI freezes?

harlan-zw commented 3 months ago

Thanks for the great investigation, will merge for now and re-visit if the issue pops up again.

sethidden commented 3 months ago

@harlan-zw Is it ok to port this to v2.x as well? I could make a PR, I'd have to bump playwright to 1.41 there

harlan-zw commented 3 months ago

@harlan-zw Is it ok to port this to v2.x as well? I could make a PR, I'd have to bump playwright to 1.41 there, or just update to latest version

Sounds good 👍

sethidden commented 3 months ago

Added https://github.com/nuxt-modules/og-image/pull/218