mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
fix build citation rollup plugin to actually generate citation
This commit is contained in:
parent
bab33ead69
commit
909cb9a768
@ -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;
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user