Skip to content

Commit

Permalink
Check if directory exists, before compressing
Browse files Browse the repository at this point in the history
  • Loading branch information
bjon committed Jan 2, 2022
1 parent 943835f commit b76fad1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createReadStream, createWriteStream, statSync, writeFileSync } from 'fs';
import { createReadStream, createWriteStream, existsSync, statSync, writeFileSync } from 'fs';
import { pipeline } from 'stream';
import glob from 'tiny-glob';
import { fileURLToPath } from 'url';
Expand Down Expand Up @@ -62,6 +62,10 @@ export default function ({
* @param {string} directory
*/
async function compress(directory) {
if (!existsSync(directory)) {
return;
}

const files = await glob('**/*.{html,js,json,css,svg,xml}', {
cwd: directory,
dot: true,
Expand Down

0 comments on commit b76fad1

Please sign in to comment.