wip deploy -> prod

This commit is contained in:
Rizky 2024-02-08 19:32:36 +07:00
parent 620b387ebc
commit 63d1bd3a4d
14 changed files with 14 additions and 15 deletions

View File

@ -5,7 +5,7 @@ import { code } from "../ws/sync/editor/code/util-code";
import { gzipAsync } from "../ws/sync/entity/zlib";
export const _ = {
url: "/deploy/:site_id/**",
url: "/prod/:site_id/**",
async api() {
const { req, res } = apiContext(this);
@ -25,9 +25,9 @@ export const _ = {
<body class="flex-col flex-1 w-full min-h-screen flex opacity-0">
<div id="root"></div>
<script>
window._prasi={basepath: "/deploy/${site_id}",site_id:"${site_id}"}
window._prasi={basepath: "/prod/${site_id}",site_id:"${site_id}"}
</script>
<script src="/deploy/${site_id}/main.js" type="module"></script>
<script src="/prod/${site_id}/main.js" type="module"></script>
</body>
</html>`,
{ headers: { "content-type": "text/html" } }
@ -158,7 +158,7 @@ window._prasi={basepath: "/deploy/${site_id}",site_id:"${site_id}"}
} else if (pathname === "index.html" || pathname === "_") {
return index_html;
} else {
const res = dir.data(`/deploy/${pathname}`);
const res = dir.data(`/prod/${pathname}`);
const file = Bun.file(res);
if (!(await file.exists())) {
return index_html;

View File

@ -128,7 +128,7 @@ const CodeBody = () => {
<div className="relative w-full h-full flex flex-col">
<div className="border-b flex justify-between h-[40px] items-stretch">
<div className="flex items-stretch">
<Popover
{/* <Popover
placement="bottom"
offset={0}
arrow={false}
@ -161,7 +161,7 @@ const CodeBody = () => {
__html: iconChevronDown,
}}
></div>
</Popover>
</Popover> */}
{/* <Tooltip
content="STDOUT Log"

View File

@ -24,11 +24,11 @@ import { w } from "./w";
location.hostname === "10.0.2.2" // android localhost
) {
if (
location.pathname.startsWith("/deploy") &&
!_href.startsWith("/deploy")
location.pathname.startsWith("/prod") &&
!_href.startsWith("/prod")
) {
const patharr = location.pathname.split("/");
_href = `/deploy/${patharr[2]}${_href}`;
_href = `/prod/${patharr[2]}${_href}`;
}
}
}

View File

@ -30,7 +30,7 @@ export const Root = () => {
const site_script = evalCJS(
await (
await fetch(`/deploy/${base.site.id}/_prasi/code/index.js`)
await fetch(`/prod/${base.site.id}/_prasi/code/index.js`)
).text()
);
if (site_script) {

View File

@ -1,12 +1,11 @@
import { dir } from "dir";
import { context } from "esbuild";
import { g } from "./utils/global";
const ctx = await context({
bundle: true,
absWorkingDir: dir.path(""),
entryPoints: [dir.path("app/web/src/nova/deploy/main.tsx")],
outdir: dir.data(`/deploy`),
entryPoints: [dir.path("app/web/src/nova/prod/main.tsx")],
outdir: dir.data(`/prod`),
splitting: true,
format: "esm",
jsx: "transform",

View File

@ -16,7 +16,7 @@ const onEndPlugin: Plugin = {
},
};
console.log("Building deploy");
console.log("Building site deploy");
const ctx = await context({
bundle: true,
absWorkingDir: dir.path(""),

View File

@ -76,7 +76,7 @@ if (!g.parcel) {
await parcelBuild();
}
await import("./build-deploy");
await import("./build-prod");
const { createServer } = await import("./server/create");
await createServer();