fix
This commit is contained in:
parent
c19505692a
commit
6e1ad373dd
|
|
@ -76,6 +76,7 @@ export const codeBuild = async (code: DBCode) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
console.error(e);
|
||||||
activity.site
|
activity.site
|
||||||
.room(code.id_site)
|
.room(code.id_site)
|
||||||
.findAll({ site_js: code.name })
|
.findAll({ site_js: code.name })
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export const startCodeWatcher = async (code: DBCode) => {
|
||||||
let delay = false;
|
let delay = false;
|
||||||
const indexes = {} as Record<string, (typeof code)["code_file"][0]>;
|
const indexes = {} as Record<string, (typeof code)["code_file"][0]>;
|
||||||
|
|
||||||
if (code.code_file.length === 0) {
|
if (!code.code_file.find((e) => e.path === "package.json")) {
|
||||||
code.code_file.push(
|
code.code_file.push(
|
||||||
await db.code_file.create({
|
await db.code_file.create({
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -45,6 +45,20 @@ export const startCodeWatcher = async (code: DBCode) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!code.code_file.find((e) => e.path === "index.tsx")) {
|
||||||
|
let content = `export const hello = 'world';`;
|
||||||
|
|
||||||
|
code.code_file.push(
|
||||||
|
await db.code_file.create({
|
||||||
|
data: {
|
||||||
|
id_code: code.id,
|
||||||
|
path: "index.tsx",
|
||||||
|
content,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for (const c of code.code_file) {
|
for (const c of code.code_file) {
|
||||||
const path = Code.path(c.id_code, c.path);
|
const path = Code.path(c.id_code, c.path);
|
||||||
|
|
||||||
|
|
@ -67,6 +81,8 @@ export const startCodeWatcher = async (code: DBCode) => {
|
||||||
stderr: "ignore",
|
stderr: "ignore",
|
||||||
stdout: "ignore",
|
stdout: "ignore",
|
||||||
}).exited;
|
}).exited;
|
||||||
|
|
||||||
|
await codeBuild(code);
|
||||||
|
|
||||||
Code.watchers[code.id] = {
|
Code.watchers[code.id] = {
|
||||||
id: code.id,
|
id: code.id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue