Initial commit

This commit is contained in:
2022-08-14 20:04:30 +02:00
commit 6f84cd60ab
69 changed files with 12910 additions and 0 deletions

27
vite.plugins.js Normal file
View File

@ -0,0 +1,27 @@
import fs from "fs";
import {resolve} from "path";
import {homedir} from "os";
export let bladeRefreshPlugin = {
name: 'blade',
handleHotUpdate({ file, server }) {
if (file.endsWith('.blade.php')) { server.ws.send({ type: 'full-reload', path: '*' }) }
if (file.endsWith('.md')) { server.ws.send({ type: 'full-reload', path: '*' }) }
},
};
export function serverConfiguration(host) {
let keyPath = resolve(homedir(), `.config/valet/Certificates/${host}.key`)
let certificatePath = resolve(homedir(), `.config/valet/Certificates/${host}.crt`)
if (!fs.existsSync(keyPath) || !fs.existsSync(certificatePath)) {
return {}
}
return {
hmr: {host}, host, https: {
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certificatePath),
},
}
}