wip prep-d-code
This commit is contained in:
parent
32c9d3a46c
commit
30c89dc617
|
|
@ -13,7 +13,7 @@ export const prepCode = async (site_id: string, name: string) => {
|
||||||
let code = await getCode(site_id, name);
|
let code = await getCode(site_id, name);
|
||||||
|
|
||||||
const pkgfile = Bun.file(
|
const pkgfile = Bun.file(
|
||||||
dir.path(`${g.datadir}/site/code/${site_id}/package.json`)
|
dir.path(`${g.datadir}/site/code/${site_id}/package.json`),
|
||||||
);
|
);
|
||||||
if (!(await pkgfile.exists())) {
|
if (!(await pkgfile.exists())) {
|
||||||
await dirAsync(dir.path(`${g.datadir}/site/code/${site_id}`));
|
await dirAsync(dir.path(`${g.datadir}/site/code/${site_id}`));
|
||||||
|
|
@ -25,14 +25,13 @@ export const prepCode = async (site_id: string, name: string) => {
|
||||||
workspaces: ["./*"],
|
workspaces: ["./*"],
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
await dirAsync(dir.path(`${g.datadir}/site/code/${site_id}/${code.id}`));
|
await dirAsync(dir.path(`${g.datadir}/site/code/${site_id}/${code.id}`));
|
||||||
|
|
||||||
await prepDCode(site_id);
|
await prepDCode(site_id);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,7 @@ export const hello_world = () => {
|
||||||
dependencies: {},
|
dependencies: {},
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -114,6 +113,11 @@ export const prepDCode = async (site_id: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
Bun.spawn({
|
||||||
|
cmd: ["chmod", "777", "-R", "."],
|
||||||
|
cwd: dir.path(`${g.datadir}/site}`),
|
||||||
|
});
|
||||||
|
|
||||||
const src_bin = Y.encodeStateAsUpdate(docs.code[site_id].src as Doc);
|
const src_bin = Y.encodeStateAsUpdate(docs.code[site_id].src as Doc);
|
||||||
const build_bin = Y.encodeStateAsUpdate(docs.code[site_id].build as Doc);
|
const build_bin = Y.encodeStateAsUpdate(docs.code[site_id].build as Doc);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue