@noforeignland/signalk-to-noforeignland 1.0.0 → 1.0.1-beta.5
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/.github/workflows/publish.yml +6 -1
- package/CHANGELOG.md +3 -0
- package/cleanup-old-plugin.js +36 -0
- package/doc/dev +13 -0
- package/index.js +50 -0
- package/package.json +4 -1
|
@@ -32,4 +32,9 @@ jobs:
|
|
|
32
32
|
- run: npm test
|
|
33
33
|
|
|
34
34
|
- name: Publish
|
|
35
|
-
run:
|
|
35
|
+
run: |
|
|
36
|
+
if [[ "${{ github.ref }}" == refs/tags/*-beta.* ]] || [[ "${{ github.ref }}" == refs/tags/*-rc.* ]]; then
|
|
37
|
+
npm publish --provenance --access public --tag beta
|
|
38
|
+
else
|
|
39
|
+
npm publish --provenance --access public
|
|
40
|
+
fi
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
1.0.1
|
|
2
|
+
* CHANGE: Cleanup previous installs and migrate plugin config.
|
|
3
|
+
|
|
1
4
|
1.0.0
|
|
2
5
|
* CHANGE: Package now released unter npmjs org noforeignland in version 1.0.0 due to deployment changes in npmjs and the need of trustworthy sources. All npmjs keys will be revoked Nov 19th, 2025.
|
|
3
6
|
Users of the old (depricated) 0.1.x versions need to install this new package once manually using the Signal K Appstore. The Plugin Configuration will be kept from the 0.1.x install.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// 1. Migration
|
|
6
|
+
try {
|
|
7
|
+
const configDir = path.join(process.env.HOME || '', '.signalk');
|
|
8
|
+
const configPath = path.join(configDir, 'plugin-config-data');
|
|
9
|
+
const oldConfig = path.join(configPath, 'signalk-to-noforeignland.json');
|
|
10
|
+
const newConfig = path.join(configPath, '@noforeignland-signalk-to-noforeignland.json');
|
|
11
|
+
|
|
12
|
+
if (fs.existsSync(oldConfig) && !fs.existsSync(newConfig)) {
|
|
13
|
+
fs.copyFileSync(oldConfig, newConfig);
|
|
14
|
+
fs.copyFileSync(oldConfig, `${oldConfig}.backup`);
|
|
15
|
+
console.log('✓ Configuration migrated');
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.warn('Could not migrate config:', e.message);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 2. Uninstall (mit Verzögerung, damit npm fertig ist)
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
try {
|
|
24
|
+
const signalkDir = path.join(process.env.HOME || '', '.signalk');
|
|
25
|
+
const oldPluginDir = path.join(signalkDir, 'node_modules', 'signalk-to-noforeignland');
|
|
26
|
+
|
|
27
|
+
if (fs.existsSync(oldPluginDir)) {
|
|
28
|
+
console.log('Removing old plugin...');
|
|
29
|
+
// Direktes Löschen ist sicherer als npm uninstall während Installation
|
|
30
|
+
fs.rmSync(oldPluginDir, { recursive: true, force: true });
|
|
31
|
+
console.log('✓ Old plugin removed');
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.warn('Could not remove old plugin automatically. Please run: npm uninstall signalk-to-noforeignland');
|
|
35
|
+
}
|
|
36
|
+
}, 2000); // 2 Sekunden warten bis npm fertig ist
|
package/doc/dev
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
cd ~/dirk/nfl-signalk
|
|
2
|
+
|
|
3
|
+
# Aktuelle Version zu Beta machen
|
|
4
|
+
npm version 1.0.1-beta.1 --no-git-tag-version
|
|
5
|
+
|
|
6
|
+
# Package bauen
|
|
7
|
+
npm pack
|
|
8
|
+
|
|
9
|
+
# Mit beta tag publishen (nicht als 'latest')
|
|
10
|
+
npm publish --tag beta
|
|
11
|
+
|
|
12
|
+
# Falls du noch nicht eingeloggt bist:
|
|
13
|
+
npm login
|
package/index.js
CHANGED
|
@@ -279,6 +279,9 @@ class SignalkToNoforeignland {
|
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
// NEW: Cleanup old plugin
|
|
283
|
+
await this.cleanupOldPlugin();
|
|
284
|
+
|
|
282
285
|
// Migrate old track files
|
|
283
286
|
await this.migrateOldTrackFile();
|
|
284
287
|
|
|
@@ -307,6 +310,53 @@ class SignalkToNoforeignland {
|
|
|
307
310
|
this.startPositionHealthCheck();
|
|
308
311
|
}
|
|
309
312
|
|
|
313
|
+
async cleanupOldPlugin() {
|
|
314
|
+
try {
|
|
315
|
+
// 1. Config Migration
|
|
316
|
+
const configDir = process.env.SIGNALK_NODE_CONFIG_DIR ||
|
|
317
|
+
path.join(process.env.HOME || process.env.USERPROFILE, '.signalk');
|
|
318
|
+
const configPath = path.join(configDir, 'plugin-config-data');
|
|
319
|
+
const oldConfigFile = path.join(configPath, 'signalk-to-noforeignland.json');
|
|
320
|
+
const newConfigFile = path.join(configPath, '@noforeignland-signalk-to-noforeignland.json');
|
|
321
|
+
|
|
322
|
+
if (fs.existsSync(oldConfigFile) && !fs.existsSync(newConfigFile)) {
|
|
323
|
+
this.app.debug('Migrating configuration from old plugin...');
|
|
324
|
+
fs.copyFileSync(oldConfigFile, newConfigFile);
|
|
325
|
+
fs.copyFileSync(oldConfigFile, `${oldConfigFile}.backup`);
|
|
326
|
+
this.app.debug('✓ Configuration migrated successfully');
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// 2. Check if old plugin still exists
|
|
330
|
+
const oldPluginDir = path.join(configDir, 'node_modules', 'signalk-to-noforeignland');
|
|
331
|
+
|
|
332
|
+
if (fs.existsSync(oldPluginDir)) {
|
|
333
|
+
this.app.debug('Old plugin "signalk-to-noforeignland" detected');
|
|
334
|
+
this.app.setPluginError(
|
|
335
|
+
'Old plugin "signalk-to-noforeignland" is still installed. ' +
|
|
336
|
+
'Please uninstall it manually: cd ~/.signalk && npm uninstall signalk-to-noforeignland'
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// Try to remove it after a delay (non-blocking)
|
|
340
|
+
setTimeout(async () => {
|
|
341
|
+
try {
|
|
342
|
+
this.app.debug('Attempting to remove old plugin directory...');
|
|
343
|
+
await fs.remove(oldPluginDir);
|
|
344
|
+
this.app.debug('✓ Old plugin directory removed');
|
|
345
|
+
// Clear error if removal successful
|
|
346
|
+
this.setPluginStatus('Started (old plugin cleaned up)');
|
|
347
|
+
} catch (err) {
|
|
348
|
+
this.app.debug('Could not automatically remove old plugin:', err.message);
|
|
349
|
+
this.app.debug('Please manually run: npm uninstall signalk-to-noforeignland');
|
|
350
|
+
}
|
|
351
|
+
}, 5000); // 5 Sekunden warten bis SignalK vollständig gestartet ist
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
} catch (err) {
|
|
355
|
+
this.app.debug('Error during old plugin cleanup:', err.message);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
|
|
310
360
|
async migrateOldTrackFile() {
|
|
311
361
|
const oldTrackFile = path.join(this.options.trackDir, 'nfl-track.jsonl');
|
|
312
362
|
const oldPendingFile = path.join(this.options.trackDir, 'nfl-track-pending.jsonl');
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noforeignland/signalk-to-noforeignland",
|
|
3
|
-
"
|
|
3
|
+
"signalk": {
|
|
4
|
+
"id": "@noforeignland/signalk-to-noforeignland"
|
|
5
|
+
},
|
|
6
|
+
"version": "1.0.1-beta.5",
|
|
4
7
|
"description": "SignalK track logger to noforeignland.com",
|
|
5
8
|
"main": "index.js",
|
|
6
9
|
"keywords": [
|