fix: account for chokidar v4 glob deprecation in source watching
This commit is contained in:
parent
f84a6554f6
commit
a6b2967df8
1 changed files with 7 additions and 7 deletions
|
@ -15,6 +15,7 @@ import { WebSocketServer } from "ws"
|
||||||
import { randomUUID } from "crypto"
|
import { randomUUID } from "crypto"
|
||||||
import { Mutex } from "async-mutex"
|
import { Mutex } from "async-mutex"
|
||||||
import { CreateArgv } from "./args.js"
|
import { CreateArgv } from "./args.js"
|
||||||
|
import { globby } from "globby"
|
||||||
import {
|
import {
|
||||||
exitIfCancel,
|
exitIfCancel,
|
||||||
escapePath,
|
escapePath,
|
||||||
|
@ -290,8 +291,8 @@ export async function handleBuild(argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleanupBuild) {
|
if (cleanupBuild) {
|
||||||
await cleanupBuild()
|
|
||||||
console.log(chalk.yellow("Detected a source code change, doing a hard rebuild..."))
|
console.log(chalk.yellow("Detected a source code change, doing a hard rebuild..."))
|
||||||
|
await cleanupBuild()
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await ctx.rebuild().catch((err) => {
|
const result = await ctx.rebuild().catch((err) => {
|
||||||
|
@ -423,13 +424,12 @@ export async function handleBuild(argv) {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
console.log("hint: exit with ctrl+c")
|
console.log("hint: exit with ctrl+c")
|
||||||
|
const paths = await globby(["**/*.ts", "**/*.tsx", "**/*.scss", "package.json"])
|
||||||
chokidar
|
chokidar
|
||||||
.watch(["**/*.ts", "**/*.tsx", "**/*.scss", "package.json"], {
|
.watch(paths, { ignoreInitial: true })
|
||||||
ignoreInitial: true,
|
.on("add", () => build(clientRefresh))
|
||||||
})
|
.on("change", () => build(clientRefresh))
|
||||||
.on("all", async () => {
|
.on("unlink", () => build(clientRefresh))
|
||||||
build(clientRefresh)
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
await build(() => {})
|
await build(() => {})
|
||||||
ctx.dispose()
|
ctx.dispose()
|
||||||
|
|
Loading…
Reference in a new issue