Skip to content

Commit 9969015

Browse files
committed
only watch src when running inside the monorepo
1 parent 345d78a commit 9969015

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@erikt/docgen",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"type": "module",
55
"bin": {
66
"docgen": "./dist/bin.js"

packages/core/src/bin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import { spawn } from "node:child_process";
4+
import { existsSync } from "node:fs";
45
import { resolve } from "node:path";
56
import { pathToFileURL } from "node:url";
67
import { buildDocs } from "./index.js";
@@ -9,7 +10,9 @@ const command = process.argv[2];
910
const configPath = resolve("docs.config.ts");
1011

1112
if (command === "dev") {
12-
spawn("node", ["--watch", "--watch-path=./pages", `--watch-path=${resolve(import.meta.dirname, "..", "src")}`, configPath], { stdio: "inherit" });
13+
const coreSrc = resolve(import.meta.dirname, "..", "src");
14+
const watchArgs = existsSync(coreSrc) ? [`--watch-path=${coreSrc}`] : [];
15+
spawn("node", ["--watch", "--watch-path=./pages", ...watchArgs, configPath], { stdio: "inherit" });
1316
} else if (command === "build") {
1417
const { default: configPromise } = await import(pathToFileURL(configPath).href);
1518
const config = await configPromise;

0 commit comments

Comments
 (0)