@flowfuse/nr-launcher 3.0.2 → 3.0.3-3b301ba-202609141307.0

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/lib/launcher.js CHANGED
@@ -167,22 +167,23 @@ class Launcher {
167
167
  } else if (this.settings.nodesDir && typeof this.settings.nodesDir === 'string') {
168
168
  nodesDir.push(this.settings.nodesDir)
169
169
  }
170
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-project-nodes').replace(/\\/g, '/'))
171
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-project-nodes').replace(/\\/g, '/'))
172
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-tables-nodes').replace(/\\/g, '/'))
173
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-tables-nodes').replace(/\\/g, '/'))
174
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-file-nodes').replace(/\\/g, '/'))
175
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-file-nodes').replace(/\\/g, '/'))
170
+ const mainPath = require.main ? require.main.path : '/tmp' // needed as mocha breaks require.main
171
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-project-nodes').replace(/\\/g, '/'))
172
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-project-nodes').replace(/\\/g, '/'))
173
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-tables-nodes').replace(/\\/g, '/'))
174
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-tables-nodes').replace(/\\/g, '/'))
175
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-file-nodes').replace(/\\/g, '/'))
176
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-file-nodes').replace(/\\/g, '/'))
176
177
  // Only include nr-assistant in nodesDir if the assistant is enabled by the platform
177
178
  if (this.settings.assistant?.enabled !== false) {
178
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-assistant').replace(/\\/g, '/'))
179
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-assistant').replace(/\\/g, '/'))
180
- }
181
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-mqtt-nodes').replace(/\\/g, '/'))
182
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-mqtt-nodes').replace(/\\/g, '/'))
183
- nodesDir.push(path.join(require.main.path, 'node_modules', '@flowfuse', 'nr-subflow-export').replace(/\\/g, '/'))
184
- nodesDir.push(path.join(require.main.path, '..', '..', '@flowfuse', 'nr-subflow-export').replace(/\\/g, '/'))
185
- nodesDir.push(require.main.path)
179
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-assistant').replace(/\\/g, '/'))
180
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-assistant').replace(/\\/g, '/'))
181
+ }
182
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-mqtt-nodes').replace(/\\/g, '/'))
183
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-mqtt-nodes').replace(/\\/g, '/'))
184
+ nodesDir.push(path.join(mainPath, 'node_modules', '@flowfuse', 'nr-subflow-export').replace(/\\/g, '/'))
185
+ nodesDir.push(path.join(mainPath, '..', '..', '@flowfuse', 'nr-subflow-export').replace(/\\/g, '/'))
186
+ nodesDir.push(mainPath)
186
187
 
187
188
  this.settings.nodesDir = nodesDir
188
189
  if (hasProperty(this.settings, 'disableAutoSafeMode') && typeof this.settings.disableAutoSafeMode === 'boolean') {