-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Port to Vite and Typescript #103
base: master
Are you sure you want to change the base?
Conversation
Wow, awesome work. I'm a bit daunted by such a massive overhaul PR, but a few initial thoughts:
|
Tested on Firefox, Chrome and Opera but haven't tested on Safari
Docs can be found here: https://vite-plugin-web-extension.aklinker1.io/guide/configuration.html#browser-specific-manifest-fields
Tested the consent and popup on both Chrome and Firefox. Using it in a test environment alongside the production extension to see if there's any discrepancies |
Heads up that I haven't abandoned this! It's been working great on my machine so far but would definitely like to get a few more eyes on it when it's closer to being ready. Waiting on the axios support for fetch axios/axios#5146 or will look to test and get my changes in https://github.com/Saghen/aw-client-js merged in before this PR can be merged. |
No worries! Just a heads-up though, there have been a few changes to master since you made this PR. You might want to carefully rebase, or resolve them some other way. I would also appreciate it if you avoided any change to formatting rules. Big PRs like this are difficult to review as it is, so let's keep the formatting changes as minimal as possible so that the diff is readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, apparently I had all these old review comments that I'd forgotten to submit. Sorry about the late response.
I merged the aw-client-js PR. Curious if you'll continue to work on this, but no pressure or rush :) |
Yep! Still planning to get this wrapped up |
Surprised by some of my choices on the original PR, like removing the Makefile 😛 Rebased onto master but none of the changes, beside the README change seemed to be applicable. Other changes:
I should have waited for your review before squashing the commits, sorry about that. Firefox supports Manifest v3 now so it may be worth upgrading to that in a subsequent PR, although there's some weird caveats wrt permissions that I might have to check on. |
Hey @ErikBjare would you be willing to take over this PR? Seems like some pretty minor things at this point and you should have edit access to the branch. I feel that would be quicker than the back and forth |
@Saghen I haven't reviewed it properly because the diff is practically unreadable due to the formatting changes, making git not understand that files were moved and edited, not deleted and rewritten from scratch. It is possible one might be able to fix this by using rebase and adding a move commit before the other commits (as explained here), but I haven't done that before.
Edit: Will take a little work, but this works: #!/usr/bin/fish
git rebase -i $branch_head^ # edit first commit
git reset HEAD^
# For each moved file
set old static/popup.js && git restore $old
set new src/popup/main.ts && mv $new $new.new && git mv $old $new && mv $new.new $new
git commit --amend |
Gotcha, let me know how that goes! I did rewrite everything from scratch except for |
It worked, but was too cumbersome to complete.
I realized that as I made my attempt and actually saw how significant the changes were. Even harder to review 😅, but I massively appreciate the effort of putting this together! 🥇 I'll give it another pass when the CI is passing and the formatting stuff is fixed. Might try to get another pair of eyes on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only concern I have is that the Brave detection is not present in this version of the extension, so it would be a step back in the functionality of the extension...
Everything else looks fine to me 👍
@ErikBjare comments resolved and rebased on master! |
Really excited about this, will try to find time to review and merge in the coming days. |
|
||
// FIXME: Detect Vivaldi? It seems to be intentionally impossible | ||
export const getBrowserName = () => { | ||
if ((navigator as any).brave.isBrave()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: Cannot read properties of undefined (reading 'isBrave')
I am unable to load the result of https://stackoverflow.com/q/39854127 In the browserconsole (ctrl+J) I see:
I was able to load the Ok, it's probably due to missing:
in manifest.json Fixed in Saghen#2 |
mkdir -p artifacts && cd build && zip ../artifacts/chrome.zip -r * | ||
|
||
zip-build-firefox: | ||
mkdir -p artifacts && cd build && zip ../artifacts/firefox.zip -r * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might make sense to add -FS
to the zip command, so that not-anymore-existing files get removed in the .zip archive
I recently discovered this fantastic project and, while getting the extension running on Firefox, I noticed the extension could use a fresh coat of paint. In general, I've attempted to improve the maintainability of the codebase through refactoring and the switch to Typescript while attempting to avoid complexity from a bundler.
browser.storage.local
intostorage.ts
Currently, I'm using a fork of
aw-client-js
with support forfetch
. Axios uses XHR behind the scenes which has been removed in Service Workers, a requirement for Manifest V3. Fetch is only supported on Node 18+ by default so I'll need to revisit those changes. https://github.com/Saghen/aw-client-js