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];
|
||||
|
||||
await isInstalling(id_site);
|
||||
|
||||
if (existing) {
|
||||
if (existing.npm) {
|
||||
if (pending[id_site]) return;
|
||||
|
|
@ -48,8 +50,6 @@ export const initFrontEnd = async (
|
|||
}
|
||||
|
||||
try {
|
||||
await isInstalling(id_site);
|
||||
|
||||
if (code.internal.frontend[id_site]?.watch) {
|
||||
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) {
|
||||
await Bun.write(pkg, JSON.stringify(pkg_json, null, 2));
|
||||
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) => {
|
||||
return watch(p, { recursive }, (e, filename) => {
|
||||
if (filename === "global.d.ts") return;
|
||||
if (
|
||||
filename?.endsWith(".tsx") ||
|
||||
filename?.endsWith(".ts") ||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export class Watcher {
|
|||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
ipc(message, childProc) {
|
||||
console.log(id_site, message);
|
||||
const fe = code.internal.frontend[id_site];
|
||||
if (typeof fe !== "undefined" && !fe.rebuilding) {
|
||||
fe.rebuilding = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue