virmator 7.0.0 → 7.0.1

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.
@@ -5,7 +5,10 @@ export const ncuConfig: RunOptions = {
5
5
  upgrade: true,
6
6
  root: true,
7
7
  // exclude these
8
- reject: [],
8
+ reject: [
9
+ /** Not ready for v3. */
10
+ 'prettier',
11
+ ],
9
12
  // include only these
10
13
  filter: [],
11
14
  };
@@ -7,5 +7,4 @@ export declare function alwaysReloadPlugin(config?: Partial<{
7
7
  exclusions: string[];
8
8
  /** Inclusions apply after exclusions so they will override exclusions. */
9
9
  inclusions: string[];
10
- root: string;
11
10
  }>): PluginOption;
@@ -36,16 +36,10 @@ function alwaysReloadPlugin(config = {}) {
36
36
  name: 'alwaysReloadPlugin',
37
37
  apply: 'serve',
38
38
  config: () => ({ server: { watch: { disableGlobbing: false } } }),
39
- configureServer({ watcher, ws, config: { logger } }) {
40
- const { root = process.cwd(), inclusions = [], exclusions = [] } = config;
39
+ configureServer({ watcher, ws, config: { logger, publicDir = '', root = process.cwd() } }) {
40
+ const { inclusions = [], exclusions = [] } = config;
41
41
  let callingAlready = false;
42
- let loggedAlready = false;
43
- const reloadCallback = (path) => {
44
- if (!loggedAlready) {
45
- loggedAlready = true;
46
- // log watched stuff so that we can make sure it's not watching too much
47
- // console.info({watched: watcher.getWatched()});
48
- }
42
+ function reloadCallback(path) {
49
43
  // prevent duplicate calls cause the watcher is very eager to call callbacks multiple times in a row
50
44
  if (!callingAlready) {
51
45
  callingAlready = true;
@@ -53,28 +47,39 @@ function alwaysReloadPlugin(config = {}) {
53
47
  type: 'full-reload',
54
48
  path: '*',
55
49
  });
56
- logger.info(`${node_js_1.logColors.success}page reload ${node_js_1.logColors.faint}${(0, path_1.relative)(root, path)}${node_js_1.logColors.reset}`, { clear: true, timestamp: true });
50
+ logger.info(`${node_js_1.logColors.success}page reload ${node_js_1.logColors.faint}${(0, path_1.relative)(process.cwd(), path)}${node_js_1.logColors.reset}`, {
51
+ clear: true,
52
+ timestamp: true,
53
+ });
57
54
  /**
58
- * Debounce reloads calls so that they don't get spammed. If you're saving
59
- * faster than this, then what the heck are you doing anyway?
55
+ * Debounce reloads calls so that they don't get spammed. If you're actually
56
+ * intentionally saving faster than this, then what the heck are you doing?
60
57
  */
61
58
  setTimeout(() => {
62
59
  callingAlready = false;
63
60
  }, 100);
64
61
  }
65
- };
62
+ }
63
+ watcher.add(root);
66
64
  if (exclusions.length) {
67
65
  watcher.unwatch(mapToActualPaths(exclusions));
68
- // ignore macOS file system metadata stuff
69
66
  }
67
+ // ignore macOS file system metadata stuff
70
68
  watcher.unwatch('./**/.DS_Store');
71
69
  if (inclusions.length) {
72
- watcher.add(inclusions);
70
+ watcher.add(mapToActualPaths(inclusions));
71
+ }
72
+ if (publicDir) {
73
+ watcher.add(publicDir);
73
74
  }
75
+ watcher.removeAllListeners();
74
76
  if (!watcher.listeners('change').includes(reloadCallback)) {
75
77
  watcher.on('change', reloadCallback);
76
78
  watcher.on('add', reloadCallback);
79
+ watcher.on('unlink', reloadCallback);
77
80
  }
81
+ // // for debugging. Note that this isn't actually reliable, test the actual reloads.
82
+ // console.info({watched: watcher.getWatched()});
78
83
  },
79
84
  };
80
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",