@giantswarm-io/pro 1.10.12 → 1.10.13
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 +1 -0
- package/package.json +1 -1
- package/src/lib/selfupdate.js +3 -3
- package/src/lib/version.js +29 -3
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ each call.
|
|
|
99
99
|
- `GITHUB_API_TOKEN` (required for stdio and the env-token HTTP mode): GitHub PAT with `project:write` and `repo:write` scopes.
|
|
100
100
|
- `OAUTH_BEARER_ONLY` (optional, HTTP transport): `true` selects the bearer-only mode described above.
|
|
101
101
|
- `HTTP_PORT` (optional): Port for HTTP transport (default: 8080).
|
|
102
|
+
- `PRO_VERSION` (set by the Helm chart): the version the server reports in its startup log and MCP `serverInfo`, the image tag the chart deploys. Unset, the server reports the `package.json` version, which the npm package carries from its release tag; a checkout reports `0.0.0-dev`.
|
|
102
103
|
|
|
103
104
|
## Transport Modes
|
|
104
105
|
|
package/package.json
CHANGED
package/src/lib/selfupdate.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { execFileSync } from 'node:child_process';
|
|
12
|
-
import { version } from './version.js';
|
|
12
|
+
import { version, isDevBuild } from './version.js';
|
|
13
13
|
import { logger } from './logger.js';
|
|
14
14
|
|
|
15
15
|
const GITHUB_REPO = 'giantswarm/pro';
|
|
@@ -38,8 +38,8 @@ function isNewer(localVersion, remoteVersion) {
|
|
|
38
38
|
export async function selfUpdate() {
|
|
39
39
|
const currentVersion = version;
|
|
40
40
|
|
|
41
|
-
if (
|
|
42
|
-
throw new Error(
|
|
41
|
+
if (isDevBuild) {
|
|
42
|
+
throw new Error(`Cannot self-update a development build (${currentVersion})`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
logger.info(`Current version: ${currentVersion}`);
|
package/src/lib/version.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version utility
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The release tag is the single source of truth for versions; package.json
|
|
5
|
+
* stays at 0.0.0 in git. Each distribution carries the tag its own way:
|
|
6
|
+
*
|
|
7
|
+
* - the container image: the Helm chart sets PRO_VERSION to the image tag it
|
|
8
|
+
* deploys (its appVersion, which the release build sets from the tag),
|
|
9
|
+
* - the npm package: the Publish package workflow stamps package.json from
|
|
10
|
+
* the tag before packing.
|
|
11
|
+
*
|
|
12
|
+
* A checkout has neither and reports 0.0.0-dev.
|
|
6
13
|
*/
|
|
7
14
|
|
|
8
15
|
import { readFileSync } from 'node:fs';
|
|
@@ -15,5 +22,24 @@ const __dirname = dirname(__filename);
|
|
|
15
22
|
const pkgPath = join(__dirname, '..', '..', 'package.json');
|
|
16
23
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
const UNSTAMPED = '0.0.0';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the version the server reports.
|
|
29
|
+
*
|
|
30
|
+
* @param {string | undefined} envVersion - PRO_VERSION
|
|
31
|
+
* @param {string} pkgVersion - the package.json version
|
|
32
|
+
* @returns {{ version: string, isDevBuild: boolean }}
|
|
33
|
+
*/
|
|
34
|
+
export function resolveVersion(envVersion, pkgVersion) {
|
|
35
|
+
if (envVersion) {
|
|
36
|
+
return { version: envVersion.replace(/^v/, ''), isDevBuild: false };
|
|
37
|
+
}
|
|
38
|
+
if (pkgVersion !== UNSTAMPED) {
|
|
39
|
+
return { version: pkgVersion, isDevBuild: false };
|
|
40
|
+
}
|
|
41
|
+
return { version: `${UNSTAMPED}-dev`, isDevBuild: true };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const { version, isDevBuild } = resolveVersion(process.env.PRO_VERSION, pkg.version);
|
|
19
45
|
export const name = pkg.name;
|