mirror of
https://github.com/LukeHagar/sveltekit-extension-template.git
synced 2025-12-06 04:21:37 +00:00
Merge branch 'main' of https://github.com/caticodev/sveltekit-extension-template into caticodev-main
This commit is contained in:
14
package.json
14
package.json
@@ -3,8 +3,13 @@
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"dev": "pnpm build-dev && run-p run:chrome watch",
|
||||
"build-dev": "vite build --mode development && pnpm replace-background-path && pnpm build-content-script",
|
||||
"watch": "watch 'pnpm build-dev' src static",
|
||||
"build": "vite build && pnpm replace-background-path && pnpm build-content-script",
|
||||
"run:chrome": "web-ext run -t chromium -s build",
|
||||
"replace-background-path": "cd build; sed -i \"\" \"s#\\$BACKGROUND_PATH#$(find app -wholename '*/immutable/background.*.js')#g\" manifest.json; cd -",
|
||||
"build-content-script": "esbuild src/content.ts --bundle --minify --outdir=build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
@@ -38,8 +43,9 @@
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.11",
|
||||
"vitest": "^0.34.6"
|
||||
"vitest": "^0.34.6",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"watch": "^1.0.2"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
|
||||
|
||||
1
src/background.ts
Normal file
1
src/background.ts
Normal file
@@ -0,0 +1 @@
|
||||
console.log('hello from background script')
|
||||
1
src/content.ts
Normal file
1
src/content.ts
Normal file
@@ -0,0 +1 @@
|
||||
console.log('hello from content script')
|
||||
@@ -10,5 +10,15 @@
|
||||
"default_popup": "index.html",
|
||||
"default_icon": "favicon.png",
|
||||
"default_title": "sveltekit-extension-template"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "$BACKGROUND_PATH",
|
||||
"type": "module"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["http://*/*", "https://*/*"],
|
||||
"js": ["content.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()],
|
||||
test: {
|
||||
include: ['src/**/*.{test,spec}.{js,ts}']
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
background: fileURLToPath(new URL('./src/background.ts', import.meta.url)),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user