next-routes-readme
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -14,14 +14,58 @@ "use strict"; | ||
**Implementation**: \`${currentHandler.implementation}\` | ||
**HTTP Method**: ${currentHandler.method} | ||
**HTTP Method**: \`${currentHandler.method}\` | ||
**Documentation**: | ||
\`\`\`json | ||
${JSON.stringify(currentHandler.doc, null, 2)} | ||
\`\`\` | ||
**Variables**: | ||
${currentHandler.doc.variables | ||
.map(variable => { | ||
return `> **Value**: \`${variable.value}\` | ||
> **Line**: [${file}#L${variable.line}](${file}#L${variable.line})`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Conditionals**: | ||
${currentHandler.doc.conditionals | ||
.map(conditional => { | ||
return `> **Value**:${conditional.value} | ||
> **Line**: [${file}#L${conditional.line}](${file}#L${conditional.line})`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Comments**: | ||
${currentHandler.doc.comments | ||
.map(comment => { | ||
return `> **Value**:${comment.value} | ||
> **Line**: [${file}#L${comment.line}](${file}#L${comment.line})`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Errors**: | ||
${currentHandler.doc.errors | ||
.map(error => { | ||
return `> **Value**:${error.value} | ||
> **Line**: [${file}#L${error.line}](${file}#L${error.line})`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Query Params**: | ||
${currentHandler.doc.queryParams | ||
.map(query => { | ||
return `> **Value**:${query}`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Route Params**: | ||
${currentHandler.doc.routeParams | ||
.map(route => { | ||
return `> **Value**:${route}`; | ||
}) | ||
.join('\n\n') || '*None*'} | ||
**Dependencies**: | ||
\`\`\`json | ||
${JSON.stringify(currentHandler.dependencies, null, 2)} | ||
\`\`\` | ||
${currentHandler.dependencies | ||
.map(dependency => { | ||
return `\`${dependency}\``; | ||
}) | ||
.join('\n') || '*None*'} | ||
`; | ||
@@ -28,0 +72,0 @@ fs_1.default.appendFileSync('ROUTES.md', markdownOutput); |
{ | ||
"name": "next-routes-readme", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Creates README badges from istanbul coverage report", | ||
@@ -11,3 +11,6 @@ "type": "commonjs", | ||
"release": "standard-version", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build", | ||
"lint": "eslint --fix", | ||
"prepare": "npx husky install", | ||
"format": "prettier --write \"./**/*.{ts,tsx}\"" | ||
}, | ||
@@ -57,7 +60,12 @@ "main": "lib/index.js", | ||
"eslint": "^8.51.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^14.0.1", | ||
"next": "^13.5.4", | ||
"next-auth": "^4.23.2", | ||
"nodemon": "^3.0.1", | ||
"openai-edge": "^1.2.2", | ||
"prettier": "^3.0.3", | ||
"standard-version": "^9.5.0", | ||
@@ -64,0 +72,0 @@ "ts-jest": "^29.1.1", |
@@ -27,3 +27,3 @@ # Next Routes Readme | ||
## Example Output | ||
## Example Output [ROUTES.md](ROUTES.md) | ||
@@ -33,44 +33,32 @@ Here is an example of the generated documentation for an API route: | ||
```markdown | ||
--- | ||
# Route: [examples/app/route.ts](examples/app/route.ts) | ||
--- | ||
# Route 1: [examples/app/[dynamicRoute]/[...subMultipleDynamicRoutes]/route.ts](examples/app/[dynamicRoute]/[...subMultipleDynamicRoutes]/route.ts) | ||
**Implementation**: `async function POST(request: NextRequest)` | ||
**HTTP Method**: GET | ||
**Implementation**: `async function DELETE(_: NextRequest, { params }: { params: { dynamicRouteA: string; dynamicRouteB: string } })` | ||
**HTTP Method**: `DELETE` | ||
**Documentation**: | ||
```json | ||
{ | ||
"variables": [ | ||
{ | ||
"value": "const {\n severity,\n message,\n functionName,\n gcpProject,\n serviceAccountEmail,\n serviceAccountKey,\n env,\n } = await request.json();", | ||
"line": 5 | ||
} | ||
], | ||
"conditionals": [ | ||
{ | ||
"value": "if (\n !severity ||\n !message ||\n !functionName ||\n !gcpProject ||\n !serviceAccountEmail ||\n !serviceAccountKey ||\n !env\n ) {\n return NextResponse.json({ error: 'Invalid Request' }, { status: 500 });\n }", | ||
"line": 15 | ||
} | ||
], | ||
"errors": [ | ||
{ | ||
"value": "NextResponse.json({ error: 'Invalid Request' }, { status: 500 })", | ||
"line": 24 | ||
}, | ||
{ | ||
"value": "catch (error) {\n console.error('Error logging to GCP:', error);\n return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });\n }", | ||
"line": 31 | ||
}, | ||
{ | ||
"value": "NextResponse.json({ error: 'Internal Server Error' }, { status: 500 })", | ||
"line": 33 | ||
} | ||
], | ||
"comments": [ | ||
{ | ||
"value": "// eslint-disable-next-line @typescript-eslint/no-explicit-any", | ||
"line": 27 | ||
} | ||
] | ||
} | ||
**Documentation** | ||
**Variables**: | ||
> **Value**: `const { dynamicRouteA, dynamicRouteB } = params;` | ||
> **Line**: [examples/app/[dynamicRoute]/[...subMultipleDynamicRoutes]/route.ts#L7](examples/app/[dynamicRoute]/[...subMultipleDynamicRoutes]/route.ts#L7) | ||
**Conditionals**: | ||
*None* | ||
**Comments**: | ||
*None* | ||
**Errors**: | ||
*None* | ||
**Query Params**: | ||
*None* | ||
**Route Params**: | ||
> **Value**:...subMultipleDynamicRoutes | ||
**Dependencies**: | ||
`import { NextRequest, NextResponse } from 'next/server';` | ||
``` | ||
@@ -77,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
31657
331
20
77