@graphql-codegen/cli 3.2.0 → 3.2.1-alpha-20230223182235-254177bec

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
7
7
  const utils_1 = require("@graphql-tools/utils");
8
8
  const debounce_1 = tslib_1.__importDefault(require("debounce"));
9
9
  const is_glob_1 = tslib_1.__importDefault(require("is-glob"));
10
+ const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
10
11
  const log_symbols_1 = tslib_1.__importDefault(require("log-symbols"));
11
12
  const codegen_js_1 = require("../codegen.js");
12
13
  const config_js_1 = require("../config.js");
@@ -82,6 +83,12 @@ const createWatcher = (initalContext, onNext) => {
82
83
  watcherSubscription = await parcelWatcher.subscribe(process.cwd(), async (_, events) => {
83
84
  // it doesn't matter what has changed, need to run whole process anyway
84
85
  await Promise.all(events.map(async ({ type: eventName, path }) => {
86
+ /**
87
+ * @parcel/watcher has no way to run watcher on specific files (https://github.com/parcel-bundler/watcher/issues/42)
88
+ * But we can use micromatch to filter out events that we don't care about
89
+ */
90
+ if (!micromatch_1.default.contains(path, files))
91
+ return;
85
92
  (0, hooks_js_1.lifecycleHooks)(config.hooks).onWatchTriggered(eventName, path);
86
93
  (0, debugging_js_1.debugLog)(`[Watcher] triggered due to a file ${eventName} event: ${path}`);
87
94
  const fullPath = (0, path_1.join)(process.cwd(), path);
@@ -3,6 +3,7 @@ import { normalizeInstanceOrArray, normalizeOutputParam } from '@graphql-codegen
3
3
  import { isValidPath } from '@graphql-tools/utils';
4
4
  import debounce from 'debounce';
5
5
  import isGlob from 'is-glob';
6
+ import mm from 'micromatch';
6
7
  import logSymbols from 'log-symbols';
7
8
  import { executeCodegen } from '../codegen.js';
8
9
  import { loadContext } from '../config.js';
@@ -78,6 +79,12 @@ export const createWatcher = (initalContext, onNext) => {
78
79
  watcherSubscription = await parcelWatcher.subscribe(process.cwd(), async (_, events) => {
79
80
  // it doesn't matter what has changed, need to run whole process anyway
80
81
  await Promise.all(events.map(async ({ type: eventName, path }) => {
82
+ /**
83
+ * @parcel/watcher has no way to run watcher on specific files (https://github.com/parcel-bundler/watcher/issues/42)
84
+ * But we can use micromatch to filter out events that we don't care about
85
+ */
86
+ if (!mm.contains(path, files))
87
+ return;
81
88
  lifecycleHooks(config.hooks).onWatchTriggered(eventName, path);
82
89
  debugLog(`[Watcher] triggered due to a file ${eventName} event: ${path}`);
83
90
  const fullPath = join(process.cwd(), path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "3.2.0",
3
+ "version": "3.2.1-alpha-20230223182235-254177bec",
4
4
  "peerDependencies": {
5
5
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
6
6
  },
@@ -33,6 +33,7 @@
33
33
  "json-to-pretty-yaml": "^1.2.2",
34
34
  "listr2": "^4.0.5",
35
35
  "log-symbols": "^4.0.0",
36
+ "micromatch": "^4.0.5",
36
37
  "shell-quote": "^1.7.3",
37
38
  "string-env-interpolation": "^1.0.1",
38
39
  "ts-log": "^2.2.3",