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

@ -7,15 +7,18 @@
// 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');
if (process.argv.length !== 3) throw new Error('Use: node bin/checkPad.js $PADID');
// get the padID
const padId = process.argv[2];
let checkRevisionCount = 0;
// load and initialize NPM;
const npm = require('ep_etherpad-lite/node_modules/npm');
npm.load({}, async () => {
(async () => {
await util.promisify(npm.load)({});
try {
// initialize database
require('ep_etherpad-lite/node/utils/Settings');
@ -86,4 +89,4 @@ npm.load({}, async () => {
console.trace(err);
throw err;
}
});
})();