Skip to content

Only watch necessary files#189

Open
EliTheGingerCat wants to merge 2 commits intoevaera:masterfrom
EliTheGingerCat:fix-watch-necessary
Open

Only watch necessary files#189
EliTheGingerCat wants to merge 2 commits intoevaera:masterfrom
EliTheGingerCat:fix-watch-necessary

Conversation

@EliTheGingerCat
Copy link
Copy Markdown
Contributor

Rather than watch projectDir and all of its descendants, this pull request changes it so that the CLI watches projectDir shallowly and watches everything in watchPaths deeply. This means that new relevant items are detected, such as ./pages, while ignoring anything beyond that, such as ignoring the descendants of ./node_modules.

I am pretty sure everything else behaves the same, but it is hard to tell. I did come across some things that seem strange while testing, but it appears that these existed before, so it is not a regression. Here are the issues:

  • The topbar navigation buttons for changelog, blog, et cetera do not hot reload. If these things exist when starting the local site, they persist even if the relevant files are deleted. Similarly, if they do not exist when starting the local site, they will never create topbar buttons, though the pages still work, that is, http://localhost:3000/changelog would be available if CHANGELOG.md is added after starting the local site.
  • If the website started with ./docs/intro.md, then removing/renaming it causes an error until it is returned.
  • There is an option for enabling the changelog in moonwave.toml, but it does not matter because it is always set to true:
    changelog: true,

I am curious as to where the program says to watch changes to ./src / ./lib since these are not included in watchPaths.

On a side note, I think moonwave.json is not mentioned anywhere on the website, even though it is valid as the fallback configuration file if moonwave.toml is missing.

Closes #178

@EliTheGingerCat
Copy link
Copy Markdown
Contributor Author

By the way, I tested whether descendants of irrelevant directories would be watched by adding console.log("changed") in onAll in ./cli/src/commands/dev.ts and then adding files under node_modules and noticing how the console message is not sent.

@EliTheGingerCat
Copy link
Copy Markdown
Contributor Author

I am curious as to where the program says to watch changes to ./src / ./lib since these are not included in watchPaths.

Quote from #189 (comment)

I think I found it:

getPathsToWatch() {
return options.code.map((filePath) => `${filePath}/**/*.{lua,luau}`)
},

@YetAnotherClown YetAnotherClown added bug Something isn't working cli labels Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filewatcher watches node_modules and other directories it doesn't need to

2 participants