wip deploy -> prod
This commit is contained in:
parent
620b387ebc
commit
63d1bd3a4d
|
|
@ -5,7 +5,7 @@ import { code } from "../ws/sync/editor/code/util-code";
|
||||||
import { gzipAsync } from "../ws/sync/entity/zlib";
|
import { gzipAsync } from "../ws/sync/entity/zlib";
|
||||||
|
|
||||||
export const _ = {
|
export const _ = {
|
||||||
url: "/deploy/:site_id/**",
|
url: "/prod/:site_id/**",
|
||||||
async api() {
|
async api() {
|
||||||
const { req, res } = apiContext(this);
|
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">
|
<body class="flex-col flex-1 w-full min-h-screen flex opacity-0">
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script>
|
<script>
|
||||||
window._prasi={basepath: "/deploy/${site_id}",site_id:"${site_id}"}
|
window._prasi={basepath: "/prod/${site_id}",site_id:"${site_id}"}
|
||||||
</script>
|
</script>
|
||||||
<script src="/deploy/${site_id}/main.js" type="module"></script>
|
<script src="/prod/${site_id}/main.js" type="module"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>`,
|
</html>`,
|
||||||
{ headers: { "content-type": "text/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 === "_") {
|
} else if (pathname === "index.html" || pathname === "_") {
|
||||||
return index_html;
|
return index_html;
|
||||||
} else {
|
} else {
|
||||||
const res = dir.data(`/deploy/${pathname}`);
|
const res = dir.data(`/prod/${pathname}`);
|
||||||
const file = Bun.file(res);
|
const file = Bun.file(res);
|
||||||
if (!(await file.exists())) {
|
if (!(await file.exists())) {
|
||||||
return index_html;
|
return index_html;
|
||||||
|
|
@ -128,7 +128,7 @@ const CodeBody = () => {
|
||||||
<div className="relative w-full h-full flex flex-col">
|
<div className="relative w-full h-full flex flex-col">
|
||||||
<div className="border-b flex justify-between h-[40px] items-stretch">
|
<div className="border-b flex justify-between h-[40px] items-stretch">
|
||||||
<div className="flex items-stretch">
|
<div className="flex items-stretch">
|
||||||
<Popover
|
{/* <Popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
offset={0}
|
offset={0}
|
||||||
arrow={false}
|
arrow={false}
|
||||||
|
|
@ -161,7 +161,7 @@ const CodeBody = () => {
|
||||||
__html: iconChevronDown,
|
__html: iconChevronDown,
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
</Popover>
|
</Popover> */}
|
||||||
|
|
||||||
{/* <Tooltip
|
{/* <Tooltip
|
||||||
content="STDOUT Log"
|
content="STDOUT Log"
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ import { w } from "./w";
|
||||||
location.hostname === "10.0.2.2" // android localhost
|
location.hostname === "10.0.2.2" // android localhost
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
location.pathname.startsWith("/deploy") &&
|
location.pathname.startsWith("/prod") &&
|
||||||
!_href.startsWith("/deploy")
|
!_href.startsWith("/prod")
|
||||||
) {
|
) {
|
||||||
const patharr = location.pathname.split("/");
|
const patharr = location.pathname.split("/");
|
||||||
_href = `/deploy/${patharr[2]}${_href}`;
|
_href = `/prod/${patharr[2]}${_href}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ export const Root = () => {
|
||||||
|
|
||||||
const site_script = evalCJS(
|
const site_script = evalCJS(
|
||||||
await (
|
await (
|
||||||
await fetch(`/deploy/${base.site.id}/_prasi/code/index.js`)
|
await fetch(`/prod/${base.site.id}/_prasi/code/index.js`)
|
||||||
).text()
|
).text()
|
||||||
);
|
);
|
||||||
if (site_script) {
|
if (site_script) {
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import { dir } from "dir";
|
import { dir } from "dir";
|
||||||
import { context } from "esbuild";
|
import { context } from "esbuild";
|
||||||
import { g } from "./utils/global";
|
|
||||||
|
|
||||||
const ctx = await context({
|
const ctx = await context({
|
||||||
bundle: true,
|
bundle: true,
|
||||||
absWorkingDir: dir.path(""),
|
absWorkingDir: dir.path(""),
|
||||||
entryPoints: [dir.path("app/web/src/nova/deploy/main.tsx")],
|
entryPoints: [dir.path("app/web/src/nova/prod/main.tsx")],
|
||||||
outdir: dir.data(`/deploy`),
|
outdir: dir.data(`/prod`),
|
||||||
splitting: true,
|
splitting: true,
|
||||||
format: "esm",
|
format: "esm",
|
||||||
jsx: "transform",
|
jsx: "transform",
|
||||||
|
|
@ -16,7 +16,7 @@ const onEndPlugin: Plugin = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("Building deploy");
|
console.log("Building site deploy");
|
||||||
const ctx = await context({
|
const ctx = await context({
|
||||||
bundle: true,
|
bundle: true,
|
||||||
absWorkingDir: dir.path(""),
|
absWorkingDir: dir.path(""),
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ if (!g.parcel) {
|
||||||
await parcelBuild();
|
await parcelBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
await import("./build-deploy");
|
await import("./build-prod");
|
||||||
|
|
||||||
const { createServer } = await import("./server/create");
|
const { createServer } = await import("./server/create");
|
||||||
await createServer();
|
await createServer();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue