feat: add CI for publishing chrome extension (#1568)

* fix: remove the permission not needed and update the player style link

* fix: change the way of importing worker script

* improve the extension version

* build: add process env to disable inline worker import

* improve style file

* upgrade svelte2tsx

* disable eslint check for that line

* merge the extension-release action into release action

---------

Co-authored-by: YunFeng0817 <YunFeng0817@users.noreply.github.com>
This commit is contained in:
Yun Feng
2026-04-01 12:00:00 +08:00
committed by GitHub
parent f993bb5c88
commit 3211ded262
12 changed files with 130 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import Browser, { type Storage } from 'webextension-polyfill';
import Browser from 'webextension-polyfill';
import { nanoid } from 'nanoid';
import type { eventWithTime } from '@rrweb/types';
import {
@@ -166,9 +166,7 @@ async function initMainPage() {
async function initCrossOriginIframe() {
Browser.storage.local.onChanged.addListener((change) => {
if (change[LocalDataKey.recorderStatus]) {
const statusChange = change[
LocalDataKey.recorderStatus
] as Storage.StorageChange;
const statusChange = change[LocalDataKey.recorderStatus];
const newStatus =
statusChange.newValue as LocalData[LocalDataKey.recorderStatus];
if (newStatus.status === RecorderStatus.RECORDING) startRecord();

View File

@@ -14,7 +14,7 @@
"48": "icon48.png",
"128": "icon128.png"
},
"permissions": ["activeTab", "tabs", "storage", "unlimitedStorage"]
"permissions": ["activeTab", "storage", "unlimitedStorage"]
},
"v2": {
"common": {

View File

@@ -1,3 +1,4 @@
/// <reference types="chrome"/>
import { useRef, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import Replayer from 'rrweb-player';
@@ -29,9 +30,10 @@ export default function Player() {
.then((events) => {
if (!playerElRef.current) return;
const manifest = chrome.runtime.getManifest();
const rrwebPlayerVersion = manifest.version_name || manifest.version;
const linkEl = document.createElement('link');
linkEl.href =
'https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css';
linkEl.href = `https://cdn.jsdelivr.net/npm/rrweb-player@${rrwebPlayerVersion}/dist/style.min.css`;
linkEl.rel = 'stylesheet';
document.head.appendChild(linkEl);
playerRef.current = new Replayer({
@@ -46,6 +48,7 @@ export default function Player() {
console.error(err);
});
return () => {
// eslint-disable-next-line
playerRef.current?.pause();
};
}, [sessionId]);

View File

@@ -1,9 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>rrweb</title>
<html>
<body>
<div id="root"></div>
</body>
<script type="module" src="./index.tsx"></script>
</html>
<head>
<meta charset="utf-8" />
<title>rrweb</title>
</head>
<body>
<div id="root"></div>
</body>
<script type="module" src="./index.tsx"></script>
</html>