Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 37 additions & 21 deletions .github/workflows/submit-ff.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
name: "Submit to Firefox Add-ons"
on:
workflow_dispatch:
inputs:
channel:
description: "Submission channel"
required: true
type: choice
options:
- listed
- unlisted
default: listed
version:
description: "Version override (unlisted/beta only, e.g. 1.41.3.1)"
required: false
type: string

jobs:
build:
runs-on: ubuntu-latest
# Only run on production branch
if: github.ref == 'refs/heads/production'
# Only allow "listed" on production branch
if: ${{ inputs.channel == 'unlisted' || github.ref == 'refs/heads/production' }}
steps:
- name: Validate inputs
if: inputs.channel == 'unlisted' && inputs.version == ''
run: |
echo "::error::Version is required for unlisted channel"
exit 1

- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4.0.1
Expand All @@ -30,24 +49,21 @@ jobs:
echo "PLASMO_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.GA_MEASUREMENT_ID }}" >> .env
echo "PLASMO_PUBLIC_GA_API_SECRET=${{ secrets.GA_API_SECRET }}" >> .env

- name: Build and Package the Firefox extension into a zip artifact
run: yarn build:firefox --zip

- name: Prepare submission keys
id: prepare-keys
- name: Modify package.json for beta (unlisted)
if: inputs.channel == 'unlisted'
run: |
# Take the base keys JSON and replace placeholder values with actual secrets
KEYS_JSON='${{ secrets.SUBMIT_KEYS_PRODUCTION_FF }}'
KEYS_JSON=$(echo "$KEYS_JSON" | jq --arg extId "${{ secrets.FIREFOX_EXT_ID }}" \
--arg apiKey "${{ secrets.FIREFOX_API_KEY }}" \
--arg apiSecret "${{ secrets.FIREFOX_API_SECRET }}" \
'.firefox.extId = $extId | .firefox.apiKey = $apiKey | .firefox.apiSecret = $apiSecret')
echo "KEYS_JSON<<EOF" >> $GITHUB_ENV
echo "$KEYS_JSON" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
jq '.displayName = "Wander BETA"' package.json > temp.json && mv temp.json package.json
jq --arg version "${{ inputs.version }}" '.version = $version' package.json > temp.json && mv temp.json package.json
cp -rf assets-beta/* assets/

- name: Browser Platform Publish
uses: PlasmoHQ/bpp@v3
with:
keys: ${{ env.KEYS_JSON }}
artifact: build/firefox-mv3-prod.zip
- name: Build the Firefox extension (includes bundle splitting)
run: yarn build:firefox

- name: Install web-ext
run: npm install -g web-ext

- name: Submit via web-ext
env:
WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
run: web-ext sign --source-dir=build/firefox-mv3-prod --channel=${{ inputs.channel }}
36 changes: 30 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wander",
"displayName": "Wander",
"version": "1.40.0",
"version": "1.41.3",
"description": "__MSG_extensionDescription__",
"author": "th8ta",
"packageManager": "yarn@1.22.18",
Expand All @@ -10,7 +10,7 @@
"dev:chrome": "yarn patch:math-intrinsics && cross-env PARCEL_WORKER_BACKEND=process plasmo dev",
"build:chrome": "yarn patch:math-intrinsics && cross-env PARCEL_WORKER_BACKEND=process plasmo build --no-hoist",
"dev:firefox": "yarn patch:math-intrinsics && cross-env PARCEL_WORKER_BACKEND=process plasmo dev --target=firefox-mv3",
"build:firefox": "yarn patch:math-intrinsics && cross-env PARCEL_WORKER_BACKEND=process plasmo build --target=firefox-mv3 --no-hoist",
"build:firefox": "yarn patch:math-intrinsics && node patches/patch-plasmo-bundler.js && cross-env PARCEL_WORKER_BACKEND=process plasmo build --target=firefox-mv3 && node scripts/split-large-bundles.js",
"dev:iframe": "vite",
"build:iframe": "vite build && yarn build:assets",
"preview:iframe": "vite preview",
Expand Down Expand Up @@ -55,16 +55,29 @@
"*://*/*"
]
}
]
],
"browser_specific_settings": {
"gecko": {
"id": "{6c337925-991d-4139-8b64-8380cd30517a}",
"data_collection_permissions": {
"required": [
"none"
],
"optional": [
"technicalAndInteraction"
]
}
}
}
},
"dependencies": {
"@ar.io/sdk": "^3.18.0",
"@ar.io/sdk": "^3.23.1",
"@arconnect/components": "^1.0.0",
"@arconnect/keystone-sdk": "^0.0.5",
"@dha-team/arbundles": "^1.0.2",
"@iconicicons/react": "^1.5.0",
"@keystonehq/arweave-keyring": "^0.1.1-alpha.0",
"@keystonehq/bc-ur-registry-arweave": "^0.1.1-alpha.0",
"@keystonehq/arweave-keyring": "^0.5.3",
"@keystonehq/bc-ur-registry-arweave": "^0.5.3",
"@ngraveio/bc-ur": "^1.1.6",
"@noble/curves": "^1.9.2",
"@number-flow/react": "^0.5.5",
Expand Down Expand Up @@ -129,6 +142,7 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@plasmohq/bms": "^2.6.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6",
"@types/chrome": "^0.0.319",
Expand Down Expand Up @@ -182,5 +196,15 @@
},
"lint-staged": {
"*.{js,ts,tsx,html,css,scss,md,json}": "prettier --write"
},
"@plasmohq/parcel-config": {
"minBundles": 2,
"minBundleSize": 3000,
"maxParallelRequests": 30
},
"@parcel/bundler-default": {
"minBundles": 2,
"minBundleSize": 3000,
"maxParallelRequests": 30
}
}
26 changes: 26 additions & 0 deletions patches/patch-plasmo-bundler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fs = require("fs");

try {
console.log("Patching @plasmohq/parcel-bundler for Firefox bundle splitting");

const bundlerPath = require.resolve("@plasmohq/parcel-bundler/dist/index.js");
let content = fs.readFileSync(bundlerPath, "utf-8");

const target = "minBundles:2,minBundleSize:1e3,maxParallelRequests:100";

if (content.includes(target)) {
console.log("Already patched");
} else {
// Match any variant of the EXTENSION_OPTIONS pattern
const re = /minBundles:\s*[\d.e]+\s*,\s*minBundleSize:\s*[\d.e]+\s*,\s*maxParallelRequests:\s*[\d.e]+/;
if (re.test(content)) {
content = content.replace(re, target);
fs.writeFileSync(bundlerPath, content);
console.log("Patched: minBundles->2, minBundleSize->1000, maxParallelRequests->100");
} else {
console.error("Could not find EXTENSION_OPTIONS pattern in bundler - skipping patch");
}
}
} catch (err) {
console.error("Failed to patch @plasmohq/parcel-bundler:", err.message);
}
Loading
Loading