next-routes-readme
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -6,3 +6,4 @@ "use strict"; | ||
routeFilename: 'route', | ||
markdownFilename: 'ROUTES.md', | ||
}); | ||
//# sourceMappingURL=constants.js.map |
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const constants_1 = require("./config/constants"); | ||
@@ -13,5 +14,5 @@ const parser_1 = require("./route-parser/parser"); | ||
const generateMarkdown_1 = require("./utils/generateMarkdown"); | ||
const validator_1 = require("./utils/validator"); | ||
const folderPath = process.argv[2]; | ||
async function main() { | ||
fs_1.default.writeFileSync('ROUTES.md', ''); // Clear existing content or create new file | ||
const folderPath = process.argv[2]; | ||
await (0, traverseDictory_1.traverseDirectory)(folderPath, async (file) => { | ||
@@ -22,13 +23,21 @@ try { | ||
const handlers = (0, parser_1.parseRouteHandlers)(file); | ||
fs_1.default.writeFileSync(constants_1.constants.markdownFilename, ''); | ||
for (const handler of handlers) { | ||
await (0, generateMarkdown_1.generateMarkdownOutput)([handler], file); | ||
return await (0, generateMarkdown_1.generateMarkdownOutput)([handler], file); | ||
} | ||
} | ||
} | ||
catch (error) { | ||
console.error(`Error processing file ${file}:`, error); | ||
catch (_a) { | ||
return Promise.reject(new Error(`Error while parsing file ${file}.`)); | ||
} | ||
}); | ||
} | ||
main(); | ||
(0, validator_1.checkIfFolderExists)(folderPath) | ||
.then(() => main()) | ||
.then(() => { | ||
const projectRoot = path_1.default.resolve(process.cwd()); | ||
const filePath = path_1.default.resolve(projectRoot, constants_1.constants.markdownFilename); | ||
console.log(`Finished. Please check ${filePath}`); | ||
}) | ||
.catch(error => console.error(error.message)); | ||
//# sourceMappingURL=index.js.map |
@@ -19,8 +19,9 @@ "use strict"; | ||
else { | ||
fileCallback(filePath, parentFolderName); | ||
return fileCallback(filePath, parentFolderName); | ||
} | ||
} | ||
return Promise.reject(Error(`There are no Next.js Route files for path ${directory}.`)); | ||
} | ||
catch (error) { | ||
console.error(`Error while traversing directory ${directory}:`, error); | ||
return Promise.reject(new Error(`Error while traversing directory ${directory}.`)); | ||
} | ||
@@ -27,0 +28,0 @@ } |
{ | ||
"name": "next-routes-readme", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Creates README badges from istanbul coverage report", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
24962
19
275
5