Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest v3 migration #24

Merged
merged 2 commits into from Apr 23, 2021

Conversation

Mikescops
Copy link
Contributor

As proposed in #22 here is a pull request to support the new manifest v3.

A few considerations:

  • the update is a breaking change with v2
  • the background script is now a service worker and should be placed at the root of the extension. As per this thread I used the importScripts() method to reuse most of the existing implementation.

Work left to do:

  • I didn't update the tests for the snapshot, I'm not used to this system.
  • Make sure the livereload is still working
  • Add some documentation for people migrating to v3 with neutrino-webextension

@crimx
Copy link
Member

crimx commented Apr 20, 2021

Thanks for the input!

the update is a breaking change with v2

Can this be done intelligently? Like switching to different implementation base on the manifest_version field.

@Mikescops
Copy link
Contributor Author

I think we can do so yes, let's try.

@Mikescops
Copy link
Contributor Author

How do you like something like this? ⬆️

@Mikescops
Copy link
Contributor Author

Mikescops commented Apr 20, 2021

Considering that Firefox may not be compatible with v3 anytime soon, I recommend adding an explanation to have 2 different .neutrinorc.js configuration with different manifest so that it's easy to build for v2 and v3 in a same project.

Like specified here: https://neutrinojs.org/usage/#generating-multiple-builds

Copy link
Member

@crimx crimx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks so cool! Can you just copy everything inside test/ to test/manifestV3/ and make changes there instead? I'll take care of the rest.

.neutrinorc.js Show resolved Hide resolved
test/specs/WexExtManifestPlugin.spec.js Outdated Show resolved Hide resolved
@Mikescops
Copy link
Contributor Author

Mikescops commented Apr 20, 2021

The implementation looks so cool! Can you just copy everything inside test/ to test/manifestV3/ and make changes there instead? I'll take care of the rest.

I'd recommend not having a /test folder and using the branch system to separate the new version 👍

let say:

  • until release masterbranch is the current v2 and beta branch is the v3+v2
  • after release v2 branch will be the v2 and master branch will be v3+v2

that way we don't add noise to the repository and we can backport any potential hotfix of the v2

also when publishing the package you can set the beta branch to beta on npm

@crimx
Copy link
Member

crimx commented Apr 21, 2021

I was going to do something like

/test/
  manifestV2/
  manifestV3/

so that I can test both of them. What's the downside of this approach?

@Mikescops
Copy link
Contributor Author

Ah sorry, only for the tests, ok, I misunderstood, i thought you wanted to duplicate the whole code, in a subfolder for the v3

@Mikescops
Copy link
Contributor Author

Took me a while but I finally figured out how to build two presets at the same time.
So now:

  • tests are in separate folder
  • it's possible to build v2 and v3 at the same time with different configurations (for Firefox in v2 on one side and Chrome in v3 on the other for instance)

@Mikescops Mikescops requested a review from crimx April 21, 2021 08:47
@crimx
Copy link
Member

crimx commented Apr 23, 2021

LGTM! Thanks for the PR!

@crimx crimx merged commit 1f9cca5 into awesome-webextension:master Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants