mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Reverted "Refactored remaining function in package-json lib to use async-await"
- this reverts commit 2be01e7cbd
.
- reverting until I can figure out why the tests are broken
This commit is contained in:
parent
2be01e7cbd
commit
7f09052ba1
1 changed files with 10 additions and 11 deletions
|
@ -150,10 +150,10 @@ module.exports = class PackageJson {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async readPackages(packagePath) {
|
readPackages(packagePath) {
|
||||||
const dirContents = await fs.readdir(packagePath);
|
const self = this;
|
||||||
|
|
||||||
const packageNames = dirContents
|
return Promise.resolve(fs.readdir(packagePath))
|
||||||
.filter(function (packageName) {
|
.filter(function (packageName) {
|
||||||
// Filter out things which are not packages by regex
|
// Filter out things which are not packages by regex
|
||||||
if (packageName.match(notAPackageRegex)) {
|
if (packageName.match(notAPackageRegex)) {
|
||||||
|
@ -163,14 +163,13 @@ module.exports = class PackageJson {
|
||||||
return fs.stat(join(packagePath, packageName)).then(function (stat) {
|
return fs.stat(join(packagePath, packageName)).then(function (stat) {
|
||||||
return stat.isDirectory();
|
return stat.isDirectory();
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.map(function readPackageJson(packageName) {
|
||||||
const packages = await Promise.all(packageNames
|
|
||||||
.map((packageName) => {
|
|
||||||
const absolutePath = join(packagePath, packageName);
|
const absolutePath = join(packagePath, packageName);
|
||||||
return this.processPackage(absolutePath, packageName);
|
return self.processPackage(absolutePath, packageName);
|
||||||
}));
|
})
|
||||||
|
.then(function (packages) {
|
||||||
return _.keyBy(packages, 'name');
|
return _.keyBy(packages, 'name');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue