-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.mjs
78 lines (76 loc) · 4.32 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineConfig } from 'astro/config';
import chalk from 'chalk';
import { hostname } from 'os';
import tailwind from '@astrojs/tailwind';
import node from '@astrojs/node';
import preact from '@astrojs/preact';
// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
integrations: [tailwind(), preact()],
vite: {
plugins: [
{
name: 'custom-startup-message',
configureServer(server) {
server.httpServer?.on('listening', () => {
const address = server.httpServer?.address();
const theme = chalk.hex('48bd6b');
const host = chalk.hex('8F00FF');
console.log(
chalk.bold(
theme(`
╔══════════════════════════════════════════════════════════════════════════╗
║ ░▒▓██████▓▒░ ░▒▓███████▓▒░▒▓███████▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓████████▓▒░ ║ ╗
║ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ║ ║
║ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ║ ║
║ ░▒▓████████▓▒░░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓██████▓▒░ ║ ║
║ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ║ ║
║ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ║ ║
║ ░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░ ║ ║
╚══════════════════════════════════════════════════════════════════════════╝ ║
╚══════════════════════════════════════════════════════════════════════════╝
`)
)
);
console.log(
` ${chalk.bold(host('Local System:'))} http://${address.family === 'IPv6' ? `[${address.address}]` : address.address}${address.port === 80 ? '' : ':' + chalk.bold(address.port)}`
);
console.log(
` ${chalk.bold(host('Local System:'))} http://localhost${address.port === 8080 ? '' : ':' + chalk.bold(address.port)}`
);
try {
console.log(
` ${chalk.bold(host('On Your Network:'))} http://${hostname()}${address.port === 8080 ? '' : ':' + chalk.bold(address.port)}`
);
} catch (err) {
// can't find LAN interface
}
if (process.env.REPL_SLUG && process.env.REPL_OWNER) {
console.log(
` ${chalk.bold(host('Replit:'))} https://${process.env.REPL_SLUG}.${process.env.REPL_OWNER}.repl.co`
);
}
if (
process.env.HOSTNAME &&
process.env.GITPOD_WORKSPACE_CLUSTER_HOST
) {
console.log(
` ${chalk.bold(host('Gitpod:'))} https://${process.env.PORT}-${process.env.HOSTNAME}.${process.env.GITPOD_WORKSPACE_CLUSTER_HOST}`
);
}
if (
process.env.CODESPACE_NAME &&
process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
) {
console.log(
` ${chalk.bold(host('Github Codespaces:'))} https://${process.env.CODESPACE_NAME}-${address.port === 80 ? '' : address.port}.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}`
);
}
});
}
}
]
}
});