Undo previous complication

This commit is contained in:
Luke Hagar
2024-01-03 13:25:07 -06:00
parent 1f8230ad00
commit d8b23d7a51
5 changed files with 7 additions and 35 deletions

View File

@@ -3,13 +3,8 @@
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "pnpm build-dev && run-p run:chrome watch", "dev": "vite dev",
"build-dev": "vite build --mode development && pnpm replace-background-path && pnpm build-content-script", "build": "vite build",
"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", "preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
@@ -43,11 +38,8 @@
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite-plugin-tailwind-purgecss": "^0.1.3", "vite": "^4.4.11",
"vite": "^5.0.0", "vitest": "^0.34.6"
"vitest": "^1.0.0",
"npm-run-all": "^4.1.5",
"watch": "^1.0.2"
}, },
"type": "module" "type": "module"
} }

View File

@@ -1 +0,0 @@
console.log('hello from background script')

View File

@@ -1 +0,0 @@
console.log('hello from content script')

View File

@@ -10,15 +10,5 @@
"default_popup": "index.html", "default_popup": "index.html",
"default_icon": "favicon.png", "default_icon": "favicon.png",
"default_title": "sveltekit-extension-template" "default_title": "sveltekit-extension-template"
}, }
"background": {
"service_worker": "$BACKGROUND_PATH",
"type": "module"
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
]
} }

View File

@@ -1,18 +1,10 @@
import { sveltekit } from '@sveltejs/kit/vite'; import { sveltekit } from '@sveltejs/kit/vite';
import { purgeCss } from 'vite-plugin-tailwind-purgecss'; import { purgeCss } from 'vite-plugin-tailwind-purgecss';
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'url';
export default defineConfig({ export default defineConfig({
plugins: [sveltekit(), purgeCss()], plugins: [sveltekit(), purgeCss()],
test: { test: {
include: ['src/**/*.{test,spec}.{js,ts}'] include: ['src/**/*.{test,spec}.{js,ts}']
}, }
build: {
rollupOptions: {
input: {
background: fileURLToPath(new URL('./src/background.ts', import.meta.url)),
}
}
}
}); });