fix
This commit is contained in:
parent
4a6ac8db6b
commit
4e511eef9e
|
|
@ -21,6 +21,8 @@ export const initFrontEnd = async (
|
||||||
) => {
|
) => {
|
||||||
let existing = code.internal.frontend[id_site];
|
let existing = code.internal.frontend[id_site];
|
||||||
|
|
||||||
|
await isInstalling(id_site);
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
if (existing.npm) {
|
if (existing.npm) {
|
||||||
if (pending[id_site]) return;
|
if (pending[id_site]) return;
|
||||||
|
|
@ -48,8 +50,6 @@ export const initFrontEnd = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await isInstalling(id_site);
|
|
||||||
|
|
||||||
if (code.internal.frontend[id_site]?.watch) {
|
if (code.internal.frontend[id_site]?.watch) {
|
||||||
await code.internal.frontend[id_site].watch.close();
|
await code.internal.frontend[id_site].watch.close();
|
||||||
}
|
}
|
||||||
|
|
@ -111,6 +111,17 @@ const isInstalling = async (id_site: string) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const k of Object.keys(pkg_json.dependencies)) {
|
||||||
|
if (
|
||||||
|
!(await Bun.file(
|
||||||
|
code.path(id_site, "site", "src", `node_modules/${k}`)
|
||||||
|
).exists())
|
||||||
|
) {
|
||||||
|
should_install = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (should_install) {
|
if (should_install) {
|
||||||
await Bun.write(pkg, JSON.stringify(pkg_json, null, 2));
|
await Bun.write(pkg, JSON.stringify(pkg_json, null, 2));
|
||||||
await $`npm i`.cwd(code.path(id_site, "site", "src")).quiet();
|
await $`npm i`.cwd(code.path(id_site, "site", "src")).quiet();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ const watchers = {} as Record<string, FSWatcher>;
|
||||||
|
|
||||||
const createWatcher = (p: string, recursive: boolean) => {
|
const createWatcher = (p: string, recursive: boolean) => {
|
||||||
return watch(p, { recursive }, (e, filename) => {
|
return watch(p, { recursive }, (e, filename) => {
|
||||||
|
if (filename === "global.d.ts") return;
|
||||||
if (
|
if (
|
||||||
filename?.endsWith(".tsx") ||
|
filename?.endsWith(".tsx") ||
|
||||||
filename?.endsWith(".ts") ||
|
filename?.endsWith(".ts") ||
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export class Watcher {
|
||||||
stdout: "inherit",
|
stdout: "inherit",
|
||||||
stderr: "inherit",
|
stderr: "inherit",
|
||||||
ipc(message, childProc) {
|
ipc(message, childProc) {
|
||||||
|
console.log(id_site, message);
|
||||||
const fe = code.internal.frontend[id_site];
|
const fe = code.internal.frontend[id_site];
|
||||||
if (typeof fe !== "undefined" && !fe.rebuilding) {
|
if (typeof fe !== "undefined" && !fe.rebuilding) {
|
||||||
fe.rebuilding = true;
|
fe.rebuilding = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue