@constellation-network/node-pilot 0.0.20 → 0.1.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 CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @constellation-network/node-pilot
21
21
  $ cpilot COMMAND
22
22
  running command...
23
23
  $ cpilot (--version|-v)
24
- @constellation-network/node-pilot/0.0.20 darwin-arm64 node-v24.8.0
24
+ @constellation-network/node-pilot/0.1.0 darwin-arm64 node-v22.15.0
25
25
  $ cpilot --help [COMMAND]
26
26
  USAGE
27
27
  $ cpilot COMMAND
@@ -71,7 +71,7 @@ EXAMPLES
71
71
  $ cpilot clean
72
72
  ```
73
73
 
74
- _See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/clean.ts)_
74
+ _See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/clean.ts)_
75
75
 
76
76
  ## `cpilot config`
77
77
 
@@ -88,7 +88,7 @@ EXAMPLES
88
88
  $ cpilot config
89
89
  ```
90
90
 
91
- _See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/config.ts)_
91
+ _See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/config.ts)_
92
92
 
93
93
  ## `cpilot config get [NAME]`
94
94
 
@@ -112,7 +112,7 @@ EXAMPLES
112
112
  $ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
113
113
  ```
114
114
 
115
- _See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/config/get.ts)_
115
+ _See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/config/get.ts)_
116
116
 
117
117
  ## `cpilot config set NAME VALUE`
118
118
 
@@ -135,7 +135,7 @@ EXAMPLES
135
135
  $ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
136
136
  ```
137
137
 
138
- _See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/config/set.ts)_
138
+ _See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/config/set.ts)_
139
139
 
140
140
  ## `cpilot help [COMMAND]`
141
141
 
@@ -172,7 +172,7 @@ EXAMPLES
172
172
  $ cpilot info
173
173
  ```
174
174
 
175
- _See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/info.ts)_
175
+ _See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/info.ts)_
176
176
 
177
177
  ## `cpilot logs LAYER`
178
178
 
@@ -196,7 +196,7 @@ EXAMPLES
196
196
  $ cpilot logs
197
197
  ```
198
198
 
199
- _See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/logs.ts)_
199
+ _See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/logs.ts)_
200
200
 
201
201
  ## `cpilot restart [LAYER]`
202
202
 
@@ -224,7 +224,7 @@ EXAMPLES
224
224
  $ cpilot restart
225
225
  ```
226
226
 
227
- _See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/restart.ts)_
227
+ _See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/restart.ts)_
228
228
 
229
229
  ## `cpilot shutdown`
230
230
 
@@ -244,7 +244,7 @@ EXAMPLES
244
244
  $ cpilot shutdown
245
245
  ```
246
246
 
247
- _See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/shutdown.ts)_
247
+ _See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/shutdown.ts)_
248
248
 
249
249
  ## `cpilot status`
250
250
 
@@ -258,5 +258,5 @@ DESCRIPTION
258
258
  Display node status and configuration settings
