Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typera-openapi

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typera-openapi - npm Package Compare versions

Comparing version 0.9.1 to 0.10.0

31

dist/cli.js

@@ -15,8 +15,14 @@ #!/usr/bin/env node

const path = require("path");
const ts = require("typescript");
const yargs = require("yargs");
const _1 = require(".");
const prettify_1 = require("./prettify");
const yargs = require("yargs");
const log = (location, level, ...args) => console.log(`${location}: ${level}:`, ...args);
const parseArgs = () => yargs
.usage('Usage: $0 [options] FILE...')
.option('verbose', {
description: 'Verbose output',
type: 'boolean',
default: false,
})
.option('format', {

@@ -27,2 +33,6 @@ description: 'Output file format',

})
.option('tsconfig', {
description: 'Which tsconfig.json to use',
default: 'tsconfig.json',
})
.option('prettify', {

@@ -45,3 +55,11 @@ alias: 'p',

const ext = `.openapi.${args.format}`;
const results = _1.generate(sourceFiles, { strict: true }, { log }).map((result) => (Object.assign(Object.assign({}, result), { outputFileName: outputFileName(result.fileName, ext) })));
const compilerOptions = readCompilerOptions(args.tsconfig);
if (!compilerOptions)
process.exit(1);
if (args.verbose) {
console.log(`Compiler options: ${JSON.stringify(compilerOptions, null, 2)}`);
}
const results = _1.generate(sourceFiles, compilerOptions, {
log,
}).map((result) => (Object.assign(Object.assign({}, result), { outputFileName: outputFileName(result.fileName, ext) })));
let success = true;

@@ -65,2 +83,11 @@ for (const { outputFileName, paths } of results) {

});
const readCompilerOptions = (tsconfigPath) => {
const tsconfig = ts.readConfigFile(tsconfigPath, (path) => fs.readFileSync(path, 'utf-8'));
if (tsconfig.error) {
console.error(`Unable to read ${tsconfigPath}: ${tsconfig.error.messageText}`);
console.error(`(Tip: Use --tsconfig to specify configuration file path)`);
return;
}
return tsconfig.config.compilerOptions;
};
const checkOutput = (fileName, content) => {

@@ -67,0 +94,0 @@ const current = fs.readFileSync(fileName, 'utf-8');

2

package.json
{
"name": "typera-openapi",
"version": "0.9.1",
"version": "0.10.0",
"description": "Generate OpenAPI spec from typera routes",

@@ -5,0 +5,0 @@ "repository": "https://github.com/akheron/typera-openapi",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc