Skip to content

Commit ec2f091

Browse files
authored
feat: migrate extension from Plasmo to WXT (#1172)
* feat: migrate extension framework to wxt - Replace Plasmo entrypoints, messaging, and storage usage with WXT-compatible implementations - Update workflows, build scripts, and locale paths for WXT outputs - Switch store submission to wxt submit with optional dry-run input * fix(ci): fallback to vars for submit credentials - Resolve missing required config in submit workflow when values are stored in GitHub Variables instead of Secrets - Keep existing secrets first and add vars fallback for Chrome, Firefox, and Edge credentials
1 parent c93d74d commit ec2f091

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3392
-4923
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ on:
66
- "*"
77

88
env:
9-
PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }}
10-
PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }}
9+
WXT_UMAMI_ID: ${{ vars.WXT_UMAMI_ID || vars.PLASMO_PUBLIC_UMAMI_ID }}
10+
WXT_UMAMI_URL: ${{ vars.WXT_UMAMI_URL || vars.PLASMO_PUBLIC_UMAMI_URL }}
11+
WXT_UMAMI_SAMPLE_RATE: ${{ vars.WXT_UMAMI_SAMPLE_RATE || vars.PLASMO_PUBLIC_UMAMI_SAMPLE_RATE }}
1112

1213
jobs:
1314
build:
@@ -32,9 +33,9 @@ jobs:
3233
node-version: 22.x
3334
cache: "pnpm"
3435
- name: Package the extension for Chrome
35-
run: pnpm build --zip
36+
run: pnpm zip
3637
- name: Package the extension for Firefox
37-
run: pnpm build:firefox --zip
38+
run: pnpm zip:firefox
3839
- name: Package the extension for Safari
3940
run: pnpm build:safari:zip
4041
- name: Upload file

.github/workflows/submit.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
name: "Submit to Web Store"
22
on:
33
workflow_dispatch:
4+
inputs:
5+
dry_run:
6+
description: "Run submission in dry-run mode"
7+
required: false
8+
default: false
9+
type: boolean
410

511
env:
6-
PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }}
7-
PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }}
12+
WXT_UMAMI_ID: ${{ vars.WXT_UMAMI_ID || vars.PLASMO_PUBLIC_UMAMI_ID }}
13+
WXT_UMAMI_URL: ${{ vars.WXT_UMAMI_URL || vars.PLASMO_PUBLIC_UMAMI_URL }}
14+
WXT_UMAMI_SAMPLE_RATE: ${{ vars.WXT_UMAMI_SAMPLE_RATE || vars.PLASMO_PUBLIC_UMAMI_SAMPLE_RATE }}
815

916
jobs:
1017
build:
@@ -28,14 +35,30 @@ jobs:
2835
node-version: 22.x
2936
cache: "pnpm"
3037
- name: Package the extension for Chrome
31-
run: pnpm build --zip
38+
run: pnpm zip
3239
- name: Package the extension for Firefox
33-
run: pnpm build:firefox --zip
34-
- name: Browser Platform Publish
35-
uses: PlasmoHQ/bpp@v3
36-
with:
37-
keys: ${{ secrets.SUBMIT_KEYS }}
38-
chrome-file: build/chrome-mv3-prod.zip
39-
edge-file: build/chrome-mv3-prod.zip
40-
firefox-file: build/firefox-mv3-prod.zip
41-
notes: "RSSHub Radar is an open source project, you can find the source code at https://github.com/DIYgod/RSSHub-Radar"
40+
run: pnpm zip:firefox
41+
- name: Submit to web stores
42+
env:
43+
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID || vars.CHROME_EXTENSION_ID }}
44+
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID || vars.CHROME_CLIENT_ID }}
45+
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET || vars.CHROME_CLIENT_SECRET }}
46+
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN || vars.CHROME_REFRESH_TOKEN }}
47+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID || vars.FIREFOX_EXTENSION_ID }}
48+
FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER || vars.FIREFOX_JWT_ISSUER }}
49+
FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET || vars.FIREFOX_JWT_SECRET }}
50+
EDGE_PRODUCT_ID: ${{ secrets.EDGE_PRODUCT_ID || vars.EDGE_PRODUCT_ID }}
51+
EDGE_CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID || vars.EDGE_CLIENT_ID }}
52+
EDGE_API_KEY: ${{ secrets.EDGE_API_KEY || vars.EDGE_API_KEY }}
53+
run: |
54+
DRY_RUN_FLAG=""
55+
if [ "${{ inputs.dry_run }}" = "true" ]; then
56+
DRY_RUN_FLAG="--dry-run"
57+
fi
58+
59+
pnpm wxt submit \
60+
--chrome-zip .output/*-chrome.zip \
61+
--firefox-zip .output/*-firefox.zip \
62+
--firefox-sources-zip .output/*-sources.zip \
63+
--edge-zip .output/*-chrome.zip \
64+
${DRY_RUN_FLAG}

.github/workflows/test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ on:
44
push:
55

66
env:
7-
PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }}
8-
PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }}
7+
WXT_UMAMI_ID: ${{ vars.WXT_UMAMI_ID || vars.PLASMO_PUBLIC_UMAMI_ID }}
8+
WXT_UMAMI_URL: ${{ vars.WXT_UMAMI_URL || vars.PLASMO_PUBLIC_UMAMI_URL }}
9+
WXT_UMAMI_SAMPLE_RATE: ${{ vars.WXT_UMAMI_SAMPLE_RATE || vars.PLASMO_PUBLIC_UMAMI_SAMPLE_RATE }}
910

1011
jobs:
1112
build:
@@ -30,9 +31,9 @@ jobs:
3031
node-version: 22.x
3132
cache: "pnpm"
3233
- name: Package the extension for Chrome
33-
run: pnpm build --zip
34+
run: pnpm zip
3435
- name: Package the extension for Firefox
35-
run: pnpm build:firefox --zip
36+
run: pnpm zip:firefox
3637
- name: Package the extension for Safari
3738
run: pnpm build:safari:zip
3839
- name: Archive production artifacts

.prettierrc.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export default {
1515
"<BUILTIN_MODULES>", // Node.js built-in modules
1616
"<THIRD_PARTY_MODULES>", // Imports not matched by other special words or groups.
1717
"", // Empty line
18-
"^@plasmo/(.*)$",
19-
"",
2018
"^@plasmohq/(.*)$",
2119
"",
2220
"^~(.*)$",

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ Open the upper right corner `Developer mode`
6767

6868
Click `Load unpacked extension` in the upper left corner
6969

70-
Select the unzipped `dist` directory
70+
Select the unzipped extension directory containing `manifest.json`
7171

7272
**Firefox install extension:**
7373

7474
Open `about:debugging`
7575

7676
Click `Load Temporary Extension` in the upper right corner
7777

78-
Select the `manifest.json` file in the unzipped `dist` directory
78+
Select the `manifest.json` file in the unzipped extension directory
7979

8080
## Join us
8181

8282
### Start the Development Server
8383

84-
Also refer to: https://docs.plasmo.com/framework/workflows/dev
84+
Also refer to: https://wxt.dev/guide/installation
8585

8686
```
8787
pnpm i
@@ -95,7 +95,7 @@ npm install
9595
npm run dev
9696
```
9797

98-
Get the `build/chrome-mv3-dev` directory, the installation method refers to [manual installation](#manual installation)
98+
Get the `.output/chrome-mv3` directory, the installation method refers to [manual installation](#manual installation)
9999

100100
### Submit New RSSHub Radar Rules
101101

package.json

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
"author": "DIYgod",
77
"packageManager": "pnpm@9.12.3",
88
"scripts": {
9-
"dev": "plasmo dev --no-cs-reload",
10-
"build": "plasmo build",
11-
"dev:firefox": "plasmo dev --target=firefox-mv3 --no-cs-reload",
12-
"build:firefox": "plasmo build --target=firefox-mv3",
13-
"build:safari": "plasmo build --target=safari-mv3",
14-
"safari-convert": "xcrun safari-web-extension-converter build/safari-mv3-prod --project-location build --bundle-identifier app.rsshub.RSSHub-Radar --force",
9+
"dev": "wxt",
10+
"build": "wxt build",
11+
"dev:firefox": "wxt -b firefox --mv3",
12+
"build:firefox": "wxt build -b firefox --mv3",
13+
"build:safari": "wxt build -b safari --mv3",
14+
"zip": "wxt zip && mkdir -p build && cp .output/rsshub-radar-*-chrome.zip build/chrome-mv3-prod.zip",
15+
"zip:firefox": "wxt zip -b firefox --mv3 && mkdir -p build && cp .output/rsshub-radar-*-firefox.zip build/firefox-mv3-prod.zip",
16+
"safari-convert": "xcrun safari-web-extension-converter .output/safari-mv3 --project-location build --bundle-identifier app.rsshub.RSSHub-Radar --force",
1517
"safari-zip": "zip -r build/safari-mv3-prod.zip \"build/RSSHub Radar\"",
16-
"build:safari:zip": "npm run build:safari && npm run safari-convert && npm run safari-zip",
17-
"package": "plasmo package",
18-
"prepare": "husky install"
18+
"build:safari:zip": "pnpm build:safari && pnpm safari-convert && pnpm safari-zip",
19+
"package": "pnpm zip && pnpm zip:firefox",
20+
"prepare": "husky install",
21+
"postinstall": "wxt prepare"
1922
},
2023
"dependencies": {
2124
"@iconify-json/mingcute": "^1.2.3",
22-
"@plasmohq/messaging": "^0.6.2",
23-
"@plasmohq/storage": "^1.13.0",
2425
"@radix-ui/react-accordion": "^1.2.3",
2526
"@radix-ui/react-dialog": "1.1.6",
2627
"@radix-ui/react-label": "^2.1.2",
@@ -34,7 +35,6 @@
3435
"lodash": "^4.17.21",
3536
"lucide-react": "^0.475.0",
3637
"md5.js": "^1.3.5",
37-
"plasmo": "0.89.4",
3838
"react": "18.3.1",
3939
"react-dom": "18.3.1",
4040
"react-hot-toast": "^2.5.1",
@@ -54,6 +54,7 @@
5454
"@types/node": "22.13.1",
5555
"@types/react": "18.3.11",
5656
"@types/react-dom": "18.3.1",
57+
"@wxt-dev/module-react": "^1.1.5",
5758
"autoprefixer": "^10.4.20",
5859
"husky": "9.1.7",
5960
"lint-staged": "15.4.3",
@@ -62,29 +63,15 @@
6263
"prettier-package-json": "2.8.0",
6364
"shadcn-ui": "^0.9.4",
6465
"tailwindcss": "^3.4.13",
65-
"typescript": "5.7.3"
66+
"typescript": "5.7.3",
67+
"wxt": "^0.20.14"
6668
},
6769
"lint-staged": {
6870
"**/*": "prettier --write --ignore-unknown"
6971
},
70-
"manifest": {
71-
"default_locale": "en",
72-
"host_permissions": [
73-
"https://*/*"
74-
],
75-
"permissions": [
76-
"tabs",
77-
"offscreen",
78-
"storage",
79-
"alarms"
80-
],
81-
"optional_permissions": [
82-
"notifications"
83-
],
84-
"browser_specific_settings": {
85-
"gecko": {
86-
"id": "i@diygod.me"
87-
}
72+
"pnpm": {
73+
"overrides": {
74+
"publish-browser-extension": "3.0.3"
8875
}
8976
}
9077
}

0 commit comments

Comments
 (0)