mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +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
|
// Try to find CITATION.cff file
|
||||||
const citationCff = (() => {
|
const citationCff = (() => {
|
||||||
try {
|
try {
|
||||||
fs.readFileSync("./CITATION.cff", "utf-8").toString();
|
return fs.readFileSync("./CITATION.cff", "utf-8").toString();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Error finding CITATION.cff: ${error.message}`);
|
console.log(`Error finding CITATION.cff: ${error.message}`);
|
||||||
return null;
|
return null;
|
||||||
@ -42,13 +42,15 @@ export default function cffToJsonPlugin() {
|
|||||||
2
|
2
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Error building citation from CITATION.cff: ${error.message}`);
|
console.log(`Error converting CITATION.cff to JSON: ${error.message}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Replace target string with citation JSON
|
// Replace target string with citation JSON
|
||||||
if (!citationJson) return { code: code };
|
if (!citationJson) {
|
||||||
|
return { code: code };
|
||||||
|
}
|
||||||
const citationString = "citation: " + citationJson;
|
const citationString = "citation: " + citationJson;
|
||||||
const startIndex = code.indexOf(targetString);
|
const startIndex = code.indexOf(targetString);
|
||||||
if (startIndex !== -1) {
|
if (startIndex !== -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user