mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
Merge pull request #9526 from overleaf/em-promisify-tpdsupdatehandler
Promisify TpdsUpdateHandler GitOrigin-RevId: 3955a535e8d0b702751883d05c21c4c78717fed5
This commit is contained in:
@@ -24,6 +24,7 @@ const { promisify } = require('util')
|
||||
const async = require('async')
|
||||
const globby = require('globby')
|
||||
const _ = require('underscore')
|
||||
const { promisifyAll } = require('../../util/promises')
|
||||
|
||||
module.exports = ProjectRootDocManager = {
|
||||
setRootDocAutomatically(project_id, callback) {
|
||||
@@ -300,27 +301,10 @@ module.exports = ProjectRootDocManager = {
|
||||
},
|
||||
}
|
||||
|
||||
const promises = {
|
||||
setRootDocAutomatically: promisify(
|
||||
ProjectRootDocManager.setRootDocAutomatically
|
||||
),
|
||||
|
||||
findRootDocFileFromDirectory: directoryPath =>
|
||||
new Promise((resolve, reject) => {
|
||||
ProjectRootDocManager.findRootDocFileFromDirectory(
|
||||
directoryPath,
|
||||
(error, path, content) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
resolve({ path, content })
|
||||
}
|
||||
}
|
||||
)
|
||||
}),
|
||||
setRootDocFromName: promisify(ProjectRootDocManager.setRootDocFromName),
|
||||
}
|
||||
|
||||
ProjectRootDocManager.promises = promises
|
||||
|
||||
module.exports = ProjectRootDocManager
|
||||
module.exports.promises = promisifyAll(module.exports, {
|
||||
without: ['_rootDocSort'],
|
||||
multiResult: {
|
||||
findRootDocFileFromDirectory: ['path', 'content'],
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user