nextjs-routes-docs
Advanced tools
Comparing version
18
index.js
@@ -23,2 +23,3 @@ #!/usr/bin/env node | ||
const { text, swagger, params } = options; | ||
const output = options.output ? options.output : "."; | ||
const outputBoth = !text && !swagger; | ||
@@ -118,9 +119,11 @@ const apiDir = path.join(dir, "pages", "api"); | ||
if (text || outputBoth) { | ||
writeFileSync("routes", content.join("\n")); | ||
console.log(chalk.green("routes file created")); | ||
const outputPath = path.join(output, "routes"); | ||
writeFileSync(outputPath, content.join("\n")); | ||
console.log(chalk.green(`${outputPath} file created`)); | ||
} | ||
if (swagger || outputBoth) { | ||
// create swagger api file | ||
writeFileSync("routes.yml", yaml.dump(spec)); | ||
console.log(chalk.green("routes.yml file created")); | ||
const outputPath = path.join(output, "routes.yml"); | ||
writeFileSync(outputPath, yaml.dump(spec)); | ||
console.log(chalk.green(`${outputPath} file created`)); | ||
} | ||
@@ -156,5 +159,6 @@ }) | ||
.addArgument(new Argument("<dir>", "Nextjs project directory")) | ||
.option("-t, --text", " text docs") | ||
.option("-s, --swagger", "swagger docs") | ||
.option("-p, --params", "[BETA] parse code to get params") | ||
.option("-t, --text", "Produce text docs") | ||
.option("-s, --swagger", "Produce swagger docs") | ||
.option("-p, --params", "[BETA] Parse code to get params") | ||
.option("-o, --output <value>", "Choose output folder") | ||
.action(function (dir, options, command) { | ||
@@ -161,0 +165,0 @@ if (options.params) { |
{ | ||
"name": "nextjs-routes-docs", | ||
"version": "0.0.3", | ||
"version": "0.0.41", | ||
"description": "Generate docs for nextjs routes", | ||
"bin": { | ||
"nextjs-routes": "./index.js" | ||
"nextjs-routes-docs": "./index.js" | ||
}, | ||
@@ -20,2 +20,3 @@ "scripts": { | ||
"dependencies": { | ||
"0g": "^0.0.6", | ||
"acorn": "^8.6.0", | ||
@@ -22,0 +23,0 @@ "chalk": "^4.1.2", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
157
1.29%1
-50%114
Infinity%9730
-0.44%6
20%3
-62.5%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added