@xiaozhiclaw/provider-core-server 0.1.1 → 0.1.3
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/dist/config.js +14 -1
- package/package.json +7 -7
package/dist/config.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
function readPackageVersion() {
|
|
3
|
+
try {
|
|
4
|
+
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
5
|
+
if (typeof packageJson.version === "string" && packageJson.version.trim()) {
|
|
6
|
+
return packageJson.version;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
// Keep startup deterministic even if a custom bundle omits package.json.
|
|
11
|
+
}
|
|
12
|
+
return "0.0.0";
|
|
13
|
+
}
|
|
1
14
|
export function loadConfig(env = process.env) {
|
|
2
15
|
return {
|
|
3
16
|
host: env.PROVIDER_CORE_HOST ?? "127.0.0.1",
|
|
4
17
|
port: Number(env.PROVIDER_CORE_PORT ?? "8787"),
|
|
5
18
|
serviceToken: env.PROVIDER_CORE_TOKEN,
|
|
6
|
-
version: env.PROVIDER_CORE_VERSION ??
|
|
19
|
+
version: env.PROVIDER_CORE_VERSION ?? readPackageVersion(),
|
|
7
20
|
runtime: env.PROVIDER_CORE_RUNTIME === "real" ? "real" : "fixture",
|
|
8
21
|
credentialResolver: env.PROVIDER_CORE_CREDENTIAL_RESOLVER === "external"
|
|
9
22
|
? "external"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaozhiclaw/provider-core-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Internal HTTP/SSE server for QLogic Provider Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"test": "vitest run"
|
|
17
|
-
},
|
|
18
14
|
"engines": {
|
|
19
15
|
"node": ">=22.0.0"
|
|
20
16
|
},
|
|
21
17
|
"dependencies": {
|
|
22
|
-
"@xiaozhiclaw/provider-core": "^0.1.
|
|
18
|
+
"@xiaozhiclaw/provider-core": "^0.1.2"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"test": "vitest run"
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
}
|