Fixing remote auth optional depencies error (#1640)

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
Yuri
2022-08-10 13:46:43 -03:00
committed by GitHub
parent 537e843a49
commit ab7ee0eb4f

View File

@@ -6,7 +6,9 @@ try {
var unzipper = require('unzipper');
var archiver = require('archiver');
} catch {
throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag');
fs = undefined;
unzipper = undefined;
archiver = undefined;
}
const path = require('path');
@@ -23,6 +25,7 @@ const BaseAuthStrategy = require('./BaseAuthStrategy');
*/
class RemoteAuth extends BaseAuthStrategy {
constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) {
if (!fs && !unzipper && !archiver) throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag');
super();
const idRegex = /^[-_\w]+$/i;
@@ -198,4 +201,4 @@ class RemoteAuth extends BaseAuthStrategy {
}
}
module.exports = RemoteAuth;
module.exports = RemoteAuth;