refactor(npm): final polishing for the npm distribution

This commit is contained in:
Marc Nuri
2025-02-15 04:14:44 +01:00
parent 07762e9a7a
commit e1432e7222
5 changed files with 8 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env node
const path = require('path')
const childProcess = require('child_process');
const BINARY_MAP = {
@@ -12,14 +11,13 @@ const BINARY_MAP = {
win32_arm64: {name: 'kubernetes-mcp-server-windows-arm64', suffix: '.exe'},
};
const binary = BINARY_MAP[`${process.platform}_${process.arch}`];
// Resolving will fail if the optionalDependency was not installed or the platform/arch is not supported
const resolveBinaryPath = () => {
try {
// Resolving will fail if the optionalDependency was not installed
return require.resolve(`${binary.name}/bin/${binary.name}${binary.suffix}`)
const binary = BINARY_MAP[`${process.platform}_${process.arch}`];
return require.resolve(`${binary.name}/bin/${binary.name}${binary.suffix}`);
} catch (e) {
return path.join(__dirname, '..', `${binary.name}${binary.suffix}`)
throw new Error(`Could not resolve binary path for platform/arch: ${process.platform}/${process.arch}`);
}
};

View File

@@ -1,24 +0,0 @@
{
"name": "kubernetes-mcp-server",
"version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kubernetes-mcp-server",
"version": "0.0.0",
"license": "Apache-2.0",
"bin": {
"kubernetes-mcp-server": "bin/kubernetes-mcp-server.js"
},
"optionalDependencies": {
"kubernetes-mcp-server-darwin-amd64": "0.0.0",
"kubernetes-mcp-server-darwin-arm64": "0.0.0",
"kubernetes-mcp-server-linux-amd64": "0.0.0",
"kubernetes-mcp-server-linux-arm64": "0.0.0",
"kubernetes-mcp-server-win32-amd64": "0.0.0",
"kubernetes-mcp-server-win32-arm64": "0.0.0"
}
}
}
}

View File

@@ -22,6 +22,7 @@
"mcp",
"kubernetes",
"openshift",
"model context protocol",
"model",
"context",
"protocol"