chore: update integration name to @ayco/astro-sw
This commit is contained in:
parent
1b2b48b960
commit
b89c5221ab
6 changed files with 614 additions and 8 deletions
|
@ -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'
|
||||
|
|
|
@ -79,7 +79,6 @@ self.addEventListener('install', (event) => {
|
|||
console.log('installing...', event)
|
||||
event.waitUntil(
|
||||
addResourcesToCache([
|
||||
'./',
|
||||
...(__assets ?? [])
|
||||
])
|
||||
);
|
||||
|
|
2
index.js
2
index.js
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
590
pnpm-lock.yaml
590
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
18
server.mjs
Executable file
18
server.mjs
Executable 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 });
|
Loading…
Reference in a new issue