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

@@ -2,13 +2,17 @@
import dts from 'vite-plugin-dts';
import { copyFileSync } from 'node:fs';
import { defineConfig, LibraryOptions, LibraryFormats, Plugin } from 'vite';
import glob from 'fast-glob';
import { build, Format } from 'esbuild';
import { resolve } from 'path';
import { umdWrapper } from 'esbuild-plugin-umd-wrapper';
// don't empty out dir if --watch flag is passed
const emptyOutDir = !process.argv.includes('--watch');
/**
* Chrome web store does not allow base64 inline workers.
* For chrome extension, we need to disable worker inlining to pass the review.
*/
const disableWorkerInlining = process.env.DISABLE_WORKER_INLINING === 'true';
function minifyAndUMDPlugin({
name,
@@ -157,6 +161,19 @@ export default function (
},
}),
minifyAndUMDPlugin({ name, outDir }),
{
name: 'remove-worker-inline',
enforce: 'pre',
transform(code, id) {
if (!disableWorkerInlining) return;
if (/\.(js|ts|jsx|tsx)$/.test(id)) {
return {
code: code.replace(/\?worker&inline/g, '?worker'),
map: null,
};
}
},
},
...plugins,
],
}));