Skip to content

Commit

Permalink
Try a workaround for glib
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomersiva committed Aug 17, 2019
1 parent 6664e17 commit 5d1619f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tasks/copyMinorStaticAssets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = async function(site, options = {}) {
const fs = require('fs-extra');
const parcelWatcher = require('@parcel/watcher');
const corePath = require('path');

const cleanFileList = require('../utils/cleanFileList');
Expand All @@ -23,15 +22,20 @@ module.exports = async function(site, options = {}) {
fs.removeSync(snapshotPath);
}

let parcelWatcher;
if (fs.existsSync(snapshotPath)) {
parcelWatcher = require('@parcel/watcher');
let events = await parcelWatcher.getEventsSince(STATIC, snapshotPath);
let changedFiles = events.map(event => event.path.replace(`${process.cwd()}${corePath.sep}${STATIC}`, ''));
staticFiles = cleanFileList(changedFiles);
} else {
staticFiles = cleanFileList(fs.readdirSync(STATIC));
}

await parcelWatcher.writeSnapshot(STATIC, snapshotPath);
// this is a workaround for Netlify
if (parcelWatcher) {
await parcelWatcher.writeSnapshot(STATIC, snapshotPath);
}

minorStaticFiles = staticFiles.filter((path) => !['css', 'js'].includes(path));
} else {
Expand Down

0 comments on commit 5d1619f

Please sign in to comment.