-
Notifications
You must be signed in to change notification settings - Fork 0
feat: build and ship a Firefox target from the same source #1
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ coverage/ | |
| /popup.js | ||
| /popup.css | ||
| /popup.html | ||
| /firefox/ | ||
| .worktree-backup/ | ||
| .env | ||
| .env.* | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ bun.lock | |
| /popup.css | ||
| /popup.html | ||
| .worktree-backup | ||
| /firefox | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // The manifest in the repository is Chrome's, so the checkout stays loadable | ||
| // unpacked. Everything Firefox needs differently lives here. | ||
|
|
||
| /** AMO keys an add-on on this. It must not change between releases, and | ||
| * `storage.sync` needs it to have somewhere to write. */ | ||
| export const GECKO_ID = 'sharp@tshmieldev.github.io'; | ||
| /** What the extension needs to run at all: 128 for MAIN-world content scripts, | ||
| * module event pages and `optional_host_permissions`, 133 for | ||
| * `storage.local.getBytesInUse`. The floor is 140 because that is where | ||
| * `data_collection_permissions` below starts being honoured, and 140 is the | ||
| * current ESR, so nothing still supported is excluded. */ | ||
| export const GECKO_MIN_VERSION = '140.0'; | ||
|
|
||
| /** The manifest a target actually loads, given the Chrome one in the | ||
| * repository. Chrome's is returned unchanged; Firefox's differs only in the | ||
| * keys below. */ | ||
| export function manifestFor(base, target) { | ||
| if (target !== 'firefox') return base; | ||
| const { background, ...rest } = base; | ||
| return { | ||
| ...rest, | ||
| // Firefox MV3 runs the background as an event page, not a service worker. | ||
| // Same bundle either way: the code touches no worker-only globals. | ||
| background: { scripts: [background.service_worker], type: background.type }, | ||
| browser_specific_settings: { | ||
| gecko: { | ||
| id: GECKO_ID, | ||
| strict_min_version: GECKO_MIN_VERSION, | ||
| // AMO requires this declaration. Nothing reaches the developer — there | ||
| // is no server — but post text, handles and reply context do go to the | ||
| // AI provider the reader configured, which is a third party, and that | ||
| // is the whole point of the extension rather than something optional. | ||
| // See privacy-policy.md. | ||
| data_collection_permissions: { required: ['websiteContent'] }, | ||
| }, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| /** Every file a packaged build contains, relative to its own root. */ | ||
| export function assetsOf(manifest) { | ||
| const background = manifest.background.service_worker ?? manifest.background.scripts[0]; | ||
| return [ | ||
| ...new Set([ | ||
| 'manifest.json', | ||
| background, | ||
| manifest.action.default_popup, | ||
| ...Object.values(manifest.icons), | ||
| ...Object.values(manifest.action.default_icon), | ||
| ...manifest.content_scripts.flatMap((script) => [...script.js, ...(script.css ?? [])]), | ||
| 'popup.js', | ||
| 'popup.css', | ||
| ]), | ||
| ]; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.