@marineyachtradar/signalk-playback-plugin 0.1.1 → 0.1.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/build.js +38 -4
- package/package.json +1 -1
package/build.js
CHANGED
|
@@ -48,20 +48,54 @@ function copyDir(src, dest) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Find mayara-gui in node_modules (handles npm hoisting)
|
|
53
|
+
*/
|
|
54
|
+
function findGuiPackage() {
|
|
55
|
+
// Possible locations for mayara-gui:
|
|
56
|
+
// 1. Nested in plugin's own node_modules (npm nested install)
|
|
57
|
+
// 2. Hoisted to parent node_modules (SignalK App Store installs to ~/.signalk/node_modules/)
|
|
58
|
+
// Structure: ~/.signalk/node_modules/@marineyachtradar/signalk-playback-plugin/
|
|
59
|
+
// ~/.signalk/node_modules/@marineyachtradar/mayara-gui/
|
|
60
|
+
// 3. Local development (sibling directory)
|
|
61
|
+
const candidates = [
|
|
62
|
+
// Nested: <plugin>/node_modules/@marineyachtradar/mayara-gui
|
|
63
|
+
path.join(scriptDir, 'node_modules', '@marineyachtradar', 'mayara-gui'),
|
|
64
|
+
// Hoisted (scoped): <node_modules>/@marineyachtradar/<plugin> -> <node_modules>/@marineyachtradar/mayara-gui
|
|
65
|
+
path.join(scriptDir, '..', 'mayara-gui'),
|
|
66
|
+
// Hoisted (top-level): <node_modules>/@marineyachtradar/<plugin> -> <node_modules>/@marineyachtradar/mayara-gui
|
|
67
|
+
path.join(scriptDir, '..', '..', '@marineyachtradar', 'mayara-gui'),
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
for (const candidate of candidates) {
|
|
71
|
+
if (fs.existsSync(candidate)) {
|
|
72
|
+
return candidate
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null
|
|
76
|
+
}
|
|
77
|
+
|
|
51
78
|
/**
|
|
52
79
|
* Copy GUI from npm package
|
|
53
80
|
*/
|
|
54
81
|
function setupGuiFromNpm() {
|
|
55
82
|
console.log('Copying GUI from node_modules...\n')
|
|
56
83
|
|
|
57
|
-
|
|
84
|
+
// Find mayara-gui (handles npm hoisting where deps may be in parent node_modules)
|
|
85
|
+
const guiSource = findGuiPackage()
|
|
58
86
|
|
|
59
|
-
if (!
|
|
60
|
-
console.error('Error: @marineyachtradar/mayara-gui not found
|
|
61
|
-
console.error('
|
|
87
|
+
if (!guiSource) {
|
|
88
|
+
console.error('Error: @marineyachtradar/mayara-gui not found')
|
|
89
|
+
console.error('Searched locations:')
|
|
90
|
+
console.error(' - ' + path.join(scriptDir, 'node_modules', '@marineyachtradar', 'mayara-gui'))
|
|
91
|
+
console.error(' - ' + path.join(scriptDir, '..', 'mayara-gui'))
|
|
92
|
+
console.error(' - ' + path.join(scriptDir, '..', '..', '@marineyachtradar', 'mayara-gui'))
|
|
93
|
+
console.error('Make sure @marineyachtradar/mayara-gui is listed in package.json dependencies')
|
|
62
94
|
process.exit(1)
|
|
63
95
|
}
|
|
64
96
|
|
|
97
|
+
console.log('Found mayara-gui at: ' + guiSource)
|
|
98
|
+
|
|
65
99
|
if (fs.existsSync(publicDest)) {
|
|
66
100
|
fs.rmSync(publicDest, { recursive: true })
|
|
67
101
|
}
|
package/package.json
CHANGED