@marineyachtradar/signalk-playback-plugin 0.1.2 → 0.2.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/README.md +8 -13
- package/package.json +3 -3
- package/public/api.js +402 -0
- package/public/assets/MaYaRa_RED.png +0 -0
- package/public/base.css +91 -0
- package/public/control.html +23 -0
- package/public/control.js +1155 -0
- package/public/controls.css +538 -0
- package/public/discovery.css +478 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +10 -0
- package/public/layout.css +87 -0
- package/public/mayara.js +510 -0
- package/public/playback.html +572 -0
- package/public/proto/RadarMessage.proto +41 -0
- package/public/protobuf/protobuf.js +9112 -0
- package/public/protobuf/protobuf.js.map +1 -0
- package/public/protobuf/protobuf.min.js +8 -0
- package/public/protobuf/protobuf.min.js.map +1 -0
- package/public/radar.svg +29 -0
- package/public/render_webgpu.js +886 -0
- package/public/responsive.css +29 -0
- package/public/van-1.5.2.debug.js +126 -0
- package/public/van-1.5.2.js +140 -0
- package/public/van-1.5.2.min.js +1 -0
- package/public/viewer.html +30 -0
- package/public/viewer.js +797 -0
- package/build.js +0 -282
package/build.js
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Build script for mayara-server-signalk-playbackrecordings-plugin
|
|
4
|
-
*
|
|
5
|
-
* Copies @marineyachtradar/mayara-gui from npm to public/
|
|
6
|
-
* The plugin adds its own playback.html for file upload/control.
|
|
7
|
-
*
|
|
8
|
-
* Usage: node build.js [options]
|
|
9
|
-
* --local-gui Use local mayara-gui instead of npm (for development)
|
|
10
|
-
* --pack Create a .tgz tarball with public/ included (for manual install)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const fs = require('fs')
|
|
14
|
-
const path = require('path')
|
|
15
|
-
const { execSync } = require('child_process')
|
|
16
|
-
|
|
17
|
-
const args = process.argv.slice(2)
|
|
18
|
-
const useLocalGui = args.includes('--local-gui')
|
|
19
|
-
const createPack = args.includes('--pack')
|
|
20
|
-
|
|
21
|
-
const scriptDir = __dirname
|
|
22
|
-
const publicDest = path.join(scriptDir, 'public')
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Recursively copy directory contents
|
|
26
|
-
*/
|
|
27
|
-
function copyDir(src, dest) {
|
|
28
|
-
if (!fs.existsSync(src)) {
|
|
29
|
-
console.error(`Source directory not found: ${src}`)
|
|
30
|
-
process.exit(1)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (fs.existsSync(dest)) {
|
|
34
|
-
fs.rmSync(dest, { recursive: true })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
fs.mkdirSync(dest, { recursive: true })
|
|
38
|
-
|
|
39
|
-
const entries = fs.readdirSync(src, { withFileTypes: true })
|
|
40
|
-
for (const entry of entries) {
|
|
41
|
-
const srcPath = path.join(src, entry.name)
|
|
42
|
-
const destPath = path.join(dest, entry.name)
|
|
43
|
-
if (entry.isDirectory()) {
|
|
44
|
-
copyDir(srcPath, destPath)
|
|
45
|
-
} else {
|
|
46
|
-
fs.copyFileSync(srcPath, destPath)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
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
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Copy GUI from npm package
|
|
80
|
-
*/
|
|
81
|
-
function setupGuiFromNpm() {
|
|
82
|
-
console.log('Copying GUI from node_modules...\n')
|
|
83
|
-
|
|
84
|
-
// Find mayara-gui (handles npm hoisting where deps may be in parent node_modules)
|
|
85
|
-
const guiSource = findGuiPackage()
|
|
86
|
-
|
|
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')
|
|
94
|
-
process.exit(1)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
console.log('Found mayara-gui at: ' + guiSource)
|
|
98
|
-
|
|
99
|
-
if (fs.existsSync(publicDest)) {
|
|
100
|
-
fs.rmSync(publicDest, { recursive: true })
|
|
101
|
-
}
|
|
102
|
-
fs.mkdirSync(publicDest, { recursive: true })
|
|
103
|
-
|
|
104
|
-
// Copy GUI files (exclude package.json, node_modules, etc.)
|
|
105
|
-
const guiPatterns = [
|
|
106
|
-
{ ext: '.html' },
|
|
107
|
-
{ ext: '.js' },
|
|
108
|
-
{ ext: '.css' },
|
|
109
|
-
{ ext: '.ico' },
|
|
110
|
-
{ ext: '.svg' },
|
|
111
|
-
{ dir: 'assets' },
|
|
112
|
-
{ dir: 'proto' },
|
|
113
|
-
{ dir: 'protobuf' }
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
// Exclude recordings.html since we have our own playback UI
|
|
117
|
-
const excludeFiles = ['recordings.html', 'recordings.js', 'recordings.css']
|
|
118
|
-
|
|
119
|
-
const entries = fs.readdirSync(guiSource, { withFileTypes: true })
|
|
120
|
-
for (const entry of entries) {
|
|
121
|
-
if (excludeFiles.includes(entry.name)) continue
|
|
122
|
-
|
|
123
|
-
const srcPath = path.join(guiSource, entry.name)
|
|
124
|
-
const destPath = path.join(publicDest, entry.name)
|
|
125
|
-
|
|
126
|
-
if (entry.isDirectory()) {
|
|
127
|
-
if (guiPatterns.some(p => p.dir === entry.name)) {
|
|
128
|
-
copyDir(srcPath, destPath)
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
if (guiPatterns.some(p => p.ext && entry.name.endsWith(p.ext))) {
|
|
132
|
-
fs.copyFileSync(srcPath, destPath)
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Copy our custom files from plugin/public/ (overrides GUI files)
|
|
138
|
-
const pluginPublic = path.join(scriptDir, 'plugin', 'public')
|
|
139
|
-
if (fs.existsSync(pluginPublic)) {
|
|
140
|
-
const customEntries = fs.readdirSync(pluginPublic, { withFileTypes: true })
|
|
141
|
-
let customCount = 0
|
|
142
|
-
for (const entry of customEntries) {
|
|
143
|
-
const srcPath = path.join(pluginPublic, entry.name)
|
|
144
|
-
const destPath = path.join(publicDest, entry.name)
|
|
145
|
-
if (entry.isDirectory()) {
|
|
146
|
-
copyDir(srcPath, destPath)
|
|
147
|
-
customCount++
|
|
148
|
-
} else {
|
|
149
|
-
fs.copyFileSync(srcPath, destPath)
|
|
150
|
-
customCount++
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
console.log(`Added ${customCount} custom files from plugin/public/`)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const fileCount = fs.readdirSync(publicDest, { recursive: true }).length
|
|
157
|
-
console.log(`Copied ${fileCount} GUI files to public/\n`)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Copy GUI from local sibling directory (for development)
|
|
162
|
-
*/
|
|
163
|
-
function setupGuiFromLocal() {
|
|
164
|
-
const localGuiPath = path.join(scriptDir, '..', 'mayara-gui')
|
|
165
|
-
console.log(`Copying GUI from local ${localGuiPath}...\n`)
|
|
166
|
-
|
|
167
|
-
if (fs.existsSync(publicDest)) {
|
|
168
|
-
fs.rmSync(publicDest, { recursive: true })
|
|
169
|
-
}
|
|
170
|
-
fs.mkdirSync(publicDest, { recursive: true })
|
|
171
|
-
|
|
172
|
-
const guiPatterns = [
|
|
173
|
-
{ ext: '.html' },
|
|
174
|
-
{ ext: '.js' },
|
|
175
|
-
{ ext: '.css' },
|
|
176
|
-
{ ext: '.ico' },
|
|
177
|
-
{ ext: '.svg' },
|
|
178
|
-
{ dir: 'assets' },
|
|
179
|
-
{ dir: 'proto' },
|
|
180
|
-
{ dir: 'protobuf' }
|
|
181
|
-
]
|
|
182
|
-
|
|
183
|
-
// Exclude recordings files since we have our own playback UI
|
|
184
|
-
const excludeFiles = ['recordings.html', 'recordings.js', 'recordings.css']
|
|
185
|
-
|
|
186
|
-
const entries = fs.readdirSync(localGuiPath, { withFileTypes: true })
|
|
187
|
-
for (const entry of entries) {
|
|
188
|
-
if (excludeFiles.includes(entry.name)) continue
|
|
189
|
-
|
|
190
|
-
const srcPath = path.join(localGuiPath, entry.name)
|
|
191
|
-
const destPath = path.join(publicDest, entry.name)
|
|
192
|
-
|
|
193
|
-
if (entry.isDirectory()) {
|
|
194
|
-
if (guiPatterns.some(p => p.dir === entry.name)) {
|
|
195
|
-
copyDir(srcPath, destPath)
|
|
196
|
-
}
|
|
197
|
-
} else {
|
|
198
|
-
if (guiPatterns.some(p => p.ext && entry.name.endsWith(p.ext))) {
|
|
199
|
-
fs.copyFileSync(srcPath, destPath)
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Copy our custom files from plugin/public/ (overrides GUI files)
|
|
205
|
-
const pluginPublic = path.join(scriptDir, 'plugin', 'public')
|
|
206
|
-
if (fs.existsSync(pluginPublic)) {
|
|
207
|
-
const customEntries = fs.readdirSync(pluginPublic, { withFileTypes: true })
|
|
208
|
-
let customCount = 0
|
|
209
|
-
for (const entry of customEntries) {
|
|
210
|
-
const srcPath = path.join(pluginPublic, entry.name)
|
|
211
|
-
const destPath = path.join(publicDest, entry.name)
|
|
212
|
-
if (entry.isDirectory()) {
|
|
213
|
-
copyDir(srcPath, destPath)
|
|
214
|
-
customCount++
|
|
215
|
-
} else {
|
|
216
|
-
fs.copyFileSync(srcPath, destPath)
|
|
217
|
-
customCount++
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
console.log(`Added ${customCount} custom files from plugin/public/`)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const fileCount = fs.readdirSync(publicDest, { recursive: true }).length
|
|
224
|
-
console.log(`Copied ${fileCount} files from local mayara-gui/ to public/\n`)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function main() {
|
|
228
|
-
console.log('=== MaYaRa SignalK Playback Plugin Build ===\n')
|
|
229
|
-
|
|
230
|
-
// Skip build if public/ already exists with content (installed from --pack tarball)
|
|
231
|
-
// This prevents postinstall from failing when mayara-gui isn't in node_modules
|
|
232
|
-
if (fs.existsSync(publicDest) && !useLocalGui && !createPack) {
|
|
233
|
-
const files = fs.readdirSync(publicDest)
|
|
234
|
-
if (files.length > 0) {
|
|
235
|
-
console.log(`public/ already exists with ${files.length} files (installed from tarball)`)
|
|
236
|
-
console.log('Skipping build.\n')
|
|
237
|
-
console.log('=== Build complete ===')
|
|
238
|
-
return
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (useLocalGui) {
|
|
243
|
-
setupGuiFromLocal()
|
|
244
|
-
} else {
|
|
245
|
-
setupGuiFromNpm()
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Create tarball if --pack flag is set
|
|
249
|
-
if (createPack) {
|
|
250
|
-
console.log('Creating tarball with public/ included...\n')
|
|
251
|
-
|
|
252
|
-
// Temporarily remove public/ from .npmignore
|
|
253
|
-
const npmignorePath = path.join(scriptDir, '.npmignore')
|
|
254
|
-
const npmignoreContent = fs.readFileSync(npmignorePath, 'utf8')
|
|
255
|
-
const npmignoreWithoutPublic = npmignoreContent.replace(/^public\/\n?/m, '')
|
|
256
|
-
fs.writeFileSync(npmignorePath, npmignoreWithoutPublic)
|
|
257
|
-
|
|
258
|
-
// Also temporarily add public/ to files in package.json
|
|
259
|
-
const pkgPath = path.join(scriptDir, 'package.json')
|
|
260
|
-
const pkgContent = fs.readFileSync(pkgPath, 'utf8')
|
|
261
|
-
const pkg = JSON.parse(pkgContent)
|
|
262
|
-
const originalFiles = [...pkg.files]
|
|
263
|
-
pkg.files.push('public/**/*')
|
|
264
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
265
|
-
|
|
266
|
-
try {
|
|
267
|
-
// Run npm pack
|
|
268
|
-
execSync('npm pack', { stdio: 'inherit', cwd: scriptDir })
|
|
269
|
-
console.log('\nTarball created successfully!')
|
|
270
|
-
} finally {
|
|
271
|
-
// Restore .npmignore
|
|
272
|
-
fs.writeFileSync(npmignorePath, npmignoreContent)
|
|
273
|
-
// Restore package.json
|
|
274
|
-
pkg.files = originalFiles
|
|
275
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
console.log('\n=== Build complete ===')
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
main()
|