@kapeta/local-cluster-service 0.21.1 → 0.21.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.21.2](https://github.com/kapetacom/local-cluster-service/compare/v0.21.1...v0.21.2) (2023-09-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Handle windows paths in watcher ([#81](https://github.com/kapetacom/local-cluster-service/issues/81)) ([a2b7c3d](https://github.com/kapetacom/local-cluster-service/commit/a2b7c3dc9efba4d1b6d0a1a64703f7cf40ea3278))
7
+
1
8
  ## [0.21.1](https://github.com/kapetacom/local-cluster-service/compare/v0.21.0...v0.21.1) (2023-09-19)
2
9
 
3
10
 
@@ -96,7 +96,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
96
96
  if (path.startsWith(this.baseDir)) {
97
97
  const relativePath = node_path_1.default.relative(this.baseDir, path);
98
98
  // Inside the repo we can use the path to determine the handle, name and version
99
- [handle, name, version] = relativePath.split(/\//g);
99
+ [handle, name, version] = relativePath.split(node_path_1.default.sep);
100
100
  if (!handle || !name || !version) {
101
101
  // Do nothing with this
102
102
  return;
@@ -134,7 +134,6 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
134
134
  if (!path) {
135
135
  return;
136
136
  }
137
- //console.log('File changed', eventName, path);
138
137
  const assetIdentity = await this.getAssetIdentity(path);
139
138
  if (!assetIdentity) {
140
139
  return;
@@ -144,7 +143,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
144
143
  }
145
144
  // If this is false it's because we're watching a symlink target
146
145
  const withinRepo = path.startsWith(this.baseDir);
147
- if (withinRepo && assetIdentity.version === 'local' && path.endsWith('/local')) {
146
+ if (withinRepo && assetIdentity.version === 'local' && path.endsWith(node_path_1.default.sep + 'local')) {
148
147
  // This is likely a symlink target
149
148
  if (eventName === 'add') {
150
149
  //console.log('Checking if we should add symlink target', handle, name, version, path);
@@ -244,7 +243,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
244
243
  }
245
244
  catch (e) { }
246
245
  if (symbolicLink) {
247
- const realPath = `${await fs_extra_1.default.realpath(path)}/kapeta.yml`;
246
+ const realPath = node_path_1.default.join(await fs_extra_1.default.realpath(path), 'kapeta.yml');
248
247
  if (await this.exists(realPath)) {
249
248
  //console.log('Watching symlink target %s => %s', path, realPath);
250
249
  this.watcher?.add(realPath);
@@ -261,7 +260,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
261
260
  if (!path.startsWith(this.baseDir)) {
262
261
  return false;
263
262
  }
264
- if (path.includes('/node_modules/')) {
263
+ if (path.includes(node_path_1.default.sep + 'node_modules' + node_path_1.default.sep)) {
265
264
  return true;
266
265
  }
267
266
  const filename = node_path_1.default.basename(path);
@@ -96,7 +96,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
96
96
  if (path.startsWith(this.baseDir)) {
97
97
  const relativePath = node_path_1.default.relative(this.baseDir, path);
98
98
  // Inside the repo we can use the path to determine the handle, name and version
99
- [handle, name, version] = relativePath.split(/\//g);
99
+ [handle, name, version] = relativePath.split(node_path_1.default.sep);
100
100
  if (!handle || !name || !version) {
101
101
  // Do nothing with this
102
102
  return;
@@ -134,7 +134,6 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
134
134
  if (!path) {
135
135
  return;
136
136
  }
137
- //console.log('File changed', eventName, path);
138
137
  const assetIdentity = await this.getAssetIdentity(path);
139
138
  if (!assetIdentity) {
140
139
  return;
@@ -144,7 +143,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
144
143
  }
145
144
  // If this is false it's because we're watching a symlink target
146
145
  const withinRepo = path.startsWith(this.baseDir);
147
- if (withinRepo && assetIdentity.version === 'local' && path.endsWith('/local')) {
146
+ if (withinRepo && assetIdentity.version === 'local' && path.endsWith(node_path_1.default.sep + 'local')) {
148
147
  // This is likely a symlink target
149
148
  if (eventName === 'add') {
150
149
  //console.log('Checking if we should add symlink target', handle, name, version, path);
@@ -244,7 +243,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
244
243
  }
245
244
  catch (e) { }
246
245
  if (symbolicLink) {
247
- const realPath = `${await fs_extra_1.default.realpath(path)}/kapeta.yml`;
246
+ const realPath = node_path_1.default.join(await fs_extra_1.default.realpath(path), 'kapeta.yml');
248
247
  if (await this.exists(realPath)) {
249
248
  //console.log('Watching symlink target %s => %s', path, realPath);
250
249
  this.watcher?.add(realPath);
@@ -261,7 +260,7 @@ class RepositoryWatcher extends node_events_1.EventEmitter {
261
260
  if (!path.startsWith(this.baseDir)) {
262
261
  return false;
263
262
  }
264
- if (path.includes('/node_modules/')) {
263
+ if (path.includes(node_path_1.default.sep + 'node_modules' + node_path_1.default.sep)) {
265
264
  return true;
266
265
  }
267
266
  const filename = node_path_1.default.basename(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -101,7 +101,7 @@ export class RepositoryWatcher extends EventEmitter {
101
101
  if (path.startsWith(this.baseDir)) {
102
102
  const relativePath = Path.relative(this.baseDir, path);
103
103
  // Inside the repo we can use the path to determine the handle, name and version
104
- [handle, name, version] = relativePath.split(/\//g);
104
+ [handle, name, version] = relativePath.split(Path.sep);
105
105
  if (!handle || !name || !version) {
106
106
  // Do nothing with this
107
107
  return;
@@ -143,8 +143,6 @@ export class RepositoryWatcher extends EventEmitter {
143
143
  return;
144
144
  }
145
145
 
146
- //console.log('File changed', eventName, path);
147
-
148
146
  const assetIdentity = await this.getAssetIdentity(path);
149
147
  if (!assetIdentity) {
150
148
  return;
@@ -156,7 +154,7 @@ export class RepositoryWatcher extends EventEmitter {
156
154
 
157
155
  // If this is false it's because we're watching a symlink target
158
156
  const withinRepo = path.startsWith(this.baseDir);
159
- if (withinRepo && assetIdentity.version === 'local' && path.endsWith('/local')) {
157
+ if (withinRepo && assetIdentity.version === 'local' && path.endsWith(Path.sep + 'local')) {
160
158
  // This is likely a symlink target
161
159
  if (eventName === 'add') {
162
160
  //console.log('Checking if we should add symlink target', handle, name, version, path);
@@ -271,7 +269,7 @@ export class RepositoryWatcher extends EventEmitter {
271
269
  } catch (e) {}
272
270
 
273
271
  if (symbolicLink) {
274
- const realPath = `${await FS.realpath(path)}/kapeta.yml`;
272
+ const realPath = Path.join(await FS.realpath(path), 'kapeta.yml');
275
273
  if (await this.exists(realPath)) {
276
274
  //console.log('Watching symlink target %s => %s', path, realPath);
277
275
  this.watcher?.add(realPath);
@@ -288,7 +286,7 @@ export class RepositoryWatcher extends EventEmitter {
288
286
  if (!path.startsWith(this.baseDir)) {
289
287
  return false;
290
288
  }
291
- if (path.includes('/node_modules/')) {
289
+ if (path.includes(Path.sep + 'node_modules' + Path.sep)) {
292
290
  return true;
293
291
  }
294
292