Closed lubosmato closed 3 months ago
@lubosmato Thanks for contributing!
There are some missing bits that I'd like to add before merging, would you please enable Allow edits from maintainers?
Hi @vicary, thank you for this amazing project. Allow by maintainers should be allowed.
@lubosmato For some reason a canary is not published, would you like to test the main branch locally before release?
@vicary I have just tested it and it's not working 🤔. I will check what is the problem and ping back.
isMatch
is now checking resolved file path against parent folder which is not correct. E.g. fullPath = "./api/schema.graphql"
and wachEndpoints = ["./api/"]
.
The correct isMatch
params should be fullPath
and resolved filenames of endpoints
:
diff --git a/packages/cli/src/commands/default.ts b/packages/cli/src/commands/default.ts
index 1f54a4b4..9d9c4508 100644
--- a/packages/cli/src/commands/default.ts
+++ b/packages/cli/src/commands/default.ts
@@ -274,12 +274,13 @@ export const addCommand = (command: Command) => {
// Watch file changes
(async () => {
- const watchEndpoints = endpoints
- .map((endpoint) => path.resolve(endpoint))
+ const watchFiles = endpoints
+ .map((endpoint) => path.resolve(endpoint));
+ const watchDirectories = watchFiles
.map((endpoint) => path.dirname(endpoint));
const watchIterable = pipeAsync(
- [...new Set(watchEndpoints)],
+ [...new Set(watchDirectories)],
map((path) =>
pipeAsync(
watch(path),
@@ -296,7 +297,7 @@ export const addCommand = (command: Command) => {
const fullPath = path.resolve(parentPath, filename);
- if (!isMatch(fullPath, watchEndpoints)) continue;
+ if (!isMatch(fullPath, watchFiles)) continue;
// Already queued
if (shouldRun) continue;
@lubosmato My bad for the oversight, pushed again to main.
The PR fixes watching of schema files that are outside of working directory.
Solves #1997