Merge pull request #18 from harsha-iiiv/fix/cli-path
chore: Update version to 3.1.1 and modify CLI entry point
This commit is contained in:
commit
c607d9c759
6
bin/openapi-mcp-generator.js
Executable file
6
bin/openapi-mcp-generator.js
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import { program } from '../dist/index.js';
|
||||||
|
|
||||||
|
// Parse CLI arguments and run the program
|
||||||
|
program.parse(process.argv);
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "openapi-mcp-generator",
|
"name": "openapi-mcp-generator",
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"description": "Generates MCP server code from OpenAPI specifications",
|
"description": "Generates MCP server code from OpenAPI specifications",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Harsha",
|
"author": "Harsha",
|
||||||
@ -9,10 +9,11 @@
|
|||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"openapi-mcp-generator": "./dist/index.js"
|
"openapi-mcp-generator": "./bin/openapi-mcp-generator.js"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
"bin",
|
||||||
"README.md",
|
"README.md",
|
||||||
"LICENSE"
|
"LICENSE"
|
||||||
],
|
],
|
||||||
@ -20,7 +21,7 @@
|
|||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"build": "tsc && chmod 755 dist/index.js",
|
"build": "tsc && chmod 755 dist/index.js && chmod 755 bin/openapi-mcp-generator.js",
|
||||||
"version:patch": "npm version patch",
|
"version:patch": "npm version patch",
|
||||||
"version:minor": "npm version minor",
|
"version:minor": "npm version minor",
|
||||||
"version:major": "npm version major"
|
"version:major": "npm version major"
|
||||||
|
|||||||
25
src/index.ts
25
src/index.ts
@ -72,22 +72,17 @@ program
|
|||||||
(val) => parseInt(val, 10)
|
(val) => parseInt(val, 10)
|
||||||
)
|
)
|
||||||
.option('--force', 'Overwrite existing files without prompting')
|
.option('--force', 'Overwrite existing files without prompting')
|
||||||
.version('3.1.0'); // Match package.json version
|
.version('3.1.1') // Match package.json version
|
||||||
|
.action(options => {
|
||||||
|
runGenerator(options)
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Unhandled error:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Check if module is being run directly (not imported)
|
// Export the program object for use in bin stub
|
||||||
const isMainModule = process.argv[1] === new URL(import.meta.url).pathname;
|
export { program };
|
||||||
|
|
||||||
if (isMainModule) {
|
|
||||||
// Parse arguments explicitly from process.argv
|
|
||||||
program.parse(process.argv);
|
|
||||||
|
|
||||||
// Run with the parsed options
|
|
||||||
runGenerator(program.opts<CliOptions & { force?: boolean }>())
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Unhandled error:', error);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function to run the generator
|
* Main function to run the generator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user