This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from Financial-Times/matth/support-workspaces
Support Yarn style workspaces configuration
- Loading branch information
Showing
3 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
const findUp = require('find-up'); | ||
|
||
module.exports = async () => { | ||
const config = await findUp('monorepo.json'); | ||
const [ monorepo, manifest ] = await Promise.all([ | ||
findUp('monorepo.json'), | ||
findUp('package.json') | ||
]); | ||
|
||
if (!config) { | ||
throw Error('Could not find monorepo.json'); | ||
// Lerna style configuration file | ||
if (monorepo) { | ||
return require(monorepo).packages; | ||
} | ||
|
||
return require(config); | ||
// Yarn workspaces style configuration | ||
if (manifest) { | ||
const pkg = require(manifest); | ||
|
||
if (Array.isArray(pkg.workspaces)) { | ||
return pkg.workspaces; | ||
} | ||
} | ||
|
||
throw Error('Could not find any Athloi configuration'); | ||
}; |