@ovipakla/gm-cli 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/GMFileWatcher.js +17 -6
  2. package/package.json +1 -1
package/GMFileWatcher.js CHANGED
@@ -69,6 +69,15 @@ function defaultWatcherHook() {
69
69
  };
70
70
  }
71
71
 
72
+ function syncWatcherHook() {
73
+ return {
74
+ ignored: /[\/\\]\./,
75
+ persistent: false,
76
+ ignoreInitial: true,
77
+ depth: 99,
78
+ };
79
+ }
80
+
72
81
  /* ---------------------------------------------------------
73
82
  * GMFileWatcher
74
83
  * --------------------------------------------------------- */
@@ -88,16 +97,16 @@ class GMFileWatcher {
88
97
 
89
98
  initializeWatchedModules(dependencies) {
90
99
  return dependencies.map(([name, version]) => {
91
- const gmModule = this.parseModule(name, version);
100
+ const gmModule = this.parseModule(name, version, true);
92
101
  this.syncModuleFiles(name, gmModule.dir, gmModule.objectWatchers, gmModule.sceneWatchers);
93
102
  return gmModule;
94
103
  });
95
104
  }
96
105
 
97
106
  initializeSyncModules(dependencies) {
98
- dependencies.forEach(([name]) => {
99
- const modulePath = path.join(this.modulesDirPath, name);
100
- this.syncModuleFiles(name, modulePath);
107
+ dependencies.forEach(([name, version]) => {
108
+ const gmModule = this.parseModule(name, version, false);
109
+ this.syncModuleFiles(name, gmModule.dir, gmModule.objectWatchers, gmModule.sceneWatchers);
101
110
  });
102
111
  return [];
103
112
  }
@@ -171,8 +180,10 @@ class GMFileWatcher {
171
180
  /* ---------------------------------------------
172
181
  * Watcher handlers
173
182
  * --------------------------------------------- */
174
- parseModule(name, version) {
175
- const gmModule = new GMModule(resolvePath(path.join(this.modulesDirName, name)), version);
183
+ parseModule(name, version, watch = true) {
184
+ const gmModule = new GMModule(resolvePath(path.join(this.modulesDirName, name)), version, watch
185
+ ? defaultWatcherHook()
186
+ : syncWatcherHook());
176
187
 
177
188
  const moduleFilter = (p, module) =>
178
189
  path.normalize(p).includes(path.normalize(module.dir));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.1",
6
+ "version": "1.0.2",
7
7
  "description": "Gamemaker CLI toolkit. Watch & sync gml sources with yyp project.",
8
8
  "main": "app.js",
9
9
  "scripts": {},