bin scripts: Promisify npm.load

This commit is contained in:
Richard Hansen 2021-01-09 02:44:59 -05:00 committed by John McLear
parent 92cd2cc760
commit efdcaae526
7 changed files with 39 additions and 23 deletions

View file

@ -4,9 +4,12 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
const npm = require('ep_etherpad-lite/node_modules/npm');
const util = require('util');
require('ep_etherpad-lite/node_modules/npm').load({}, async (er, npm) => {
(async () => {
await util.promisify(npm.load)({});
process.chdir(`${npm.root}/..`);
// This script requires that you have modified your settings.json file
@ -56,4 +59,4 @@ require('ep_etherpad-lite/node_modules/npm').load({}, async (er, npm) => {
await util.promisify(db.close.bind(db))();
console.log('Finished.');
});
})();