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:
@@ -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,
|
||||
],
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user