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
commit ab7ee0eb4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;