Skip to content

Commit

Permalink
fix build citation rollup plugin to actually generate citation
Browse files Browse the repository at this point in the history
  • Loading branch information
cchang-vassar committed Sep 13, 2024
1 parent bab33ea commit 909cb9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/config/rollup-plugin-build-citation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function cffToJsonPlugin() {
// Try to find CITATION.cff file
const citationCff = (() => {
try {
fs.readFileSync("./CITATION.cff", "utf-8").toString();
return fs.readFileSync("./CITATION.cff", "utf-8").toString();
} catch (error) {
console.log(`Error finding CITATION.cff: ${error.message}`);
return null;
Expand All @@ -42,13 +42,15 @@ export default function cffToJsonPlugin() {
2
);
} catch (error) {
console.log(`Error building citation from CITATION.cff: ${error.message}`);
console.log(`Error converting CITATION.cff to JSON: ${error.message}`);
return null;
}
})();

// Replace target string with citation JSON
if (!citationJson) return { code: code };
if (!citationJson) {
return { code: code };
}
const citationString = "citation: " + citationJson;
const startIndex = code.indexOf(targetString);
if (startIndex !== -1) {
Expand Down

0 comments on commit 909cb9a

Please sign in to comment.