Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
NebulaServices
GitHub Repository: NebulaServices/Nebula
Path: blob/main/astro.config.ts
976 views
1
import { fileURLToPath } from "node:url";
2
import node from "@astrojs/node";
3
import svelte from "@astrojs/svelte";
4
import tailwind from "@astrojs/tailwind";
5
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
6
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
7
import { libcurlPath } from "@mercuryworkshop/libcurl-transport";
8
import playformCompress from "@playform/compress";
9
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
10
import { scramjetPath } from "@mercuryworkshop/scramjet/path";
11
import icon from "astro-icon";
12
import { defineConfig, envField } from "astro/config";
13
import { viteStaticCopy } from "vite-plugin-static-copy";
14
import { version } from "./package.json";
15
import { parsedDoc } from "./server/config.js";
16
const workerwarePath = fileURLToPath(new URL("./workerware/src", import.meta.url));
17
18
export default defineConfig({
19
site: parsedDoc.seo.enabled ? parsedDoc.seo.domain || process.env.SITE : 'http://localhost:4321',
20
env: {
21
schema: {
22
API_URL: envField.string({
23
context: "server",
24
access: "secret",
25
optional: true,
26
default: `http://localhost:${parsedDoc.server.server.port}`
27
}),
28
VERSION: envField.string({
29
context: "client",
30
access: "public",
31
optional: true,
32
default: version
33
}),
34
MARKETPLACE_ENABLED: envField.boolean({
35
context: "client",
36
access: "public",
37
optional: true,
38
default: parsedDoc.marketplace.enabled
39
}),
40
SEO: envField.string({
41
context: "client",
42
access: "public",
43
optional: true,
44
default: JSON.stringify({
45
enabled: parsedDoc.seo.enabled,
46
domain: new URL(parsedDoc.seo.domain).host
47
})
48
}),
49
}
50
},
51
integrations: [
52
tailwind(),
53
//sitemap(),
54
icon(),
55
svelte(),
56
playformCompress({
57
CSS: false,
58
HTML: true,
59
Image: true,
60
JavaScript: true,
61
SVG: true
62
})
63
],
64
vite: {
65
plugins: [
66
viteStaticCopy({
67
targets: [
68
{
69
src: `${uvPath}/**/*`.replace(/\\/g, "/"),
70
dest: "uv",
71
overwrite: false
72
},
73
{
74
src: `${epoxyPath}/**/*`.replace(/\\/g, "/"),
75
dest: "epoxy",
76
overwrite: false
77
},
78
{
79
src: `${libcurlPath}/**/*`.replace(/\\/g, "/"),
80
dest: "libcurl",
81
overwrite: false
82
},
83
{
84
src: `${scramjetPath}/**/*`.replace(/\\/g, "/"),
85
dest: "scram",
86
overwrite: false
87
},
88
{
89
src: `${baremuxPath}/**/*`.replace(/\\/g, "/"),
90
dest: "baremux",
91
overwrite: false
92
},
93
{
94
src: `${workerwarePath}/**/*`.replace(/\\/g, "/"),
95
dest: "workerware",
96
overwrite: false
97
}
98
]
99
})
100
],
101
server: {
102
proxy: {
103
"/api/catalog-stats": {
104
target: "http://localhost:8080/api/catalog-stats",
105
changeOrigin: true,
106
rewrite: (path) => path.replace(/^\/api\/catalog-stats/, "")
107
},
108
"/api/catalog-assets": {
109
target: "http://localhost:8080/api/catalog-assets",
110
changeOrigin: true,
111
rewrite: (path) => path.replace(/^\/api\/catalog-assets/, "")
112
},
113
"/api/packages": {
114
target: "http://localhost:8080/api/packages",
115
changeOrigin: true,
116
rewrite: (path) => path.replace(/^\/api\/packages/, "")
117
},
118
"/packages": {
119
target: "http://localhost:8080",
120
changeOrigin: true
121
},
122
"/wisp/": {
123
target: "ws://localhost:8080/wisp/",
124
changeOrigin: true,
125
ws: true,
126
rewrite: (path) => path.replace(/^\/wisp\//, "")
127
},
128
"/styles": {
129
target: "http://localhost:8080",
130
changeOrigin: true
131
}
132
}
133
}
134
},
135
output: "server",
136
adapter: node({
137
mode: "middleware"
138
})
139
});
140
141