Skip to content

Commit

Permalink
⚡ Switch to async check
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Apr 11, 2022
1 parent de2b550 commit 175e63f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/* eslint-disable no-await-in-loop */

import express from 'express';
import { readFileSync, existsSync } from 'fs';
import { readFileSync, promises } from 'fs';
import { readFile } from 'fs/promises';
import _, { cloneDeep } from 'lodash';
import { dirname as pathDirname, join as pathJoin, resolve as pathResolve } from 'path';
Expand Down Expand Up @@ -1504,7 +1504,11 @@ class App {
const packagesPath = pathJoin(__dirname, '..', '..', '..');
const headersPath = pathJoin(packagesPath, 'nodes-base', 'dist', 'nodes', 'headers');

if (!existsSync(`${headersPath}.js`)) return;
try {
await promises.access(`${headersPath}.js`);
} catch (_) {
return; // no headers available
}

try {
return require(headersPath);
Expand Down

0 comments on commit 175e63f

Please sign in to comment.