259
259
  ```
260
260
 
261
- _See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.20/src/commands/status.ts)_
261
+ _See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.1.0/src/commands/status.ts)_
262
262
  <!-- commandsstop -->
@@ -2,11 +2,13 @@ import { JSONStorage } from "node-localstorage";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
+ import semver from "semver";
5
6
  import packageJson from '../../package.json' with { type: 'json' };
6
7
  import { clm } from "../clm.js";
7
8
  import { configStore } from "../config-store.js";
8
9
  import { projectHelper } from "../helpers/project-helper.js";
9
10
  import { promptHelper } from "../helpers/prompt-helper.js";
11
+ import { dockerService } from "../services/docker-service.js";
10
12
  import { shellService } from "../services/shell-service.js";
11
13
  const REGISTRY_URL = 'https://registry.npmjs.org/';
12
14
  export const checkNodePilot = {
@@ -26,17 +28,44 @@ export const checkNodePilot = {
26
28
  if (!result) {
27
29
  return;
28
30
  }
29
- const latestVersion = result['dist-tags'].latest;
30
- // console.log(`Current version: "${packageJson.version}", Latest version: "${latestVersion}"`);
31
- if (packageJson.version !== latestVersion) {
32
- console.log(`There is a new node-pilot version available. Current version: "${packageJson.version}", Latest version: "${latestVersion}"`);
33
- if (os.platform() === 'linux' && await promptHelper.confirmPrompt('Do you wish to upgrade now?')) {
34
- await shellService.runCommand('sudo npm install -g @constellation-network/node-pilot@latest');
35
- await projectHelper.upgradeHypergraph();
36
- clm.postStep('Run cpilot again to use the latest version');
37
- process.exit(0);
31
+ const latestVer = semver.parse(result['dist-tags'].latest);
32
+ const currentVer = semver.parse(packageJson.version);
33
+ if (!latestVer || !currentVer || latestVer.compare(currentVer) === 0)
34
+ return;
35
+ clm.echo(`There is a new node-pilot version available. Current version: "${currentVer.version}", Latest version: "${latestVer.version}"`);
36
+ if (os.platform() !== 'linux')
37
+ return;
38
+ const hasMajorMinorChange = latestVer.major !== currentVer.major || latestVer.minor !== currentVer.minor;
39
+ if (hasMajorMinorChange) {
40
+ const dockerIsRunning = await dockerService.isRunning();
41
+ if (dockerIsRunning) {
42
+ clm.warn('This update requires the Node to shutdown before proceeding.');
43
+ }
44
+ if (await promptHelper.confirmPrompt('Do you wish to upgrade now?')) {
45
+ if (dockerIsRunning) {
46
+ await dockerService.dockerDown();
47
+ }
48
+ }
49
+ else {
50
+ clm.postStep('Skipping update...');
51
+ return;
38
52
  }
39
53
  }
54
+ else {
55
+ clm.preStep('This update includes a minor change. There is no need to restart your Node.');
56
+ if (!await promptHelper.confirmPrompt('Do you wish to upgrade now?')) {
57
+ clm.postStep('Skipping update...');
58
+ return;
59
+ }
60
+ }
61
+ clm.step('Updating Node Pilot to the latest version...');
62
+ await shellService.runCommand(`sudo npm install -g @constellation-network/node-pilot@${latestVer.version}`);
63
+ if (hasMajorMinorChange) {
64
+ clm.step('Updating scripts and configuration files...');
65
+ await projectHelper.upgradeHypergraph();
66
+ }
67
+ clm.postStep('Update completed. Run cpilot again to use the latest version');
68
+ process.exit(0);
40
69
  },
41
70
  async promptDiscordRegistration() {
42
71
  const hcStorage = getHcStorage();
@@ -336,5 +336,5 @@
336
336
  ]
337
337
  }
338
338
  },
339
- "version": "0.0.20"
339
+ "version": "0.1.0"
340
340
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@constellation-network/node-pilot",
3
3
  "description": "An easy deployment and monitoring tool for Constellation nodes.",
4
- "version": "0.0.20",
4
+ "version": "0.1.0",
5
5
  "author": "Frank Fox",
6
6
  "bin": {
7
7
  "cpilot": "bin/run.js"
@@ -39,6 +39,7 @@
39
39
  "json-bigint-patch": "^0.0.8",
40
40
  "node-localstorage": "^3.0.5",
41
41
  "ora": "^8.2.0",
42
+ "semver": "^7.7.3",
42
43
  "shelljs": "^0.10.0",
43
44
  "tty-table": "^4.2.3",
44
45
  "yaml": "^2.8.1"
@@ -51,6 +52,7 @@
51
52
  "@types/mocha": "^10",
52
53
  "@types/node": "^22.17.1",
53
54
  "@types/node-localstorage": "^1.3.3",
55
+ "@types/semver": "^7.7.1",
54
56
  "@types/shelljs": "^0.8.17",
55
57
  "chai": "^4",
56
58
  "eslint": "^9",
@@ -39,7 +39,7 @@ COPY dist/gl0.jar /app/jars/gl0.jar
39
39
  #COPY ./health-check /health-check
40
40
  #RUN chmod +x /health-check/bin/run.sh
41
41
  #RUN chmod +x /health-check/bin/hydrate.sh
42
- RUN npm install -g "@constellation-network/node-pilot-health-check@latest"
42
+ RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.15"
43
43
 
44
44
  # Add entrypoint
45
45
  COPY ./entrypoint.sh /app/entrypoint.sh