@jackdbd/zod-to-doc
Advanced tools
Comparing version 1.0.6 to 1.0.7
# CHANGELOG | ||
## [1.0.7](https://github.com/jackdbd/zod-to-doc/compare/v1.0.6...v1.0.7) (2024-02-06) | ||
### Bug Fixes | ||
* add ansi-colors for color output ([e6db552](https://github.com/jackdbd/zod-to-doc/commit/e6db552536a8d5152f1413e7de44c0d087ef6297)) | ||
* update link to issue a bug report ([0385698](https://github.com/jackdbd/zod-to-doc/commit/03856983298c6ce3071f30b7cb0a90a1ece00a7a)) | ||
## [1.0.6](https://github.com/jackdbd/zod-to-doc/compare/v1.0.5...v1.0.6) (2024-02-06) | ||
@@ -4,0 +12,0 @@ |
#!/usr/bin/env node | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import c from 'ansi-colors'; | ||
import defDebug from 'debug'; | ||
import yargs from 'yargs/yargs'; | ||
import { markdownTableFromZodSchema } from './lib.js'; | ||
import { CLI_NAME, DEBUG_PREFIX, INFO_PREFIX, LINK_ISSUE_BUG, LINK_ISSUE_ENHANCEMENT } from './constants.js'; | ||
import { CLI_NAME, DEBUG_PREFIX, INFO_PREFIX, LINK_BUGS, LINK_ENHANCEMENTS } from './constants.js'; | ||
import { couldNotGenerateTable, documentNotFound, esModuleNotFound, placeholderNotFound, schemaNotFound } from './error-messages.js'; | ||
@@ -50,9 +51,8 @@ const debug = defDebug(`${DEBUG_PREFIX}:cli`); | ||
.epilogue([ | ||
`Documenation:\nhttps://github.com/jackdbd/zod-to-doc`, | ||
`Found a bug? Please submit it here:\n${LINK_ISSUE_BUG}`, | ||
`Feature requests & suggestions:\n${LINK_ISSUE_ENHANCEMENT}` | ||
`Bugs:\n${LINK_BUGS}`, | ||
`Feature requests & suggestions:\n${LINK_ENHANCEMENTS}` | ||
].join('\n\n')).argv; | ||
const module_filepath = path.join(process.env.PWD, argv.module); | ||
if (!fs.existsSync(module_filepath)) { | ||
console.error(esModuleNotFound(module_filepath)); | ||
console.error(c.red(esModuleNotFound(module_filepath))); | ||
process.exit(1); | ||
@@ -63,3 +63,3 @@ } | ||
if (!schema) { | ||
console.error(schemaNotFound(argv.schema, module_filepath)); | ||
console.error(c.red(schemaNotFound(argv.schema, module_filepath))); | ||
process.exit(1); | ||
@@ -70,3 +70,3 @@ } | ||
if (error) { | ||
console.error(couldNotGenerateTable(error)); | ||
console.error(c.red(couldNotGenerateTable(error))); | ||
process.exit(1); | ||
@@ -78,3 +78,3 @@ } | ||
if (!fs.existsSync(doc_filepath)) { | ||
console.error(documentNotFound(doc_filepath)); | ||
console.error(c.red(documentNotFound(doc_filepath))); | ||
process.exit(1); | ||
@@ -94,3 +94,3 @@ } | ||
if (i_begin === -1) { | ||
console.error(placeholderNotFound(argv.placeholder, doc_filepath)); | ||
console.error(c.red(placeholderNotFound(argv.placeholder, doc_filepath))); | ||
process.exit(1); | ||
@@ -113,3 +113,3 @@ } | ||
if (argv['dry-run']) { | ||
console.info(`${INFO_PREFIX} ${doc_filepath} not modified because of --dry-run. Here is how it would look like:`); | ||
console.info(c.blue(`${INFO_PREFIX} ${doc_filepath} not modified because of --dry-run. Here is how it would look like:`)); | ||
console.log(`=== BEGIN ${doc_filepath} ===`); | ||
@@ -121,4 +121,4 @@ console.log(md); | ||
fs.writeFileSync(doc_filepath, md); | ||
console.info(`${INFO_PREFIX} ${doc_filepath} updated`); | ||
console.info(c.blue(`${INFO_PREFIX} ${doc_filepath} updated`)); | ||
} | ||
//# sourceMappingURL=cli.js.map |
@@ -5,4 +5,6 @@ export declare const CLI_NAME = "ztd"; | ||
export declare const INFO_PREFIX = "\uD83D\uDEC8"; | ||
export declare const LINK_ISSUE_BUG = "https://github.com/jackdbd/zod-to-doc/labels/bug"; | ||
export declare const LINK_ISSUE_ENHANCEMENT = "https://github.com/jackdbd/zod-to-doc/labels/enhancement"; | ||
export declare const LINK_BUGS = "https://github.com/jackdbd/zod-to-doc/labels/bug"; | ||
export declare const LINK_ENHANCEMENTS = "https://github.com/jackdbd/zod-to-doc/labels/enhancement"; | ||
export declare const LINK_ISSUE_BUG_REPORT = "https://github.com/jackdbd/zod-to-doc/issues/new?assignees=jackdbd&labels=bug&projects=&template=01-bug_report.md&title=Something%20is%20broken"; | ||
export declare const LINK_ISSUE_FEATURE_REQUEST = "https://github.com/jackdbd/zod-to-doc/issues/new?assignees=jackdbd&labels=enhancement&projects=&template=02-feature_request.md&title="; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -5,4 +5,7 @@ export const CLI_NAME = 'ztd'; | ||
export const INFO_PREFIX = '🛈'; | ||
export const LINK_ISSUE_BUG = `https://github.com/jackdbd/zod-to-doc/labels/bug`; | ||
export const LINK_ISSUE_ENHANCEMENT = `https://github.com/jackdbd/zod-to-doc/labels/enhancement`; | ||
export const LINK_BUGS = `https://github.com/jackdbd/zod-to-doc/labels/bug`; | ||
export const LINK_ENHANCEMENTS = `https://github.com/jackdbd/zod-to-doc/labels/enhancement`; | ||
const ASSIGNEES = 'jackdbd'; | ||
export const LINK_ISSUE_BUG_REPORT = `https://github.com/jackdbd/zod-to-doc/issues/new?assignees=${ASSIGNEES}&labels=bug&projects=&template=01-bug_report.md&title=Something%20is%20broken`; | ||
export const LINK_ISSUE_FEATURE_REQUEST = `https://github.com/jackdbd/zod-to-doc/issues/new?assignees=${ASSIGNEES}&labels=enhancement&projects=&template=02-feature_request.md&title=`; | ||
//# sourceMappingURL=constants.js.map |
@@ -1,4 +0,4 @@ | ||
import { ERROR_PREFIX, LINK_ISSUE_BUG } from './constants.js'; | ||
import { ERROR_PREFIX, LINK_ISSUE_BUG_REPORT } from './constants.js'; | ||
// Call To Action to encourage users to submit a bug report in case of an error | ||
const CTA_BUG = `Do you think this is a bug? Please submit an issue here: ${LINK_ISSUE_BUG}`; | ||
const CTA_BUG = `Do you think this is a bug? Please submit a bug report:\n${LINK_ISSUE_BUG_REPORT}`; | ||
export const esModuleNotFound = (filepath) => { | ||
@@ -5,0 +5,0 @@ const summary = `${ERROR_PREFIX} ES module not found`; |
{ | ||
"name": "@jackdbd/zod-to-doc", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Inject your [Zod](https://github.com/colinhacks/zod) schemas into your docs.", | ||
@@ -84,2 +84,3 @@ "author": { | ||
"dependencies": { | ||
"ansi-colors": "^4.1.3", | ||
"debug": "^4.3.4", | ||
@@ -86,0 +87,0 @@ "yargs": "^17.7.2", |
@@ -104,2 +104,3 @@ # Zod to Doc | ||
|---|---| | ||
| [ansi-colors](https://www.npmjs.com/package/ansi-colors) | `^4.1.3` | | ||
| [debug](https://www.npmjs.com/package/debug) | `^4.3.4` | | ||
@@ -106,0 +107,0 @@ | [yargs](https://www.npmjs.com/package/yargs) | `^17.7.2` | |
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
Sorry, the diff of this file is not supported yet
46119
574
112
4
+ Addedansi-colors@^4.1.3
+ Addedansi-colors@4.1.3(transitive)