feat: even more site functionality
This commit is contained in:
@@ -9,7 +9,7 @@ function getData() {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile('../scraper/db.json', (err, str) => {
|
||||
if (err) reject(err);
|
||||
else resolve(str);
|
||||
else resolve(JSON.parse(str));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -17,9 +17,13 @@ function getData() {
|
||||
async function build() {
|
||||
const data = await getData();
|
||||
const options = {};
|
||||
data.strains = data.strains.sort((n, strain) => {
|
||||
if (strain.rating === n.rating) return 0;
|
||||
return strain.rating < n.rating ? -1 : 1;
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
ejs.renderFile(srcFile, { data }, options, (err, str) => {
|
||||
ejs.renderFile(srcFile, { data: JSON.stringify(data) }, options, (err, str) => {
|
||||
if (err) reject(err);
|
||||
else {
|
||||
fs.writeFile(destFile, str, er => {
|
||||
|
||||
Reference in New Issue
Block a user