Don't attempt to save index when there are no posts or profile details (complained about directory not existing)
This commit is contained in:
parent
44cdd37e49
commit
a68493d0fa
|
@ -29,6 +29,10 @@ async function writeToIndex(posts, profilePaths, user) {
|
||||||
posts: newAndUpdatedEntries.concat(user.indexed.original),
|
posts: newAndUpdatedEntries.concat(user.indexed.original),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!data.profile.image && !data.profile.description && !data.posts.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return fs.writeFile(filename, yaml.safeDump(data));
|
return fs.writeFile(filename, yaml.safeDump(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const config = require('config');
|
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const fs = require('fs-extra');
|
|
||||||
const yaml = require('js-yaml');
|
|
||||||
|
|
||||||
const getIndex = require('./getIndex.js');
|
const getIndex = require('./getIndex.js');
|
||||||
const getArchivePostIds = require('../archives/getArchivePostIds.js');
|
const getArchivePostIds = require('../archives/getArchivePostIds.js');
|
||||||
const curateUser = require('../curate/user.js');
|
const curateUser = require('../curate/user.js');
|
||||||
const interpolate = require('../interpolate.js');
|
|
||||||
|
|
||||||
async function getUser(username, reddit) {
|
async function getUser(username, reddit) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue