Comparing version 2.2.1 to 2.2.2
@@ -55,3 +55,2 @@ #!/usr/bin/env node | ||
dockerfile: "dockerfile", | ||
toml: "toml", | ||
ini: "ini", | ||
@@ -198,4 +197,4 @@ }; | ||
catch (error) { | ||
// Force TypeScript to treat error as an instance of Error | ||
console.error("Prettier formatting failed:", error.message); | ||
const errorMessage = error.message.split("\n")[0]; | ||
console.warn(`Plain text fallback at ${filePath}: ${errorMessage}`); | ||
} | ||
@@ -205,11 +204,2 @@ } | ||
data = data.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); | ||
data = data.replace(/Ð/g, "\n"); | ||
data = data.replace(/\r\n/g, "\n"); | ||
data = data.replace(/\r/g, "\n"); | ||
data = data.replace(/uþs/g, ""); | ||
doc.addPage(); | ||
doc | ||
.font("Courier") | ||
.fontSize(10) | ||
.text(`${fileName}\n\n`, { lineGap: 4 }); | ||
if (removeComments) { | ||
@@ -223,3 +213,2 @@ data = (0, strip_comments_1.default)(data); | ||
try { | ||
// Check if language is supported before attempting to highlight | ||
if (addHighlighting && highlight_js_1.default.getLanguage(extension)) { | ||
@@ -231,3 +220,2 @@ highlightedCode = highlight_js_1.default.highlight(data, { | ||
else { | ||
// Use plaintext highlighting if language is not supported | ||
highlightedCode = highlight_js_1.default.highlight(data, { | ||
@@ -239,3 +227,2 @@ language: "plaintext", | ||
catch (error) { | ||
// Use plaintext highlighting if an error occurs | ||
highlightedCode = highlight_js_1.default.highlight(data, { | ||
@@ -259,6 +246,3 @@ language: "plaintext", | ||
} | ||
if (color) | ||
doc.fillColor(color); | ||
else | ||
doc.fillColor("black"); | ||
doc.fillColor(color || "black"); | ||
if (text !== "\n") | ||
@@ -265,0 +249,0 @@ doc.text(text, { continued: true }); |
{ | ||
"name": "repo2pdf", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "A CLI tool for generating a PDF document from a GitHub repository", | ||
@@ -5,0 +5,0 @@ "main": "dist/clone.js", |
@@ -54,3 +54,2 @@ #!/usr/bin/env node | ||
dockerfile: "dockerfile", | ||
toml: "toml", | ||
ini: "ini", | ||
@@ -236,2 +235,3 @@ }; | ||
const parser = getPrettierParser(extension); | ||
if (parser) { | ||
@@ -241,6 +241,5 @@ try { | ||
} catch (error: unknown) { | ||
// Force TypeScript to treat error as an instance of Error | ||
console.error( | ||
"Prettier formatting failed:", | ||
(error as Error).message, | ||
const errorMessage = (error as Error).message.split("\n")[0]; | ||
console.warn( | ||
`Plain text fallback at ${filePath}: ${errorMessage}`, | ||
); | ||
@@ -252,13 +251,3 @@ } | ||
data = data.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); | ||
data = data.replace(/Ð/g, "\n"); | ||
data = data.replace(/\r\n/g, "\n"); | ||
data = data.replace(/\r/g, "\n"); | ||
data = data.replace(/uþs/g, ""); | ||
doc.addPage(); | ||
doc | ||
.font("Courier") | ||
.fontSize(10) | ||
.text(`${fileName}\n\n`, { lineGap: 4 }); | ||
if (removeComments) { | ||
@@ -274,3 +263,2 @@ data = strip(data); | ||
try { | ||
// Check if language is supported before attempting to highlight | ||
if (addHighlighting && hljs.getLanguage(extension)) { | ||
@@ -281,3 +269,2 @@ highlightedCode = hljs.highlight(data, { | ||
} else { | ||
// Use plaintext highlighting if language is not supported | ||
highlightedCode = hljs.highlight(data, { | ||
@@ -288,3 +275,2 @@ language: "plaintext", | ||
} catch (error) { | ||
// Use plaintext highlighting if an error occurs | ||
highlightedCode = hljs.highlight(data, { | ||
@@ -294,2 +280,3 @@ language: "plaintext", | ||
} | ||
const hlData = htmlToJson(highlightedCode, removeEmptyLines); | ||
@@ -312,4 +299,3 @@ let lineNum = 1; | ||
} | ||
if (color) doc.fillColor(color); | ||
else doc.fillColor("black"); | ||
doc.fillColor(color || "black"); | ||
@@ -316,0 +302,0 @@ if (text !== "\n") doc.text(text, { continued: true }); |
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
70653
20
1093
3