straight citeproc-js:
const CSL = require('citeproc')
const fs = require('fs')
const style = fs.readFileSync('apa.csl', 'utf-8')
// your list of references in CSL-JSON
const references = {
item1: {
id: 'item1',
type: 'book',
title: 'Stuff',
},
}
// Create a CSL engine
const sys = {
retrieveLocale: function (lang) {
const locale = fs.readFileSync('locales-en-US.xml', 'utf-8')
return locale
},
retrieveItem: function (id) {
return references[id]
}
}
const citeproc = new CSL.Engine(sys, style)
// Specify the references to cite
citeproc.updateItems(Object.keys(references))
// Generate the bibliography
var bib = citeproc.makeBibliography()
console.log(bib[1].join('\n'))