chore: update integration name to @ayco/astro-sw

This commit is contained in:
Ayo Ayco 2024-08-17 12:49:17 +02:00
parent 1b2b48b960
commit b89c5221ab
6 changed files with 614 additions and 8 deletions

View file

@ -10,9 +10,9 @@ export default defineConfig({
site: 'https://ayo.ayco.io',
integrations: [
serviceWorker({
assetCachePrefix: 'cozy-reader',
path: './example_sw.js',
customRoutes: [
'/threads'
// '/threads'
],
excludeRoutes: [
'/exclude'

View file

@ -79,7 +79,6 @@ self.addEventListener('install', (event) => {
console.log('installing...', event)
event.waitUntil(
addResourcesToCache([
'./',
...(__assets ?? [])
])
);

View file

@ -9,7 +9,7 @@ import { randomUUID } from "node:crypto";
import path from 'pathe';
import { build } from 'esbuild';
const ASTROSW = 'astro-sw';
const ASTROSW = '@ayco/astro-sw';
/**
* @typedef {import('astro').AstroIntegration} AstroIntegration
* @typedef {import('esbuild').BuildOptions} BuildOptions

View file

@ -20,6 +20,8 @@
"scripts": {
"start": "astro dev",
"build": "astro build",
"build:preview:static": "astro build && astro preview",
"build:preview": "astro build && node ./server.mjs",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
@ -29,8 +31,11 @@
"author": "Ayo Ayco",
"license": "MIT",
"devDependencies": {
"@astrojs/node": "^8.3.3",
"@fastify/middie": "^8.3.1",
"@fastify/static": "^7.0.4",
"astro": "^4.14.2",
"@astrojs/node": "^8.3.3"
"fastify": "^4.28.1"
},
"dependencies": {
"esbuild": "^0.23.1",

File diff suppressed because it is too large Load diff

18
server.mjs Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env node
import Fastify from 'fastify';
import fastifyMiddie from '@fastify/middie';
import fastifyStatic from '@fastify/static';
import { fileURLToPath } from 'node:url';
import { handler as ssrHandler } from './dist/server/entry.mjs';
const app = Fastify({ logger: true });
await app
.register(fastifyStatic, {
root: fileURLToPath(new URL('./dist/client', import.meta.url)),
})
.register(fastifyMiddie);
app.use(ssrHandler);
app.listen({ port: 4321 });