@rjgf/swagger2ts
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -7,7 +7,21 @@ #!/usr/bin/env node --no-deprecation --abort-on-uncaught-exception --no-warnings | ||
const axios = require('axios') | ||
require('dotenv').config() | ||
const { exec } = require('child_process') | ||
const defaultOutputDir = path.join(process.cwd(), '.', 'src', 'api') | ||
const defaultSwaggerFileName = 'swagger.ts' | ||
readConfigFile() | ||
async function main() { | ||
procesesArgvs() | ||
const config = await readConfigFile() | ||
await generateSwagger(config) | ||
postExeHook(config) | ||
} | ||
function procesesArgvs() { | ||
if (process.argv.includes('--env-path')) { | ||
const index = process.argv.findIndex(((v) => v === "--env-path")) | ||
const path = process.argv[index + 1] | ||
if (path) { | ||
require('dotenv').config({ path }) | ||
} | ||
} | ||
} | ||
async function readConfigFile() { | ||
@@ -22,6 +36,6 @@ const jsonConfigPath = path.join(process.cwd(), 'swaggertsrc.json') | ||
}) | ||
generateSwagger(configJson) | ||
return configJson | ||
} else if (hasJSConfigPath) { | ||
const jsConfig = require(jsConfigPath) | ||
generateSwagger(jsConfig) | ||
return jsConfig | ||
} else { | ||
@@ -80,1 +94,9 @@ throw Error('swaggertsrc.json not found Please create swaggertsrc.json or .swaggertsrc.js in the root directory') | ||
} | ||
function postExeHook(config) { | ||
if (config.postexe) { | ||
console.log(`postexe: ${config.postexe}`) | ||
exec(config.postexe) | ||
} | ||
} | ||
main() |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"dependencies": { | ||
@@ -26,0 +26,0 @@ "dotenv": "^16.0.3" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35125
622
1